| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" | 5 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 namespace { | 33 namespace { |
| 34 | 34 |
| 35 extensions::ComponentLoader* GetComponentLoader(BrowserContext* context) { | 35 extensions::ComponentLoader* GetComponentLoader(BrowserContext* context) { |
| 36 extensions::ExtensionSystem* extension_system = | 36 extensions::ExtensionSystem* extension_system = |
| 37 extensions::ExtensionSystem::Get(context); | 37 extensions::ExtensionSystem::Get(context); |
| 38 ExtensionService* extension_service = extension_system->extension_service(); | 38 ExtensionService* extension_service = extension_system->extension_service(); |
| 39 return extension_service->component_loader(); | 39 return extension_service->component_loader(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void LoadGaiaAuthExtension(BrowserContext* context) { | 42 void LoadGaiaAuthExtension(BrowserContext* context) { |
| 43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 43 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 44 | 44 |
| 45 extensions::ComponentLoader* component_loader = GetComponentLoader(context); | 45 extensions::ComponentLoader* component_loader = GetComponentLoader(context); |
| 46 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 46 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 47 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { | 47 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { |
| 48 base::FilePath auth_extension_path = | 48 base::FilePath auth_extension_path = |
| 49 command_line->GetSwitchValuePath(switches::kAuthExtensionPath); | 49 command_line->GetSwitchValuePath(switches::kAuthExtensionPath); |
| 50 component_loader->Add(IDR_GAIA_AUTH_MANIFEST, auth_extension_path); | 50 component_loader->Add(IDR_GAIA_AUTH_MANIFEST, auth_extension_path); |
| 51 return; | 51 return; |
| 52 } | 52 } |
| 53 | 53 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 72 } | 72 } |
| 73 #else | 73 #else |
| 74 int manifest_resource_id = IDR_GAIA_AUTH_DESKTOP_MANIFEST; | 74 int manifest_resource_id = IDR_GAIA_AUTH_DESKTOP_MANIFEST; |
| 75 #endif | 75 #endif |
| 76 | 76 |
| 77 component_loader->Add(manifest_resource_id, | 77 component_loader->Add(manifest_resource_id, |
| 78 base::FilePath(FILE_PATH_LITERAL("gaia_auth"))); | 78 base::FilePath(FILE_PATH_LITERAL("gaia_auth"))); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void UnloadGaiaAuthExtension(BrowserContext* context) { | 81 void UnloadGaiaAuthExtension(BrowserContext* context) { |
| 82 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 82 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 83 | 83 |
| 84 content::StoragePartition* partition = | 84 content::StoragePartition* partition = |
| 85 content::BrowserContext::GetStoragePartitionForSite( | 85 content::BrowserContext::GetStoragePartitionForSite( |
| 86 context, GURL(chrome::kChromeUIChromeSigninURL)); | 86 context, GURL(chrome::kChromeUIChromeSigninURL)); |
| 87 if (partition) { | 87 if (partition) { |
| 88 partition->ClearData( | 88 partition->ClearData( |
| 89 content::StoragePartition::REMOVE_DATA_MASK_ALL, | 89 content::StoragePartition::REMOVE_DATA_MASK_ALL, |
| 90 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, | 90 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
| 91 GURL(), | 91 GURL(), |
| 92 content::StoragePartition::OriginMatcherFunction(), | 92 content::StoragePartition::OriginMatcherFunction(), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader> > g_factory = | 138 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader> > g_factory = |
| 139 LAZY_INSTANCE_INITIALIZER; | 139 LAZY_INSTANCE_INITIALIZER; |
| 140 | 140 |
| 141 // static | 141 // static |
| 142 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* | 142 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* |
| 143 GaiaAuthExtensionLoader::GetFactoryInstance() { | 143 GaiaAuthExtensionLoader::GetFactoryInstance() { |
| 144 return g_factory.Pointer(); | 144 return g_factory.Pointer(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace extensions | 147 } // namespace extensions |
| OLD | NEW |