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 base::string16 GetAccessibleTabName(const Tab* tab) const override; | 238 base::string16 GetAccessibleTabName(const Tab* tab) const override; |
243 int GetBackgroundResourceId(bool* custom_image) const override; | 239 int GetBackgroundResourceId(bool* custom_image) const override; |
244 void UpdateTabAccessibilityState(const Tab* tab, | 240 void UpdateTabAccessibilityState(const Tab* tab, |
245 ui::AXNodeData* node_data) override; | 241 ui::AXNodeData* node_data) override; |
246 | 242 |
247 // MouseWatcherListener overrides: | 243 // MouseWatcherListener overrides: |
248 void MouseMovedOutOfHost() override; | 244 void MouseMovedOutOfHost() override; |
249 | 245 |
250 // views::View overrides: | 246 // views::View overrides: |
251 void Layout() override; | 247 void Layout() override; |
252 void PaintChildren(const ui::PaintContext& context) override; | 248 void PaintChildren(const ui::PaintContext& context) override; |
253 const char* GetClassName() const override; | 249 const char* GetClassName() const override; |
254 gfx::Size GetPreferredSize() const override; | 250 gfx::Size GetPreferredSize() const override; |
255 // NOTE: the drag and drop methods are invoked from FrameView. This is done | 251 // NOTE: the drag and drop methods are invoked from FrameView. This is done |
256 // to allow for a drop region that extends outside the bounds of the TabStrip. | 252 // to allow for a drop region that extends outside the bounds of the TabStrip. |
257 void OnDragEntered(const ui::DropTargetEvent& event) override; | 253 void OnDragEntered(const ui::DropTargetEvent& event) override; |
258 int OnDragUpdated(const ui::DropTargetEvent& event) override; | 254 int OnDragUpdated(const ui::DropTargetEvent& event) override; |
259 void OnDragExited() override; | 255 void OnDragExited() override; |
260 int OnPerformDrop(const ui::DropTargetEvent& event) override; | 256 int OnPerformDrop(const ui::DropTargetEvent& event) override; |
261 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 257 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
262 views::View* GetTooltipHandlerForPoint(const gfx::Point& point) override; | 258 views::View* GetTooltipHandlerForPoint(const gfx::Point& point) override; |
263 | 259 |
264 // Returns preferred height in immersive style. | |
265 static int GetImmersiveHeight(); | |
266 | |
267 private: | 260 private: |
268 typedef std::vector<Tab*> Tabs; | 261 typedef std::vector<Tab*> Tabs; |
269 typedef std::map<int, Tabs> TabsClosingMap; | 262 typedef std::map<int, Tabs> TabsClosingMap; |
270 typedef std::pair<TabsClosingMap::iterator, | 263 typedef std::pair<TabsClosingMap::iterator, |
271 Tabs::iterator> FindClosingTabResult; | 264 Tabs::iterator> FindClosingTabResult; |
272 | 265 |
273 class RemoveTabDelegate; | 266 class RemoveTabDelegate; |
274 | 267 |
275 friend class TabDragController; | 268 friend class TabDragController; |
276 friend class TabDragControllerTest; | 269 friend class TabDragControllerTest; |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 // Time of the last mouse move event. | 636 // Time of the last mouse move event. |
644 base::TimeTicks last_mouse_move_time_; | 637 base::TimeTicks last_mouse_move_time_; |
645 | 638 |
646 // Number of mouse moves. | 639 // Number of mouse moves. |
647 int mouse_move_count_; | 640 int mouse_move_count_; |
648 | 641 |
649 // Timer used when a tab is closed and we need to relayout. Only used when a | 642 // Timer used when a tab is closed and we need to relayout. Only used when a |
650 // tab close comes from a touch device. | 643 // tab close comes from a touch device. |
651 base::OneShotTimer resize_layout_timer_; | 644 base::OneShotTimer resize_layout_timer_; |
652 | 645 |
653 // True if tabs are painted as rectangular light-bars. | |
654 bool immersive_style_; | |
655 | |
656 // Our observers. | 646 // Our observers. |
657 typedef base::ObserverList<TabStripObserver> TabStripObservers; | 647 typedef base::ObserverList<TabStripObserver> TabStripObservers; |
658 TabStripObservers observers_; | 648 TabStripObservers observers_; |
659 | 649 |
660 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 650 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
661 }; | 651 }; |
662 | 652 |
663 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 653 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
OLD | NEW |