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

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

Issue 6992084: Disallow gtk theme on cros (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 | « no previous file | no next file » | 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>
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 FreeIconSets(); 283 FreeIconSets();
284 284
285 // We have to call this because FreePlatformCached() in ~ThemeService 285 // We have to call this because FreePlatformCached() in ~ThemeService
286 // doesn't call the right virutal FreePlatformCaches. 286 // doesn't call the right virutal FreePlatformCaches.
287 FreePlatformCaches(); 287 FreePlatformCaches();
288 } 288 }
289 289
290 void GtkThemeService::Init(Profile* profile) { 290 void GtkThemeService::Init(Profile* profile) {
291 registrar_.Init(profile->GetPrefs()); 291 registrar_.Init(profile->GetPrefs());
292 registrar_.Add(prefs::kUsesSystemTheme, this); 292 registrar_.Add(prefs::kUsesSystemTheme, this);
293 #if defined(OS_CHROMEOS)
294 use_gtk_ = false;
295 #else
293 use_gtk_ = profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); 296 use_gtk_ = profile->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
294 297 #endif
295 ThemeService::Init(profile); 298 ThemeService::Init(profile);
296 } 299 }
297 300
298 SkBitmap* GtkThemeService::GetBitmapNamed(int id) const { 301 SkBitmap* GtkThemeService::GetBitmapNamed(int id) const {
299 // Try to get our cached version: 302 // Try to get our cached version:
300 ImageCache::const_iterator it = gtk_images_.find(id); 303 ImageCache::const_iterator it = gtk_images_.find(id);
301 if (it != gtk_images_.end()) 304 if (it != gtk_images_.end())
302 return it->second; 305 return it->second;
303 306
304 if (use_gtk_ && IsOverridableImage(id)) { 307 if (use_gtk_ && IsOverridableImage(id)) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 362
360 bool GtkThemeService::UsingNativeTheme() const { 363 bool GtkThemeService::UsingNativeTheme() const {
361 return use_gtk_; 364 return use_gtk_;
362 } 365 }
363 366
364 void GtkThemeService::Observe(NotificationType type, 367 void GtkThemeService::Observe(NotificationType type,
365 const NotificationSource& source, 368 const NotificationSource& source,
366 const NotificationDetails& details) { 369 const NotificationDetails& details) {
367 if ((type == NotificationType::PREF_CHANGED) && 370 if ((type == NotificationType::PREF_CHANGED) &&
368 (*Details<std::string>(details).ptr() == prefs::kUsesSystemTheme)) { 371 (*Details<std::string>(details).ptr() == prefs::kUsesSystemTheme)) {
372 #if !defined(OS_CHROMEOS)
369 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme); 373 use_gtk_ = profile()->GetPrefs()->GetBoolean(prefs::kUsesSystemTheme);
374 #endif
370 } else { 375 } else {
371 ThemeService::Observe(type, source, details); 376 ThemeService::Observe(type, source, details);
372 } 377 }
373 } 378 }
374 379
375 GtkWidget* GtkThemeService::BuildChromeButton() { 380 GtkWidget* GtkThemeService::BuildChromeButton() {
376 GtkWidget* button = HoverControllerGtk::CreateChromeButton(); 381 GtkWidget* button = HoverControllerGtk::CreateChromeButton();
377 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_);
378 chrome_buttons_.push_back(button); 383 chrome_buttons_.push_back(button);
379 384
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 cairo_set_line_width(cr, 1.0); 1144 cairo_set_line_width(cr, 1.0);
1140 cairo_move_to(cr, start_x, widget->allocation.y); 1145 cairo_move_to(cr, start_x, widget->allocation.y);
1141 cairo_line_to(cr, start_x, 1146 cairo_line_to(cr, start_x,
1142 widget->allocation.y + widget->allocation.height); 1147 widget->allocation.y + widget->allocation.height);
1143 cairo_stroke(cr); 1148 cairo_stroke(cr);
1144 cairo_destroy(cr); 1149 cairo_destroy(cr);
1145 cairo_pattern_destroy(pattern); 1150 cairo_pattern_destroy(pattern);
1146 1151
1147 return TRUE; 1152 return TRUE;
1148 } 1153 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698