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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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') | chrome/browser/ui/gtk/infobars/infobar_gtk.h » ('j') | 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) 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>
11 11
12 #include "base/environment.h" 12 #include "base/environment.h"
13 #include "base/nix/xdg_util.h" 13 #include "base/nix/xdg_util.h"
14 #include "base/stl_util-inl.h" 14 #include "base/stl_util-inl.h"
15 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/themes/theme_service_factory.h" 17 #include "chrome/browser/themes/theme_service_factory.h"
18 #include "chrome/browser/ui/browser_list.h" 18 #include "chrome/browser/ui/browser_list.h"
19 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" 20 #include "chrome/browser/ui/gtk/cairo_cached_surface.h"
21 #include "chrome/browser/ui/gtk/chrome_gtk_frame.h" 21 #include "chrome/browser/ui/gtk/chrome_gtk_frame.h"
22 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" 22 #include "chrome/browser/ui/gtk/gtk_chrome_button.h"
23 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" 23 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h"
24 #include "chrome/browser/ui/gtk/gtk_util.h" 24 #include "chrome/browser/ui/gtk/gtk_util.h"
25 #include "chrome/browser/ui/gtk/hover_controller_gtk.h" 25 #include "chrome/browser/ui/gtk/hover_controller_gtk.h"
26 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
27 #include "content/browser/user_metrics.h" 28 #include "content/browser/user_metrics.h"
28 #include "content/common/notification_details.h" 29 #include "content/common/notification_details.h"
29 #include "content/common/notification_service.h" 30 #include "content/common/notification_service.h"
30 #include "content/common/notification_source.h" 31 #include "content/common/notification_source.h"
31 #include "content/common/notification_type.h"
32 #include "grit/theme_resources.h" 32 #include "grit/theme_resources.h"
33 #include "grit/theme_resources_standard.h" 33 #include "grit/theme_resources_standard.h"
34 #include "grit/ui_resources.h" 34 #include "grit/ui_resources.h"
35 #include "third_party/skia/include/core/SkBitmap.h" 35 #include "third_party/skia/include/core/SkBitmap.h"
36 #include "third_party/skia/include/core/SkCanvas.h" 36 #include "third_party/skia/include/core/SkCanvas.h"
37 #include "third_party/skia/include/core/SkColor.h" 37 #include "third_party/skia/include/core/SkColor.h"
38 #include "third_party/skia/include/core/SkShader.h" 38 #include "third_party/skia/include/core/SkShader.h"
39 #include "ui/base/gtk/gtk_signal_registrar.h" 39 #include "ui/base/gtk/gtk_signal_registrar.h"
40 #include "ui/base/resource/resource_bundle.h" 40 #include "ui/base/resource/resource_bundle.h"
41 #include "ui/gfx/canvas_skia.h" 41 #include "ui/gfx/canvas_skia.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::NOTIFICATION_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 11 matching lines...) Expand all
359 } 359 }
360 360
361 bool GtkThemeService::UsingDefaultTheme() const { 361 bool GtkThemeService::UsingDefaultTheme() const {
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(int 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::NOTIFICATION_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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.h ('k') | chrome/browser/ui/gtk/infobars/infobar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698