| 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 CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_REGISTRY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // in the PENDING state. | 61 // in the PENDING state. |
| 62 bool VerifyRequest(int render_process_id, | 62 bool VerifyRequest(int render_process_id, |
| 63 int render_frame_id, | 63 int render_frame_id, |
| 64 const std::string& extension_id); | 64 const std::string& extension_id); |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 friend class BrowserContextKeyedAPIFactory<TabCaptureRegistry>; | 67 friend class BrowserContextKeyedAPIFactory<TabCaptureRegistry>; |
| 68 class LiveRequest; | 68 class LiveRequest; |
| 69 | 69 |
| 70 explicit TabCaptureRegistry(content::BrowserContext* context); | 70 explicit TabCaptureRegistry(content::BrowserContext* context); |
| 71 virtual ~TabCaptureRegistry(); | 71 ~TabCaptureRegistry() override; |
| 72 | 72 |
| 73 // Used by BrowserContextKeyedAPI. | 73 // Used by BrowserContextKeyedAPI. |
| 74 static const char* service_name() { | 74 static const char* service_name() { |
| 75 return "TabCaptureRegistry"; | 75 return "TabCaptureRegistry"; |
| 76 } | 76 } |
| 77 | 77 |
| 78 static const bool kServiceIsCreatedWithBrowserContext = false; | 78 static const bool kServiceIsCreatedWithBrowserContext = false; |
| 79 static const bool kServiceRedirectedInIncognito = true; | 79 static const bool kServiceRedirectedInIncognito = true; |
| 80 | 80 |
| 81 // ExtensionRegistryObserver implementation. | 81 // ExtensionRegistryObserver implementation. |
| 82 virtual void OnExtensionUnloaded( | 82 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 83 content::BrowserContext* browser_context, | 83 const Extension* extension, |
| 84 const Extension* extension, | 84 UnloadedExtensionInfo::Reason reason) override; |
| 85 UnloadedExtensionInfo::Reason reason) override; | |
| 86 | 85 |
| 87 // MediaCaptureDevicesDispatcher::Observer implementation. | 86 // MediaCaptureDevicesDispatcher::Observer implementation. |
| 88 virtual void OnRequestUpdate( | 87 void OnRequestUpdate(int original_target_render_process_id, |
| 89 int original_target_render_process_id, | 88 int original_target_render_frame_id, |
| 90 int original_target_render_frame_id, | 89 content::MediaStreamType stream_type, |
| 91 content::MediaStreamType stream_type, | 90 const content::MediaRequestState state) override; |
| 92 const content::MediaRequestState state) override; | |
| 93 | 91 |
| 94 // Send a StatusChanged event containing the current state of |request|. | 92 // Send a StatusChanged event containing the current state of |request|. |
| 95 void DispatchStatusChangeEvent(const LiveRequest* request) const; | 93 void DispatchStatusChangeEvent(const LiveRequest* request) const; |
| 96 | 94 |
| 97 // Look-up a LiveRequest associated with the given |target_contents| (or | 95 // Look-up a LiveRequest associated with the given |target_contents| (or |
| 98 // the originally targetted RenderFrameHost), if any. | 96 // the originally targetted RenderFrameHost), if any. |
| 99 LiveRequest* FindRequest(const content::WebContents* target_contents) const; | 97 LiveRequest* FindRequest(const content::WebContents* target_contents) const; |
| 100 LiveRequest* FindRequest(int original_target_render_process_id, | 98 LiveRequest* FindRequest(int original_target_render_process_id, |
| 101 int original_target_render_frame_id) const; | 99 int original_target_render_frame_id) const; |
| 102 | 100 |
| 103 // Removes the |request| from |requests_|, thus causing its destruction. | 101 // Removes the |request| from |requests_|, thus causing its destruction. |
| 104 void KillRequest(LiveRequest* request); | 102 void KillRequest(LiveRequest* request); |
| 105 | 103 |
| 106 content::BrowserContext* const browser_context_; | 104 content::BrowserContext* const browser_context_; |
| 107 ScopedVector<LiveRequest> requests_; | 105 ScopedVector<LiveRequest> requests_; |
| 108 | 106 |
| 109 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 107 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 110 extension_registry_observer_; | 108 extension_registry_observer_; |
| 111 | 109 |
| 112 DISALLOW_COPY_AND_ASSIGN(TabCaptureRegistry); | 110 DISALLOW_COPY_AND_ASSIGN(TabCaptureRegistry); |
| 113 }; | 111 }; |
| 114 | 112 |
| 115 } // namespace extensions | 113 } // namespace extensions |
| 116 | 114 |
| 117 #endif // CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_REGISTRY_H_ | 115 #endif // CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_REGISTRY_H_ |
| OLD | NEW |