OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_SIDEBAR_SIDEBAR_TAB_STRIP_HOST_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_SIDEBAR_SIDEBAR_TAB_STRIP_HOST_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/scoped_ptr.h" |
| 10 #include "gfx/native_widget_types.h" |
| 11 |
| 12 class BrowserView; |
| 13 class SidebarBaseTabStrip; |
| 14 |
| 15 namespace gfx { |
| 16 class Rect; |
| 17 class Size; |
| 18 } |
| 19 |
| 20 namespace views { |
| 21 class View; |
| 22 class Widget; |
| 23 } |
| 24 |
| 25 // SidebarTabStripHost implements the container widget for the UI that |
| 26 // is shown on top of the browser contents. It uses the appropriate |
| 27 // implementation from sidebar_tab_strip_host_win.cc or |
| 28 // sidebar_tab_strip_host_gtk.cc to draw its content and is responsible |
| 29 // for showing, hiding and resizing the host widget and keeping widget shape |
| 30 // in sync with sidebar tab strip. |
| 31 class SidebarTabStripHost { |
| 32 public: |
| 33 explicit SidebarTabStripHost(BrowserView* browser_view); |
| 34 virtual ~SidebarTabStripHost(); |
| 35 |
| 36 // Initializes the dropdown bar host with the given view. |
| 37 void Init(SidebarBaseTabStrip* view); |
| 38 |
| 39 // Moves the widget to the provided location, moves it to top |
| 40 // in the z-order (HWND_TOP, not HWND_TOPMOST for windows) and shows |
| 41 // the widget if new_pos is not empty, hides it otherwise. |
| 42 virtual void SetPosition(const gfx::Rect& new_pos); |
| 43 |
| 44 // Updates host widget to match the shape of the tab strip. |
| 45 void UpdateWindowEdges(); |
| 46 |
| 47 // Returns the size of the widget's contents view. |
| 48 gfx::Size GetContentsSize() const; |
| 49 |
| 50 protected: |
| 51 // Returns the sidebar tab strip view. |
| 52 SidebarBaseTabStrip* view() const { return view_; } |
| 53 |
| 54 // Creates and returns the native Widget. |
| 55 views::Widget* CreateHost(); |
| 56 |
| 57 // Allows platform implementation to tweak widget position. |
| 58 void SetWidgetPositionNative(const gfx::Rect& new_pos, bool no_redraw); |
| 59 |
| 60 private: |
| 61 // The BrowserView that created us. |
| 62 BrowserView* const browser_view_; |
| 63 |
| 64 // Our view, which is responsible for drawing the UI. |
| 65 SidebarBaseTabStrip* view_; |
| 66 |
| 67 // Host widget. |
| 68 scoped_ptr<views::Widget> host_; |
| 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(SidebarTabStripHost); |
| 71 }; |
| 72 |
| 73 #endif // CHROME_BROWSER_UI_VIEWS_SIDEBAR_SIDEBAR_TAB_STRIP_HOST_H_ |
| 74 |
OLD | NEW |