OLD | NEW |
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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 #endif | 411 #endif |
411 extension_service_.reset(new ExtensionService( | 412 extension_service_.reset(new ExtensionService( |
412 this, | 413 this, |
413 CommandLine::ForCurrentProcess(), | 414 CommandLine::ForCurrentProcess(), |
414 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), | 415 GetPath().AppendASCII(ExtensionService::kInstallDirectoryName), |
415 extension_prefs_.get(), | 416 extension_prefs_.get(), |
416 autoupdate_enabled, | 417 autoupdate_enabled, |
417 extensions_enabled)); | 418 extensions_enabled)); |
418 | 419 |
419 extension_service_->component_loader()->AddDefaultComponentExtensions(); | 420 extension_service_->component_loader()->AddDefaultComponentExtensions(); |
| 421 if (command_line->HasSwitch(switches::kLoadComponentExtension)) { |
| 422 std::string path_list = command_line->GetSwitchValueASCII( |
| 423 switches::kLoadComponentExtension); |
| 424 StringTokenizer t(path_list, ","); |
| 425 while (t.GetNext()) { |
| 426 extension_service_->component_loader()->AddFromCommandLine( |
| 427 FilePath(t.token())); |
| 428 } |
| 429 } |
420 extension_service_->Init(); | 430 extension_service_->Init(); |
421 | 431 |
422 if (extensions_enabled) { | 432 if (extensions_enabled) { |
423 // Load any extensions specified with --load-extension. | 433 // Load any extensions specified with --load-extension. |
424 // TODO(yoz): Seems like this should move into ExtensionService::Init. | 434 // TODO(yoz): Seems like this should move into ExtensionService::Init. |
425 if (command_line->HasSwitch(switches::kLoadExtension)) { | 435 if (command_line->HasSwitch(switches::kLoadExtension)) { |
426 FilePath path = command_line->GetSwitchValuePath( | 436 FilePath path = command_line->GetSwitchValuePath( |
427 switches::kLoadExtension); | 437 switches::kLoadExtension); |
428 extensions::UnpackedInstaller::Create(extension_service_.get())-> | 438 extensions::UnpackedInstaller::Create(extension_service_.get())-> |
429 LoadFromCommandLine(path); | 439 LoadFromCommandLine(path); |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 FilePath* cache_path, | 1587 FilePath* cache_path, |
1578 int* max_size) { | 1588 int* max_size) { |
1579 DCHECK(cache_path); | 1589 DCHECK(cache_path); |
1580 DCHECK(max_size); | 1590 DCHECK(max_size); |
1581 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1591 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
1582 if (!path.empty()) | 1592 if (!path.empty()) |
1583 *cache_path = path; | 1593 *cache_path = path; |
1584 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1594 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1585 prefs_->GetInteger(prefs::kDiskCacheSize); | 1595 prefs_->GetInteger(prefs::kDiskCacheSize); |
1586 } | 1596 } |
OLD | NEW |