| 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_MEDIA_INTERNALS_PROXY_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_MEDIA_INTERNALS_PROXY_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_MEDIA_INTERNALS_PROXY_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_MEDIA_INTERNALS_PROXY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/message_loop_helpers.h" |
| 10 #include "base/string16.h" | 11 #include "base/string16.h" |
| 11 #include "chrome/browser/media/media_internals_observer.h" | 12 #include "chrome/browser/media/media_internals_observer.h" |
| 12 #include "chrome/browser/net/chrome_net_log.h" | 13 #include "chrome/browser/net/chrome_net_log.h" |
| 13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 14 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 16 | 17 |
| 17 class IOThread; | 18 class IOThread; |
| 18 class MediaInternalsMessageHandler; | 19 class MediaInternalsMessageHandler; |
| 19 | 20 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // ChromeNetLog::ThreadSafeObserver implementation. Callable from any thread: | 57 // ChromeNetLog::ThreadSafeObserver implementation. Callable from any thread: |
| 57 virtual void OnAddEntry(net::NetLog::EventType type, | 58 virtual void OnAddEntry(net::NetLog::EventType type, |
| 58 const base::TimeTicks& time, | 59 const base::TimeTicks& time, |
| 59 const net::NetLog::Source& source, | 60 const net::NetLog::Source& source, |
| 60 net::NetLog::EventPhase phase, | 61 net::NetLog::EventPhase phase, |
| 61 net::NetLog::EventParameters* params) OVERRIDE; | 62 net::NetLog::EventParameters* params) OVERRIDE; |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 friend struct content::BrowserThread::DeleteOnThread< | 65 friend struct content::BrowserThread::DeleteOnThread< |
| 65 content::BrowserThread::UI>; | 66 content::BrowserThread::UI>; |
| 66 friend class DeleteTask<MediaInternalsProxy>; | 67 friend class base::DeleteHelper<MediaInternalsProxy>; |
| 67 virtual ~MediaInternalsProxy(); | 68 virtual ~MediaInternalsProxy(); |
| 68 | 69 |
| 69 // Build a dictionary mapping constant names to values. | 70 // Build a dictionary mapping constant names to values. |
| 70 base::Value* GetConstants(); | 71 base::Value* GetConstants(); |
| 71 | 72 |
| 72 void ObserveMediaInternalsOnIOThread(); | 73 void ObserveMediaInternalsOnIOThread(); |
| 73 void StopObservingMediaInternalsOnIOThread(); | 74 void StopObservingMediaInternalsOnIOThread(); |
| 74 void GetEverythingOnIOThread(); | 75 void GetEverythingOnIOThread(); |
| 75 void UpdateUIOnUIThread(const string16& update); | 76 void UpdateUIOnUIThread(const string16& update); |
| 76 | 77 |
| 77 // Put |entry| on a list of events to be sent to the page. | 78 // Put |entry| on a list of events to be sent to the page. |
| 78 void AddNetEventOnUIThread(base::Value* entry); | 79 void AddNetEventOnUIThread(base::Value* entry); |
| 79 | 80 |
| 80 // Send all pending events to the page. | 81 // Send all pending events to the page. |
| 81 void SendNetEventsOnUIThread(); | 82 void SendNetEventsOnUIThread(); |
| 82 | 83 |
| 83 // Call a JavaScript function on the page. Takes ownership of |args|. | 84 // Call a JavaScript function on the page. Takes ownership of |args|. |
| 84 void CallJavaScriptFunctionOnUIThread(const std::string& function, | 85 void CallJavaScriptFunctionOnUIThread(const std::string& function, |
| 85 base::Value* args); | 86 base::Value* args); |
| 86 | 87 |
| 87 MediaInternalsMessageHandler* handler_; | 88 MediaInternalsMessageHandler* handler_; |
| 88 IOThread* io_thread_; | 89 IOThread* io_thread_; |
| 89 scoped_ptr<base::ListValue> pending_net_updates_; | 90 scoped_ptr<base::ListValue> pending_net_updates_; |
| 90 content::NotificationRegistrar registrar_; | 91 content::NotificationRegistrar registrar_; |
| 91 | 92 |
| 92 DISALLOW_COPY_AND_ASSIGN(MediaInternalsProxy); | 93 DISALLOW_COPY_AND_ASSIGN(MediaInternalsProxy); |
| 93 }; | 94 }; |
| 94 | 95 |
| 95 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_MEDIA_INTERNALS_PROXY_H_ | 96 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_MEDIA_INTERNALS_PROXY_H_ |
| OLD | NEW |