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

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 8659002: Adding the --load-component-extension flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding comment to ScopedAllowIO.wq Created 9 years 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
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/profiles/profile_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/string_tokenizer.h"
15 #include "base/string_util.h" 16 #include "base/string_util.h"
16 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 18 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
18 #include "chrome/browser/autocomplete/network_action_predictor.h" 19 #include "chrome/browser/autocomplete/network_action_predictor.h"
19 #include "chrome/browser/autofill/personal_data_manager.h" 20 #include "chrome/browser/autofill/personal_data_manager.h"
20 #include "chrome/browser/background/background_contents_service_factory.h" 21 #include "chrome/browser/background/background_contents_service_factory.h"
21 #include "chrome/browser/background/background_mode_manager.h" 22 #include "chrome/browser/background/background_mode_manager.h"
22 #include "chrome/browser/bookmarks/bookmark_model.h" 23 #include "chrome/browser/bookmarks/bookmark_model.h"
23 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/browsing_data_remover.h" 25 #include "chrome/browser/browsing_data_remover.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 #endif 430 #endif
430 extension_service_.reset(new ExtensionService( 431 extension_service_.reset(new ExtensionService(
431 this, 432 this,
432 CommandLine::ForCurrentProcess(), 433 CommandLine::ForCurrentProcess(),
433 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), 434 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
434 extension_prefs_.get(), 435 extension_prefs_.get(),
435 autoupdate_enabled, 436 autoupdate_enabled,
436 extensions_enabled)); 437 extensions_enabled));
437 438
438 extension_service_->component_loader()->AddDefaultComponentExtensions(); 439 extension_service_->component_loader()->AddDefaultComponentExtensions();
440 if (command_line->HasSwitch(switches::kLoadComponentExtension)) {
441 CommandLine::StringType path_list = command_line->GetSwitchValueNative(
442 switches::kLoadComponentExtension);
443 StringTokenizerT<CommandLine::StringType,
444 CommandLine::StringType::const_iterator> t(path_list,
445 FILE_PATH_LITERAL(","));
446 while (t.GetNext()) {
447 // Load the component extension manifest synchronously.
448 // Blocking the UI thread is acceptable here since
449 // this flag designated for developers.
450 base::ThreadRestrictions::ScopedAllowIO allow_io;
451 extension_service_->component_loader()->AddOrReplace(
452 FilePath(t.token()));
453 }
454 }
439 extension_service_->Init(); 455 extension_service_->Init();
440 456
441 if (extensions_enabled) { 457 if (extensions_enabled) {
442 // Load any extensions specified with --load-extension. 458 // Load any extensions specified with --load-extension.
443 // TODO(yoz): Seems like this should move into ExtensionService::Init. 459 // TODO(yoz): Seems like this should move into ExtensionService::Init.
444 if (command_line->HasSwitch(switches::kLoadExtension)) { 460 if (command_line->HasSwitch(switches::kLoadExtension)) {
445 FilePath path = command_line->GetSwitchValuePath( 461 FilePath path = command_line->GetSwitchValuePath(
446 switches::kLoadExtension); 462 switches::kLoadExtension);
447 extensions::UnpackedInstaller::Create(extension_service_.get())-> 463 extensions::UnpackedInstaller::Create(extension_service_.get())->
448 LoadFromCommandLine(path); 464 LoadFromCommandLine(path);
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 FilePath* cache_path, 1632 FilePath* cache_path,
1617 int* max_size) { 1633 int* max_size) {
1618 DCHECK(cache_path); 1634 DCHECK(cache_path);
1619 DCHECK(max_size); 1635 DCHECK(max_size);
1620 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); 1636 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir));
1621 if (!path.empty()) 1637 if (!path.empty())
1622 *cache_path = path; 1638 *cache_path = path;
1623 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1639 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1624 prefs_->GetInteger(prefs::kDiskCacheSize); 1640 prefs_->GetInteger(prefs::kDiskCacheSize);
1625 } 1641 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698