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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 11 matching lines...) Expand all Loading... |
22 class Profile; | 22 class Profile; |
23 | 23 |
24 namespace extensions { | 24 namespace extensions { |
25 | 25 |
26 namespace tab_capture = extensions::api::tab_capture; | 26 namespace tab_capture = extensions::api::tab_capture; |
27 | 27 |
28 class TabCaptureRegistry : public ProfileKeyedService, | 28 class TabCaptureRegistry : public ProfileKeyedService, |
29 public content::NotificationObserver { | 29 public content::NotificationObserver { |
30 public: | 30 public: |
31 struct TabCaptureRequest { | 31 struct TabCaptureRequest { |
| 32 TabCaptureRequest(std::string extension_id, |
| 33 int tab_id, |
| 34 tab_capture::TabCaptureState status); |
| 35 ~TabCaptureRequest(); |
| 36 |
32 std::string extension_id; | 37 std::string extension_id; |
33 int tab_id; | 38 int tab_id; |
34 tab_capture::TabCaptureState status; | 39 tab_capture::TabCaptureState status; |
35 | |
36 TabCaptureRequest() : tab_id(-1) {} | |
37 TabCaptureRequest(std::string extension_id, int tab_id, | |
38 tab_capture::TabCaptureState status) | |
39 : extension_id(extension_id), tab_id(tab_id), status(status) {} | |
40 }; | 40 }; |
41 typedef std::vector<TabCaptureRequest> CaptureRequestList; | 41 typedef std::vector<TabCaptureRequest> CaptureRequestList; |
42 | 42 |
43 explicit TabCaptureRegistry(Profile* profile); | 43 explicit TabCaptureRegistry(Profile* profile); |
44 | 44 |
45 const CaptureRequestList GetCapturedTabs(const std::string& extension_id); | 45 const CaptureRequestList GetCapturedTabs(const std::string& extension_id); |
46 bool AddRequest(const std::pair<int, int>, const TabCaptureRequest& request); | 46 bool AddRequest(const std::pair<int, int>, const TabCaptureRequest& request); |
47 bool VerifyRequest(int render_process_id, int render_view_id); | 47 bool VerifyRequest(int render_process_id, int render_view_id); |
48 | 48 |
49 private: | 49 private: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 content::NotificationRegistrar registrar_; | 98 content::NotificationRegistrar registrar_; |
99 Profile* const profile_; | 99 Profile* const profile_; |
100 DeviceCaptureRequestMap requests_; | 100 DeviceCaptureRequestMap requests_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(TabCaptureRegistry); | 102 DISALLOW_COPY_AND_ASSIGN(TabCaptureRegistry); |
103 }; | 103 }; |
104 | 104 |
105 } // namespace extension | 105 } // namespace extension |
106 | 106 |
107 #endif // CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_REGISTRY_H_ | 107 #endif // CHROME_BROWSER_EXTENSIONS_API_TAB_CAPTURE_TAB_CAPTURE_REGISTRY_H_ |
OLD | NEW |