| 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 | |
| 42 private: | 40 private: |
| 43 friend class BrowserContextKeyedAPIFactory<GcdPrivateAPI>; | 41 friend class BrowserContextKeyedAPIFactory<GcdPrivateAPI>; |
| 44 | 42 |
| 45 typedef std::map<std::string /* id_string */, | 43 typedef std::map<std::string /* id_string */, |
| 46 linked_ptr<api::gcd_private::GCDDevice> > GCDDeviceMap; | 44 linked_ptr<api::gcd_private::GCDDevice> > GCDDeviceMap; |
| 47 | 45 |
| 48 // EventRouter::Observer implementation. | 46 // EventRouter::Observer implementation. |
| 49 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 47 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; |
| 50 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; | 48 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; |
| 51 | 49 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 91 |
| 94 int requests_succeeded_; | 92 int requests_succeeded_; |
| 95 int requests_failed_; | 93 int requests_failed_; |
| 96 DeviceList devices_; | 94 DeviceList devices_; |
| 97 | 95 |
| 98 scoped_ptr<local_discovery::GCDApiFlow> printer_list_; | 96 scoped_ptr<local_discovery::GCDApiFlow> printer_list_; |
| 99 scoped_ptr<local_discovery::GCDApiFlow> device_list_; | 97 scoped_ptr<local_discovery::GCDApiFlow> device_list_; |
| 100 }; | 98 }; |
| 101 | 99 |
| 102 class GcdPrivateQueryForNewLocalDevicesFunction | 100 class GcdPrivateQueryForNewLocalDevicesFunction |
| 103 : public ChromeSyncExtensionFunction { | 101 : public ChromeAsyncExtensionFunction { |
| 104 public: | 102 public: |
| 105 DECLARE_EXTENSION_FUNCTION("gcdPrivate.queryForNewLocalDevices", | 103 DECLARE_EXTENSION_FUNCTION("gcdPrivate.queryForNewLocalDevices", |
| 106 GCDPRIVATE_QUERYFORNEWLOCALDEVICES) | 104 GCDPRIVATE_QUERYFORNEWLOCALDEVICES) |
| 107 | 105 |
| 108 GcdPrivateQueryForNewLocalDevicesFunction(); | 106 GcdPrivateQueryForNewLocalDevicesFunction(); |
| 109 | 107 |
| 110 protected: | 108 protected: |
| 111 virtual ~GcdPrivateQueryForNewLocalDevicesFunction(); | 109 virtual ~GcdPrivateQueryForNewLocalDevicesFunction(); |
| 112 | 110 |
| 113 // SyncExtensionFunction overrides. | 111 // AsyncExtensionFunction overrides. |
| 114 virtual bool RunSync() OVERRIDE; | 112 virtual bool RunAsync() OVERRIDE; |
| 115 }; | 113 }; |
| 116 | 114 |
| 117 class GcdPrivateStartSetupFunction : public ChromeAsyncExtensionFunction { | 115 class GcdPrivateStartSetupFunction : public ChromeAsyncExtensionFunction { |
| 118 public: | 116 public: |
| 119 public: | 117 public: |
| 120 DECLARE_EXTENSION_FUNCTION("gcdPrivate.startSetup", GCDPRIVATE_STARTSETUP) | 118 DECLARE_EXTENSION_FUNCTION("gcdPrivate.startSetup", GCDPRIVATE_STARTSETUP) |
| 121 | 119 |
| 122 GcdPrivateStartSetupFunction(); | 120 GcdPrivateStartSetupFunction(); |
| 123 | 121 |
| 124 protected: | 122 protected: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 187 |
| 190 // AsyncExtensionFunction overrides. | 188 // AsyncExtensionFunction overrides. |
| 191 virtual bool RunAsync() OVERRIDE; | 189 virtual bool RunAsync() OVERRIDE; |
| 192 | 190 |
| 193 private: | 191 private: |
| 194 }; | 192 }; |
| 195 | 193 |
| 196 } // namespace extensions | 194 } // namespace extensions |
| 197 | 195 |
| 198 #endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ | 196 #endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ |
| OLD | NEW |