| 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/tabs/tab_strip_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/debug/trace_event.h" | 12 #include "base/debug/trace_event.h" |
| 13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/autocomplete/autocomplete.h" | 16 #include "chrome/browser/autocomplete/autocomplete.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 17 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 18 #include "chrome/browser/autocomplete/autocomplete_match.h" | 18 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/tabs/tab_strip_model_delegate.h" | 20 #include "chrome/browser/tabs/tab_strip_model_delegate.h" |
| 21 #include "chrome/browser/themes/theme_service.h" | 21 #include "chrome/browser/themes/theme_service.h" |
| 22 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_navigator.h" | 23 #include "chrome/browser/ui/browser_navigator.h" |
| 24 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 24 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 25 #include "chrome/browser/ui/gtk/custom_button.h" | 25 #include "chrome/browser/ui/gtk/custom_button.h" |
| 26 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
| 27 #include "chrome/browser/ui/gtk/gtk_util.h" | 26 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 28 #include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h" | 27 #include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h" |
| 29 #include "chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h" | 28 #include "chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h" |
| 29 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 30 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 30 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 31 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
| 32 #include "content/public/browser/notification_source.h" | 32 #include "content/public/browser/notification_source.h" |
| 33 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
| 34 #include "grit/theme_resources.h" | 34 #include "grit/theme_resources.h" |
| 35 #include "grit/theme_resources_standard.h" | 35 #include "grit/theme_resources_standard.h" |
| 36 #include "grit/ui_resources.h" | 36 #include "grit/ui_resources.h" |
| 37 #include "ui/base/animation/animation_delegate.h" | 37 #include "ui/base/animation/animation_delegate.h" |
| 38 #include "ui/base/animation/slide_animation.h" | 38 #include "ui/base/animation/slide_animation.h" |
| 39 #include "ui/base/dragdrop/gtk_dnd_util.h" | 39 #include "ui/base/dragdrop/gtk_dnd_util.h" |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 const int TabStripGtk::mini_to_non_mini_gap_ = 3; | 707 const int TabStripGtk::mini_to_non_mini_gap_ = 3; |
| 708 | 708 |
| 709 TabStripGtk::TabStripGtk(TabStripModel* model, BrowserWindowGtk* window) | 709 TabStripGtk::TabStripGtk(TabStripModel* model, BrowserWindowGtk* window) |
| 710 : current_unselected_width_(TabGtk::GetStandardSize().width()), | 710 : current_unselected_width_(TabGtk::GetStandardSize().width()), |
| 711 current_selected_width_(TabGtk::GetStandardSize().width()), | 711 current_selected_width_(TabGtk::GetStandardSize().width()), |
| 712 available_width_for_tabs_(-1), | 712 available_width_for_tabs_(-1), |
| 713 needs_resize_layout_(false), | 713 needs_resize_layout_(false), |
| 714 tab_vertical_offset_(0), | 714 tab_vertical_offset_(0), |
| 715 model_(model), | 715 model_(model), |
| 716 window_(window), | 716 window_(window), |
| 717 theme_service_(GtkThemeService::GetFrom(model->profile())), | 717 theme_service_(ThemeServiceGtk::GetFrom(model->profile())), |
| 718 weak_factory_(this), | 718 weak_factory_(this), |
| 719 layout_factory_(this), | 719 layout_factory_(this), |
| 720 added_as_message_loop_observer_(false), | 720 added_as_message_loop_observer_(false), |
| 721 hover_tab_selector_(model) { | 721 hover_tab_selector_(model) { |
| 722 } | 722 } |
| 723 | 723 |
| 724 TabStripGtk::~TabStripGtk() { | 724 TabStripGtk::~TabStripGtk() { |
| 725 model_->RemoveObserver(this); | 725 model_->RemoveObserver(this); |
| 726 tabstrip_.Destroy(); | 726 tabstrip_.Destroy(); |
| 727 | 727 |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 bool TabStripGtk::EndDrag(bool canceled) { | 1293 bool TabStripGtk::EndDrag(bool canceled) { |
| 1294 return drag_controller_.get() ? drag_controller_->EndDrag(canceled) : false; | 1294 return drag_controller_.get() ? drag_controller_->EndDrag(canceled) : false; |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 bool TabStripGtk::HasAvailableDragActions() const { | 1297 bool TabStripGtk::HasAvailableDragActions() const { |
| 1298 return model_->delegate()->GetDragActions() != 0; | 1298 return model_->delegate()->GetDragActions() != 0; |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 GtkThemeService* TabStripGtk::GetThemeProvider() { | 1301 ThemeServiceGtk* TabStripGtk::GetThemeProvider() { |
| 1302 return theme_service_; | 1302 return theme_service_; |
| 1303 } | 1303 } |
| 1304 | 1304 |
| 1305 TabStripMenuController* TabStripGtk::GetTabStripMenuControllerForTab( | 1305 TabStripMenuController* TabStripGtk::GetTabStripMenuControllerForTab( |
| 1306 TabGtk* tab) { | 1306 TabGtk* tab) { |
| 1307 return new TabStripMenuController(tab, model(), GetIndexOfTab(tab)); | 1307 return new TabStripMenuController(tab, model(), GetIndexOfTab(tab)); |
| 1308 } | 1308 } |
| 1309 | 1309 |
| 1310 /////////////////////////////////////////////////////////////////////////////// | 1310 /////////////////////////////////////////////////////////////////////////////// |
| 1311 // TabStripGtk, MessageLoop::Observer implementation: | 1311 // TabStripGtk, MessageLoop::Observer implementation: |
| (...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2252 } | 2252 } |
| 2253 | 2253 |
| 2254 void TabStripGtk::SetNewTabButtonBackground() { | 2254 void TabStripGtk::SetNewTabButtonBackground() { |
| 2255 SkColor color = theme_service_->GetColor( | 2255 SkColor color = theme_service_->GetColor( |
| 2256 ThemeService::COLOR_BUTTON_BACKGROUND); | 2256 ThemeService::COLOR_BUTTON_BACKGROUND); |
| 2257 SkBitmap* background = theme_service_->GetBitmapNamed( | 2257 SkBitmap* background = theme_service_->GetBitmapNamed( |
| 2258 IDR_THEME_WINDOW_CONTROL_BACKGROUND); | 2258 IDR_THEME_WINDOW_CONTROL_BACKGROUND); |
| 2259 SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); | 2259 SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK); |
| 2260 newtab_button_->SetBackground(color, background, mask); | 2260 newtab_button_->SetBackground(color, background, mask); |
| 2261 } | 2261 } |
| OLD | NEW |