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