| 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 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // window caption area of the browser window. | 179 // window caption area of the browser window. |
| 180 bool IsPositionInWindowCaption(const gfx::Point& point); | 180 bool IsPositionInWindowCaption(const gfx::Point& point); |
| 181 | 181 |
| 182 // Returns true if the specified rect (in TabStrip coordinates) intersects | 182 // Returns true if the specified rect (in TabStrip coordinates) intersects |
| 183 // the window caption area of the browser window. | 183 // the window caption area of the browser window. |
| 184 bool IsRectInWindowCaption(const gfx::Rect& rect); | 184 bool IsRectInWindowCaption(const gfx::Rect& rect); |
| 185 | 185 |
| 186 // Set the background offset used by inactive tabs to match the frame image. | 186 // Set the background offset used by inactive tabs to match the frame image. |
| 187 void SetBackgroundOffset(const gfx::Point& offset); | 187 void SetBackgroundOffset(const gfx::Point& offset); |
| 188 | 188 |
| 189 // Sets a painting style with miniature "tab indicator" rectangles at the top. | |
| 190 void SetImmersiveStyle(bool enable); | |
| 191 | |
| 192 // Returns the alpha that inactive tabs and the new tab button should use to | 189 // Returns the alpha that inactive tabs and the new tab button should use to |
| 193 // blend against the frame background. Inactive tabs and the new tab button | 190 // blend against the frame background. Inactive tabs and the new tab button |
| 194 // differ in whether they change alpha when tab multiselection is occurring; | 191 // differ in whether they change alpha when tab multiselection is occurring; |
| 195 // |for_new_tab_button| toggles between the two calculations. | 192 // |for_new_tab_button| toggles between the two calculations. |
| 196 SkAlpha GetInactiveAlpha(bool for_new_tab_button) const; | 193 SkAlpha GetInactiveAlpha(bool for_new_tab_button) const; |
| 197 | 194 |
| 198 // Returns true if Tabs in this TabStrip are currently changing size or | 195 // Returns true if Tabs in this TabStrip are currently changing size or |
| 199 // position. | 196 // position. |
| 200 bool IsAnimating() const; | 197 bool IsAnimating() const; |
| 201 | 198 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 230 void ContinueDrag(views::View* view, const ui::LocatedEvent& event) override; | 227 void ContinueDrag(views::View* view, const ui::LocatedEvent& event) override; |
| 231 bool EndDrag(EndDragReason reason) override; | 228 bool EndDrag(EndDragReason reason) override; |
| 232 Tab* GetTabAt(Tab* tab, const gfx::Point& tab_in_tab_coordinates) override; | 229 Tab* GetTabAt(Tab* tab, const gfx::Point& tab_in_tab_coordinates) override; |
| 233 void OnMouseEventInTab(views::View* source, | 230 void OnMouseEventInTab(views::View* source, |
| 234 const ui::MouseEvent& event) override; | 231 const ui::MouseEvent& event) override; |
| 235 bool ShouldPaintTab( | 232 bool ShouldPaintTab( |
| 236 const Tab* tab, | 233 const Tab* tab, |
| 237 const base::Callback<gfx::Path(const gfx::Size&)>& border_callback, | 234 const base::Callback<gfx::Path(const gfx::Size&)>& border_callback, |
| 238 gfx::Path* clip) override; | 235 gfx::Path* clip) override; |
| 239 bool CanPaintThrobberToLayer() const override; | 236 bool CanPaintThrobberToLayer() const override; |
| 240 bool IsImmersiveStyle() const override; | |
| 241 SkColor GetToolbarTopSeparatorColor() const override; | 237 SkColor GetToolbarTopSeparatorColor() const override; |
| 242 int GetBackgroundResourceId(bool* custom_image) const override; | 238 int GetBackgroundResourceId(bool* custom_image) const override; |
| 243 void UpdateTabAccessibilityState(const Tab* tab, | 239 void UpdateTabAccessibilityState(const Tab* tab, |
| 244 ui::AXViewState* state) override; | 240 ui::AXViewState* state) override; |
| 245 | 241 |
| 246 // MouseWatcherListener overrides: | 242 // MouseWatcherListener overrides: |
| 247 void MouseMovedOutOfHost() override; | 243 void MouseMovedOutOfHost() override; |
| 248 | 244 |
| 249 // views::View overrides: | 245 // views::View overrides: |
| 250 void Layout() override; | 246 void Layout() override; |
| 251 void PaintChildren(const ui::PaintContext& context) override; | 247 void PaintChildren(const ui::PaintContext& context) override; |
| 252 const char* GetClassName() const override; | 248 const char* GetClassName() const override; |
| 253 gfx::Size GetPreferredSize() const override; | 249 gfx::Size GetPreferredSize() const override; |
| 254 // NOTE: the drag and drop methods are invoked from FrameView. This is done | 250 // NOTE: the drag and drop methods are invoked from FrameView. This is done |
| 255 // to allow for a drop region that extends outside the bounds of the TabStrip. | 251 // to allow for a drop region that extends outside the bounds of the TabStrip. |
| 256 void OnDragEntered(const ui::DropTargetEvent& event) override; | 252 void OnDragEntered(const ui::DropTargetEvent& event) override; |
| 257 int OnDragUpdated(const ui::DropTargetEvent& event) override; | 253 int OnDragUpdated(const ui::DropTargetEvent& event) override; |
| 258 void OnDragExited() override; | 254 void OnDragExited() override; |
| 259 int OnPerformDrop(const ui::DropTargetEvent& event) override; | 255 int OnPerformDrop(const ui::DropTargetEvent& event) override; |
| 260 void GetAccessibleState(ui::AXViewState* state) override; | 256 void GetAccessibleState(ui::AXViewState* state) override; |
| 261 views::View* GetTooltipHandlerForPoint(const gfx::Point& point) override; | 257 views::View* GetTooltipHandlerForPoint(const gfx::Point& point) override; |
| 262 | 258 |
| 263 // Returns preferred height in immersive style. | |
| 264 static int GetImmersiveHeight(); | |
| 265 | |
| 266 private: | 259 private: |
| 267 typedef std::vector<Tab*> Tabs; | 260 typedef std::vector<Tab*> Tabs; |
| 268 typedef std::map<int, Tabs> TabsClosingMap; | 261 typedef std::map<int, Tabs> TabsClosingMap; |
| 269 typedef std::pair<TabsClosingMap::iterator, | 262 typedef std::pair<TabsClosingMap::iterator, |
| 270 Tabs::iterator> FindClosingTabResult; | 263 Tabs::iterator> FindClosingTabResult; |
| 271 | 264 |
| 272 class RemoveTabDelegate; | 265 class RemoveTabDelegate; |
| 273 | 266 |
| 274 friend class TabDragController; | 267 friend class TabDragController; |
| 275 friend class TabDragControllerTest; | 268 friend class TabDragControllerTest; |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 // Time of the last mouse move event. | 635 // Time of the last mouse move event. |
| 643 base::TimeTicks last_mouse_move_time_; | 636 base::TimeTicks last_mouse_move_time_; |
| 644 | 637 |
| 645 // Number of mouse moves. | 638 // Number of mouse moves. |
| 646 int mouse_move_count_; | 639 int mouse_move_count_; |
| 647 | 640 |
| 648 // Timer used when a tab is closed and we need to relayout. Only used when a | 641 // Timer used when a tab is closed and we need to relayout. Only used when a |
| 649 // tab close comes from a touch device. | 642 // tab close comes from a touch device. |
| 650 base::OneShotTimer resize_layout_timer_; | 643 base::OneShotTimer resize_layout_timer_; |
| 651 | 644 |
| 652 // True if tabs are painted as rectangular light-bars. | |
| 653 bool immersive_style_; | |
| 654 | |
| 655 // Our observers. | 645 // Our observers. |
| 656 typedef base::ObserverList<TabStripObserver> TabStripObservers; | 646 typedef base::ObserverList<TabStripObserver> TabStripObservers; |
| 657 TabStripObservers observers_; | 647 TabStripObservers observers_; |
| 658 | 648 |
| 659 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 649 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
| 660 }; | 650 }; |
| 661 | 651 |
| 662 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 652 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| OLD | NEW |