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

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: Added a unit test. 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
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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 #endif 438 #endif
438 extension_service_.reset(new ExtensionService( 439 extension_service_.reset(new ExtensionService(
439 this, 440 this,
440 CommandLine::ForCurrentProcess(), 441 CommandLine::ForCurrentProcess(),
441 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), 442 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName),
442 extension_prefs_.get(), 443 extension_prefs_.get(),
443 autoupdate_enabled, 444 autoupdate_enabled,
444 extensions_enabled)); 445 extensions_enabled));
445 446
446 extension_service_->component_loader()->AddDefaultComponentExtensions(); 447 extension_service_->component_loader()->AddDefaultComponentExtensions();
448 if (command_line->HasSwitch(switches::kLoadComponentExtension)) {
449 CommandLine::StringType path_list = command_line->GetSwitchValueNative(
450 switches::kLoadComponentExtension);
451 StringTokenizerT<CommandLine::StringType,
452 CommandLine::StringType::const_iterator> t(path_list,
453 FILE_PATH_LITERAL(","));
454 while (t.GetNext()) {
455 extension_service_->component_loader()->AddOrReplace(
Aaron Boodman 2011/12/05 22:11:26 How does this work? It seems like it should DCHECK
SeRya 2011/12/06 08:19:27 Now sure why it works. Probably caller code allows
456 FilePath(t.token()));
457 }
458 }
447 extension_service_->Init(); 459 extension_service_->Init();
448 460
449 if (extensions_enabled) { 461 if (extensions_enabled) {
450 // Load any extensions specified with --load-extension. 462 // Load any extensions specified with --load-extension.
451 // TODO(yoz): Seems like this should move into ExtensionService::Init. 463 // TODO(yoz): Seems like this should move into ExtensionService::Init.
452 if (command_line->HasSwitch(switches::kLoadExtension)) { 464 if (command_line->HasSwitch(switches::kLoadExtension)) {
453 FilePath path = command_line->GetSwitchValuePath( 465 FilePath path = command_line->GetSwitchValuePath(
454 switches::kLoadExtension); 466 switches::kLoadExtension);
455 extensions::UnpackedInstaller::Create(extension_service_.get())-> 467 extensions::UnpackedInstaller::Create(extension_service_.get())->
456 LoadFromCommandLine(path); 468 LoadFromCommandLine(path);
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 FilePath* cache_path, 1662 FilePath* cache_path,
1651 int* max_size) { 1663 int* max_size) {
1652 DCHECK(cache_path); 1664 DCHECK(cache_path);
1653 DCHECK(max_size); 1665 DCHECK(max_size);
1654 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); 1666 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir));
1655 if (!path.empty()) 1667 if (!path.empty())
1656 *cache_path = path; 1668 *cache_path = path;
1657 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1669 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1658 prefs_->GetInteger(prefs::kDiskCacheSize); 1670 prefs_->GetInteger(prefs::kDiskCacheSize);
1659 } 1671 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698