| 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/lock.h" | 10 #include "base/lock.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/app/locales/locale_settings.h" | 15 #include "chrome/app/locales/locale_settings.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 17 #include "chrome/browser/browser_list.h" | 17 #include "chrome/browser/browser_list.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/download/download_manager.h" | 19 #include "chrome/browser/download/download_manager.h" |
| 20 #include "chrome/browser/extensions/extensions_service.h" | 20 #include "chrome/browser/extensions/extensions_service.h" |
| 21 #include "chrome/browser/greasemonkey_master.h" | 21 #include "chrome/browser/extensions/user_script_master.h" |
| 22 #include "chrome/browser/history/history.h" | 22 #include "chrome/browser/history/history.h" |
| 23 #include "chrome/browser/navigation_controller.h" | 23 #include "chrome/browser/navigation_controller.h" |
| 24 #include "chrome/browser/net/chrome_url_request_context.h" | 24 #include "chrome/browser/net/chrome_url_request_context.h" |
| 25 #include "chrome/browser/profile_manager.h" | 25 #include "chrome/browser/profile_manager.h" |
| 26 #include "chrome/browser/render_process_host.h" | 26 #include "chrome/browser/render_process_host.h" |
| 27 #include "chrome/browser/sessions/session_service.h" | 27 #include "chrome/browser/sessions/session_service.h" |
| 28 #include "chrome/browser/sessions/tab_restore_service.h" | 28 #include "chrome/browser/sessions/tab_restore_service.h" |
| 29 #include "chrome/browser/spellchecker.h" | 29 #include "chrome/browser/spellchecker.h" |
| 30 #include "chrome/browser/template_url_fetcher.h" | 30 #include "chrome/browser/template_url_fetcher.h" |
| 31 #include "chrome/browser/template_url_model.h" | 31 #include "chrome/browser/template_url_model.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 127 } |
| 128 | 128 |
| 129 virtual VisitedLinkMaster* GetVisitedLinkMaster() { | 129 virtual VisitedLinkMaster* GetVisitedLinkMaster() { |
| 130 return profile_->GetVisitedLinkMaster(); | 130 return profile_->GetVisitedLinkMaster(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 virtual ExtensionsService* GetExtensionsService() { | 133 virtual ExtensionsService* GetExtensionsService() { |
| 134 return profile_->GetExtensionsService(); | 134 return profile_->GetExtensionsService(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 virtual GreasemonkeyMaster* GetGreasemonkeyMaster() { | 137 virtual UserScriptMaster* GetUserScriptMaster() { |
| 138 return profile_->GetGreasemonkeyMaster(); | 138 return profile_->GetUserScriptMaster(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 virtual HistoryService* GetHistoryService(ServiceAccessType sat) { | 141 virtual HistoryService* GetHistoryService(ServiceAccessType sat) { |
| 142 if (sat == EXPLICIT_ACCESS) { | 142 if (sat == EXPLICIT_ACCESS) { |
| 143 return profile_->GetHistoryService(sat); | 143 return profile_->GetHistoryService(sat); |
| 144 } else { | 144 } else { |
| 145 NOTREACHED() << "This profile is OffTheRecord"; | 145 NOTREACHED() << "This profile is OffTheRecord"; |
| 146 return NULL; | 146 return NULL; |
| 147 } | 147 } |
| 148 } | 148 } |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 visited_link_master_.swap(visited_links); | 441 visited_link_master_.swap(visited_links); |
| 442 } | 442 } |
| 443 | 443 |
| 444 return visited_link_master_.get(); | 444 return visited_link_master_.get(); |
| 445 } | 445 } |
| 446 | 446 |
| 447 ExtensionsService* ProfileImpl::GetExtensionsService() { | 447 ExtensionsService* ProfileImpl::GetExtensionsService() { |
| 448 return extensions_service_.get(); | 448 return extensions_service_.get(); |
| 449 } | 449 } |
| 450 | 450 |
| 451 GreasemonkeyMaster* ProfileImpl::GetGreasemonkeyMaster() { | 451 UserScriptMaster* ProfileImpl::GetUserScriptMaster() { |
| 452 if (!greasemonkey_master_.get()) { | 452 if (!user_script_master_.get()) { |
| 453 std::wstring script_dir = GetPath(); | 453 std::wstring script_dir = GetPath(); |
| 454 file_util::AppendToPath(&script_dir, chrome::kUserScriptsDirname); | 454 file_util::AppendToPath(&script_dir, chrome::kUserScriptsDirname); |
| 455 greasemonkey_master_ = | 455 user_script_master_ = |
| 456 new GreasemonkeyMaster(g_browser_process->file_thread()->message_loop(), | 456 new UserScriptMaster(g_browser_process->file_thread()->message_loop(), |
| 457 FilePath(script_dir)); | 457 FilePath(script_dir)); |
| 458 } | 458 } |
| 459 | 459 |
| 460 return greasemonkey_master_.get(); | 460 return user_script_master_.get(); |
| 461 } | 461 } |
| 462 | 462 |
| 463 PrefService* ProfileImpl::GetPrefs() { | 463 PrefService* ProfileImpl::GetPrefs() { |
| 464 if (!prefs_.get()) { | 464 if (!prefs_.get()) { |
| 465 prefs_.reset(new PrefService(GetPrefFilePath())); | 465 prefs_.reset(new PrefService(GetPrefFilePath())); |
| 466 | 466 |
| 467 // The Profile class and ProfileManager class may read some prefs so | 467 // The Profile class and ProfileManager class may read some prefs so |
| 468 // register known prefs as soon as possible. | 468 // register known prefs as soon as possible. |
| 469 Profile::RegisterUserPrefs(prefs_.get()); | 469 Profile::RegisterUserPrefs(prefs_.get()); |
| 470 ProfileManager::RegisterUserPrefs(prefs_.get()); | 470 ProfileManager::RegisterUserPrefs(prefs_.get()); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 } | 758 } |
| 759 | 759 |
| 760 #ifdef CHROME_PERSONALIZATION | 760 #ifdef CHROME_PERSONALIZATION |
| 761 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { | 761 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { |
| 762 if (!personalization_.get()) | 762 if (!personalization_.get()) |
| 763 personalization_.reset( | 763 personalization_.reset( |
| 764 Personalization::CreateProfilePersonalization(this)); | 764 Personalization::CreateProfilePersonalization(this)); |
| 765 return personalization_.get(); | 765 return personalization_.get(); |
| 766 } | 766 } |
| 767 #endif | 767 #endif |
| OLD | NEW |