Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: chrome/browser/profile.cc

Issue 150176: GTK: First draft of using native themes, partially based on evan's CL 118358. (Closed)
Patch Set: And the codereview tool is back. Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
38 #include "chrome/common/chrome_paths.h" 38 #include "chrome/common/chrome_paths.h"
39 #include "chrome/common/chrome_switches.h" 39 #include "chrome/common/chrome_switches.h"
40 #include "chrome/common/extensions/extension_error_reporter.h" 40 #include "chrome/common/extensions/extension_error_reporter.h"
41 #include "chrome/common/net/cookie_monster_sqlite.h" 41 #include "chrome/common/net/cookie_monster_sqlite.h"
42 #include "chrome/common/notification_service.h" 42 #include "chrome/common/notification_service.h"
43 #include "chrome/common/pref_names.h" 43 #include "chrome/common/pref_names.h"
44 #include "chrome/common/render_messages.h" 44 #include "chrome/common/render_messages.h"
45 #include "grit/locale_settings.h" 45 #include "grit/locale_settings.h"
46 #include "net/base/force_tls_state.h" 46 #include "net/base/force_tls_state.h"
47 47
48 #if defined(OS_LINUX)
49 #include "chrome/browser/gtk/gtk_theme_provider.h"
50 #endif
51
48 using base::Time; 52 using base::Time;
49 using base::TimeDelta; 53 using base::TimeDelta;
50 54
51 namespace { 55 namespace {
52 56
53 // Delay, in milliseconds, before we explicitly create the SessionService. 57 // Delay, in milliseconds, before we explicitly create the SessionService.
54 static const int kCreateSessionServiceDelayMS = 500; 58 static const int kCreateSessionServiceDelayMS = 500;
55 59
56 enum ContextType { 60 enum ContextType {
57 kNormalContext, 61 kNormalContext,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 void Profile::RegisterUserPrefs(PrefService* prefs) { 113 void Profile::RegisterUserPrefs(PrefService* prefs) {
110 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true); 114 prefs->RegisterBooleanPref(prefs::kSearchSuggestEnabled, true);
111 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true); 115 prefs->RegisterBooleanPref(prefs::kSessionExitedCleanly, true);
112 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true); 116 prefs->RegisterBooleanPref(prefs::kSafeBrowsingEnabled, true);
113 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. 117 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string.
114 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, 118 prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary,
115 IDS_SPELLCHECK_DICTIONARY); 119 IDS_SPELLCHECK_DICTIONARY);
116 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); 120 prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true);
117 prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true); 121 prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true);
118 prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false); 122 prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false);
123 #if defined(OS_LINUX)
124 prefs->RegisterBooleanPref(prefs::kUsesSystemTheme, false);
125 #endif
119 prefs->RegisterStringPref(prefs::kCurrentThemeID, L""); 126 prefs->RegisterStringPref(prefs::kCurrentThemeID, L"");
120 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages); 127 prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages);
121 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors); 128 prefs->RegisterDictionaryPref(prefs::kCurrentThemeColors);
122 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints); 129 prefs->RegisterDictionaryPref(prefs::kCurrentThemeTints);
123 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties); 130 prefs->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties);
124 prefs->RegisterBooleanPref(prefs::kEnableExtensions, false); 131 prefs->RegisterBooleanPref(prefs::kEnableExtensions, false);
125 } 132 }
126 133
127 // static 134 // static
128 Profile* Profile::CreateProfile(const FilePath& path) { 135 Profile* Profile::CreateProfile(const FilePath& path) {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 287 }
281 288
282 virtual void InitThemes() { 289 virtual void InitThemes() {
283 GetOriginalProfile()->InitThemes(); 290 GetOriginalProfile()->InitThemes();
284 } 291 }
285 292
286 virtual void SetTheme(Extension* extension) { 293 virtual void SetTheme(Extension* extension) {
287 GetOriginalProfile()->SetTheme(extension); 294 GetOriginalProfile()->SetTheme(extension);
288 } 295 }
289 296
297 virtual void SetNativeTheme() {
298 GetOriginalProfile()->SetNativeTheme();
299 }
300
290 virtual void ClearTheme() { 301 virtual void ClearTheme() {
291 GetOriginalProfile()->ClearTheme(); 302 GetOriginalProfile()->ClearTheme();
292 } 303 }
293 304
294 virtual ThemeProvider* GetThemeProvider() { 305 virtual ThemeProvider* GetThemeProvider() {
295 return GetOriginalProfile()->GetThemeProvider(); 306 return GetOriginalProfile()->GetThemeProvider();
296 } 307 }
297 308
298 virtual URLRequestContext* GetRequestContext() { 309 virtual URLRequestContext* GetRequestContext() {
299 return request_context_; 310 return request_context_;
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 } 926 }
916 return download_manager_.get(); 927 return download_manager_.get();
917 } 928 }
918 929
919 bool ProfileImpl::HasCreatedDownloadManager() const { 930 bool ProfileImpl::HasCreatedDownloadManager() const {
920 return created_download_manager_; 931 return created_download_manager_;
921 } 932 }
922 933
923 void ProfileImpl::InitThemes() { 934 void ProfileImpl::InitThemes() {
924 if (!created_theme_provider_) { 935 if (!created_theme_provider_) {
936 #if defined(OS_LINUX)
937 scoped_refptr<BrowserThemeProvider> themes(new GtkThemeProvider);
tony 2009/07/07 19:47:05 Nit: Maybe make a static ::Create method to avoid
938 #else
925 scoped_refptr<BrowserThemeProvider> themes(new BrowserThemeProvider); 939 scoped_refptr<BrowserThemeProvider> themes(new BrowserThemeProvider);
940 #endif
926 themes->Init(this); 941 themes->Init(this);
927 created_theme_provider_ = true; 942 created_theme_provider_ = true;
928 theme_provider_.swap(themes); 943 theme_provider_.swap(themes);
929 } 944 }
930 } 945 }
931 946
932 void ProfileImpl::SetTheme(Extension* extension) { 947 void ProfileImpl::SetTheme(Extension* extension) {
933 InitThemes(); 948 InitThemes();
934 theme_provider_.get()->SetTheme(extension); 949 theme_provider_.get()->SetTheme(extension);
935 } 950 }
936 951
952 void ProfileImpl::SetNativeTheme() {
953 InitThemes();
954 theme_provider_.get()->SetNativeTheme();
955 }
956
937 void ProfileImpl::ClearTheme() { 957 void ProfileImpl::ClearTheme() {
938 InitThemes(); 958 InitThemes();
939 theme_provider_.get()->UseDefaultTheme(); 959 theme_provider_.get()->UseDefaultTheme();
940 } 960 }
941 961
942 ThemeProvider* ProfileImpl::GetThemeProvider() { 962 ThemeProvider* ProfileImpl::GetThemeProvider() {
943 InitThemes(); 963 InitThemes();
944 return theme_provider_.get(); 964 return theme_provider_.get();
945 } 965 }
946 966
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 1174
1155 void ProfileImpl::StopCreateSessionServiceTimer() { 1175 void ProfileImpl::StopCreateSessionServiceTimer() {
1156 create_session_service_timer_.Stop(); 1176 create_session_service_timer_.Stop();
1157 } 1177 }
1158 1178
1159 #ifdef CHROME_PERSONALIZATION 1179 #ifdef CHROME_PERSONALIZATION
1160 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { 1180 ProfilePersonalization* ProfileImpl::GetProfilePersonalization() {
1161 return personalization_.get(); 1181 return personalization_.get();
1162 } 1182 }
1163 #endif 1183 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698