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. | 260 // A set method to update whether tabstrip is on offscreen state, this could |
265 static int GetImmersiveHeight(); | 261 // happen when browser window is in immersive fullscreen unrevealed state. |
| 262 void set_offscreen(bool offscreen) { offscreen_ = offscreen; } |
266 | 263 |
267 private: | 264 private: |
268 typedef std::vector<Tab*> Tabs; | 265 typedef std::vector<Tab*> Tabs; |
269 typedef std::map<int, Tabs> TabsClosingMap; | 266 typedef std::map<int, Tabs> TabsClosingMap; |
270 typedef std::pair<TabsClosingMap::iterator, | 267 typedef std::pair<TabsClosingMap::iterator, |
271 Tabs::iterator> FindClosingTabResult; | 268 Tabs::iterator> FindClosingTabResult; |
272 | 269 |
273 class RemoveTabDelegate; | 270 class RemoveTabDelegate; |
274 | 271 |
275 friend class TabDragController; | 272 friend class TabDragController; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 // Time of the last mouse move event. | 640 // Time of the last mouse move event. |
644 base::TimeTicks last_mouse_move_time_; | 641 base::TimeTicks last_mouse_move_time_; |
645 | 642 |
646 // Number of mouse moves. | 643 // Number of mouse moves. |
647 int mouse_move_count_; | 644 int mouse_move_count_; |
648 | 645 |
649 // Timer used when a tab is closed and we need to relayout. Only used when a | 646 // Timer used when a tab is closed and we need to relayout. Only used when a |
650 // tab close comes from a touch device. | 647 // tab close comes from a touch device. |
651 base::OneShotTimer resize_layout_timer_; | 648 base::OneShotTimer resize_layout_timer_; |
652 | 649 |
653 // True if tabs are painted as rectangular light-bars. | 650 // True if tabstrip is completely offscreen, otherwise false. |
654 bool immersive_style_; | 651 bool offscreen_; |
655 | 652 |
656 // Our observers. | 653 // Our observers. |
657 typedef base::ObserverList<TabStripObserver> TabStripObservers; | 654 typedef base::ObserverList<TabStripObserver> TabStripObservers; |
658 TabStripObservers observers_; | 655 TabStripObservers observers_; |
659 | 656 |
660 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 657 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
661 }; | 658 }; |
662 | 659 |
663 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 660 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
OLD | NEW |