| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 462 |
| 463 // Starts various types of TabStrip animations. | 463 // Starts various types of TabStrip animations. |
| 464 void StartResizeLayoutAnimation(); | 464 void StartResizeLayoutAnimation(); |
| 465 void StartMiniTabAnimation(); | 465 void StartMiniTabAnimation(); |
| 466 void StartMouseInitiatedRemoveTabAnimation(int model_index); | 466 void StartMouseInitiatedRemoveTabAnimation(int model_index); |
| 467 | 467 |
| 468 // Returns true if the specified point in TabStrip coords is within the | 468 // Returns true if the specified point in TabStrip coords is within the |
| 469 // hit-test region of the specified Tab. | 469 // hit-test region of the specified Tab. |
| 470 bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords); | 470 bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords); |
| 471 | 471 |
| 472 // Returns true if the specified rect in TabStrip coords intersects the |
| 473 // hit-test region of the specified Tab. |
| 474 bool IsRectInTab(Tab* tab, const gfx::Rect& rect_in_tabstrip_coords); |
| 475 |
| 472 // -- Touch Layout ---------------------------------------------------------- | 476 // -- Touch Layout ---------------------------------------------------------- |
| 473 | 477 |
| 474 // Returns the position normal tabs start at. | 478 // Returns the position normal tabs start at. |
| 475 int GetStartXForNormalTabs() const; | 479 int GetStartXForNormalTabs() const; |
| 476 | 480 |
| 477 // Returns the tab to use for event handling. This uses FindTabForEventFrom() | 481 // Returns the tab to use for event handling. This uses FindTabForEventFrom() |
| 478 // to do the actual searching. | 482 // to do the actual searching. |
| 483 // TODO: Deprecate |
| 479 Tab* FindTabForEvent(const gfx::Point& point); | 484 Tab* FindTabForEvent(const gfx::Point& point); |
| 480 | 485 |
| 486 // Returns the tab to use for event handling. This uses FindTabForEventFrom() |
| 487 // to do the actual searching. |
| 488 Tab* FindTabForEvent(const gfx::Rect& rect); |
| 489 |
| 481 // Returns the tab to use for event handling starting at index |start| and | 490 // Returns the tab to use for event handling starting at index |start| and |
| 482 // iterating by |delta|. | 491 // iterating by |delta|. |
| 492 // TODO: Deprecate |
| 483 Tab* FindTabForEventFrom(const gfx::Point& point, int start, int delta); | 493 Tab* FindTabForEventFrom(const gfx::Point& point, int start, int delta); |
| 484 | 494 |
| 495 // Returns the tab to use for event handling starting at index |start| and |
| 496 // iterating by |delta|. |
| 497 Tab* FindTabForEventFrom(const gfx::Rect& rect, int start, int delta); |
| 498 |
| 485 // Returns the x-coordinates of the tabs. | 499 // Returns the x-coordinates of the tabs. |
| 486 std::vector<int> GetTabXCoordinates(); | 500 std::vector<int> GetTabXCoordinates(); |
| 487 | 501 |
| 488 // Creates/Destroys |touch_layout_| as necessary. | 502 // Creates/Destroys |touch_layout_| as necessary. |
| 489 void SwapLayoutIfNecessary(); | 503 void SwapLayoutIfNecessary(); |
| 490 | 504 |
| 491 // Returns true if |touch_layout_| is needed. | 505 // Returns true if |touch_layout_| is needed. |
| 492 bool NeedsTouchLayout() const; | 506 bool NeedsTouchLayout() const; |
| 493 | 507 |
| 494 // Sets the value of |reset_to_shrink_on_exit_|. If true |mouse_watcher_| is | 508 // 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... |
| 585 int mouse_move_count_; | 599 int mouse_move_count_; |
| 586 | 600 |
| 587 // Timer used when a tab is closed and we need to relayout. Only used when a | 601 // Timer used when a tab is closed and we need to relayout. Only used when a |
| 588 // tab close comes from a touch device. | 602 // tab close comes from a touch device. |
| 589 base::OneShotTimer<TabStrip> resize_layout_timer_; | 603 base::OneShotTimer<TabStrip> resize_layout_timer_; |
| 590 | 604 |
| 591 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 605 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
| 592 }; | 606 }; |
| 593 | 607 |
| 594 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 608 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| OLD | NEW |