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 EXTENSIONS_BROWSER_API_VPN_PROVIDER_VPN_SERVICE_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_VPN_PROVIDER_VPN_SERVICE_H_ |
6 #define EXTENSIONS_BROWSER_API_VPN_PROVIDER_VPN_SERVICE_H_ | 6 #define EXTENSIONS_BROWSER_API_VPN_PROVIDER_VPN_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace base { | 23 namespace base { |
24 | 24 |
25 class DictionaryValue; | 25 class DictionaryValue; |
26 class ListValue; | 26 class ListValue; |
27 | 27 |
28 } // namespace base | 28 } // namespace base |
29 | 29 |
30 namespace content { | 30 namespace content { |
31 | 31 |
32 class BrowserContext; | 32 class BrowserContext; |
| 33 class PepperVpnProviderResourceHostProxy; |
| 34 class VpnServiceProxy; |
33 | 35 |
34 } // namespace content | 36 } // namespace content |
35 | 37 |
36 namespace extensions { | 38 namespace extensions { |
37 | 39 |
38 class EventRouter; | 40 class EventRouter; |
39 class ExtensionRegistry; | 41 class ExtensionRegistry; |
40 | 42 |
41 } // namespace extensions | 43 } // namespace extensions |
42 | 44 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 157 |
156 // Verifies if the extension has a configuration that is connected. | 158 // Verifies if the extension has a configuration that is connected. |
157 bool VerifyConfigIsConnectedForTesting(const std::string& extension_id); | 159 bool VerifyConfigIsConnectedForTesting(const std::string& extension_id); |
158 | 160 |
159 // Gets the unique key for the configuration |configuration_name| created by | 161 // Gets the unique key for the configuration |configuration_name| created by |
160 // the extension with id |extension_id|. | 162 // the extension with id |extension_id|. |
161 // This method is made public for testing. | 163 // This method is made public for testing. |
162 static std::string GetKey(const std::string& extension_id, | 164 static std::string GetKey(const std::string& extension_id, |
163 const std::string& configuration_name); | 165 const std::string& configuration_name); |
164 | 166 |
| 167 // Creates a new VpnServiceProxy. The caller owns the returned value. It's |
| 168 // valid to return nullptr. |
| 169 std::unique_ptr<content::VpnServiceProxy> GetVpnServiceProxy(); |
| 170 |
165 private: | 171 private: |
166 class VpnConfiguration; | 172 class VpnConfiguration; |
| 173 class VpnServiceProxyImpl; |
167 | 174 |
168 using StringToConfigurationMap = std::map<std::string, VpnConfiguration*>; | 175 using StringToConfigurationMap = std::map<std::string, VpnConfiguration*>; |
169 | 176 |
170 // Callback used to indicate that configuration was successfully created. | 177 // Callback used to indicate that configuration was successfully created. |
171 void OnCreateConfigurationSuccess(const SuccessCallback& callback, | 178 void OnCreateConfigurationSuccess(const SuccessCallback& callback, |
172 VpnConfiguration* configuration, | 179 VpnConfiguration* configuration, |
173 const std::string& service_path, | 180 const std::string& service_path, |
174 const std::string& guid); | 181 const std::string& guid); |
175 | 182 |
176 // Callback used to indicate that configuration creation failed. | 183 // Callback used to indicate that configuration creation failed. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 const std::string& event_name, | 226 const std::string& event_name, |
220 std::unique_ptr<base::ListValue> event_args); | 227 std::unique_ptr<base::ListValue> event_args); |
221 | 228 |
222 // Destroy configurations belonging to the extension. | 229 // Destroy configurations belonging to the extension. |
223 void DestroyConfigurationsForExtension( | 230 void DestroyConfigurationsForExtension( |
224 const extensions::Extension* extension); | 231 const extensions::Extension* extension); |
225 | 232 |
226 // Set the active configuration. | 233 // Set the active configuration. |
227 void SetActiveConfiguration(VpnConfiguration* configuration); | 234 void SetActiveConfiguration(VpnConfiguration* configuration); |
228 | 235 |
| 236 void Bind(const std::string& extension_id, |
| 237 const std::string& configuration_id, |
| 238 const std::string& configuration_name, |
| 239 const SuccessCallback& success, |
| 240 const FailureCallback& failure, |
| 241 std::unique_ptr<content::PepperVpnProviderResourceHostProxy> |
| 242 pepper_vpn_provider_proxy); |
| 243 |
229 content::BrowserContext* browser_context_; | 244 content::BrowserContext* browser_context_; |
230 std::string userid_hash_; | 245 std::string userid_hash_; |
231 | 246 |
232 extensions::ExtensionRegistry* extension_registry_; | 247 extensions::ExtensionRegistry* extension_registry_; |
233 extensions::EventRouter* event_router_; | 248 extensions::EventRouter* event_router_; |
234 ShillThirdPartyVpnDriverClient* shill_client_; | 249 ShillThirdPartyVpnDriverClient* shill_client_; |
235 NetworkConfigurationHandler* network_configuration_handler_; | 250 NetworkConfigurationHandler* network_configuration_handler_; |
236 NetworkProfileHandler* network_profile_handler_; | 251 NetworkProfileHandler* network_profile_handler_; |
237 NetworkStateHandler* network_state_handler_; | 252 NetworkStateHandler* network_state_handler_; |
238 | 253 |
239 VpnConfiguration* active_configuration_; | 254 VpnConfiguration* active_configuration_; |
240 | 255 |
241 // Key map owns the VpnConfigurations. | 256 // Key map owns the VpnConfigurations. |
242 StringToConfigurationMap key_to_configuration_map_; | 257 StringToConfigurationMap key_to_configuration_map_; |
243 | 258 |
244 // Service path does not own the VpnConfigurations. | 259 // Service path does not own the VpnConfigurations. |
245 StringToConfigurationMap service_path_to_configuration_map_; | 260 StringToConfigurationMap service_path_to_configuration_map_; |
246 | 261 |
247 base::WeakPtrFactory<VpnService> weak_factory_; | 262 base::WeakPtrFactory<VpnService> weak_factory_; |
248 | 263 |
249 DISALLOW_COPY_AND_ASSIGN(VpnService); | 264 DISALLOW_COPY_AND_ASSIGN(VpnService); |
250 }; | 265 }; |
251 | 266 |
252 } // namespace chromeos | 267 } // namespace chromeos |
253 | 268 |
254 #endif // EXTENSIONS_BROWSER_API_VPN_PROVIDER_VPN_SERVICE_H_ | 269 #endif // EXTENSIONS_BROWSER_API_VPN_PROVIDER_VPN_SERVICE_H_ |
OLD | NEW |