Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / media / media_internals_handler.h
blobd984a96d1a2e3af72f5c456ab84f9050d13045b0
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.
5 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_HANDLER_H_
6 #define CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/public/browser/web_ui_message_handler.h"
12 namespace base {
13 class ListValue;
16 namespace content {
17 class MediaInternalsProxy;
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 ~MediaInternalsMessageHandler() override;
26 // WebUIMessageHandler implementation.
27 void RegisterMessages() override;
29 // Javascript message handlers.
30 void OnGetEverything(const base::ListValue* list);
32 // MediaInternals message handlers.
33 void OnUpdate(const base::string16& update);
35 private:
36 scoped_refptr<MediaInternalsProxy> proxy_;
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_;
42 DISALLOW_COPY_AND_ASSIGN(MediaInternalsMessageHandler);
45 } // namespace content
47 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_HANDLER_H_