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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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
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>
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 360 }
361 361
362 bool GtkThemeService::UsingDefaultTheme() const { 362 bool GtkThemeService::UsingDefaultTheme() const {
363 return !use_gtk_ && ThemeService::UsingDefaultTheme(); 363 return !use_gtk_ && ThemeService::UsingDefaultTheme();
364 } 364 }
365 365
366 bool GtkThemeService::UsingNativeTheme() const { 366 bool GtkThemeService::UsingNativeTheme() const {
367 return use_gtk_; 367 return use_gtk_;
368 } 368 }
369 369
370 void GtkThemeService::Observe(int type, 370 void GtkThemeService::OnPreferenceChanged(PrefServiceBase* service,
371 const content::NotificationSource& source, 371 const std::string& pref_name) {
372 const content::NotificationDetails& details) { 372 if (pref_name == prefs::kUsesSystemTheme) {
373 if ((type == chrome::NOTIFICATION_PREF_CHANGED) &&
374 (*content::Details<std::string>(details).ptr() ==
375 prefs::kUsesSystemTheme)) {
376 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); 373 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
377 } else {
378 ThemeService::Observe(type, source, details);
379 } 374 }
380 } 375 }
381 376
382 GtkWidget* GtkThemeService::BuildChromeButton() { 377 GtkWidget* GtkThemeService::BuildChromeButton() {
383 GtkWidget* button = HoverControllerGtk::CreateChromeButton(); 378 GtkWidget* button = HoverControllerGtk::CreateChromeButton();
384 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button), use_gtk_); 379 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button), use_gtk_);
385 chrome_buttons_.push_back(button); 380 chrome_buttons_.push_back(button);
386 381
387 signals_->Connect(button, "destroy", G_CALLBACK(OnDestroyChromeButtonThunk), 382 signals_->Connect(button, "destroy", G_CALLBACK(OnDestroyChromeButtonThunk),
388 this); 383 this);
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 cairo_new_path(cr); 1145 cairo_new_path(cr);
1151 cairo_set_line_width(cr, 1.0); 1146 cairo_set_line_width(cr, 1.0);
1152 cairo_move_to(cr, start_x, allocation.y); 1147 cairo_move_to(cr, start_x, allocation.y);
1153 cairo_line_to(cr, start_x, allocation.y + allocation.height); 1148 cairo_line_to(cr, start_x, allocation.y + allocation.height);
1154 cairo_stroke(cr); 1149 cairo_stroke(cr);
1155 cairo_destroy(cr); 1150 cairo_destroy(cr);
1156 cairo_pattern_destroy(pattern); 1151 cairo_pattern_destroy(pattern);
1157 1152
1158 return TRUE; 1153 return TRUE;
1159 } 1154 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.h ('k') | chrome/browser/ui/gtk/location_bar_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698