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

Side by Side Diff: chrome/browser/extensions/component_loader.cc

Issue 13872010: cros: Add a header for gaia auth requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/component_loader.h" 5 #include "chrome/browser/extensions/component_loader.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 command_line->GetSwitchValuePath(switches::kImageLoaderExtensionPath)); 268 command_line->GetSwitchValuePath(switches::kImageLoaderExtensionPath));
269 Add(IDR_IMAGE_LOADER_MANIFEST, image_loader_extension_path); 269 Add(IDR_IMAGE_LOADER_MANIFEST, image_loader_extension_path);
270 return; 270 return;
271 } 271 }
272 #endif // NDEBUG 272 #endif // NDEBUG
273 Add(IDR_IMAGE_LOADER_MANIFEST, 273 Add(IDR_IMAGE_LOADER_MANIFEST,
274 base::FilePath(FILE_PATH_LITERAL("image_loader"))); 274 base::FilePath(FILE_PATH_LITERAL("image_loader")));
275 #endif // defined(IMAGE_LOADER_EXTENSION) 275 #endif // defined(IMAGE_LOADER_EXTENSION)
276 } 276 }
277 277
278 #if defined(OS_CHROMEOS)
279 void ComponentLoader::AddGaiaAuthExtension() {
280 const CommandLine* command_line = CommandLine::ForCurrentProcess();
281 if (command_line->HasSwitch(switches::kAuthExtensionPath)) {
282 base::FilePath auth_extension_path =
283 command_line->GetSwitchValuePath(switches::kAuthExtensionPath);
284 Add(IDR_GAIA_TEST_AUTH_MANIFEST, auth_extension_path);
285 return;
286 }
287 Add(IDR_GAIA_AUTH_MANIFEST, base::FilePath(FILE_PATH_LITERAL("gaia_auth")));
288 }
289 #endif // NDEBUG
290
291 void ComponentLoader::AddOrReloadEnterpriseWebStore() { 278 void ComponentLoader::AddOrReloadEnterpriseWebStore() {
292 base::FilePath path(FILE_PATH_LITERAL("enterprise_web_store")); 279 base::FilePath path(FILE_PATH_LITERAL("enterprise_web_store"));
293 280
294 // Remove the extension if it was already loaded. 281 // Remove the extension if it was already loaded.
295 Remove(path); 282 Remove(path);
296 283
297 std::string enterprise_webstore_url = 284 std::string enterprise_webstore_url =
298 profile_prefs_->GetString(prefs::kEnterpriseWebStoreURL); 285 profile_prefs_->GetString(prefs::kEnterpriseWebStoreURL);
299 286
300 // Load the extension only if the URL preference is set. 287 // Load the extension only if the URL preference is set.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 327 }
341 328
342 void ComponentLoader::AddDefaultComponentExtensions( 329 void ComponentLoader::AddDefaultComponentExtensions(
343 bool skip_session_components) { 330 bool skip_session_components) {
344 // Do not add component extensions that have background pages here -- add them 331 // Do not add component extensions that have background pages here -- add them
345 // to AddDefaultComponentExtensionsWithBackgroundPages. 332 // to AddDefaultComponentExtensionsWithBackgroundPages.
346 #if defined(OS_CHROMEOS) 333 #if defined(OS_CHROMEOS)
347 Add(IDR_MOBILE_MANIFEST, 334 Add(IDR_MOBILE_MANIFEST,
348 base::FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"))); 335 base::FilePath(FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile")));
349 336
350 if (skip_session_components)
351 AddGaiaAuthExtension();
352
353 #if defined(OFFICIAL_BUILD) 337 #if defined(OFFICIAL_BUILD)
354 if (browser_defaults::enable_help_app) { 338 if (browser_defaults::enable_help_app) {
355 Add(IDR_HELP_MANIFEST, base::FilePath(FILE_PATH_LITERAL( 339 Add(IDR_HELP_MANIFEST, base::FilePath(FILE_PATH_LITERAL(
356 "/usr/share/chromeos-assets/helpapp"))); 340 "/usr/share/chromeos-assets/helpapp")));
357 } 341 }
358 #endif 342 #endif
359 343
360 // Skip all other extensions that require user session presence. 344 // Skip all other extensions that require user session presence.
361 if (!skip_session_components) { 345 if (!skip_session_components) {
362 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 346 const CommandLine* command_line = CommandLine::ForCurrentProcess();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 void ComponentLoader::RegisterUserPrefs(PrefRegistrySyncable* registry) { 460 void ComponentLoader::RegisterUserPrefs(PrefRegistrySyncable* registry) {
477 registry->RegisterStringPref(prefs::kEnterpriseWebStoreURL, 461 registry->RegisterStringPref(prefs::kEnterpriseWebStoreURL,
478 std::string() /* default_value */, 462 std::string() /* default_value */,
479 PrefRegistrySyncable::UNSYNCABLE_PREF); 463 PrefRegistrySyncable::UNSYNCABLE_PREF);
480 registry->RegisterStringPref(prefs::kEnterpriseWebStoreName, 464 registry->RegisterStringPref(prefs::kEnterpriseWebStoreName,
481 std::string() /* default_value */, 465 std::string() /* default_value */,
482 PrefRegistrySyncable::UNSYNCABLE_PREF); 466 PrefRegistrySyncable::UNSYNCABLE_PREF);
483 } 467 }
484 468
485 } // namespace extensions 469 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698