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

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

Issue 9447096: gtk: Rename GtkThemeService to ThemeServiceGtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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/reload_button_gtk.h ('k') | chrome/browser/ui/gtk/status_bubble_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) 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/reload_button_gtk.h" 5 #include "chrome/browser/ui/gtk/reload_button_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "chrome/app/chrome_command_ids.h" 11 #include "chrome/app/chrome_command_ids.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" 13 #include "chrome/browser/ui/gtk/gtk_chrome_button.h"
14 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
15 #include "chrome/browser/ui/gtk/gtk_util.h" 14 #include "chrome/browser/ui/gtk/gtk_util.h"
16 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" 15 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
16 #include "chrome/browser/ui/gtk/theme_service_gtk.h"
17 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
18 #include "content/public/browser/notification_source.h" 18 #include "content/public/browser/notification_source.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
21 #include "grit/theme_resources_standard.h" 21 #include "grit/theme_resources_standard.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 23
24 // The width of this button in GTK+ theme mode. The Stop and Refresh stock icons 24 // The width of this button in GTK+ theme mode. The Stop and Refresh stock icons
25 // can be different sizes; this variable is used to make sure that the button 25 // can be different sizes; this variable is used to make sure that the button
26 // doesn't change sizes when switching between the two. 26 // doesn't change sizes when switching between the two.
27 static int GtkButtonWidth = 0; 27 static int GtkButtonWidth = 0;
28 28
29 //////////////////////////////////////////////////////////////////////////////// 29 ////////////////////////////////////////////////////////////////////////////////
30 // ReloadButton, public: 30 // ReloadButton, public:
31 31
32 ReloadButtonGtk::ReloadButtonGtk(LocationBarViewGtk* location_bar, 32 ReloadButtonGtk::ReloadButtonGtk(LocationBarViewGtk* location_bar,
33 Browser* browser) 33 Browser* browser)
34 : location_bar_(location_bar), 34 : location_bar_(location_bar),
35 browser_(browser), 35 browser_(browser),
36 intended_mode_(MODE_RELOAD), 36 intended_mode_(MODE_RELOAD),
37 visible_mode_(MODE_RELOAD), 37 visible_mode_(MODE_RELOAD),
38 theme_service_(browser ? 38 theme_service_(browser ?
39 GtkThemeService::GetFrom(browser->profile()) : NULL), 39 ThemeServiceGtk::GetFrom(browser->profile()) : NULL),
40 reload_(theme_service_, IDR_RELOAD, IDR_RELOAD_P, IDR_RELOAD_H, 0), 40 reload_(theme_service_, IDR_RELOAD, IDR_RELOAD_P, IDR_RELOAD_H, 0),
41 stop_(theme_service_, IDR_STOP, IDR_STOP_P, IDR_STOP_H, IDR_STOP_D), 41 stop_(theme_service_, IDR_STOP, IDR_STOP_P, IDR_STOP_H, IDR_STOP_D),
42 widget_(gtk_chrome_button_new()), 42 widget_(gtk_chrome_button_new()),
43 stop_to_reload_timer_delay_(base::TimeDelta::FromMilliseconds(1350)), 43 stop_to_reload_timer_delay_(base::TimeDelta::FromMilliseconds(1350)),
44 testing_mouse_hovered_(false), 44 testing_mouse_hovered_(false),
45 testing_reload_count_(0) { 45 testing_reload_count_(0) {
46 gtk_widget_set_size_request(widget(), reload_.Width(), reload_.Height()); 46 gtk_widget_set_size_request(widget(), reload_.Width(), reload_.Height());
47 47
48 gtk_widget_set_app_paintable(widget(), TRUE); 48 gtk_widget_set_app_paintable(widget(), TRUE);
49 49
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 //////////////////////////////////////////////////////////////////////////////// 129 ////////////////////////////////////////////////////////////////////////////////
130 // ReloadButtonGtk, content::NotificationObserver implementation: 130 // ReloadButtonGtk, content::NotificationObserver implementation:
131 131
132 void ReloadButtonGtk::Observe(int type, 132 void ReloadButtonGtk::Observe(int type,
133 const content::NotificationSource& source, 133 const content::NotificationSource& source,
134 const content::NotificationDetails& details) { 134 const content::NotificationDetails& details) {
135 DCHECK(chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type); 135 DCHECK(chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type);
136 136
137 GtkThemeService* provider = static_cast<GtkThemeService*>( 137 ThemeServiceGtk* provider = static_cast<ThemeServiceGtk*>(
138 content::Source<ThemeService>(source).ptr()); 138 content::Source<ThemeService>(source).ptr());
139 DCHECK_EQ(provider, theme_service_); 139 DCHECK_EQ(provider, theme_service_);
140 GtkButtonWidth = 0; 140 GtkButtonWidth = 0;
141 UpdateThemeButtons(); 141 UpdateThemeButtons();
142 } 142 }
143 143
144 //////////////////////////////////////////////////////////////////////////////// 144 ////////////////////////////////////////////////////////////////////////////////
145 // ReloadButtonGtk, private: 145 // ReloadButtonGtk, private:
146 146
147 void ReloadButtonGtk::OnClicked(GtkWidget* /* sender */) { 147 void ReloadButtonGtk::OnClicked(GtkWidget* /* sender */) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(widget()), use_gtk); 274 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(widget()), use_gtk);
275 } 275 }
276 276
277 void ReloadButtonGtk::OnDoubleClickTimer() { 277 void ReloadButtonGtk::OnDoubleClickTimer() {
278 ChangeMode(intended_mode_, false); 278 ChangeMode(intended_mode_, false);
279 } 279 }
280 280
281 void ReloadButtonGtk::OnStopToReloadTimer() { 281 void ReloadButtonGtk::OnStopToReloadTimer() {
282 ChangeMode(intended_mode_, true); 282 ChangeMode(intended_mode_, true);
283 } 283 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/reload_button_gtk.h ('k') | chrome/browser/ui/gtk/status_bubble_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698