OLD | NEW |
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/browser_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
6 | 6 |
7 #include <X11/XF86keysym.h> | |
8 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
9 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #include <X11/XF86keysym.h> |
10 | 10 |
11 #include "base/base_paths.h" | 11 #include "base/base_paths.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/trace_event.h" | 13 #include "base/debug/trace_event.h" |
14 #include "base/i18n/rtl.h" | 14 #include "base/i18n/rtl.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "chrome/app/chrome_command_ids.h" | 18 #include "chrome/app/chrome_command_ids.h" |
19 #include "chrome/browser/net/url_fixer_upper.h" | 19 #include "chrome/browser/net/url_fixer_upper.h" |
20 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/themes/theme_service.h" | 22 #include "chrome/browser/themes/theme_service.h" |
23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
24 #include "chrome/browser/ui/global_error_service.h" | 24 #include "chrome/browser/ui/global_error_service.h" |
25 #include "chrome/browser/ui/global_error_service_factory.h" | 25 #include "chrome/browser/ui/global_error_service_factory.h" |
26 #include "chrome/browser/ui/gtk/accelerators_gtk.h" | 26 #include "chrome/browser/ui/gtk/accelerators_gtk.h" |
27 #include "chrome/browser/ui/gtk/back_forward_button_gtk.h" | 27 #include "chrome/browser/ui/gtk/back_forward_button_gtk.h" |
28 #include "chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.h" | 28 #include "chrome/browser/ui/gtk/bookmarks/bookmark_sub_menu_model_gtk.h" |
29 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" | 29 #include "chrome/browser/ui/gtk/browser_actions_toolbar_gtk.h" |
30 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 30 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
31 #include "chrome/browser/ui/gtk/custom_button.h" | 31 #include "chrome/browser/ui/gtk/custom_button.h" |
| 32 #include "chrome/browser/ui/gtk/event_utils.h" |
32 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" | 33 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" |
33 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 34 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
34 #include "chrome/browser/ui/gtk/gtk_util.h" | 35 #include "chrome/browser/ui/gtk/gtk_util.h" |
35 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" | 36 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h" |
36 #include "chrome/browser/ui/gtk/reload_button_gtk.h" | 37 #include "chrome/browser/ui/gtk/reload_button_gtk.h" |
37 #include "chrome/browser/ui/gtk/rounded_window.h" | 38 #include "chrome/browser/ui/gtk/rounded_window.h" |
38 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" | 39 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
39 #include "chrome/browser/ui/gtk/view_id_util.h" | 40 #include "chrome/browser/ui/gtk/view_id_util.h" |
40 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" | 41 #include "chrome/browser/ui/toolbar/encoding_menu_controller.h" |
41 #include "chrome/browser/upgrade_detector.h" | 42 #include "chrome/browser/upgrade_detector.h" |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 gtk_util::DrawTextEntryBackground(offscreen_entry_.get(), | 588 gtk_util::DrawTextEntryBackground(offscreen_entry_.get(), |
588 location_hbox, &e->area, | 589 location_hbox, &e->area, |
589 &allocation); | 590 &allocation); |
590 } | 591 } |
591 | 592 |
592 return FALSE; | 593 return FALSE; |
593 } | 594 } |
594 | 595 |
595 void BrowserToolbarGtk::OnButtonClick(GtkWidget* button) { | 596 void BrowserToolbarGtk::OnButtonClick(GtkWidget* button) { |
596 if ((button == back_->widget()) || (button == forward_->widget())) { | 597 if ((button == back_->widget()) || (button == forward_->widget())) { |
597 if (gtk_util::DispositionForCurrentButtonPressEvent() == CURRENT_TAB) | 598 if (event_utils::DispositionForCurrentButtonPressEvent() == CURRENT_TAB) |
598 location_bar_->Revert(); | 599 location_bar_->Revert(); |
599 return; | 600 return; |
600 } | 601 } |
601 | 602 |
602 DCHECK(home_.get() && button == home_->widget()) << | 603 DCHECK(home_.get() && button == home_->widget()) << |
603 "Unexpected button click callback"; | 604 "Unexpected button click callback"; |
604 browser_->Home(gtk_util::DispositionForCurrentButtonPressEvent()); | 605 browser_->Home(event_utils::DispositionForCurrentButtonPressEvent()); |
605 } | 606 } |
606 | 607 |
607 gboolean BrowserToolbarGtk::OnMenuButtonPressEvent(GtkWidget* button, | 608 gboolean BrowserToolbarGtk::OnMenuButtonPressEvent(GtkWidget* button, |
608 GdkEventButton* event) { | 609 GdkEventButton* event) { |
609 if (event->button != 1) | 610 if (event->button != 1) |
610 return FALSE; | 611 return FALSE; |
611 | 612 |
612 if (!is_wrench_menu_model_valid_) | 613 if (!is_wrench_menu_model_valid_) |
613 RebuildWrenchMenu(); | 614 RebuildWrenchMenu(); |
614 | 615 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id); | 686 const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id); |
686 gfx::CanvasSkiaPaint canvas(expose, false); | 687 gfx::CanvasSkiaPaint canvas(expose, false); |
687 int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width(); | 688 int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width(); |
688 int y_offset = 0; | 689 int y_offset = 0; |
689 canvas.DrawImageInt(*badge, | 690 canvas.DrawImageInt(*badge, |
690 allocation.x + x_offset, | 691 allocation.x + x_offset, |
691 allocation.y + y_offset); | 692 allocation.y + y_offset); |
692 | 693 |
693 return FALSE; | 694 return FALSE; |
694 } | 695 } |
OLD | NEW |