| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_PROXY_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_PROXY_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_PROXY_H_ | 6 #define CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_PROXY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 // net::NetLog::ThreadSafeObserver implementation. Callable from any thread: | 54 // net::NetLog::ThreadSafeObserver implementation. Callable from any thread: |
| 55 void OnAddEntry(const net::NetLogEntry& entry) override; | 55 void OnAddEntry(const net::NetLogEntry& entry) override; |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 58 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
| 59 friend class base::DeleteHelper<MediaInternalsProxy>; | 59 friend class base::DeleteHelper<MediaInternalsProxy>; |
| 60 ~MediaInternalsProxy() override; | 60 ~MediaInternalsProxy() override; |
| 61 | 61 |
| 62 // Build a dictionary mapping constant names to values. | 62 // Build a dictionary mapping constant names to values. |
| 63 base::Value* GetConstants(); | 63 std::unique_ptr<base::Value> GetConstants(); |
| 64 | 64 |
| 65 void ObserveMediaInternalsOnIOThread(); | 65 void ObserveMediaInternalsOnIOThread(); |
| 66 void StopObservingMediaInternalsOnIOThread(); | 66 void StopObservingMediaInternalsOnIOThread(); |
| 67 void GetEverythingOnIOThread(); | 67 void GetEverythingOnIOThread(); |
| 68 | 68 |
| 69 // Callback for MediaInternals to update. Must be called on UI thread. | 69 // Callback for MediaInternals to update. Must be called on UI thread. |
| 70 void UpdateUIOnUIThread(const base::string16& update); | 70 void UpdateUIOnUIThread(const base::string16& update); |
| 71 | 71 |
| 72 // Put |entry| on a list of events to be sent to the page. | 72 // Put |entry| on a list of events to be sent to the page. |
| 73 void AddNetEventOnUIThread(std::unique_ptr<base::Value> entry); | 73 void AddNetEventOnUIThread(std::unique_ptr<base::Value> entry); |
| 74 | 74 |
| 75 // Send all pending events to the page. | 75 // Send all pending events to the page. |
| 76 void SendNetEventsOnUIThread(); | 76 void SendNetEventsOnUIThread(); |
| 77 | 77 |
| 78 // Call a JavaScript function on the page. Takes ownership of |args|. | 78 // Call a JavaScript function on the page. |
| 79 void CallJavaScriptFunctionOnUIThread(const std::string& function, | 79 void CallJavaScriptFunctionOnUIThread(const std::string& function, |
| 80 base::Value* args); | 80 std::unique_ptr<base::Value> args); |
| 81 | 81 |
| 82 MediaInternalsMessageHandler* handler_; | 82 MediaInternalsMessageHandler* handler_; |
| 83 std::unique_ptr<base::ListValue> pending_net_updates_; | 83 std::unique_ptr<base::ListValue> pending_net_updates_; |
| 84 NotificationRegistrar registrar_; | 84 NotificationRegistrar registrar_; |
| 85 MediaInternals::UpdateCallback update_callback_; | 85 MediaInternals::UpdateCallback update_callback_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(MediaInternalsProxy); | 87 DISALLOW_COPY_AND_ASSIGN(MediaInternalsProxy); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace content | 90 } // namespace content |
| 91 | 91 |
| 92 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_PROXY_H_ | 92 #endif // CONTENT_BROWSER_MEDIA_MEDIA_INTERNALS_PROXY_H_ |
| OLD | NEW |