| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; | 197 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; |
| 198 virtual std::string GetClassName() const OVERRIDE; | 198 virtual std::string GetClassName() const OVERRIDE; |
| 199 virtual gfx::Size GetPreferredSize() OVERRIDE; | 199 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 200 // NOTE: the drag and drop methods are invoked from FrameView. This is done | 200 // NOTE: the drag and drop methods are invoked from FrameView. This is done |
| 201 // to allow for a drop region that extends outside the bounds of the TabStrip. | 201 // to allow for a drop region that extends outside the bounds of the TabStrip. |
| 202 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; | 202 virtual void OnDragEntered(const ui::DropTargetEvent& event) OVERRIDE; |
| 203 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; | 203 virtual int OnDragUpdated(const ui::DropTargetEvent& event) OVERRIDE; |
| 204 virtual void OnDragExited() OVERRIDE; | 204 virtual void OnDragExited() OVERRIDE; |
| 205 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 205 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
| 206 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 206 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 207 virtual views::View* GetEventHandlerForPoint( | 207 virtual views::View* GetEventHandler(const gfx::Rect& rect, EventType type) |
| 208 const gfx::Point& point) OVERRIDE; | 208 OVERRIDE; |
| 209 | 209 |
| 210 protected: | 210 protected: |
| 211 // Horizontal gap between mini and non-mini-tabs. | 211 // Horizontal gap between mini and non-mini-tabs. |
| 212 static const int kMiniToNonMiniGap; | 212 static const int kMiniToNonMiniGap; |
| 213 | 213 |
| 214 void set_ideal_bounds(int index, const gfx::Rect& bounds) { | 214 void set_ideal_bounds(int index, const gfx::Rect& bounds) { |
| 215 tabs_.set_ideal_bounds(index, bounds); | 215 tabs_.set_ideal_bounds(index, bounds); |
| 216 } | 216 } |
| 217 | 217 |
| 218 // Returns the number of mini-tabs. | 218 // Returns the number of mini-tabs. |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 | 445 |
| 446 // Starts various types of TabStrip animations. | 446 // Starts various types of TabStrip animations. |
| 447 void StartResizeLayoutAnimation(); | 447 void StartResizeLayoutAnimation(); |
| 448 void StartMiniTabAnimation(); | 448 void StartMiniTabAnimation(); |
| 449 void StartMouseInitiatedRemoveTabAnimation(int model_index); | 449 void StartMouseInitiatedRemoveTabAnimation(int model_index); |
| 450 | 450 |
| 451 // Returns true if the specified point in TabStrip coords is within the | 451 // Returns true if the specified point in TabStrip coords is within the |
| 452 // hit-test region of the specified Tab. | 452 // hit-test region of the specified Tab. |
| 453 bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords); | 453 bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords); |
| 454 | 454 |
| 455 // Returns true if the specified rect in TabStrip coords intersects the |
| 456 // hit-test region of the specified Tab. |
| 457 bool IsRectInTab(Tab* tab, const gfx::Rect& rect_in_tabstrip_coords); |
| 458 |
| 455 // -- Touch Layout ---------------------------------------------------------- | 459 // -- Touch Layout ---------------------------------------------------------- |
| 456 | 460 |
| 457 // Returns the position normal tabs start at. | 461 // Returns the position normal tabs start at. |
| 458 int GetStartXForNormalTabs() const; | 462 int GetStartXForNormalTabs() const; |
| 459 | 463 |
| 460 // Returns the tab to use for event handling. This uses FindTabForEventFrom() | 464 // Returns the tab to use for event handling. This uses FindTabForEventFrom() |
| 461 // to do the actual searching. | 465 // to do the actual searching. |
| 466 // TODO: Deprecate |
| 462 Tab* FindTabForEvent(const gfx::Point& point); | 467 Tab* FindTabForEvent(const gfx::Point& point); |
| 463 | 468 |
| 469 // Returns the tab to use for event handling. This uses FindTabForEventFrom() |
| 470 // to do the actual searching. |
| 471 Tab* FindTabForEvent(const gfx::Rect& rect); |
| 472 |
| 464 // Returns the tab to use for event handling starting at index |start| and | 473 // Returns the tab to use for event handling starting at index |start| and |
| 465 // iterating by |delta|. | 474 // iterating by |delta|. |
| 475 // TODO: Deprecate |
| 466 Tab* FindTabForEventFrom(const gfx::Point& point, int start, int delta); | 476 Tab* FindTabForEventFrom(const gfx::Point& point, int start, int delta); |
| 467 | 477 |
| 478 // Returns the tab to use for event handling starting at index |start| and |
| 479 // iterating by |delta|. |
| 480 Tab* FindTabForEventFrom(const gfx::Rect& rect, int start, int delta); |
| 481 |
| 468 // Returns the x-coordinates of the tabs. | 482 // Returns the x-coordinates of the tabs. |
| 469 std::vector<int> GetTabXCoordinates(); | 483 std::vector<int> GetTabXCoordinates(); |
| 470 | 484 |
| 471 // Creates/Destroys |touch_layout_| as necessary. | 485 // Creates/Destroys |touch_layout_| as necessary. |
| 472 void SwapLayoutIfNecessary(); | 486 void SwapLayoutIfNecessary(); |
| 473 | 487 |
| 474 // Returns true if |touch_layout_| is needed. | 488 // Returns true if |touch_layout_| is needed. |
| 475 bool NeedsTouchLayout() const; | 489 bool NeedsTouchLayout() const; |
| 476 | 490 |
| 477 // Sets the value of |reset_to_shrink_on_exit_|. If true |mouse_watcher_| is | 491 // Sets the value of |reset_to_shrink_on_exit_|. If true |mouse_watcher_| is |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 int mouse_move_count_; | 582 int mouse_move_count_; |
| 569 | 583 |
| 570 // Timer used when a tab is closed and we need to relayout. Only used when a | 584 // Timer used when a tab is closed and we need to relayout. Only used when a |
| 571 // tab close comes from a touch device. | 585 // tab close comes from a touch device. |
| 572 base::OneShotTimer<TabStrip> resize_layout_timer_; | 586 base::OneShotTimer<TabStrip> resize_layout_timer_; |
| 573 | 587 |
| 574 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 588 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
| 575 }; | 589 }; |
| 576 | 590 |
| 577 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 591 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| OLD | NEW |