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 24 matching lines...) Expand all Loading... |
35 }; | 35 }; |
36 | 36 |
37 explicit GcdPrivateAPI(content::BrowserContext* context); | 37 explicit GcdPrivateAPI(content::BrowserContext* context); |
38 virtual ~GcdPrivateAPI(); | 38 virtual ~GcdPrivateAPI(); |
39 | 39 |
40 static void SetGCDApiFlowFactoryForTests(GCDApiFlowFactoryForTests* factory); | 40 static void SetGCDApiFlowFactoryForTests(GCDApiFlowFactoryForTests* factory); |
41 | 41 |
42 // BrowserContextKeyedAPI implementation. | 42 // BrowserContextKeyedAPI implementation. |
43 static BrowserContextKeyedAPIFactory<GcdPrivateAPI>* GetFactoryInstance(); | 43 static BrowserContextKeyedAPIFactory<GcdPrivateAPI>* GetFactoryInstance(); |
44 | 44 |
| 45 bool QueryForDevices(); |
| 46 |
45 private: | 47 private: |
46 friend class BrowserContextKeyedAPIFactory<GcdPrivateAPI>; | 48 friend class BrowserContextKeyedAPIFactory<GcdPrivateAPI>; |
47 | 49 |
48 typedef std::map<std::string /* id_string */, | 50 typedef std::map<std::string /* id_string */, |
49 linked_ptr<api::gcd_private::GCDDevice> > GCDDeviceMap; | 51 linked_ptr<api::gcd_private::GCDDevice> > GCDDeviceMap; |
50 | 52 |
51 // EventRouter::Observer implementation. | 53 // EventRouter::Observer implementation. |
52 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; | 54 virtual void OnListenerAdded(const EventListenerInfo& details) OVERRIDE; |
53 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; | 55 virtual void OnListenerRemoved(const EventListenerInfo& details) OVERRIDE; |
54 | 56 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 void CheckListingDone(); | 109 void CheckListingDone(); |
108 | 110 |
109 int requests_succeeded_; | 111 int requests_succeeded_; |
110 int requests_failed_; | 112 int requests_failed_; |
111 DeviceList devices_; | 113 DeviceList devices_; |
112 | 114 |
113 scoped_ptr<local_discovery::GCDApiFlow> printer_list_; | 115 scoped_ptr<local_discovery::GCDApiFlow> printer_list_; |
114 scoped_ptr<local_discovery::GCDApiFlow> device_list_; | 116 scoped_ptr<local_discovery::GCDApiFlow> device_list_; |
115 }; | 117 }; |
116 | 118 |
| 119 class GcdPrivateQueryForNewLocalDevicesFunction |
| 120 : public ChromeSyncExtensionFunction { |
| 121 public: |
| 122 DECLARE_EXTENSION_FUNCTION("gcdPrivate.queryForNewLocalDevices", |
| 123 FEEDBACKPRIVATE_GETSTRINGS) |
| 124 |
| 125 GcdPrivateQueryForNewLocalDevicesFunction(); |
| 126 |
| 127 protected: |
| 128 virtual ~GcdPrivateQueryForNewLocalDevicesFunction(); |
| 129 |
| 130 // SyncExtensionFunction overrides. |
| 131 virtual bool RunSync() OVERRIDE; |
| 132 }; |
| 133 |
117 } // namespace extensions | 134 } // namespace extensions |
118 | 135 |
119 #endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ | 136 #endif // CHROME_BROWSER_EXTENSIONS_API_GCD_PRIVATE_GCD_PRIVATE_API_H_ |
OLD | NEW |