OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_UI_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/ui/webui/chrome_web_ui.h" | 9 #include "chrome/browser/ui/webui/chrome_web_ui.h" |
10 | 10 |
scherkus (not reviewing)
2011/06/29 01:03:07
a/z ordering for includes
Scott Franklin
2011/06/29 17:35:23
Done.
| |
11 #include "base/memory/ref_counted.h" | |
12 #include "chrome/browser/media/media_internals_observer.h" | |
13 | |
14 class MediaInternalsUI; | |
scherkus (not reviewing)
2011/06/29 01:03:07
a/z ordering
Scott Franklin
2011/06/29 17:35:23
Done.
| |
15 class IOThread; | |
16 | |
17 class MediaInternalsProxy | |
18 : public MediaInternalsObserver, | |
19 public base::RefCountedThreadSafe<MediaInternalsProxy> { | |
20 public: | |
21 // Methods for MediaInternalsUI. Called on UI thread. | |
22 MediaInternalsProxy(); | |
23 void SetUI(MediaInternalsUI* ui); | |
24 void RemoveUI(); | |
25 void GetEverything(); | |
26 | |
27 // MediaInternalsObserver implementation. Called on IO thread. | |
28 virtual void OnUpdate(const string16& update); | |
29 | |
30 private: | |
31 friend class base::RefCountedThreadSafe<MediaInternalsProxy>; | |
32 virtual ~MediaInternalsProxy(); | |
33 | |
34 void ObserveMediaInternalsOnIOThread(); | |
35 void StopObservingMediaInternalsOnIOThread(); | |
36 void GetEverythingOnIOThread(); | |
37 void UpdateUIOnUIThread(const string16& update); | |
38 | |
39 MediaInternalsUI* ui_; | |
40 IOThread* io_thread_; | |
41 }; | |
42 | |
11 // The implementation for the chrome://media-internals page. | 43 // The implementation for the chrome://media-internals page. |
12 class MediaInternalsUI : public ChromeWebUI { | 44 class MediaInternalsUI : public ChromeWebUI { |
13 public: | 45 public: |
14 explicit MediaInternalsUI(TabContents* contents); | 46 explicit MediaInternalsUI(TabContents* contents); |
47 virtual ~MediaInternalsUI(); | |
48 | |
49 virtual void OnWebUISend(const GURL& source_url, | |
50 const std::string& name, | |
51 const ListValue& args) OVERRIDE; | |
52 | |
53 virtual void OnUpdate(const string16& update); | |
15 | 54 |
16 private: | 55 private: |
56 scoped_refptr<MediaInternalsProxy> proxy_; | |
57 | |
17 DISALLOW_COPY_AND_ASSIGN(MediaInternalsUI); | 58 DISALLOW_COPY_AND_ASSIGN(MediaInternalsUI); |
18 }; | 59 }; |
19 | 60 |
20 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_UI_H_ | 61 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_INTERNALS_UI_H_ |
OLD | NEW |