OLD | NEW |
1 // Copyright (c) 2011 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/ui/gtk/tabs/tab_strip_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/autocomplete/autocomplete.h" | 12 #include "chrome/browser/autocomplete/autocomplete.h" |
13 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 13 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
14 #include "chrome/browser/autocomplete/autocomplete_match.h" | 14 #include "chrome/browser/autocomplete/autocomplete_match.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/tabs/tab_strip_model_delegate.h" | 16 #include "chrome/browser/tabs/tab_strip_model_delegate.h" |
17 #include "chrome/browser/themes/theme_service.h" | 17 #include "chrome/browser/themes/theme_service.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_navigator.h" | 19 #include "chrome/browser/ui/browser_navigator.h" |
20 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 20 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
21 #include "chrome/browser/ui/gtk/custom_button.h" | 21 #include "chrome/browser/ui/gtk/custom_button.h" |
22 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 22 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
23 #include "chrome/browser/ui/gtk/gtk_util.h" | 23 #include "chrome/browser/ui/gtk/gtk_util.h" |
24 #include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h" | 24 #include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h" |
25 #include "chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h" | 25 #include "chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h" |
26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 27 #include "chrome/common/chrome_notification_types.h" |
27 #include "content/browser/tab_contents/tab_contents.h" | 28 #include "content/browser/tab_contents/tab_contents.h" |
28 #include "content/common/notification_service.h" | 29 #include "content/common/notification_service.h" |
29 #include "content/common/notification_type.h" | |
30 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
31 #include "grit/theme_resources_standard.h" | 31 #include "grit/theme_resources_standard.h" |
32 #include "grit/ui_resources.h" | 32 #include "grit/ui_resources.h" |
33 #include "ui/base/animation/animation_delegate.h" | 33 #include "ui/base/animation/animation_delegate.h" |
34 #include "ui/base/animation/slide_animation.h" | 34 #include "ui/base/animation/slide_animation.h" |
35 #include "ui/base/dragdrop/gtk_dnd_util.h" | 35 #include "ui/base/dragdrop/gtk_dnd_util.h" |
36 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
37 #include "ui/gfx/gtk_util.h" | 37 #include "ui/gfx/gtk_util.h" |
38 #include "ui/gfx/image/image.h" | 38 #include "ui/gfx/image/image.h" |
39 #include "ui/gfx/point.h" | 39 #include "ui/gfx/point.h" |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 available_width_for_tabs_(-1), | 700 available_width_for_tabs_(-1), |
701 needs_resize_layout_(false), | 701 needs_resize_layout_(false), |
702 tab_vertical_offset_(0), | 702 tab_vertical_offset_(0), |
703 model_(model), | 703 model_(model), |
704 window_(window), | 704 window_(window), |
705 theme_service_(GtkThemeService::GetFrom(model->profile())), | 705 theme_service_(GtkThemeService::GetFrom(model->profile())), |
706 resize_layout_factory_(this), | 706 resize_layout_factory_(this), |
707 added_as_message_loop_observer_(false), | 707 added_as_message_loop_observer_(false), |
708 hover_tab_selector_(model) { | 708 hover_tab_selector_(model) { |
709 theme_service_->InitThemesFor(this); | 709 theme_service_->InitThemesFor(this); |
710 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 710 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
711 Source<ThemeService>(theme_service_)); | 711 Source<ThemeService>(theme_service_)); |
712 } | 712 } |
713 | 713 |
714 TabStripGtk::~TabStripGtk() { | 714 TabStripGtk::~TabStripGtk() { |
715 model_->RemoveObserver(this); | 715 model_->RemoveObserver(this); |
716 tabstrip_.Destroy(); | 716 tabstrip_.Destroy(); |
717 | 717 |
718 // Free any remaining tabs. This is needed to free the very last tab, | 718 // Free any remaining tabs. This is needed to free the very last tab, |
719 // because it is not animated on close. This also happens when all of the | 719 // because it is not animated on close. This also happens when all of the |
720 // tabs are closed at once. | 720 // tabs are closed at once. |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 HandleGlobalMouseMoveEvent(); | 1278 HandleGlobalMouseMoveEvent(); |
1279 break; | 1279 break; |
1280 default: | 1280 default: |
1281 break; | 1281 break; |
1282 } | 1282 } |
1283 } | 1283 } |
1284 | 1284 |
1285 /////////////////////////////////////////////////////////////////////////////// | 1285 /////////////////////////////////////////////////////////////////////////////// |
1286 // TabStripGtk, NotificationObserver implementation: | 1286 // TabStripGtk, NotificationObserver implementation: |
1287 | 1287 |
1288 void TabStripGtk::Observe(NotificationType type, | 1288 void TabStripGtk::Observe(int type, |
1289 const NotificationSource& source, | 1289 const NotificationSource& source, |
1290 const NotificationDetails& details) { | 1290 const NotificationDetails& details) { |
1291 if (type == NotificationType::BROWSER_THEME_CHANGED) { | 1291 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) { |
1292 TabRendererGtk::SetSelectedTitleColor(theme_service_->GetColor( | 1292 TabRendererGtk::SetSelectedTitleColor(theme_service_->GetColor( |
1293 ThemeService::COLOR_TAB_TEXT)); | 1293 ThemeService::COLOR_TAB_TEXT)); |
1294 TabRendererGtk::SetUnselectedTitleColor(theme_service_->GetColor( | 1294 TabRendererGtk::SetUnselectedTitleColor(theme_service_->GetColor( |
1295 ThemeService::COLOR_BACKGROUND_TAB_TEXT)); | 1295 ThemeService::COLOR_BACKGROUND_TAB_TEXT)); |
1296 } | 1296 } |
1297 } | 1297 } |
1298 | 1298 |
1299 //////////////////////////////////////////////////////////////////////////////// | 1299 //////////////////////////////////////////////////////////////////////////////// |
1300 // TabStripGtk, private: | 1300 // TabStripGtk, private: |
1301 | 1301 |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 | 2125 |
2126 // Let the middle mouse button initiate clicks as well. | 2126 // Let the middle mouse button initiate clicks as well. |
2127 gtk_util::SetButtonTriggersNavigation(button->widget()); | 2127 gtk_util::SetButtonTriggersNavigation(button->widget()); |
2128 g_signal_connect(button->widget(), "clicked", | 2128 g_signal_connect(button->widget(), "clicked", |
2129 G_CALLBACK(OnNewTabClickedThunk), this); | 2129 G_CALLBACK(OnNewTabClickedThunk), this); |
2130 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); | 2130 GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); |
2131 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); | 2131 gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); |
2132 | 2132 |
2133 return button; | 2133 return button; |
2134 } | 2134 } |
OLD | NEW |