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()) { |
| 41 LOG(ERROR) << "Failed to load custom Gaia auth extension given by the " |
| 42 << switches::kAuthExtensionPath << " flag: " |
| 43 << auth_extension_path.value(); |
| 44 } |
38 return; | 45 return; |
39 } | 46 } |
40 | 47 |
41 bool force_keyboard_oobe = false; | 48 bool force_keyboard_oobe = false; |
42 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
43 chromeos::system::StatisticsProvider* provider = | 50 chromeos::system::StatisticsProvider* provider = |
44 chromeos::system::StatisticsProvider::GetInstance(); | 51 chromeos::system::StatisticsProvider::GetInstance(); |
45 provider->GetMachineFlag(chromeos::kOemKeyboardDrivenOobeKey, | 52 provider->GetMachineFlag(chromeos::kOemKeyboardDrivenOobeKey, |
46 &force_keyboard_oobe); | 53 &force_keyboard_oobe); |
47 #endif // OS_CHROMEOS | 54 #endif // OS_CHROMEOS |
(...skipping 14 matching lines...) Expand all Loading... |
62 } // namespace | 69 } // namespace |
63 | 70 |
64 ScopedGaiaAuthExtension::ScopedGaiaAuthExtension(Profile* profile) | 71 ScopedGaiaAuthExtension::ScopedGaiaAuthExtension(Profile* profile) |
65 : profile_(profile) { | 72 : profile_(profile) { |
66 LoadGaiaAuthExtension(profile_); | 73 LoadGaiaAuthExtension(profile_); |
67 } | 74 } |
68 | 75 |
69 ScopedGaiaAuthExtension::~ScopedGaiaAuthExtension() { | 76 ScopedGaiaAuthExtension::~ScopedGaiaAuthExtension() { |
70 UnloadGaiaAuthExtension(profile_); | 77 UnloadGaiaAuthExtension(profile_); |
71 } | 78 } |
OLD | NEW |