| OLD | NEW |
| 1 // Copyright (c) 2010 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/gtk/browser_toolbar_gtk.h" | 5 #include "chrome/browser/gtk/browser_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <X11/XF86keysym.h> | 7 #include <X11/XF86keysym.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| 11 #include "app/gtk_dnd_util.h" | 11 #include "app/gtk_dnd_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/gtk/cairo_cached_surface.h" | 26 #include "chrome/browser/gtk/cairo_cached_surface.h" |
| 27 #include "chrome/browser/gtk/custom_button.h" | 27 #include "chrome/browser/gtk/custom_button.h" |
| 28 #include "chrome/browser/gtk/gtk_chrome_button.h" | 28 #include "chrome/browser/gtk/gtk_chrome_button.h" |
| 29 #include "chrome/browser/gtk/gtk_theme_provider.h" | 29 #include "chrome/browser/gtk/gtk_theme_provider.h" |
| 30 #include "chrome/browser/gtk/gtk_util.h" | 30 #include "chrome/browser/gtk/gtk_util.h" |
| 31 #include "chrome/browser/gtk/location_bar_view_gtk.h" | 31 #include "chrome/browser/gtk/location_bar_view_gtk.h" |
| 32 #include "chrome/browser/gtk/reload_button_gtk.h" | 32 #include "chrome/browser/gtk/reload_button_gtk.h" |
| 33 #include "chrome/browser/gtk/rounded_window.h" | 33 #include "chrome/browser/gtk/rounded_window.h" |
| 34 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" | 34 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" |
| 35 #include "chrome/browser/gtk/view_id_util.h" | 35 #include "chrome/browser/gtk/view_id_util.h" |
| 36 #include "chrome/browser/metrics/user_metrics.h" |
| 36 #include "chrome/browser/net/url_fixer_upper.h" | 37 #include "chrome/browser/net/url_fixer_upper.h" |
| 37 #include "chrome/browser/prefs/pref_service.h" | 38 #include "chrome/browser/prefs/pref_service.h" |
| 38 #include "chrome/browser/profiles/profile.h" | 39 #include "chrome/browser/profiles/profile.h" |
| 39 #include "chrome/browser/tab_contents/tab_contents.h" | 40 #include "chrome/browser/tab_contents/tab_contents.h" |
| 40 #include "chrome/browser/themes/browser_theme_provider.h" | 41 #include "chrome/browser/themes/browser_theme_provider.h" |
| 41 #include "chrome/browser/ui/browser.h" | 42 #include "chrome/browser/ui/browser.h" |
| 42 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 43 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
| 43 #include "chrome/browser/upgrade_detector.h" | 44 #include "chrome/browser/upgrade_detector.h" |
| 44 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
| 45 #include "chrome/common/notification_details.h" | 46 #include "chrome/common/notification_details.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 bool show_bottom_padding) { | 270 bool show_bottom_padding) { |
| 270 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment_), | 271 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment_), |
| 271 ShouldOnlyShowLocation() ? 0 : kTopBottomPadding, | 272 ShouldOnlyShowLocation() ? 0 : kTopBottomPadding, |
| 272 !show_bottom_padding || ShouldOnlyShowLocation() ? 0 : kTopBottomPadding, | 273 !show_bottom_padding || ShouldOnlyShowLocation() ? 0 : kTopBottomPadding, |
| 273 0, 0); | 274 0, 0); |
| 274 } | 275 } |
| 275 | 276 |
| 276 void BrowserToolbarGtk::ShowAppMenu() { | 277 void BrowserToolbarGtk::ShowAppMenu() { |
| 277 wrench_menu_->Cancel(); | 278 wrench_menu_->Cancel(); |
| 278 wrench_menu_button_->SetPaintOverride(GTK_STATE_ACTIVE); | 279 wrench_menu_button_->SetPaintOverride(GTK_STATE_ACTIVE); |
| 280 UserMetrics::RecordAction(UserMetricsAction("ShowAppMenu")); |
| 279 wrench_menu_->PopupAsFromKeyEvent(wrench_menu_button_->widget()); | 281 wrench_menu_->PopupAsFromKeyEvent(wrench_menu_button_->widget()); |
| 280 } | 282 } |
| 281 | 283 |
| 282 // CommandUpdater::CommandObserver --------------------------------------------- | 284 // CommandUpdater::CommandObserver --------------------------------------------- |
| 283 | 285 |
| 284 void BrowserToolbarGtk::EnabledStateChangedForCommand(int id, bool enabled) { | 286 void BrowserToolbarGtk::EnabledStateChangedForCommand(int id, bool enabled) { |
| 285 GtkWidget* widget = NULL; | 287 GtkWidget* widget = NULL; |
| 286 switch (id) { | 288 switch (id) { |
| 287 case IDC_BACK: | 289 case IDC_BACK: |
| 288 widget = back_->widget(); | 290 widget = back_->widget(); |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 int x_offset = base::i18n::IsRTL() ? 0 : | 653 int x_offset = base::i18n::IsRTL() ? 0 : |
| 652 sender->allocation.width - badge->width(); | 654 sender->allocation.width - badge->width(); |
| 653 int y_offset = 0; | 655 int y_offset = 0; |
| 654 canvas.DrawBitmapInt( | 656 canvas.DrawBitmapInt( |
| 655 *badge, | 657 *badge, |
| 656 sender->allocation.x + x_offset, | 658 sender->allocation.x + x_offset, |
| 657 sender->allocation.y + y_offset); | 659 sender->allocation.y + y_offset); |
| 658 | 660 |
| 659 return FALSE; | 661 return FALSE; |
| 660 } | 662 } |
| OLD | NEW |