| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 static BrowserContextKeyedAPIFactory<TabCaptureRegistry>* | 42 static BrowserContextKeyedAPIFactory<TabCaptureRegistry>* |
| 43 GetFactoryInstance(); | 43 GetFactoryInstance(); |
| 44 | 44 |
| 45 // List all pending, active and stopped capture requests. | 45 // List all pending, active and stopped capture requests. |
| 46 void GetCapturedTabs(const std::string& extension_id, | 46 void GetCapturedTabs(const std::string& extension_id, |
| 47 base::ListValue* list_of_capture_info) const; | 47 base::ListValue* list_of_capture_info) const; |
| 48 | 48 |
| 49 // Add a tab capture request to the registry when a stream is requested | 49 // Add a tab capture request to the registry when a stream is requested |
| 50 // through the API. |target_contents| refers to the WebContents associated | 50 // through the API. |target_contents| refers to the WebContents associated |
| 51 // with the tab to be captured. |extension_id| refers to the Extension | 51 // with the tab to be captured. |extension_id| refers to the Extension |
| 52 // initiating the request. | 52 // initiating the request. |is_anonymous| is true if GetCapturedTabs() should |
| 53 // not list the captured tab, and no status change events should be dispatched |
| 54 // for it. |
| 55 // |
| 56 // TODO(miu): This is broken in that it's possible for a later WebContents |
| 57 // instance to have the same pointer value as a previously-destroyed one. To |
| 58 // be fixed while working on http://crbug.com/163100. |
| 53 bool AddRequest(content::WebContents* target_contents, | 59 bool AddRequest(content::WebContents* target_contents, |
| 54 const std::string& extension_id); | 60 const std::string& extension_id, |
| 61 bool is_anonymous); |
| 55 | 62 |
| 56 // Called by MediaStreamDevicesController to verify the request before | 63 // Called by MediaStreamDevicesController to verify the request before |
| 57 // creating the stream. |render_process_id| and |render_frame_id| are used to | 64 // creating the stream. |render_process_id| and |render_frame_id| are used to |
| 58 // look-up a WebContents instance, which should match the |target_contents| | 65 // look-up a WebContents instance, which should match the |target_contents| |
| 59 // from the prior call to AddRequest(). In addition, a request is not | 66 // from the prior call to AddRequest(). In addition, a request is not |
| 60 // verified unless the |extension_id| also matches AND the request itself is | 67 // verified unless the |extension_id| also matches AND the request itself is |
| 61 // in the PENDING state. | 68 // in the PENDING state. |
| 62 bool VerifyRequest(int render_process_id, | 69 bool VerifyRequest(int render_process_id, |
| 63 int render_frame_id, | 70 int render_frame_id, |
| 64 const std::string& extension_id); | 71 const std::string& extension_id); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 113 |
| 107 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 114 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 108 extension_registry_observer_; | 115 extension_registry_observer_; |
| 109 | 116 |
| 110 DISALLOW_COPY_AND_ASSIGN(TabCaptureRegistry); | 117 DISALLOW_COPY_AND_ASSIGN(TabCaptureRegistry); |
| 111 }; | 118 }; |
| 112 | 119 |
| 113 } // namespace extensions | 120 } // namespace extensions |
| 114 | 121 |
| 115 #endif // CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_REGISTRY_H_ | 122 #endif // CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_REGISTRY_H_ |
| OLD | NEW |