| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 EXTENSIONS_BROWSER_API_NETWORKING_CONFIG_NETWORKING_CONFIG_SERVICE_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_NETWORKING_CONFIG_NETWORKING_CONFIG_SERVICE_H_ |
| 6 #define EXTENSIONS_BROWSER_API_NETWORKING_CONFIG_NETWORKING_CONFIG_SERVICE_H_ | 6 #define EXTENSIONS_BROWSER_API_NETWORKING_CONFIG_NETWORKING_CONFIG_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/scoped_observer.h" | 14 #include "base/scoped_observer.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "components/keyed_service/core/keyed_service.h" | 16 #include "components/keyed_service/core/keyed_service.h" |
| 17 #include "content/public/browser/browser_context.h" | 17 #include "content/public/browser/browser_context.h" |
| 18 #include "extensions/browser/event_router.h" | 18 #include "extensions/browser/event_router.h" |
| 19 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
| 20 #include "extensions/browser/extension_registry_observer.h" | 20 #include "extensions/browser/extension_registry_observer.h" |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 47 AuthenticationResult(ExtensionId extension_id, | 47 AuthenticationResult(ExtensionId extension_id, |
| 48 std::string guid, | 48 std::string guid, |
| 49 AuthenticationState authentication_state); | 49 AuthenticationState authentication_state); |
| 50 ExtensionId extension_id; | 50 ExtensionId extension_id; |
| 51 std::string guid; | 51 std::string guid; |
| 52 AuthenticationState authentication_state; | 52 AuthenticationState authentication_state; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 // Note: |extension_registry| must outlive this class. | 55 // Note: |extension_registry| must outlive this class. |
| 56 NetworkingConfigService(content::BrowserContext* browser_context, | 56 NetworkingConfigService(content::BrowserContext* browser_context, |
| 57 scoped_ptr<EventDelegate> event_delegate, | 57 std::unique_ptr<EventDelegate> event_delegate, |
| 58 ExtensionRegistry* extension_registry); | 58 ExtensionRegistry* extension_registry); |
| 59 ~NetworkingConfigService() override; | 59 ~NetworkingConfigService() override; |
| 60 | 60 |
| 61 // ExtensionRegistryObserver | 61 // ExtensionRegistryObserver |
| 62 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 62 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 63 const Extension* extension, | 63 const Extension* extension, |
| 64 UnloadedExtensionInfo::Reason reason) override; | 64 UnloadedExtensionInfo::Reason reason) override; |
| 65 | 65 |
| 66 // Returns the extension id registered for |hex_ssid|. If no extension is | 66 // Returns the extension id registered for |hex_ssid|. If no extension is |
| 67 // registered for this |hex_ssid|, the function returns an empty string. | 67 // registered for this |hex_ssid|, the function returns an empty string. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 private: | 109 private: |
| 110 void OnGotProperties(const std::string& extension_id, | 110 void OnGotProperties(const std::string& extension_id, |
| 111 const std::string& guid, | 111 const std::string& guid, |
| 112 const base::Closure& authentication_callback, | 112 const base::Closure& authentication_callback, |
| 113 const std::string& service_path, | 113 const std::string& service_path, |
| 114 const base::DictionaryValue& onc_network_config); | 114 const base::DictionaryValue& onc_network_config); |
| 115 | 115 |
| 116 void OnGetPropertiesFailed(const std::string& extension_id, | 116 void OnGetPropertiesFailed(const std::string& extension_id, |
| 117 const std::string& guid, | 117 const std::string& guid, |
| 118 const std::string& error_name, | 118 const std::string& error_name, |
| 119 scoped_ptr<base::DictionaryValue> error_data); | 119 std::unique_ptr<base::DictionaryValue> error_data); |
| 120 | 120 |
| 121 // Creates the captive portal event about the network with guid |guid| that is | 121 // Creates the captive portal event about the network with guid |guid| that is |
| 122 // to be dispatched to the extension identified by |extension_id|. |bssid| | 122 // to be dispatched to the extension identified by |extension_id|. |bssid| |
| 123 // contains a human readable, hex-encoded version of the BSSID with bytes | 123 // contains a human readable, hex-encoded version of the BSSID with bytes |
| 124 // separated by colons, e.g. 45:67:89:ab:cd:ef. | 124 // separated by colons, e.g. 45:67:89:ab:cd:ef. |
| 125 scoped_ptr<Event> CreatePortalDetectedEventAndDispatch( | 125 std::unique_ptr<Event> CreatePortalDetectedEventAndDispatch( |
| 126 const std::string& extension_id, | 126 const std::string& extension_id, |
| 127 const std::string& guid, | 127 const std::string& guid, |
| 128 const std::string* bssid); | 128 const std::string* bssid); |
| 129 | 129 |
| 130 content::BrowserContext* const browser_context_; | 130 content::BrowserContext* const browser_context_; |
| 131 | 131 |
| 132 AuthenticationResult authentication_result_; | 132 AuthenticationResult authentication_result_; |
| 133 base::Closure authentication_callback_; | 133 base::Closure authentication_callback_; |
| 134 | 134 |
| 135 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 135 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 136 registry_observer_; | 136 registry_observer_; |
| 137 | 137 |
| 138 scoped_ptr<EventDelegate> event_delegate_; | 138 std::unique_ptr<EventDelegate> event_delegate_; |
| 139 | 139 |
| 140 // This map associates a given hex encoded SSID to an extension entry. | 140 // This map associates a given hex encoded SSID to an extension entry. |
| 141 std::map<std::string, std::string> hex_ssid_to_extension_id_; | 141 std::map<std::string, std::string> hex_ssid_to_extension_id_; |
| 142 | 142 |
| 143 base::WeakPtrFactory<NetworkingConfigService> weak_factory_; | 143 base::WeakPtrFactory<NetworkingConfigService> weak_factory_; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 } // namespace extensions | 146 } // namespace extensions |
| 147 | 147 |
| 148 #endif // EXTENSIONS_BROWSER_API_NETWORKING_CONFIG_NETWORKING_CONFIG_SERVICE_H_ | 148 #endif // EXTENSIONS_BROWSER_API_NETWORKING_CONFIG_NETWORKING_CONFIG_SERVICE_H_ |
| OLD | NEW |