Chromium Code Reviews| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 // in response to dragged tabs. | 49 // in response to dragged tabs. |
| 50 // | 50 // |
| 51 /////////////////////////////////////////////////////////////////////////////// | 51 /////////////////////////////////////////////////////////////////////////////// |
| 52 class TabStrip : public views::View, | 52 class TabStrip : public views::View, |
| 53 public views::ButtonListener, | 53 public views::ButtonListener, |
| 54 public views::MouseWatcherListener, | 54 public views::MouseWatcherListener, |
| 55 public TabController { | 55 public TabController { |
| 56 public: | 56 public: |
| 57 static const char kViewClassName[]; | 57 static const char kViewClassName[]; |
| 58 | 58 |
| 59 // Horizontal offset for the new tab button to bring it closer to the | |
| 60 // rightmost tab. | |
| 61 static const int kNewTabButtonHorizontalOffset; | |
| 62 | |
| 63 // The vertical offset of the tab strip button. This offset applies only to | |
| 64 // restored windows. | |
| 65 static const int kNewTabButtonVerticalOffset; | |
| 66 | |
| 59 explicit TabStrip(TabStripController* controller); | 67 explicit TabStrip(TabStripController* controller); |
| 60 virtual ~TabStrip(); | 68 virtual ~TabStrip(); |
| 61 | 69 |
| 62 // Add and remove observers to changes within this TabStrip. | 70 // Add and remove observers to changes within this TabStrip. |
| 63 void AddObserver(TabStripObserver* observer); | 71 void AddObserver(TabStripObserver* observer); |
| 64 void RemoveObserver(TabStripObserver* observer); | 72 void RemoveObserver(TabStripObserver* observer); |
| 65 | 73 |
| 66 // If |adjust_layout| is true the stacked layout changes based on whether the | 74 // If |adjust_layout| is true the stacked layout changes based on whether the |
| 67 // user uses a mouse or a touch device with the tabstrip. | 75 // user uses a mouse or a touch device with the tabstrip. |
| 68 void set_adjust_layout(bool adjust_layout) { adjust_layout_ = adjust_layout; } | 76 void set_adjust_layout(bool adjust_layout) { adjust_layout_ = adjust_layout; } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 | 126 |
| 119 // Invoked when the title of a tab changes and the tab isn't loading. | 127 // Invoked when the title of a tab changes and the tab isn't loading. |
| 120 void TabTitleChangedNotLoading(int model_index); | 128 void TabTitleChangedNotLoading(int model_index); |
| 121 | 129 |
| 122 // Retrieves the ideal bounds for the Tab at the specified index. | 130 // Retrieves the ideal bounds for the Tab at the specified index. |
| 123 const gfx::Rect& ideal_bounds(int tab_data_index) { | 131 const gfx::Rect& ideal_bounds(int tab_data_index) { |
| 124 return tabs_.ideal_bounds(tab_data_index); | 132 return tabs_.ideal_bounds(tab_data_index); |
| 125 } | 133 } |
| 126 | 134 |
| 127 // Returns the Tab at |index|. | 135 // Returns the Tab at |index|. |
| 128 Tab* tab_at(int index) const; | 136 Tab* tab_at(int index) const { |
| 137 return static_cast<Tab*>(tabs_.view_at(index)); | |
| 138 } | |
| 129 | 139 |
| 130 // Returns the index of the specified tab in the model coordinate system, or | 140 // Returns the index of the specified tab in the model coordinate system, or |
| 131 // -1 if tab is closing or not valid. | 141 // -1 if tab is closing or not valid. |
| 132 int GetModelIndexOfTab(const Tab* tab) const; | 142 int GetModelIndexOfTab(const Tab* tab) const; |
| 133 | 143 |
| 134 // Gets the number of Tabs in the tab strip. | 144 // Gets the number of Tabs in the tab strip. |
| 135 int tab_count() const { return tabs_.view_size(); } | 145 int tab_count() const { return tabs_.view_size(); } |
| 136 | 146 |
| 137 // Cover method for TabStripController::GetCount. | 147 // Cover method for TabStripController::GetCount. |
| 138 int GetModelCount() const; | 148 int GetModelCount() const; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 165 // window caption area of the browser window. | 175 // window caption area of the browser window. |
| 166 bool IsPositionInWindowCaption(const gfx::Point& point); | 176 bool IsPositionInWindowCaption(const gfx::Point& point); |
| 167 | 177 |
| 168 // Returns true if the specified rect (in TabStrip coordinates) intersects | 178 // Returns true if the specified rect (in TabStrip coordinates) intersects |
| 169 // the window caption area of the browser window. | 179 // the window caption area of the browser window. |
| 170 bool IsRectInWindowCaption(const gfx::Rect& rect); | 180 bool IsRectInWindowCaption(const gfx::Rect& rect); |
| 171 | 181 |
| 172 // Set the background offset used by inactive tabs to match the frame image. | 182 // Set the background offset used by inactive tabs to match the frame image. |
| 173 void SetBackgroundOffset(const gfx::Point& offset); | 183 void SetBackgroundOffset(const gfx::Point& offset); |
| 174 | 184 |
| 175 // Returns the new tab button. This is never NULL. | |
| 176 views::View* newtab_button(); | |
| 177 | |
| 178 // Sets a painting style with miniature "tab indicator" rectangles at the top. | 185 // Sets a painting style with miniature "tab indicator" rectangles at the top. |
| 179 void SetImmersiveStyle(bool enable); | 186 void SetImmersiveStyle(bool enable); |
| 180 | 187 |
| 181 // Returns true if Tabs in this TabStrip are currently changing size or | 188 // Returns true if Tabs in this TabStrip are currently changing size or |
| 182 // position. | 189 // position. |
| 183 bool IsAnimating() const; | 190 bool IsAnimating() const; |
| 184 | 191 |
| 185 // Stops any ongoing animations. If |layout| is true and an animation is | 192 // Stops any ongoing animations. If |layout| is true and an animation is |
| 186 // ongoing this does a layout. | 193 // ongoing this does a layout. |
| 187 void StopAnimating(bool layout); | 194 void StopAnimating(bool layout); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 virtual void OnDragExited() OVERRIDE; | 240 virtual void OnDragExited() OVERRIDE; |
| 234 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; | 241 virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE; |
| 235 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 242 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
| 236 virtual views::View* GetEventHandlerForRect(const gfx::Rect& rect) OVERRIDE; | 243 virtual views::View* GetEventHandlerForRect(const gfx::Rect& rect) OVERRIDE; |
| 237 virtual views::View* GetTooltipHandlerForPoint( | 244 virtual views::View* GetTooltipHandlerForPoint( |
| 238 const gfx::Point& point) OVERRIDE; | 245 const gfx::Point& point) OVERRIDE; |
| 239 | 246 |
| 240 // Returns preferred height in immersive style. | 247 // Returns preferred height in immersive style. |
| 241 static int GetImmersiveHeight(); | 248 static int GetImmersiveHeight(); |
| 242 | 249 |
| 243 protected: | |
| 244 // Horizontal gap between mini and non-mini-tabs. | |
| 245 static const int kMiniToNonMiniGap; | |
| 246 | |
| 247 void set_ideal_bounds(int index, const gfx::Rect& bounds) { | |
| 248 tabs_.set_ideal_bounds(index, bounds); | |
| 249 } | |
| 250 | |
| 251 // Returns the number of mini-tabs. | |
| 252 int GetMiniTabCount() const; | |
| 253 | |
| 254 // views::ButtonListener implementation: | |
| 255 virtual void ButtonPressed(views::Button* sender, | |
| 256 const ui::Event& event) OVERRIDE; | |
| 257 | |
| 258 // View overrides. | |
| 259 virtual const views::View* GetViewByID(int id) const OVERRIDE; | |
| 260 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | |
| 261 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | |
| 262 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | |
| 263 virtual void OnMouseCaptureLost() OVERRIDE; | |
| 264 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; | |
| 265 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | |
| 266 | |
| 267 // ui::EventHandler overrides. | |
| 268 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | |
| 269 | |
| 270 private: | 250 private: |
| 271 typedef std::map<int, std::vector<Tab*> > TabsClosingMap; | 251 typedef std::vector<Tab*> Tabs; |
| 252 typedef std::map<int, Tabs> TabsClosingMap; | |
| 253 typedef std::pair<TabsClosingMap::iterator, | |
| 254 Tabs::iterator> FindClosingTabResult; | |
| 272 | 255 |
| 273 class RemoveTabDelegate; | 256 class RemoveTabDelegate; |
| 274 | 257 |
| 275 friend class TabDragController; | 258 friend class TabDragController; |
| 276 friend class TabDragControllerTest; | 259 friend class TabDragControllerTest; |
| 277 FRIEND_TEST_ALL_PREFIXES(TabDragControllerTest, GestureEndShouldEndDragTest); | 260 FRIEND_TEST_ALL_PREFIXES(TabDragControllerTest, GestureEndShouldEndDragTest); |
| 278 friend class TabStripTest; | 261 friend class TabStripTest; |
| 279 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); | 262 FRIEND_TEST_ALL_PREFIXES(TabStripTest, TabHitTestMaskWhenStacked); |
| 280 FRIEND_TEST_ALL_PREFIXES(TabStripTest, ClippedTabCloseButton); | 263 FRIEND_TEST_ALL_PREFIXES(TabStripTest, ClippedTabCloseButton); |
| 281 | 264 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 307 // The URL for the drop event. | 290 // The URL for the drop event. |
| 308 GURL url; | 291 GURL url; |
| 309 | 292 |
| 310 // Whether the MIME type of the file pointed to by |url| is supported. | 293 // Whether the MIME type of the file pointed to by |url| is supported. |
| 311 bool file_supported; | 294 bool file_supported; |
| 312 | 295 |
| 313 private: | 296 private: |
| 314 DISALLOW_COPY_AND_ASSIGN(DropInfo); | 297 DISALLOW_COPY_AND_ASSIGN(DropInfo); |
| 315 }; | 298 }; |
| 316 | 299 |
| 300 // Horizontal gap between mini and non-mini-tabs. | |
| 301 static const int kMiniToNonMiniGap; | |
| 302 | |
| 303 // The size of the new tab button must be hardcoded because we need to be | |
| 304 // able to lay it out before we are able to get its image from the | |
| 305 // ui::ThemeProvider. It also makes sense to do this, because the size of the | |
| 306 // new tab button should not need to be calculated dynamically. | |
| 307 static const int kNewTabButtonAssetWidth; | |
| 308 static const int kNewTabButtonAssetHeight; | |
| 309 | |
| 317 void Init(); | 310 void Init(); |
| 318 | 311 |
| 319 // Creates and returns a new tab. The caller owners the returned tab. | 312 // Creates and returns a new tab. The caller owners the returned tab. |
| 320 Tab* CreateTab(); | 313 Tab* CreateTab(); |
| 321 | 314 |
| 322 // Invoked from |AddTabAt| after the newly created tab has been inserted. | 315 // Invoked from |AddTabAt| after the newly created tab has been inserted. |
| 323 void StartInsertTabAnimation(int model_index); | 316 void StartInsertTabAnimation(int model_index); |
| 324 | 317 |
| 325 // Invoked from |MoveTab| after |tab_data_| has been updated to animate the | 318 // Invoked from |MoveTab| after |tab_data_| has been updated to animate the |
| 326 // move. | 319 // move. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 345 void DoLayout(); | 338 void DoLayout(); |
| 346 | 339 |
| 347 // Drags the active tab by |delta|. |initial_positions| is the x-coordinates | 340 // Drags the active tab by |delta|. |initial_positions| is the x-coordinates |
| 348 // of the tabs when the drag started. | 341 // of the tabs when the drag started. |
| 349 void DragActiveTab(const std::vector<int>& initial_positions, int delta); | 342 void DragActiveTab(const std::vector<int>& initial_positions, int delta); |
| 350 | 343 |
| 351 // Sets the ideal bounds x-coordinates to |positions|. | 344 // Sets the ideal bounds x-coordinates to |positions|. |
| 352 void SetIdealBoundsFromPositions(const std::vector<int>& positions); | 345 void SetIdealBoundsFromPositions(const std::vector<int>& positions); |
| 353 | 346 |
| 354 // Stacks the dragged tabs. This is used if the drag operation is | 347 // Stacks the dragged tabs. This is used if the drag operation is |
| 355 // MOVE_VISIBILE_TABS and the tabs don't fill the tabstrip. When this happens | 348 // MOVE_VISIBLE_TABS and the tabs don't fill the tabstrip. When this happens |
| 356 // the active tab follows the mouse and the other tabs stack around it. | 349 // the active tab follows the mouse and the other tabs stack around it. |
| 357 void StackDraggedTabs(int delta); | 350 void StackDraggedTabs(int delta); |
| 358 | 351 |
| 359 // Returns true if dragging has resulted in temporarily stacking the tabs. | 352 // Returns true if dragging has resulted in temporarily stacking the tabs. |
| 360 bool IsStackingDraggedTabs() const; | 353 bool IsStackingDraggedTabs() const; |
| 361 | 354 |
| 362 // Invoked during drag to layout the tabs being dragged in |tabs| at | 355 // Invoked during drag to layout the tabs being dragged in |tabs| at |
| 363 // |location|. If |initial_drag| is true, this is the initial layout after the | 356 // |location|. If |initial_drag| is true, this is the initial layout after the |
| 364 // user moved the mouse far enough to trigger a drag. | 357 // user moved the mouse far enough to trigger a drag. |
| 365 void LayoutDraggedTabsAt(const std::vector<Tab*>& tabs, | 358 void LayoutDraggedTabsAt(const Tabs& tabs, |
| 366 Tab* active_tab, | 359 Tab* active_tab, |
| 367 const gfx::Point& location, | 360 const gfx::Point& location, |
| 368 bool initial_drag); | 361 bool initial_drag); |
| 369 | 362 |
| 370 // Calculates the bounds needed for each of the tabs, placing the result in | 363 // Calculates the bounds needed for each of the tabs, placing the result in |
| 371 // |bounds|. | 364 // |bounds|. |
| 372 void CalculateBoundsForDraggedTabs(const std::vector<Tab*>& tabs, | 365 void CalculateBoundsForDraggedTabs(const Tabs& tabs, |
| 373 std::vector<gfx::Rect>* bounds); | 366 std::vector<gfx::Rect>* bounds); |
| 374 | 367 |
| 375 // Returns the size needed for the specified tabs. This is invoked during drag | 368 // Returns the size needed for the specified tabs. This is invoked during drag |
| 376 // and drop to calculate offsets and positioning. | 369 // and drop to calculate offsets and positioning. |
| 377 int GetSizeNeededForTabs(const std::vector<Tab*>& tabs); | 370 int GetSizeNeededForTabs(const Tabs& tabs); |
| 371 | |
| 372 // Returns the number of mini-tabs. | |
| 373 int GetMiniTabCount() const; | |
| 374 | |
| 375 // Returns the last tab in the strip. | |
| 376 const Tab* GetLastVisibleTab() const; | |
|
Peter Kasting
2014/06/17 03:16:18
In the future, this function will also check tab v
| |
| 378 | 377 |
| 379 // Adds the tab at |index| to |tabs_closing_map_| and removes the tab from | 378 // Adds the tab at |index| to |tabs_closing_map_| and removes the tab from |
| 380 // |tabs_|. | 379 // |tabs_|. |
| 381 void RemoveTabFromViewModel(int index); | 380 void RemoveTabFromViewModel(int index); |
| 382 | 381 |
| 383 // Cleans up the Tab from the TabStrip. This is called from the tab animation | 382 // Cleans up the Tab from the TabStrip. This is called from the tab animation |
| 384 // code and is not a general-purpose method. | 383 // code and is not a general-purpose method. |
| 385 void RemoveAndDeleteTab(Tab* tab); | 384 void RemoveAndDeleteTab(Tab* tab); |
| 386 | 385 |
| 387 // Adjusts the indices of all tabs in |tabs_closing_map_| whose index is | 386 // Adjusts the indices of all tabs in |tabs_closing_map_| whose index is |
| 388 // >= |index| to have a new index of |index + delta|. | 387 // >= |index| to have a new index of |index + delta|. |
| 389 void UpdateTabsClosingMap(int index, int delta); | 388 void UpdateTabsClosingMap(int index, int delta); |
| 390 | 389 |
| 391 // Used by TabDragController when the user starts or stops dragging tabs. | 390 // Used by TabDragController when the user starts or stops dragging tabs. |
| 392 void StartedDraggingTabs(const std::vector<Tab*>& tabs); | 391 void StartedDraggingTabs(const Tabs& tabs); |
| 393 | 392 |
| 394 // Invoked when TabDragController detaches a set of tabs. | 393 // Invoked when TabDragController detaches a set of tabs. |
| 395 void DraggedTabsDetached(); | 394 void DraggedTabsDetached(); |
| 396 | 395 |
| 397 // Used by TabDragController when the user stops dragging tabs. |move_only| is | 396 // Used by TabDragController when the user stops dragging tabs. |move_only| is |
| 398 // true if the move behavior is TabDragController::MOVE_VISIBILE_TABS. | 397 // true if the move behavior is TabDragController::MOVE_VISIBILE_TABS. |
| 399 // |completed| is true if the drag operation completed successfully, false if | 398 // |completed| is true if the drag operation completed successfully, false if |
| 400 // it was reverted. | 399 // it was reverted. |
| 401 void StoppedDraggingTabs(const std::vector<Tab*>& tabs, | 400 void StoppedDraggingTabs(const Tabs& tabs, |
| 402 const std::vector<int>& initial_positions, | 401 const std::vector<int>& initial_positions, |
| 403 bool move_only, | 402 bool move_only, |
| 404 bool completed); | 403 bool completed); |
| 405 | 404 |
| 406 // Invoked from StoppedDraggingTabs to cleanup |tab|. If |tab| is known | 405 // Invoked from StoppedDraggingTabs to cleanup |tab|. If |tab| is known |
| 407 // |is_first_tab| is set to true. | 406 // |is_first_tab| is set to true. |
| 408 void StoppedDraggingTab(Tab* tab, bool* is_first_tab); | 407 void StoppedDraggingTab(Tab* tab, bool* is_first_tab); |
| 409 | 408 |
| 410 // Takes ownership of |controller|. | 409 // Takes ownership of |controller|. |
| 411 void OwnDragController(TabDragController* controller); | 410 void OwnDragController(TabDragController* controller); |
| 412 | 411 |
| 413 // Destroys the current TabDragController. This cancel the existing drag | 412 // Destroys the current TabDragController. This cancel the existing drag |
| 414 // operation. | 413 // operation. |
| 415 void DestroyDragController(); | 414 void DestroyDragController(); |
| 416 | 415 |
| 417 // Releases ownership of the current TabDragController. | 416 // Releases ownership of the current TabDragController. |
| 418 TabDragController* ReleaseDragController(); | 417 TabDragController* ReleaseDragController(); |
| 419 | 418 |
| 419 // Finds |tab| in the |tab_closing_map_| and returns a pair of iterators | |
| 420 // indicating precisely where it is. | |
| 421 FindClosingTabResult FindClosingTab(const Tab* tab); | |
| 422 | |
| 420 // Paints all the tabs in |tabs_closing_map_[index]|. | 423 // Paints all the tabs in |tabs_closing_map_[index]|. |
| 421 void PaintClosingTabs(gfx::Canvas* canvas, | 424 void PaintClosingTabs(gfx::Canvas* canvas, |
| 422 int index, | 425 int index, |
| 423 const views::CullSet& cull_set); | 426 const views::CullSet& cull_set); |
| 424 | 427 |
| 425 // Invoked when a mouse event occurs over |source|. Potentially switches the | 428 // Invoked when a mouse event occurs over |source|. Potentially switches the |
| 426 // |stacked_layout_|. | 429 // |stacked_layout_|. |
| 427 void UpdateStackedLayoutFromMouseEvent(views::View* source, | 430 void UpdateStackedLayoutFromMouseEvent(views::View* source, |
| 428 const ui::MouseEvent& event); | 431 const ui::MouseEvent& event); |
| 429 | 432 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 // Generates the ideal bounds for each of the tabs as well as the new tab | 494 // Generates the ideal bounds for each of the tabs as well as the new tab |
| 492 // button. | 495 // button. |
| 493 void GenerateIdealBounds(); | 496 void GenerateIdealBounds(); |
| 494 | 497 |
| 495 // Generates the ideal bounds for the mini tabs. Returns the index to position | 498 // Generates the ideal bounds for the mini tabs. Returns the index to position |
| 496 // the first non-mini tab and sets |first_non_mini_index| to the index of the | 499 // the first non-mini tab and sets |first_non_mini_index| to the index of the |
| 497 // first non-mini tab. | 500 // first non-mini tab. |
| 498 int GenerateIdealBoundsForMiniTabs(int* first_non_mini_index); | 501 int GenerateIdealBoundsForMiniTabs(int* first_non_mini_index); |
| 499 | 502 |
| 500 // Returns the width needed for the new tab button (and padding). | 503 // Returns the width needed for the new tab button (and padding). |
| 501 static int new_tab_button_width(); | 504 static int new_tab_button_width() { |
| 502 | 505 return kNewTabButtonAssetWidth + kNewTabButtonHorizontalOffset; |
| 503 // Returns the vertical offset of the tab strip button. This offset applies | 506 } |
| 504 // only to restored windows. | |
| 505 static int button_v_offset(); | |
| 506 | 507 |
| 507 // Returns the width of the area that contains tabs. This does not include | 508 // Returns the width of the area that contains tabs. This does not include |
| 508 // the width of the new tab button. | 509 // the width of the new tab button. |
| 509 int tab_area_width() const; | 510 int tab_area_width() const { return width() - new_tab_button_width(); } |
| 510 | 511 |
| 511 // Starts various types of TabStrip animations. | 512 // Starts various types of TabStrip animations. |
| 512 void StartResizeLayoutAnimation(); | 513 void StartResizeLayoutAnimation(); |
| 513 void StartMiniTabAnimation(); | 514 void StartMiniTabAnimation(); |
| 514 void StartMouseInitiatedRemoveTabAnimation(int model_index); | 515 void StartMouseInitiatedRemoveTabAnimation(int model_index); |
| 515 | 516 |
| 516 // Returns true if the specified point in TabStrip coords is within the | 517 // Returns true if the specified point in TabStrip coords is within the |
| 517 // hit-test region of the specified Tab. | 518 // hit-test region of the specified Tab. |
| 518 bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords); | 519 bool IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords); |
| 519 | 520 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 544 void SwapLayoutIfNecessary(); | 545 void SwapLayoutIfNecessary(); |
| 545 | 546 |
| 546 // Returns true if |touch_layout_| is needed. | 547 // Returns true if |touch_layout_| is needed. |
| 547 bool NeedsTouchLayout() const; | 548 bool NeedsTouchLayout() const; |
| 548 | 549 |
| 549 // Sets the value of |reset_to_shrink_on_exit_|. If true |mouse_watcher_| is | 550 // Sets the value of |reset_to_shrink_on_exit_|. If true |mouse_watcher_| is |
| 550 // used to track when the mouse truly exits the tabstrip and the stacked | 551 // used to track when the mouse truly exits the tabstrip and the stacked |
| 551 // layout is reset. | 552 // layout is reset. |
| 552 void SetResetToShrinkOnExit(bool value); | 553 void SetResetToShrinkOnExit(bool value); |
| 553 | 554 |
| 555 // views::ButtonListener implementation: | |
| 556 virtual void ButtonPressed(views::Button* sender, | |
| 557 const ui::Event& event) OVERRIDE; | |
| 558 | |
| 559 // View overrides. | |
| 560 virtual const views::View* GetViewByID(int id) const OVERRIDE; | |
| 561 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | |
| 562 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | |
| 563 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | |
| 564 virtual void OnMouseCaptureLost() OVERRIDE; | |
| 565 virtual void OnMouseMoved(const ui::MouseEvent& event) OVERRIDE; | |
| 566 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | |
| 567 | |
| 568 // ui::EventHandler overrides. | |
| 569 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | |
| 570 | |
| 554 // -- Member Variables ------------------------------------------------------ | 571 // -- Member Variables ------------------------------------------------------ |
| 555 | 572 |
| 556 // There is a one-to-one mapping between each of the tabs in the | 573 // There is a one-to-one mapping between each of the tabs in the |
| 557 // TabStripController (TabStripModel) and |tabs_|. Because we animate tab | 574 // TabStripController (TabStripModel) and |tabs_|. Because we animate tab |
| 558 // removal there exists a period of time where a tab is displayed but not in | 575 // removal there exists a period of time where a tab is displayed but not in |
| 559 // the model. When this occurs the tab is removed from |tabs_| and placed in | 576 // the model. When this occurs the tab is removed from |tabs_| and placed in |
| 560 // |tabs_closing_map_|. When the animation completes the tab is removed from | 577 // |tabs_closing_map_|. When the animation completes the tab is removed from |
| 561 // |tabs_closing_map_|. The painting code ensures both sets of tabs are | 578 // |tabs_closing_map_|. The painting code ensures both sets of tabs are |
| 562 // painted, and the event handling code ensures only tabs in |tabs_| are used. | 579 // painted, and the event handling code ensures only tabs in |tabs_| are used. |
| 563 views::ViewModel tabs_; | 580 views::ViewModel tabs_; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 bool immersive_style_; | 660 bool immersive_style_; |
| 644 | 661 |
| 645 // Our observers. | 662 // Our observers. |
| 646 typedef ObserverList<TabStripObserver> TabStripObservers; | 663 typedef ObserverList<TabStripObserver> TabStripObservers; |
| 647 TabStripObservers observers_; | 664 TabStripObservers observers_; |
| 648 | 665 |
| 649 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 666 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
| 650 }; | 667 }; |
| 651 | 668 |
| 652 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 669 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| OLD | NEW |