[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 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_FRAME_BROWSER_FRAME_H_ | ||||
6 | #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_ | ||||
7 | #pragma once | ||||
8 | |||||
[email protected] | 883ce2f | 2011-03-14 23:53:45 | [diff] [blame] | 9 | #include "base/compiler_specific.h" |
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 10 | #include "base/logging.h" |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 11 | #include "build/build_config.h" |
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 12 | #include "chrome/browser/ui/views/frame/native_browser_frame_delegate.h" |
[email protected] | 2fdd00a | 2011-06-13 21:56:26 | [diff] [blame] | 13 | #include "views/widget/widget.h" |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 14 | |
[email protected] | 883ce2f | 2011-03-14 23:53:45 | [diff] [blame] | 15 | class AeroGlassNonClientView; |
16 | class BrowserNonClientFrameView; | ||||
17 | class BrowserRootView; | ||||
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 18 | class BrowserView; |
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 19 | class NativeBrowserFrame; |
[email protected] | 883ce2f | 2011-03-14 23:53:45 | [diff] [blame] | 20 | class NonClientFrameView; |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 21 | class Profile; |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 22 | |
23 | namespace gfx { | ||||
24 | class Font; | ||||
25 | class Rect; | ||||
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 26 | } |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 27 | |
[email protected] | 9dd7e3d7 | 2011-01-20 18:27:06 | [diff] [blame] | 28 | namespace ui { |
29 | class ThemeProvider; | ||||
30 | } | ||||
31 | |||||
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 32 | namespace views { |
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 33 | class View; |
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 34 | } |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 35 | |
36 | // This is a virtual interface that allows system specific browser frames. | ||||
[email protected] | 2fdd00a | 2011-06-13 21:56:26 | [diff] [blame] | 37 | class BrowserFrame : public views::Widget { |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 38 | public: |
[email protected] | 9a56a0d | 2011-05-13 19:03:31 | [diff] [blame] | 39 | explicit BrowserFrame(BrowserView* browser_view); |
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 40 | virtual ~BrowserFrame(); |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 41 | |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 42 | static const gfx::Font& GetTitleFont(); |
43 | |||||
[email protected] | 9a56a0d | 2011-05-13 19:03:31 | [diff] [blame] | 44 | // Initialize the frame (creates the underlying native window). |
45 | void InitBrowserFrame(); | ||||
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 46 | |
47 | // Determine the distance of the left edge of the minimize button from the | ||||
48 | // left edge of the window. Used in our Non-Client View's Layout. | ||||
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 49 | int GetMinimizeButtonOffset() const; |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 50 | |
51 | // Retrieves the bounds, in non-client view coordinates for the specified | ||||
[email protected] | e68d3df6 | 2011-02-14 18:46:47 | [diff] [blame] | 52 | // TabStrip view. |
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 53 | gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const; |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 54 | |
55 | // Returns the y coordinate within the window at which the horizontal TabStrip | ||||
56 | // begins (or would begin). If |restored| is true, this is calculated as if | ||||
57 | // we were in restored mode regardless of the current mode. | ||||
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 58 | int GetHorizontalTabStripVerticalOffset(bool restored) const; |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 59 | |
60 | // Tells the frame to update the throbber. | ||||
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 61 | void UpdateThrobber(bool running); |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 62 | |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 63 | // Returns the NonClientFrameView of this frame. |
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 64 | views::View* GetFrameView() const; |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 65 | |
66 | // Notifies the frame that the tab strip display mode changed so it can update | ||||
67 | // its frame treatment if necessary. | ||||
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 68 | void TabStripDisplayModeChanged(); |
69 | |||||
[email protected] | 2fdd00a | 2011-06-13 21:56:26 | [diff] [blame] | 70 | // Overridden from views::Widget: |
[email protected] | 9a56a0d | 2011-05-13 19:03:31 | [diff] [blame] | 71 | virtual bool IsMaximized() const OVERRIDE; |
[email protected] | 1094607 | 2011-05-20 15:40:45 | [diff] [blame] | 72 | virtual views::internal::RootView* CreateRootView() OVERRIDE; |
[email protected] | 9f2ea876 | 2011-06-03 15:42:46 | [diff] [blame] | 73 | virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
[email protected] | 9a56a0d | 2011-05-13 19:03:31 | [diff] [blame] | 74 | virtual bool GetAccelerator(int command_id, |
75 | ui::Accelerator* accelerator) OVERRIDE; | ||||
76 | virtual ui::ThemeProvider* GetThemeProvider() const OVERRIDE; | ||||
[email protected] | 68c477d | 2011-06-08 17:47:43 | [diff] [blame] | 77 | virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE; |
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 78 | |
79 | private: | ||||
80 | NativeBrowserFrame* native_browser_frame_; | ||||
81 | |||||
[email protected] | 883ce2f | 2011-03-14 23:53:45 | [diff] [blame] | 82 | // A weak reference to the root view associated with the window. We save a |
83 | // copy as a BrowserRootView to avoid evil casting later, when we need to call | ||||
84 | // functions that only exist on BrowserRootView (versus RootView). | ||||
85 | BrowserRootView* root_view_; | ||||
86 | |||||
87 | // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. | ||||
88 | BrowserNonClientFrameView* browser_frame_view_; | ||||
89 | |||||
90 | // The BrowserView is our ClientView. This is a pointer to it. | ||||
91 | BrowserView* browser_view_; | ||||
92 | |||||
[email protected] | 7947f216 | 2011-03-11 05:28:37 | [diff] [blame] | 93 | DISALLOW_COPY_AND_ASSIGN(BrowserFrame); |
[email protected] | 213dac2 | 2010-11-09 07:35:32 | [diff] [blame] | 94 | }; |
95 | |||||
96 | #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_ |