| 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_DIAL_DIAL_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/extensions/api/dial/dial_device_data.h" | 11 #include "chrome/browser/extensions/api/dial/dial_device_data.h" |
| 12 #include "chrome/browser/extensions/api/dial/dial_registry.h" | 12 #include "chrome/browser/extensions/api/dial/dial_registry.h" |
| 13 #include "chrome/browser/extensions/api/dial/discovery_network_monitor.h" |
| 13 #include "components/keyed_service/core/refcounted_keyed_service.h" | 14 #include "components/keyed_service/core/refcounted_keyed_service.h" |
| 14 #include "extensions/browser/api/async_api_function.h" | 15 #include "extensions/browser/api/async_api_function.h" |
| 15 #include "extensions/browser/event_router.h" | 16 #include "extensions/browser/event_router.h" |
| 16 | 17 |
| 17 namespace extensions { | 18 namespace extensions { |
| 18 | 19 |
| 19 class DialRegistry; | 20 class DialRegistry; |
| 20 | 21 |
| 21 // Dial API which is a ref-counted KeyedService that manages | 22 // Dial API which is a ref-counted KeyedService that manages |
| 22 // the DIAL registry. It takes care of creating the registry on the IO thread | 23 // the DIAL registry. It takes care of creating the registry on the IO thread |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 DialAPI* dial_; | 94 DialAPI* dial_; |
| 94 | 95 |
| 95 // Result of the discoverNow call to the DIAL registry. This result is | 96 // Result of the discoverNow call to the DIAL registry. This result is |
| 96 // retrieved on the IO thread but the function result is returned on the UI | 97 // retrieved on the IO thread but the function result is returned on the UI |
| 97 // thread. | 98 // thread. |
| 98 bool result_; | 99 bool result_; |
| 99 | 100 |
| 100 DISALLOW_COPY_AND_ASSIGN(DialDiscoverNowFunction); | 101 DISALLOW_COPY_AND_ASSIGN(DialDiscoverNowFunction); |
| 101 }; | 102 }; |
| 102 | 103 |
| 104 class DialGetNetworkIdFunction : public AsyncApiFunction { |
| 105 public: |
| 106 DialGetNetworkIdFunction() = default; |
| 107 |
| 108 protected: |
| 109 ~DialGetNetworkIdFunction() override = default; |
| 110 |
| 111 // AsyncApiFunction: |
| 112 bool Prepare() override; |
| 113 void Work() override; |
| 114 bool Respond() override; |
| 115 |
| 116 private: |
| 117 DECLARE_EXTENSION_FUNCTION("dial.getNetworkId", DIAL_GETNETWORKID); |
| 118 |
| 119 DISALLOW_COPY_AND_ASSIGN(DialGetNetworkIdFunction); |
| 120 }; |
| 121 |
| 103 } // namespace api | 122 } // namespace api |
| 104 | 123 |
| 105 } // namespace extensions | 124 } // namespace extensions |
| 106 | 125 |
| 107 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ | 126 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_API_H_ |
| OLD | NEW |