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 const std::string extension_id = |
38 component_loader->AddOrReplace(auth_extension_path); | |
39 | |
40 if (extension_id.empty()) | |
achuithb
2013/05/23 23:08:59
Sorry, didn't notice this before, but you need cur
Tim Song
2013/05/23 23:15:20
This is a single statement, so it should be work f
achuithb
2013/05/23 23:17:47
Yup, I believe we have an explicit rule in the sty
| |
41 LOG(ERROR) << "Failed to load custom Gaia auth extension given by the " | |
42 << switches::kAuthExtensionPath << " flag: " | |
43 << auth_extension_path.value(); | |
38 return; | 44 return; |
39 } | 45 } |
40 | 46 |
41 bool force_keyboard_oobe = false; | 47 bool force_keyboard_oobe = false; |
42 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
43 chromeos::system::StatisticsProvider* provider = | 49 chromeos::system::StatisticsProvider* provider = |
44 chromeos::system::StatisticsProvider::GetInstance(); | 50 chromeos::system::StatisticsProvider::GetInstance(); |
45 provider->GetMachineFlag(chromeos::kOemKeyboardDrivenOobeKey, | 51 provider->GetMachineFlag(chromeos::kOemKeyboardDrivenOobeKey, |
46 &force_keyboard_oobe); | 52 &force_keyboard_oobe); |
47 #endif // OS_CHROMEOS | 53 #endif // OS_CHROMEOS |
(...skipping 14 matching lines...) Expand all Loading... | |
62 } // namespace | 68 } // namespace |
63 | 69 |
64 ScopedGaiaAuthExtension::ScopedGaiaAuthExtension(Profile* profile) | 70 ScopedGaiaAuthExtension::ScopedGaiaAuthExtension(Profile* profile) |
65 : profile_(profile) { | 71 : profile_(profile) { |
66 LoadGaiaAuthExtension(profile_); | 72 LoadGaiaAuthExtension(profile_); |
67 } | 73 } |
68 | 74 |
69 ScopedGaiaAuthExtension::~ScopedGaiaAuthExtension() { | 75 ScopedGaiaAuthExtension::~ScopedGaiaAuthExtension() { |
70 UnloadGaiaAuthExtension(profile_); | 76 UnloadGaiaAuthExtension(profile_); |
71 } | 77 } |
OLD | NEW |