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

Side by Side Diff: chrome/browser/ui/gtk/gtk_theme_service.cc

Issue 22677002: Notify ThemeService via callback when supervised user is ready. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT and address nits. Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/gtk/gtk_theme_service.h" 5 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/environment.h" 13 #include "base/environment.h"
14 #include "base/nix/mime_util_xdg.h" 14 #include "base/nix/mime_util_xdg.h"
15 #include "base/nix/xdg_util.h" 15 #include "base/nix/xdg_util.h"
16 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
17 #include "base/stl_util.h" 17 #include "base/stl_util.h"
18 #include "chrome/browser/chrome_notification_types.h" 18 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/themes/custom_theme_supplier.h"
20 #include "chrome/browser/themes/theme_properties.h" 21 #include "chrome/browser/themes/theme_properties.h"
21 #include "chrome/browser/themes/theme_service_factory.h" 22 #include "chrome/browser/themes/theme_service_factory.h"
22 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_iterator.h" 24 #include "chrome/browser/ui/browser_iterator.h"
24 #include "chrome/browser/ui/browser_window.h" 25 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/ui/gtk/chrome_gtk_frame.h" 26 #include "chrome/browser/ui/gtk/chrome_gtk_frame.h"
26 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" 27 #include "chrome/browser/ui/gtk/gtk_chrome_button.h"
27 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" 28 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
28 #include "chrome/browser/ui/gtk/gtk_util.h" 29 #include "chrome/browser/ui/gtk/gtk_util.h"
29 #include "chrome/browser/ui/gtk/hover_controller_gtk.h" 30 #include "chrome/browser/ui/gtk/hover_controller_gtk.h"
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 341 }
341 342
342 void GtkThemeService::InitThemesFor(content::NotificationObserver* observer) { 343 void GtkThemeService::InitThemesFor(content::NotificationObserver* observer) {
343 observer->Observe(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 344 observer->Observe(chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
344 content::Source<ThemeService>(this), 345 content::Source<ThemeService>(this),
345 content::NotificationService::NoDetails()); 346 content::NotificationService::NoDetails());
346 } 347 }
347 348
348 void GtkThemeService::SetTheme(const extensions::Extension* extension) { 349 void GtkThemeService::SetTheme(const extensions::Extension* extension) {
349 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); 350 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false);
351 use_gtk_ = false;
350 LoadDefaultValues(); 352 LoadDefaultValues();
351 ThemeService::SetTheme(extension); 353 ThemeService::SetTheme(extension);
352 } 354 }
353 355
354 void GtkThemeService::UseDefaultTheme() { 356 void GtkThemeService::UseDefaultTheme() {
355 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); 357 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false);
356 use_gtk_ = false; 358 use_gtk_ = false;
357 LoadDefaultValues(); 359 LoadDefaultValues();
358 ThemeService::UseDefaultTheme(); 360 ThemeService::UseDefaultTheme();
359 } 361 }
360 362
361 void GtkThemeService::SetNativeTheme() { 363 void GtkThemeService::SetNativeTheme() {
362 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, true); 364 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, true);
363 use_gtk_ = true; 365 use_gtk_ = true;
364 ClearAllThemeData(); 366 ClearAllThemeData();
365 LoadGtkValues(); 367 LoadGtkValues();
366 NotifyThemeChanged(); 368 NotifyThemeChanged();
367 } 369 }
368 370
369 bool GtkThemeService::UsingDefaultTheme() const { 371 bool GtkThemeService::UsingDefaultTheme() const {
370 return !use_gtk_ && ThemeService::UsingDefaultTheme(); 372 return !use_gtk_ && ThemeService::UsingDefaultTheme();
371 } 373 }
372 374
375 void GtkThemeService::SetCustomDefaultTheme(
376 scoped_refptr<CustomThemeSupplier> theme_supplier) {
377 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false);
378 use_gtk_ = false;
379 LoadDefaultValues();
380 ThemeService::SetCustomDefaultTheme(theme_supplier);
381 }
382
373 bool GtkThemeService::ShouldInitWithNativeTheme() const { 383 bool GtkThemeService::ShouldInitWithNativeTheme() const {
374 return profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); 384 return profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
375 } 385 }
376 386
377 bool GtkThemeService::UsingNativeTheme() const { 387 bool GtkThemeService::UsingNativeTheme() const {
378 return use_gtk_; 388 return use_gtk_;
379 } 389 }
380 390
381 GtkWidget* GtkThemeService::BuildChromeButton() { 391 GtkWidget* GtkThemeService::BuildChromeButton() {
382 GtkWidget* button = HoverControllerGtk::CreateChromeButton(); 392 GtkWidget* button = HoverControllerGtk::CreateChromeButton();
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 cairo_stroke(cr); 1181 cairo_stroke(cr);
1172 cairo_destroy(cr); 1182 cairo_destroy(cr);
1173 cairo_pattern_destroy(pattern); 1183 cairo_pattern_destroy(pattern);
1174 1184
1175 return TRUE; 1185 return TRUE;
1176 } 1186 }
1177 1187
1178 void GtkThemeService::OnUsesSystemThemeChanged() { 1188 void GtkThemeService::OnUsesSystemThemeChanged() {
1179 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); 1189 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
1180 } 1190 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698