1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_HANDLER_H_ 6 #define CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_HANDLER_H_ 7 8 #include "base/compiler_specific.h" 9 #include "base/memory/ref_counted.h" 10 #include "content/public/browser/web_ui_message_handler.h" 11 12 namespace base { 13 class ListValue; 14 } 15 16 namespace content { 17 class MediaInternalsProxy; 18 19 // This class handles messages to and from MediaInternalsUI. 20 // It does all its work on the IO thread through the proxy below. 21 class MediaInternalsMessageHandler : public WebUIMessageHandler { 22 public: 23 MediaInternalsMessageHandler(); 24 virtual ~MediaInternalsMessageHandler(); 25 26 // WebUIMessageHandler implementation. 27 virtual void RegisterMessages() OVERRIDE; 28 29 // Javascript message handlers. 30 void OnGetEverything(const base::ListValue* list); 31 32 // MediaInternals message handlers. 33 void OnUpdate(const base::string16& update); 34 35 private: 36 scoped_refptr<MediaInternalsProxy> proxy_; 37 38 // Reflects whether the chrome://media-internals HTML+JS has finished loading. 39 // If not, it's not safe to send JavaScript calls targeting the page yet. 40 bool page_load_complete_; 41 42 DISALLOW_COPY_AND_ASSIGN(MediaInternalsMessageHandler); 43 }; 44 45 } // namespace content 46 47 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_HANDLER_H_ 48