Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 } |
| 375 | |
| 376 // ThemeService does not observe prefs changes, so no need to | |
| 377 // forward to the base class. | |
|
Mattias Nissler (ping if slow)
2012/10/31 13:29:36
This comment does make sense for people who are aw
Jói
2012/10/31 14:56:26
Done.
| |
| 380 } | 378 } |
| 381 | 379 |
| 382 GtkWidget* GtkThemeService::BuildChromeButton() { | 380 GtkWidget* GtkThemeService::BuildChromeButton() { |
| 383 GtkWidget* button = HoverControllerGtk::CreateChromeButton(); | 381 GtkWidget* button = HoverControllerGtk::CreateChromeButton(); |
| 384 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button), use_gtk_); | 382 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button), use_gtk_); |
| 385 chrome_buttons_.push_back(button); | 383 chrome_buttons_.push_back(button); |
| 386 | 384 |
| 387 signals_->Connect(button, "destroy", G_CALLBACK(OnDestroyChromeButtonThunk), | 385 signals_->Connect(button, "destroy", G_CALLBACK(OnDestroyChromeButtonThunk), |
| 388 this); | 386 this); |
| 389 return button; | 387 return button; |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1150 cairo_new_path(cr); | 1148 cairo_new_path(cr); |
| 1151 cairo_set_line_width(cr, 1.0); | 1149 cairo_set_line_width(cr, 1.0); |
| 1152 cairo_move_to(cr, start_x, allocation.y); | 1150 cairo_move_to(cr, start_x, allocation.y); |
| 1153 cairo_line_to(cr, start_x, allocation.y + allocation.height); | 1151 cairo_line_to(cr, start_x, allocation.y + allocation.height); |
| 1154 cairo_stroke(cr); | 1152 cairo_stroke(cr); |
| 1155 cairo_destroy(cr); | 1153 cairo_destroy(cr); |
| 1156 cairo_pattern_destroy(pattern); | 1154 cairo_pattern_destroy(pattern); |
| 1157 | 1155 |
| 1158 return TRUE; | 1156 return TRUE; |
| 1159 } | 1157 } |
| OLD | NEW |