| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 // Verifies if the extension has a configuration that is connected. | 156 // Verifies if the extension has a configuration that is connected. |
| 157 bool VerifyConfigIsConnectedForTesting(const std::string& extension_id); | 157 bool VerifyConfigIsConnectedForTesting(const std::string& extension_id); |
| 158 | 158 |
| 159 // Gets the unique key for the configuration |configuration_name| created by | 159 // Gets the unique key for the configuration |configuration_name| created by |
| 160 // the extension with id |extension_id|. | 160 // the extension with id |extension_id|. |
| 161 // This method is made public for testing. | 161 // This method is made public for testing. |
| 162 static std::string GetKey(const std::string& extension_id, | 162 static std::string GetKey(const std::string& extension_id, |
| 163 const std::string& configuration_name); | 163 const std::string& configuration_name); |
| 164 | 164 |
| 165 void AddPlugin(const std::string& service_id); |
| 166 void RemovePlugin(const std::string& service_id); |
| 167 |
| 165 private: | 168 private: |
| 166 class VpnConfiguration; | 169 class VpnConfiguration; |
| 167 | 170 |
| 168 using StringToConfigurationMap = std::map<std::string, VpnConfiguration*>; | 171 using StringToConfigurationMap = std::map<std::string, VpnConfiguration*>; |
| 169 | 172 |
| 170 // Callback used to indicate that configuration was successfully created. | 173 // Callback used to indicate that configuration was successfully created. |
| 171 void OnCreateConfigurationSuccess(const SuccessCallback& callback, | 174 void OnCreateConfigurationSuccess(const SuccessCallback& callback, |
| 172 VpnConfiguration* configuration, | 175 VpnConfiguration* configuration, |
| 173 const std::string& service_path); | 176 const std::string& service_path); |
| 174 | 177 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 const std::string& event_name, | 220 const std::string& event_name, |
| 218 scoped_ptr<base::ListValue> event_args); | 221 scoped_ptr<base::ListValue> event_args); |
| 219 | 222 |
| 220 // Destroy configurations belonging to the extension. | 223 // Destroy configurations belonging to the extension. |
| 221 void DestroyConfigurationsForExtension( | 224 void DestroyConfigurationsForExtension( |
| 222 const extensions::Extension* extension); | 225 const extensions::Extension* extension); |
| 223 | 226 |
| 224 // Set the active configuration. | 227 // Set the active configuration. |
| 225 void SetActiveConfiguration(VpnConfiguration* configuration); | 228 void SetActiveConfiguration(VpnConfiguration* configuration); |
| 226 | 229 |
| 230 // Check if the service_id was registered via PPAPI |
| 231 bool RegisteredViaPlugin(const std::string& service_id); |
| 232 |
| 227 content::BrowserContext* browser_context_; | 233 content::BrowserContext* browser_context_; |
| 228 std::string userid_hash_; | 234 std::string userid_hash_; |
| 229 | 235 |
| 230 extensions::ExtensionRegistry* extension_registry_; | 236 extensions::ExtensionRegistry* extension_registry_; |
| 231 extensions::EventRouter* event_router_; | 237 extensions::EventRouter* event_router_; |
| 232 ShillThirdPartyVpnDriverClient* shill_client_; | 238 ShillThirdPartyVpnDriverClient* shill_client_; |
| 233 NetworkConfigurationHandler* network_configuration_handler_; | 239 NetworkConfigurationHandler* network_configuration_handler_; |
| 234 NetworkProfileHandler* network_profile_handler_; | 240 NetworkProfileHandler* network_profile_handler_; |
| 235 NetworkStateHandler* network_state_handler_; | 241 NetworkStateHandler* network_state_handler_; |
| 236 | 242 |
| 237 VpnConfiguration* active_configuration_; | 243 VpnConfiguration* active_configuration_; |
| 238 | 244 |
| 239 // Key map owns the VpnConfigurations. | 245 // Key map owns the VpnConfigurations. |
| 240 StringToConfigurationMap key_to_configuration_map_; | 246 StringToConfigurationMap key_to_configuration_map_; |
| 241 | 247 |
| 242 // Service path does not own the VpnConfigurations. | 248 // Service path does not own the VpnConfigurations. |
| 243 StringToConfigurationMap service_path_to_configuration_map_; | 249 StringToConfigurationMap service_path_to_configuration_map_; |
| 244 | 250 |
| 251 std::set<std::string> pepper_plugin_set_; |
| 252 |
| 245 base::WeakPtrFactory<VpnService> weak_factory_; | 253 base::WeakPtrFactory<VpnService> weak_factory_; |
| 246 | 254 |
| 247 DISALLOW_COPY_AND_ASSIGN(VpnService); | 255 DISALLOW_COPY_AND_ASSIGN(VpnService); |
| 248 }; | 256 }; |
| 249 | 257 |
| 250 } // namespace chromeos | 258 } // namespace chromeos |
| 251 | 259 |
| 252 #endif // EXTENSIONS_BROWSER_API_VPN_PROVIDER_VPN_SERVICE_H_ | 260 #endif // EXTENSIONS_BROWSER_API_VPN_PROVIDER_VPN_SERVICE_H_ |
| OLD | NEW |