| 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/views/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windowsx.h> | 8 #include <windowsx.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/grit/generated_resources.h" | 32 #include "chrome/grit/generated_resources.h" |
| 33 #include "content/public/browser/user_metrics.h" | 33 #include "content/public/browser/user_metrics.h" |
| 34 #include "grit/theme_resources.h" | 34 #include "grit/theme_resources.h" |
| 35 #include "ui/accessibility/ax_view_state.h" | 35 #include "ui/accessibility/ax_view_state.h" |
| 36 #include "ui/base/default_theme_provider.h" | 36 #include "ui/base/default_theme_provider.h" |
| 37 #include "ui/base/dragdrop/drag_drop_types.h" | 37 #include "ui/base/dragdrop/drag_drop_types.h" |
| 38 #include "ui/base/l10n/l10n_util.h" | 38 #include "ui/base/l10n/l10n_util.h" |
| 39 #include "ui/base/models/list_selection_model.h" | 39 #include "ui/base/models/list_selection_model.h" |
| 40 #include "ui/base/resource/resource_bundle.h" | 40 #include "ui/base/resource/resource_bundle.h" |
| 41 #include "ui/compositor/paint_context.h" |
| 41 #include "ui/gfx/animation/animation_container.h" | 42 #include "ui/gfx/animation/animation_container.h" |
| 42 #include "ui/gfx/animation/throb_animation.h" | 43 #include "ui/gfx/animation/throb_animation.h" |
| 43 #include "ui/gfx/canvas.h" | 44 #include "ui/gfx/canvas.h" |
| 44 #include "ui/gfx/display.h" | 45 #include "ui/gfx/display.h" |
| 45 #include "ui/gfx/geometry/rect_conversions.h" | 46 #include "ui/gfx/geometry/rect_conversions.h" |
| 46 #include "ui/gfx/geometry/size.h" | 47 #include "ui/gfx/geometry/size.h" |
| 47 #include "ui/gfx/image/image_skia.h" | 48 #include "ui/gfx/image/image_skia.h" |
| 48 #include "ui/gfx/image/image_skia_operations.h" | 49 #include "ui/gfx/image/image_skia_operations.h" |
| 49 #include "ui/gfx/path.h" | 50 #include "ui/gfx/path.h" |
| 50 #include "ui/gfx/screen.h" | 51 #include "ui/gfx/screen.h" |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 | 1234 |
| 1234 void TabStrip::Layout() { | 1235 void TabStrip::Layout() { |
| 1235 // Only do a layout if our size changed. | 1236 // Only do a layout if our size changed. |
| 1236 if (last_layout_size_ == size()) | 1237 if (last_layout_size_ == size()) |
| 1237 return; | 1238 return; |
| 1238 if (IsDragSessionActive()) | 1239 if (IsDragSessionActive()) |
| 1239 return; | 1240 return; |
| 1240 DoLayout(); | 1241 DoLayout(); |
| 1241 } | 1242 } |
| 1242 | 1243 |
| 1243 void TabStrip::PaintChildren(const PaintContext& context) { | 1244 void TabStrip::PaintChildren(const ui::PaintContext& context) { |
| 1244 gfx::Canvas* canvas = context.canvas(); | 1245 gfx::Canvas* canvas = context.canvas(); |
| 1245 // The view order doesn't match the paint order (tabs_ contains the tab | 1246 // The view order doesn't match the paint order (tabs_ contains the tab |
| 1246 // ordering). Additionally we need to paint the tabs that are closing in | 1247 // ordering). Additionally we need to paint the tabs that are closing in |
| 1247 // |tabs_closing_map_|. | 1248 // |tabs_closing_map_|. |
| 1248 Tab* active_tab = NULL; | 1249 Tab* active_tab = NULL; |
| 1249 Tabs tabs_dragging; | 1250 Tabs tabs_dragging; |
| 1250 Tabs selected_tabs; | 1251 Tabs selected_tabs; |
| 1251 int selected_tab_count = 0; | 1252 int selected_tab_count = 0; |
| 1252 bool is_dragging = false; | 1253 bool is_dragging = false; |
| 1253 int active_tab_index = -1; | 1254 int active_tab_index = -1; |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 for (TabsClosingMap::iterator i(tabs_closing_map_.begin()); | 1976 for (TabsClosingMap::iterator i(tabs_closing_map_.begin()); |
| 1976 i != tabs_closing_map_.end(); ++i) { | 1977 i != tabs_closing_map_.end(); ++i) { |
| 1977 Tabs::iterator j = std::find(i->second.begin(), i->second.end(), tab); | 1978 Tabs::iterator j = std::find(i->second.begin(), i->second.end(), tab); |
| 1978 if (j != i->second.end()) | 1979 if (j != i->second.end()) |
| 1979 return FindClosingTabResult(i, j); | 1980 return FindClosingTabResult(i, j); |
| 1980 } | 1981 } |
| 1981 NOTREACHED(); | 1982 NOTREACHED(); |
| 1982 return FindClosingTabResult(tabs_closing_map_.end(), Tabs::iterator()); | 1983 return FindClosingTabResult(tabs_closing_map_.end(), Tabs::iterator()); |
| 1983 } | 1984 } |
| 1984 | 1985 |
| 1985 void TabStrip::PaintClosingTabs(int index, const PaintContext& context) { | 1986 void TabStrip::PaintClosingTabs(int index, const ui::PaintContext& context) { |
| 1986 if (tabs_closing_map_.find(index) == tabs_closing_map_.end()) | 1987 if (tabs_closing_map_.find(index) == tabs_closing_map_.end()) |
| 1987 return; | 1988 return; |
| 1988 | 1989 |
| 1989 const Tabs& tabs = tabs_closing_map_[index]; | 1990 const Tabs& tabs = tabs_closing_map_[index]; |
| 1990 for (Tabs::const_reverse_iterator i(tabs.rbegin()); i != tabs.rend(); ++i) | 1991 for (Tabs::const_reverse_iterator i(tabs.rbegin()); i != tabs.rend(); ++i) |
| 1991 (*i)->Paint(context); | 1992 (*i)->Paint(context); |
| 1992 } | 1993 } |
| 1993 | 1994 |
| 1994 void TabStrip::UpdateStackedLayoutFromMouseEvent(views::View* source, | 1995 void TabStrip::UpdateStackedLayoutFromMouseEvent(views::View* source, |
| 1995 const ui::MouseEvent& event) { | 1996 const ui::MouseEvent& event) { |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2757 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); | 2758 ConvertPointToViewAndGetEventHandler(this, newtab_button_, point); |
| 2758 if (view) | 2759 if (view) |
| 2759 return view; | 2760 return view; |
| 2760 } | 2761 } |
| 2761 Tab* tab = FindTabForEvent(point); | 2762 Tab* tab = FindTabForEvent(point); |
| 2762 if (tab) | 2763 if (tab) |
| 2763 return ConvertPointToViewAndGetEventHandler(this, tab, point); | 2764 return ConvertPointToViewAndGetEventHandler(this, tab, point); |
| 2764 } | 2765 } |
| 2765 return this; | 2766 return this; |
| 2766 } | 2767 } |
| OLD | NEW |