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/scoped_gaia_auth_extension.h" | 5 #include "chrome/browser/extensions/scoped_gaia_auth_extension.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/extensions/component_loader.h" | 8 #include "chrome/browser/extensions/component_loader.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
(...skipping 16 matching lines...) Expand all Loading... | |
27 ExtensionService* extension_service = extension_system->extension_service(); | 27 ExtensionService* extension_service = extension_system->extension_service(); |
28 return extension_service->component_loader(); | 28 return extension_service->component_loader(); |
29 } | 29 } |
30 | 30 |
31 void LoadGaiaAuthExtension(Profile* profile) { | 31 void LoadGaiaAuthExtension(Profile* profile) { |
32 extensions::ComponentLoader* component_loader = GetComponentLoader(profile); | 32 extensions::ComponentLoader* component_loader = GetComponentLoader(profile); |
33 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 33 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
34 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { | 34 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { |
35 base::FilePath auth_extension_path = | 35 base::FilePath auth_extension_path = |
36 command_line->GetSwitchValuePath(switches::kAuthExtensionPath); | 36 command_line->GetSwitchValuePath(switches::kAuthExtensionPath); |
37 component_loader->Add(IDR_GAIA_TEST_AUTH_MANIFEST, auth_extension_path); | 37 std::string extension_id = |
achuithb
2013/05/23 22:34:47
let's make this const
Tim Song
2013/05/23 23:07:05
Done.
| |
38 component_loader->AddOrReplace(auth_extension_path); | |
39 | |
40 if (extension_id.empty()) | |
41 LOG(ERROR) << "Failed to load custom Gaia auth extension given by " | |
42 << "--auth-ext-path flag: " << auth_extension_path.value(); | |
achuithb
2013/05/23 22:34:47
nit: let's use switches::kAuthExtensionPath instea
Tim Song
2013/05/23 23:07:05
Done.
| |
38 return; | 43 return; |
39 } | 44 } |
40 | 45 |
41 bool force_keyboard_oobe = false; | 46 bool force_keyboard_oobe = false; |
42 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
43 chromeos::system::StatisticsProvider* provider = | 48 chromeos::system::StatisticsProvider* provider = |
44 chromeos::system::StatisticsProvider::GetInstance(); | 49 chromeos::system::StatisticsProvider::GetInstance(); |
45 provider->GetMachineFlag(chromeos::kOemKeyboardDrivenOobeKey, | 50 provider->GetMachineFlag(chromeos::kOemKeyboardDrivenOobeKey, |
46 &force_keyboard_oobe); | 51 &force_keyboard_oobe); |
47 #endif // OS_CHROMEOS | 52 #endif // OS_CHROMEOS |
(...skipping 14 matching lines...) Expand all Loading... | |
62 } // namespace | 67 } // namespace |
63 | 68 |
64 ScopedGaiaAuthExtension::ScopedGaiaAuthExtension(Profile* profile) | 69 ScopedGaiaAuthExtension::ScopedGaiaAuthExtension(Profile* profile) |
65 : profile_(profile) { | 70 : profile_(profile) { |
66 LoadGaiaAuthExtension(profile_); | 71 LoadGaiaAuthExtension(profile_); |
67 } | 72 } |
68 | 73 |
69 ScopedGaiaAuthExtension::~ScopedGaiaAuthExtension() { | 74 ScopedGaiaAuthExtension::~ScopedGaiaAuthExtension() { |
70 UnloadGaiaAuthExtension(profile_); | 75 UnloadGaiaAuthExtension(profile_); |
71 } | 76 } |
OLD | NEW |