| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 } | 327 } |
| 328 | 328 |
| 329 bool GtkThemeService::HasCustomImage(int id) const { | 329 bool GtkThemeService::HasCustomImage(int id) const { |
| 330 if (use_gtk_) | 330 if (use_gtk_) |
| 331 return IsOverridableImage(id); | 331 return IsOverridableImage(id); |
| 332 | 332 |
| 333 return ThemeService::HasCustomImage(id); | 333 return ThemeService::HasCustomImage(id); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void GtkThemeService::InitThemesFor(NotificationObserver* observer) { | 336 void GtkThemeService::InitThemesFor(NotificationObserver* observer) { |
| 337 observer->Observe(NotificationType::BROWSER_THEME_CHANGED, | 337 observer->Observe(chrome::BROWSER_THEME_CHANGED, |
| 338 Source<ThemeService>(this), | 338 Source<ThemeService>(this), |
| 339 NotificationService::NoDetails()); | 339 NotificationService::NoDetails()); |
| 340 } | 340 } |
| 341 | 341 |
| 342 void GtkThemeService::SetTheme(const Extension* extension) { | 342 void GtkThemeService::SetTheme(const Extension* extension) { |
| 343 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); | 343 profile()->GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, false); |
| 344 LoadDefaultValues(); | 344 LoadDefaultValues(); |
| 345 ThemeService::SetTheme(extension); | 345 ThemeService::SetTheme(extension); |
| 346 } | 346 } |
| 347 | 347 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 362 return !use_gtk_ && ThemeService::UsingDefaultTheme(); | 362 return !use_gtk_ && ThemeService::UsingDefaultTheme(); |
| 363 } | 363 } |
| 364 | 364 |
| 365 bool GtkThemeService::UsingNativeTheme() const { | 365 bool GtkThemeService::UsingNativeTheme() const { |
| 366 return use_gtk_; | 366 return use_gtk_; |
| 367 } | 367 } |
| 368 | 368 |
| 369 void GtkThemeService::Observe(NotificationType type, | 369 void GtkThemeService::Observe(NotificationType type, |
| 370 const NotificationSource& source, | 370 const NotificationSource& source, |
| 371 const NotificationDetails& details) { | 371 const NotificationDetails& details) { |
| 372 if ((type == NotificationType::PREF_CHANGED) && | 372 if ((type == chrome::PREF_CHANGED) && |
| 373 (*Details<std::string>(details).ptr() == prefs::kUsesSystemTheme)) { | 373 (*Details<std::string>(details).ptr() == prefs::kUsesSystemTheme)) { |
| 374 #if !defined(OS_CHROMEOS) | 374 #if !defined(OS_CHROMEOS) |
| 375 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); | 375 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); |
| 376 #endif | 376 #endif |
| 377 } else { | 377 } else { |
| 378 ThemeService::Observe(type, source, details); | 378 ThemeService::Observe(type, source, details); |
| 379 } | 379 } |
| 380 } | 380 } |
| 381 | 381 |
| 382 GtkWidget* GtkThemeService::BuildChromeButton() { | 382 GtkWidget* GtkThemeService::BuildChromeButton() { |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 cairo_set_line_width(cr, 1.0); | 1196 cairo_set_line_width(cr, 1.0); |
| 1197 cairo_move_to(cr, start_x, widget->allocation.y); | 1197 cairo_move_to(cr, start_x, widget->allocation.y); |
| 1198 cairo_line_to(cr, start_x, | 1198 cairo_line_to(cr, start_x, |
| 1199 widget->allocation.y + widget->allocation.height); | 1199 widget->allocation.y + widget->allocation.height); |
| 1200 cairo_stroke(cr); | 1200 cairo_stroke(cr); |
| 1201 cairo_destroy(cr); | 1201 cairo_destroy(cr); |
| 1202 cairo_pattern_destroy(pattern); | 1202 cairo_pattern_destroy(pattern); |
| 1203 | 1203 |
| 1204 return TRUE; | 1204 return TRUE; |
| 1205 } | 1205 } |
| OLD | NEW |