Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/extensions/signin/gaia_auth_extension_loader.cc

Issue 384003002: [cleanup] SAML is always enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Misprint. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
24 #include "chrome/browser/chromeos/profiles/profile_helper.h"
25 #include "chrome/browser/chromeos/system/input_device_settings.h" 23 #include "chrome/browser/chromeos/system/input_device_settings.h"
26 #include "chromeos/chromeos_constants.h"
27 #include "chromeos/chromeos_switches.h"
28 #include "components/signin/core/common/profile_management_switches.h"
29 #endif 24 #endif
30 25
31 using content::BrowserContext; 26 using content::BrowserContext;
32 using content::BrowserThread; 27 using content::BrowserThread;
33 28
34 namespace { 29 namespace {
35 30
36 extensions::ComponentLoader* GetComponentLoader(BrowserContext* context) { 31 extensions::ComponentLoader* GetComponentLoader(BrowserContext* context) {
37 extensions::ExtensionSystem* extension_system = 32 extensions::ExtensionSystem* extension_system =
38 extensions::ExtensionSystem::Get(context); 33 extensions::ExtensionSystem::Get(context);
39 ExtensionService* extension_service = extension_system->extension_service(); 34 ExtensionService* extension_service = extension_system->extension_service();
40 return extension_service->component_loader(); 35 return extension_service->component_loader();
41 } 36 }
42 37
43 void LoadGaiaAuthExtension(BrowserContext* context) { 38 void LoadGaiaAuthExtension(BrowserContext* context) {
44 DCHECK_CURRENTLY_ON(BrowserThread::UI); 39 DCHECK_CURRENTLY_ON(BrowserThread::UI);
45 40
46 extensions::ComponentLoader* component_loader = GetComponentLoader(context); 41 extensions::ComponentLoader* component_loader = GetComponentLoader(context);
47 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 42 const CommandLine* command_line = CommandLine::ForCurrentProcess();
48 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { 43 if (command_line->HasSwitch(switches::kAuthExtensionPath)) {
49 base::FilePath auth_extension_path = 44 base::FilePath auth_extension_path =
50 command_line->GetSwitchValuePath(switches::kAuthExtensionPath); 45 command_line->GetSwitchValuePath(switches::kAuthExtensionPath);
51 component_loader->Add(IDR_GAIA_AUTH_MANIFEST, auth_extension_path); 46 component_loader->Add(IDR_GAIA_AUTH_MANIFEST, auth_extension_path);
52 return; 47 return;
53 } 48 }
54 49
50 int manifest_resource_id = IDR_GAIA_AUTH_MANIFEST;
51
55 #if defined(OS_CHROMEOS) 52 #if defined(OS_CHROMEOS)
56 int manifest_resource_id = IDR_GAIA_AUTH_MANIFEST;
57 if (chromeos::system::InputDeviceSettings::Get() 53 if (chromeos::system::InputDeviceSettings::Get()
58 ->ForceKeyboardDrivenUINavigation()) { 54 ->ForceKeyboardDrivenUINavigation()) {
59 manifest_resource_id = IDR_GAIA_AUTH_KEYBOARD_MANIFEST; 55 manifest_resource_id = IDR_GAIA_AUTH_KEYBOARD_MANIFEST;
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 } 56 }
66 #else
67 int manifest_resource_id = IDR_GAIA_AUTH_SAML_MANIFEST;
68 #endif 57 #endif
69 58
70 component_loader->Add(manifest_resource_id, 59 component_loader->Add(manifest_resource_id,
71 base::FilePath(FILE_PATH_LITERAL("gaia_auth"))); 60 base::FilePath(FILE_PATH_LITERAL("gaia_auth")));
72 } 61 }
73 62
74 void UnloadGaiaAuthExtension(BrowserContext* context) { 63 void UnloadGaiaAuthExtension(BrowserContext* context) {
75 DCHECK_CURRENTLY_ON(BrowserThread::UI); 64 DCHECK_CURRENTLY_ON(BrowserThread::UI);
76 65
77 content::StoragePartition* partition = 66 content::StoragePartition* partition =
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader> > g_factory = 120 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader> > g_factory =
132 LAZY_INSTANCE_INITIALIZER; 121 LAZY_INSTANCE_INITIALIZER;
133 122
134 // static 123 // static
135 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* 124 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>*
136 GaiaAuthExtensionLoader::GetFactoryInstance() { 125 GaiaAuthExtensionLoader::GetFactoryInstance() {
137 return g_factory.Pointer(); 126 return g_factory.Pointer();
138 } 127 }
139 128
140 } // namespace extensions 129 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698