| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 bool GtkThemeService::HasCustomImage(int id) const { | 321 bool GtkThemeService::HasCustomImage(int id) const { |
| 322 if (use_gtk_) | 322 if (use_gtk_) |
| 323 return IsOverridableImage(id); | 323 return IsOverridableImage(id); |
| 324 | 324 |
| 325 return ThemeService::HasCustomImage(id); | 325 return ThemeService::HasCustomImage(id); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void GtkThemeService::InitThemesFor(NotificationObserver* observer) { | 328 void GtkThemeService::InitThemesFor(NotificationObserver* observer) { |
| 329 observer->Observe(NotificationType::BROWSER_THEME_CHANGED, | 329 observer->Observe(NotificationType::BROWSER_THEME_CHANGED, |
| 330 Source<ui::ThemeProvider>(this), | 330 Source<ThemeService>(this), |
| 331 NotificationService::NoDetails()); | 331 NotificationService::NoDetails()); |
| 332 } | 332 } |
| 333 | 333 |
| 334 void GtkThemeService::SetTheme(const Extension* extension) { | 334 void GtkThemeService::SetTheme(const Extension* extension) { |
| 335 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); | 335 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); |
| 336 LoadDefaultValues(); | 336 LoadDefaultValues(); |
| 337 ThemeService::SetTheme(extension); | 337 ThemeService::SetTheme(extension); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void GtkThemeService::UseDefaultTheme() { | 340 void GtkThemeService::UseDefaultTheme() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 351 } | 351 } |
| 352 | 352 |
| 353 bool GtkThemeService::UsingDefaultTheme() { | 353 bool GtkThemeService::UsingDefaultTheme() { |
| 354 return !use_gtk_ && ThemeService::UsingDefaultTheme(); | 354 return !use_gtk_ && ThemeService::UsingDefaultTheme(); |
| 355 } | 355 } |
| 356 | 356 |
| 357 void GtkThemeService::Observe(NotificationType type, | 357 void GtkThemeService::Observe(NotificationType type, |
| 358 const NotificationSource& source, | 358 const NotificationSource& source, |
| 359 const NotificationDetails& details) { | 359 const NotificationDetails& details) { |
| 360 if ((type == NotificationType::PREF_CHANGED) && | 360 if ((type == NotificationType::PREF_CHANGED) && |
| 361 (*Details<std::string>(details).ptr() == prefs::kUsesSystemTheme)) | 361 (*Details<std::string>(details).ptr() == prefs::kUsesSystemTheme)) { |
| 362 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); | 362 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); |
| 363 } else { |
| 364 ThemeService::Observe(type, source, details); |
| 365 } |
| 363 } | 366 } |
| 364 | 367 |
| 365 GtkWidget* GtkThemeService::BuildChromeButton() { | 368 GtkWidget* GtkThemeService::BuildChromeButton() { |
| 366 GtkWidget* button = HoverControllerGtk::CreateChromeButton(); | 369 GtkWidget* button = HoverControllerGtk::CreateChromeButton(); |
| 367 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button), use_gtk_); | 370 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button), use_gtk_); |
| 368 chrome_buttons_.push_back(button); | 371 chrome_buttons_.push_back(button); |
| 369 | 372 |
| 370 signals_->Connect(button, "destroy", G_CALLBACK(OnDestroyChromeButtonThunk), | 373 signals_->Connect(button, "destroy", G_CALLBACK(OnDestroyChromeButtonThunk), |
| 371 this); | 374 this); |
| 372 return button; | 375 return button; |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 cairo_set_line_width(cr, 1.0); | 1132 cairo_set_line_width(cr, 1.0); |
| 1130 cairo_move_to(cr, start_x, widget->allocation.y); | 1133 cairo_move_to(cr, start_x, widget->allocation.y); |
| 1131 cairo_line_to(cr, start_x, | 1134 cairo_line_to(cr, start_x, |
| 1132 widget->allocation.y + widget->allocation.height); | 1135 widget->allocation.y + widget->allocation.height); |
| 1133 cairo_stroke(cr); | 1136 cairo_stroke(cr); |
| 1134 cairo_destroy(cr); | 1137 cairo_destroy(cr); |
| 1135 cairo_pattern_destroy(pattern); | 1138 cairo_pattern_destroy(pattern); |
| 1136 | 1139 |
| 1137 return TRUE; | 1140 return TRUE; |
| 1138 } | 1141 } |
| OLD | NEW |