| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/profile.h" | 5 #include "chrome/browser/profile.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 PrefService* prefs = GetPrefs(); | 374 PrefService* prefs = GetPrefs(); |
| 375 bool user_scripts_enabled = | 375 bool user_scripts_enabled = |
| 376 command_line->HasSwitch(switches::kEnableUserScripts) || | 376 command_line->HasSwitch(switches::kEnableUserScripts) || |
| 377 prefs->GetBoolean(prefs::kEnableUserScripts); | 377 prefs->GetBoolean(prefs::kEnableUserScripts); |
| 378 bool extensions_enabled = | 378 bool extensions_enabled = |
| 379 command_line->HasSwitch(switches::kEnableExtensions) || | 379 command_line->HasSwitch(switches::kEnableExtensions) || |
| 380 prefs->GetBoolean(prefs::kEnableExtensions); | 380 prefs->GetBoolean(prefs::kEnableExtensions); |
| 381 | 381 |
| 382 FilePath script_dir; | 382 FilePath script_dir; |
| 383 if (user_scripts_enabled) { | 383 if (user_scripts_enabled) { |
| 384 script_dir = GetPath(); | 384 |
| 385 script_dir = script_dir.Append(chrome::kUserScriptsDirname); | 385 if (command_line->HasSwitch(switches::kUserScriptsDir)) { |
| 386 std::wstring path_string = |
| 387 command_line->GetSwitchValue(switches::kUserScriptsDir); |
| 388 script_dir = FilePath::FromWStringHack(path_string); |
| 389 } else { |
| 390 script_dir = GetPath(); |
| 391 script_dir = script_dir.Append(chrome::kUserScriptsDirname); |
| 392 } |
| 386 } | 393 } |
| 387 | 394 |
| 388 ExtensionErrorReporter::Init(true); // allow noisy errors. | 395 ExtensionErrorReporter::Init(true); // allow noisy errors. |
| 389 user_script_master_ = new UserScriptMaster( | 396 user_script_master_ = new UserScriptMaster( |
| 390 g_browser_process->file_thread()->message_loop(), script_dir); | 397 g_browser_process->file_thread()->message_loop(), script_dir); |
| 391 extensions_service_ = new ExtensionsService(this, user_script_master_.get()); | 398 extensions_service_ = new ExtensionsService(this, user_script_master_.get()); |
| 392 | 399 |
| 393 // If we have extensions, the extension service will kick off the first scan | 400 // If we have extensions, the extension service will kick off the first scan |
| 394 // after extensions are loaded. Otherwise, we need to do that now. | 401 // after extensions are loaded. Otherwise, we need to do that now. |
| 395 if (extensions_enabled) | 402 if (extensions_enabled) |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 | 869 |
| 863 #ifdef CHROME_PERSONALIZATION | 870 #ifdef CHROME_PERSONALIZATION |
| 864 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { | 871 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { |
| 865 DCHECK(!Personalization::IsP13NDisabled()); | 872 DCHECK(!Personalization::IsP13NDisabled()); |
| 866 if (!personalization_.get()) | 873 if (!personalization_.get()) |
| 867 personalization_.reset( | 874 personalization_.reset( |
| 868 Personalization::CreateProfilePersonalization(this)); | 875 Personalization::CreateProfilePersonalization(this)); |
| 869 return personalization_.get(); | 876 return personalization_.get(); |
| 870 } | 877 } |
| 871 #endif | 878 #endif |
| OLD | NEW |