| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); | 119 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); |
| 120 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. | 120 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. |
| 121 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, | 121 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, |
| 122 IDS_SPELLCHECK_DICTIONARY); | 122 IDS_SPELLCHECK_DICTIONARY); |
| 123 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); | 123 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); |
| 124 prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true); | 124 prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true); |
| 125 prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false); | 125 prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false); |
| 126 #if defined(OS_LINUX) | 126 #if defined(OS_LINUX) |
| 127 prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, false); | 127 prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, false); |
| 128 #endif | 128 #endif |
| 129 prefs->RegisterStringPref(prefs::kCurrentThemeID, L""); | 129 prefs->RegisterStringPref(prefs::kCurrentThemeID, |
| 130 UTF8ToWide(BrowserThemeProvider::kDefaultThemeID)); |
| 130 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages); | 131 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages); |
| 131 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors); | 132 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors); |
| 132 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints); | 133 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints); |
| 133 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties); | 134 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties); |
| 134 prefs->RegisterBooleanPref(prefs::kEnableExtensions, false); | 135 prefs->RegisterBooleanPref(prefs::kEnableExtensions, false); |
| 135 } | 136 } |
| 136 | 137 |
| 137 // static | 138 // static |
| 138 Profile* Profile::CreateProfile(const FilePath& path) { | 139 Profile* Profile::CreateProfile(const FilePath& path) { |
| 139 return new ProfileImpl(path); | 140 return new ProfileImpl(path); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 303 } |
| 303 | 304 |
| 304 virtual void SetNativeTheme() { | 305 virtual void SetNativeTheme() { |
| 305 GetOriginalProfile()->SetNativeTheme(); | 306 GetOriginalProfile()->SetNativeTheme(); |
| 306 } | 307 } |
| 307 | 308 |
| 308 virtual void ClearTheme() { | 309 virtual void ClearTheme() { |
| 309 GetOriginalProfile()->ClearTheme(); | 310 GetOriginalProfile()->ClearTheme(); |
| 310 } | 311 } |
| 311 | 312 |
| 313 virtual Extension* GetTheme() { |
| 314 return GetOriginalProfile()->GetTheme(); |
| 315 } |
| 316 |
| 312 virtual ThemeProvider* GetThemeProvider() { | 317 virtual ThemeProvider* GetThemeProvider() { |
| 313 return GetOriginalProfile()->GetThemeProvider(); | 318 return GetOriginalProfile()->GetThemeProvider(); |
| 314 } | 319 } |
| 315 | 320 |
| 316 virtual URLRequestContext* GetRequestContext() { | 321 virtual URLRequestContext* GetRequestContext() { |
| 317 return request_context_; | 322 return request_context_; |
| 318 } | 323 } |
| 319 | 324 |
| 320 virtual URLRequestContext* GetRequestContextForMedia() { | 325 virtual URLRequestContext* GetRequestContextForMedia() { |
| 321 // In OTR mode, media request context is the same as the original one. | 326 // In OTR mode, media request context is the same as the original one. |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 void ProfileImpl::SetNativeTheme() { | 978 void ProfileImpl::SetNativeTheme() { |
| 974 InitThemes(); | 979 InitThemes(); |
| 975 theme_provider_.get()->SetNativeTheme(); | 980 theme_provider_.get()->SetNativeTheme(); |
| 976 } | 981 } |
| 977 | 982 |
| 978 void ProfileImpl::ClearTheme() { | 983 void ProfileImpl::ClearTheme() { |
| 979 InitThemes(); | 984 InitThemes(); |
| 980 theme_provider_.get()->UseDefaultTheme(); | 985 theme_provider_.get()->UseDefaultTheme(); |
| 981 } | 986 } |
| 982 | 987 |
| 988 Extension* ProfileImpl::GetTheme() { |
| 989 InitThemes(); |
| 990 |
| 991 std::string id = theme_provider_.get()->GetThemeID(); |
| 992 if (id == BrowserThemeProvider::kDefaultThemeID) |
| 993 return NULL; |
| 994 |
| 995 return extensions_service_->GetExtensionById(id); |
| 996 } |
| 997 |
| 983 ThemeProvider* ProfileImpl::GetThemeProvider() { | 998 ThemeProvider* ProfileImpl::GetThemeProvider() { |
| 984 InitThemes(); | 999 InitThemes(); |
| 985 return theme_provider_.get(); | 1000 return theme_provider_.get(); |
| 986 } | 1001 } |
| 987 | 1002 |
| 988 SessionService* ProfileImpl::GetSessionService() { | 1003 SessionService* ProfileImpl::GetSessionService() { |
| 989 if (!session_service_.get() && !shutdown_session_service_) { | 1004 if (!session_service_.get() && !shutdown_session_service_) { |
| 990 session_service_ = new SessionService(this); | 1005 session_service_ = new SessionService(this); |
| 991 session_service_->ResetFromCurrentBrowsers(); | 1006 session_service_->ResetFromCurrentBrowsers(); |
| 992 } | 1007 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 | 1211 |
| 1197 void ProfileImpl::StopCreateSessionServiceTimer() { | 1212 void ProfileImpl::StopCreateSessionServiceTimer() { |
| 1198 create_session_service_timer_.Stop(); | 1213 create_session_service_timer_.Stop(); |
| 1199 } | 1214 } |
| 1200 | 1215 |
| 1201 #ifdef CHROME_PERSONALIZATION | 1216 #ifdef CHROME_PERSONALIZATION |
| 1202 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { | 1217 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { |
| 1203 return personalization_.get(); | 1218 return personalization_.get(); |
| 1204 } | 1219 } |
| 1205 #endif | 1220 #endif |
| OLD | NEW |