| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/go_button_gtk.h" | 5 #include "chrome/browser/gtk/go_button_gtk.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
| 11 #include "chrome/browser/browser.h" | 11 #include "chrome/browser/browser.h" |
| 12 #include "chrome/browser/gtk/location_bar_view_gtk.h" | 12 #include "chrome/browser/gtk/location_bar_view_gtk.h" |
| 13 #include "chrome/browser/profile.h" |
| 13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 14 #include "grit/theme_resources.h" | 15 #include "grit/theme_resources.h" |
| 15 | 16 |
| 16 GoButtonGtk::GoButtonGtk(LocationBarViewGtk* location_bar, Browser* browser) | 17 GoButtonGtk::GoButtonGtk(LocationBarViewGtk* location_bar, Browser* browser) |
| 17 : location_bar_(location_bar), | 18 : location_bar_(location_bar), |
| 18 browser_(browser), | 19 browser_(browser), |
| 19 button_delay_(0), | 20 button_delay_(0), |
| 20 stop_timer_(this), | 21 stop_timer_(this), |
| 21 intended_mode_(MODE_GO), | 22 intended_mode_(MODE_GO), |
| 22 visible_mode_(MODE_GO), | 23 visible_mode_(MODE_GO), |
| 23 state_(BS_NORMAL), | 24 state_(BS_NORMAL), |
| 24 go_(IDR_GO, IDR_GO_P, IDR_GO_H, 0), | 25 go_(browser ? browser->profile()->GetThemeProvider() : NULL, |
| 25 stop_(IDR_STOP, IDR_STOP_P, IDR_STOP_H, 0), | 26 IDR_GO, IDR_GO_P, IDR_GO_H, 0), |
| 27 stop_(browser ? browser->profile()->GetThemeProvider() : NULL, |
| 28 IDR_STOP, IDR_STOP_P, IDR_STOP_H, 0), |
| 26 widget_(gtk_button_new()) { | 29 widget_(gtk_button_new()) { |
| 27 gtk_widget_set_size_request(widget_.get(), | 30 gtk_widget_set_size_request(widget_.get(), |
| 28 gdk_pixbuf_get_width(go_.pixbufs(0)), | 31 gdk_pixbuf_get_width(go_.pixbufs(0)), |
| 29 gdk_pixbuf_get_height(go_.pixbufs(0))); | 32 gdk_pixbuf_get_height(go_.pixbufs(0))); |
| 30 | 33 |
| 31 gtk_widget_set_app_paintable(widget_.get(), TRUE); | 34 gtk_widget_set_app_paintable(widget_.get(), TRUE); |
| 32 // We effectively double-buffer by virtue of having only one image... | 35 // We effectively double-buffer by virtue of having only one image... |
| 33 gtk_widget_set_double_buffered(widget_.get(), FALSE); | 36 gtk_widget_set_double_buffered(widget_.get(), FALSE); |
| 34 | 37 |
| 35 g_signal_connect(G_OBJECT(widget_.get()), "expose-event", | 38 g_signal_connect(G_OBJECT(widget_.get()), "expose-event", |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 widget_.get(), | 165 widget_.get(), |
| 163 true ? l10n_util::GetStringFUTF8( | 166 true ? l10n_util::GetStringFUTF8( |
| 164 IDS_TOOLTIP_GO_SITE, WideToUTF16(current_text)).c_str() : | 167 IDS_TOOLTIP_GO_SITE, WideToUTF16(current_text)).c_str() : |
| 165 l10n_util::GetStringFUTF8(IDS_TOOLTIP_GO_SEARCH, UTF8ToUTF16("Google"), | 168 l10n_util::GetStringFUTF8(IDS_TOOLTIP_GO_SEARCH, UTF8ToUTF16("Google"), |
| 166 WideToUTF16(current_text)).c_str()); | 169 WideToUTF16(current_text)).c_str()); |
| 167 } else { | 170 } else { |
| 168 gtk_widget_set_tooltip_text( | 171 gtk_widget_set_tooltip_text( |
| 169 widget_.get(), l10n_util::GetStringUTF8(IDS_TOOLTIP_STOP).c_str()); | 172 widget_.get(), l10n_util::GetStringUTF8(IDS_TOOLTIP_STOP).c_str()); |
| 170 } | 173 } |
| 171 } | 174 } |
| OLD | NEW |