Chromium Code Reviews| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "chrome/browser/extensions/component_loader.h" | 11 #include "chrome/browser/extensions/component_loader.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 16 #include "content/public/browser/browser_context.h" | 16 #include "content/public/browser/browser_context.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/storage_partition.h" | 18 #include "content/public/browser/storage_partition.h" |
| 19 #include "extensions/browser/extension_system.h" | 19 #include "extensions/browser/extension_system.h" |
| 20 #include "grit/browser_resources.h" | 20 #include "grit/browser_resources.h" |
| 21 | 21 |
| 22 #if defined(OS_CHROMEOS) | 22 #if defined(OS_CHROMEOS) |
| 23 #include "base/file_util.h" | 23 #include "base/file_util.h" |
| 24 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 24 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
|
bartfab (slow)
2014/07/14 10:12:39
Nit: No longer used.
dzhioev (left Google)
2014/07/15 18:34:07
Done.
| |
| 25 #include "chrome/browser/chromeos/system/input_device_settings.h" | 25 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 26 #include "chromeos/chromeos_constants.h" | 26 #include "chromeos/chromeos_constants.h" |
| 27 #include "chromeos/chromeos_switches.h" | 27 #include "chromeos/chromeos_switches.h" |
|
bartfab (slow)
2014/07/14 10:12:40
Nit: No longer used.
dzhioev (left Google)
2014/07/15 18:34:07
Done.
| |
| 28 #include "components/signin/core/common/profile_management_switches.h" | 28 #include "components/signin/core/common/profile_management_switches.h" |
|
bartfab (slow)
2014/07/14 10:12:39
Nit: No longer used.
dzhioev (left Google)
2014/07/15 18:34:07
Done.
| |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 using content::BrowserContext; | 31 using content::BrowserContext; |
| 32 using content::BrowserThread; | 32 using content::BrowserThread; |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 extensions::ComponentLoader* GetComponentLoader(BrowserContext* context) { | 36 extensions::ComponentLoader* GetComponentLoader(BrowserContext* context) { |
| 37 extensions::ExtensionSystem* extension_system = | 37 extensions::ExtensionSystem* extension_system = |
| 38 extensions::ExtensionSystem::Get(context); | 38 extensions::ExtensionSystem::Get(context); |
| 39 ExtensionService* extension_service = extension_system->extension_service(); | 39 ExtensionService* extension_service = extension_system->extension_service(); |
| 40 return extension_service->component_loader(); | 40 return extension_service->component_loader(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void LoadGaiaAuthExtension(BrowserContext* context) { | 43 void LoadGaiaAuthExtension(BrowserContext* context) { |
| 44 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 44 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 45 | 45 |
| 46 extensions::ComponentLoader* component_loader = GetComponentLoader(context); | 46 extensions::ComponentLoader* component_loader = GetComponentLoader(context); |
| 47 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 47 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 48 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { | 48 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { |
| 49 base::FilePath auth_extension_path = | 49 base::FilePath auth_extension_path = |
| 50 command_line->GetSwitchValuePath(switches::kAuthExtensionPath); | 50 command_line->GetSwitchValuePath(switches::kAuthExtensionPath); |
| 51 component_loader->Add(IDR_GAIA_AUTH_MANIFEST, auth_extension_path); | 51 component_loader->Add(IDR_GAIA_AUTH_MANIFEST, auth_extension_path); |
| 52 return; | 52 return; |
| 53 } | 53 } |
| 54 | 54 |
| 55 int manifest_resource_id = IDR_GAIA_AUTH_MANIFEST; | |
| 56 | |
| 55 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
| 56 int manifest_resource_id = IDR_GAIA_AUTH_MANIFEST; | |
| 57 if (chromeos::system::InputDeviceSettings::Get() | 58 if (chromeos::system::InputDeviceSettings::Get() |
| 58 ->ForceKeyboardDrivenUINavigation()) { | 59 ->ForceKeyboardDrivenUINavigation()) { |
| 59 manifest_resource_id = IDR_GAIA_AUTH_KEYBOARD_MANIFEST; | 60 manifest_resource_id = IDR_GAIA_AUTH_KEYBOARD_MANIFEST; |
|
bartfab (slow)
2014/07/14 10:12:39
Did you verify that things do not break when the k
dzhioev (left Google)
2014/07/15 18:34:07
You are right, keyboard manifest was broken. I mad
| |
| 60 } else if (!command_line->HasSwitch(chromeos::switches::kDisableSamlSignin) || | |
| 61 (switches::IsNewProfileManagement() && | |
| 62 context->GetPath() != | |
| 63 chromeos::ProfileHelper::GetSigninProfileDir())) { | |
| 64 manifest_resource_id = IDR_GAIA_AUTH_SAML_MANIFEST; | |
| 65 } | 61 } |
| 66 #else | |
| 67 int manifest_resource_id = IDR_GAIA_AUTH_SAML_MANIFEST; | |
| 68 #endif | 62 #endif |
| 69 | 63 |
| 70 component_loader->Add(manifest_resource_id, | 64 component_loader->Add(manifest_resource_id, |
| 71 base::FilePath(FILE_PATH_LITERAL("gaia_auth"))); | 65 base::FilePath(FILE_PATH_LITERAL("gaia_auth"))); |
| 72 } | 66 } |
| 73 | 67 |
| 74 void UnloadGaiaAuthExtension(BrowserContext* context) { | 68 void UnloadGaiaAuthExtension(BrowserContext* context) { |
| 75 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 69 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 76 | 70 |
| 77 content::StoragePartition* partition = | 71 content::StoragePartition* partition = |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader> > g_factory = | 125 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader> > g_factory = |
| 132 LAZY_INSTANCE_INITIALIZER; | 126 LAZY_INSTANCE_INITIALIZER; |
| 133 | 127 |
| 134 // static | 128 // static |
| 135 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* | 129 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* |
| 136 GaiaAuthExtensionLoader::GetFactoryInstance() { | 130 GaiaAuthExtensionLoader::GetFactoryInstance() { |
| 137 return g_factory.Pointer(); | 131 return g_factory.Pointer(); |
| 138 } | 132 } |
| 139 | 133 |
| 140 } // namespace extensions | 134 } // namespace extensions |
| OLD | NEW |