| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.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/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 const CommandLine* command_line, | 88 const CommandLine* command_line, |
| 89 PrefService* prefs, | 89 PrefService* prefs, |
| 90 const FilePath& install_directory, | 90 const FilePath& install_directory, |
| 91 MessageLoop* frontend_loop, | 91 MessageLoop* frontend_loop, |
| 92 MessageLoop* backend_loop, | 92 MessageLoop* backend_loop, |
| 93 bool autoupdate_enabled) | 93 bool autoupdate_enabled) |
| 94 : profile_(profile), | 94 : profile_(profile), |
| 95 extension_prefs_(new ExtensionPrefs(prefs, install_directory)), | 95 extension_prefs_(new ExtensionPrefs(prefs, install_directory)), |
| 96 backend_loop_(backend_loop), | 96 backend_loop_(backend_loop), |
| 97 install_directory_(install_directory), | 97 install_directory_(install_directory), |
| 98 extensions_enabled_(false), | 98 extensions_enabled_(true), |
| 99 show_extensions_prompts_(true), | 99 show_extensions_prompts_(true), |
| 100 ready_(false) { | 100 ready_(false) { |
| 101 // Figure out if extension installation should be enabled. | 101 // Figure out if extension installation should be enabled. |
| 102 if (command_line->HasSwitch(switches::kEnableExtensions)) { | 102 if (command_line->HasSwitch(switches::kDisableExtensions)) { |
| 103 extensions_enabled_ = true; | 103 extensions_enabled_ = false; |
| 104 } else if (profile->GetPrefs()->GetBoolean(prefs::kEnableExtensions)) { | 104 } else if (profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) { |
| 105 extensions_enabled_ = true; | 105 extensions_enabled_ = false; |
| 106 } | 106 } |
| 107 | 107 |
| 108 // Set up the ExtensionUpdater | 108 // Set up the ExtensionUpdater |
| 109 if (autoupdate_enabled) { | 109 if (autoupdate_enabled) { |
| 110 int update_frequency = kDefaultUpdateFrequencySeconds; | 110 int update_frequency = kDefaultUpdateFrequencySeconds; |
| 111 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) { | 111 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) { |
| 112 update_frequency = StringToInt(WideToASCII(command_line->GetSwitchValue( | 112 update_frequency = StringToInt(WideToASCII(command_line->GetSwitchValue( |
| 113 switches::kExtensionsUpdateFrequency))); | 113 switches::kExtensionsUpdateFrequency))); |
| 114 } | 114 } |
| 115 updater_ = new ExtensionUpdater(this, prefs, update_frequency, | 115 updater_ = new ExtensionUpdater(this, prefs, update_frequency, |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 linked_ptr<ExternalExtensionProvider>(test_provider); | 690 linked_ptr<ExternalExtensionProvider>(test_provider); |
| 691 } | 691 } |
| 692 | 692 |
| 693 void ExtensionsServiceBackend::OnExternalExtensionFound( | 693 void ExtensionsServiceBackend::OnExternalExtensionFound( |
| 694 const std::string& id, const Version* version, const FilePath& path, | 694 const std::string& id, const Version* version, const FilePath& path, |
| 695 Extension::Location location) { | 695 Extension::Location location) { |
| 696 frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(frontend_, | 696 frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(frontend_, |
| 697 &ExtensionsService::OnExternalExtensionFound, id, version->GetString(), | 697 &ExtensionsService::OnExternalExtensionFound, id, version->GetString(), |
| 698 path, location)); | 698 path, location)); |
| 699 } | 699 } |
| OLD | NEW |