OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_GCD_PRIVATE_GCD_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ |
7 | 7 |
8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/extensions/chrome_extension_function.h" | 10 #include "chrome/browser/extensions/chrome_extension_function.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 }; | 30 }; |
31 | 31 |
32 explicit GcdPrivateAPI(content::BrowserContext* context); | 32 explicit GcdPrivateAPI(content::BrowserContext* context); |
33 virtual ~GcdPrivateAPI(); | 33 virtual ~GcdPrivateAPI(); |
34 | 34 |
35 static void SetGCDApiFlowFactoryForTests(GCDApiFlowFactoryForTests* factory); | 35 static void SetGCDApiFlowFactoryForTests(GCDApiFlowFactoryForTests* factory); |
36 | 36 |
37 // BrowserContextKeyedAPI implementation. | 37 // BrowserContextKeyedAPI implementation. |
38 static BrowserContextKeyedAPIFactory<GcdPrivateAPI>* GetFactoryInstance(); | 38 static BrowserContextKeyedAPIFactory<GcdPrivateAPI>* GetFactoryInstance(); |
39 | 39 |
| 40 bool QueryForDevices(); |
| 41 |
40 private: | 42 private: |
41 friend class BrowserContextKeyedAPIFactory<GcdPrivateAPI>; | 43 friend class BrowserContextKeyedAPIFactory<GcdPrivateAPI>; |
42 | 44 |
43 typedef std::map<std::string /* id_string */, | 45 typedef std::map<std::string /* id_string */, |
44 linked_ptr<api::gcd_private::GCDDevice> > GCDDeviceMap; | 46 linked_ptr<api::gcd_private::GCDDevice> > GCDDeviceMap; |
45 | 47 |
46 // EventRouter::Observer implementation. | 48 // EventRouter::Observer implementation. |
47 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 49 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; |
48 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; | 50 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; |
49 | 51 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 93 |
92 int requests_succeeded_; | 94 int requests_succeeded_; |
93 int requests_failed_; | 95 int requests_failed_; |
94 DeviceList devices_; | 96 DeviceList devices_; |
95 | 97 |
96 scoped_ptr<local_discovery::GCDApiFlow> printer_list_; | 98 scoped_ptr<local_discovery::GCDApiFlow> printer_list_; |
97 scoped_ptr<local_discovery::GCDApiFlow> device_list_; | 99 scoped_ptr<local_discovery::GCDApiFlow> device_list_; |
98 }; | 100 }; |
99 | 101 |
100 class GcdPrivateQueryForNewLocalDevicesFunction | 102 class GcdPrivateQueryForNewLocalDevicesFunction |
101 : public ChromeAsyncExtensionFunction { | 103 : public ChromeSyncExtensionFunction { |
102 public: | 104 public: |
103 DECLARE_EXTENSION_FUNCTION("gcdPrivate.queryForNewLocalDevices", | 105 DECLARE_EXTENSION_FUNCTION("gcdPrivate.queryForNewLocalDevices", |
104 GCDPRIVATE_QUERYFORNEWLOCALDEVICES) | 106 GCDPRIVATE_QUERYFORNEWLOCALDEVICES) |
105 | 107 |
106 GcdPrivateQueryForNewLocalDevicesFunction(); | 108 GcdPrivateQueryForNewLocalDevicesFunction(); |
107 | 109 |
108 protected: | 110 protected: |
109 virtual ~GcdPrivateQueryForNewLocalDevicesFunction(); | 111 virtual ~GcdPrivateQueryForNewLocalDevicesFunction(); |
110 | 112 |
111 // AsyncExtensionFunction overrides. | 113 // SyncExtensionFunction overrides. |
112 virtual bool RunAsync() OVERRIDE; | 114 virtual bool RunSync() OVERRIDE; |
113 }; | 115 }; |
114 | 116 |
115 class GcdPrivateStartSetupFunction : public ChromeAsyncExtensionFunction { | 117 class GcdPrivateStartSetupFunction : public ChromeAsyncExtensionFunction { |
116 public: | 118 public: |
117 public: | 119 public: |
118 DECLARE_EXTENSION_FUNCTION("gcdPrivate.startSetup", GCDPRIVATE_STARTSETUP) | 120 DECLARE_EXTENSION_FUNCTION("gcdPrivate.startSetup", GCDPRIVATE_STARTSETUP) |
119 | 121 |
120 GcdPrivateStartSetupFunction(); | 122 GcdPrivateStartSetupFunction(); |
121 | 123 |
122 protected: | 124 protected: |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 189 |
188 // AsyncExtensionFunction overrides. | 190 // AsyncExtensionFunction overrides. |
189 virtual bool RunAsync() OVERRIDE; | 191 virtual bool RunAsync() OVERRIDE; |
190 | 192 |
191 private: | 193 private: |
192 }; | 194 }; |
193 | 195 |
194 } // namespace extensions | 196 } // namespace extensions |
195 | 197 |
196 #endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ | 198 #endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ |
OLD | NEW |