Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: chrome/browser/ui/views/frame/browser_frame.h

Issue 7015051: Re-land: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_FRAME_BROWSER_FRAME_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "chrome/browser/ui/views/frame/native_browser_frame_delegate.h" 12 #include "chrome/browser/ui/views/frame/native_browser_frame_delegate.h"
13 #include "views/window/window.h"
13 14
14 class AeroGlassNonClientView; 15 class AeroGlassNonClientView;
15 class BrowserNonClientFrameView; 16 class BrowserNonClientFrameView;
16 class BrowserRootView; 17 class BrowserRootView;
17 class BrowserView; 18 class BrowserView;
18 class NativeBrowserFrame; 19 class NativeBrowserFrame;
19 class NonClientFrameView; 20 class NonClientFrameView;
20 class Profile; 21 class Profile;
21 22
22 namespace gfx { 23 namespace gfx {
23 class Font; 24 class Font;
24 class Rect; 25 class Rect;
25 } 26 }
26 27
27 namespace ui { 28 namespace ui {
28 class ThemeProvider; 29 class ThemeProvider;
29 } 30 }
30 31
31 namespace views { 32 namespace views {
32 class View; 33 class View;
33 class Window; 34 class Window;
34 } 35 }
35 36
36 // This is a virtual interface that allows system specific browser frames. 37 // This is a virtual interface that allows system specific browser frames.
37 class BrowserFrame : public NativeBrowserFrameDelegate { 38 class BrowserFrame : public views::Window {
38 public: 39 public:
40 explicit BrowserFrame(BrowserView* browser_view);
39 virtual ~BrowserFrame(); 41 virtual ~BrowserFrame();
40 42
41 // Creates the appropriate BrowserFrame for this platform. The returned
42 // object is owned by the caller.
43 static BrowserFrame* Create(BrowserView* browser_view, Profile* profile);
44
45 static const gfx::Font& GetTitleFont(); 43 static const gfx::Font& GetTitleFont();
46 44
47 // Returns the Window associated with this frame. Guaranteed non-NULL after 45 // Initialize the frame (creates the underlying native window).
48 // construction. 46 void InitBrowserFrame();
49 views::Window* GetWindow();
50 47
51 // Determine the distance of the left edge of the minimize button from the 48 // Determine the distance of the left edge of the minimize button from the
52 // left edge of the window. Used in our Non-Client View's Layout. 49 // left edge of the window. Used in our Non-Client View's Layout.
53 int GetMinimizeButtonOffset() const; 50 int GetMinimizeButtonOffset() const;
54 51
55 // Retrieves the bounds, in non-client view coordinates for the specified 52 // Retrieves the bounds, in non-client view coordinates for the specified
56 // TabStrip view. 53 // TabStrip view.
57 gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const; 54 gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const;
58 55
59 // Returns the y coordinate within the window at which the horizontal TabStrip 56 // Returns the y coordinate within the window at which the horizontal TabStrip
60 // begins (or would begin). If |restored| is true, this is calculated as if 57 // begins (or would begin). If |restored| is true, this is calculated as if
61 // we were in restored mode regardless of the current mode. 58 // we were in restored mode regardless of the current mode.
62 int GetHorizontalTabStripVerticalOffset(bool restored) const; 59 int GetHorizontalTabStripVerticalOffset(bool restored) const;
63 60
64 // Tells the frame to update the throbber. 61 // Tells the frame to update the throbber.
65 void UpdateThrobber(bool running); 62 void UpdateThrobber(bool running);
66 63
67 // Returns the theme provider for this frame.
68 ui::ThemeProvider* GetThemeProviderForFrame() const;
69
70 // Returns true if the window should use the native frame view. This is true 64 // Returns true if the window should use the native frame view. This is true
71 // if there are no themes applied on Vista, or if there are themes applied and 65 // if there are no themes applied on Vista, or if there are themes applied and
72 // this browser window is an app or popup. 66 // this browser window is an app or popup.
73 bool AlwaysUseNativeFrame() const; 67 bool AlwaysUseNativeFrame() const;
74 68
75 // Returns the NonClientFrameView of this frame. 69 // Returns the NonClientFrameView of this frame.
76 views::View* GetFrameView() const; 70 views::View* GetFrameView() const;
77 71
78 // Notifies the frame that the tab strip display mode changed so it can update 72 // Notifies the frame that the tab strip display mode changed so it can update
79 // its frame treatment if necessary. 73 // its frame treatment if necessary.
80 void TabStripDisplayModeChanged(); 74 void TabStripDisplayModeChanged();
81 75
82 protected: 76 // Overridden from views::Window:
83 // Overridden from NativeBrowserFrameDelegate: 77 virtual bool IsMaximized() const OVERRIDE;
84 virtual views::RootView* DelegateCreateRootView() OVERRIDE; 78 virtual views::RootView* CreateRootView() OVERRIDE;
85 virtual views::NonClientFrameView* DelegateCreateFrameViewForWindow() 79 virtual views::NonClientFrameView* CreateFrameViewForWindow() OVERRIDE;
86 OVERRIDE; 80 virtual bool GetAccelerator(int command_id,
87 81 ui::Accelerator* accelerator) OVERRIDE;
88 // TODO(beng): Temporarily provided as a way to associate the subclass' 82 virtual ui::ThemeProvider* GetThemeProvider() const OVERRIDE;
89 // implementation of NativeBrowserFrame with this. 83 virtual void OnNativeWindowActivationChanged(bool active) OVERRIDE;
90 void set_native_browser_frame(NativeBrowserFrame* native_browser_frame) {
91 native_browser_frame_ = native_browser_frame;
92 }
93
94 explicit BrowserFrame(BrowserView* browser_view);
95 84
96 private: 85 private:
97 NativeBrowserFrame* native_browser_frame_; 86 NativeBrowserFrame* native_browser_frame_;
98 87
99 // A weak reference to the root view associated with the window. We save a 88 // A weak reference to the root view associated with the window. We save a
100 // copy as a BrowserRootView to avoid evil casting later, when we need to call 89 // copy as a BrowserRootView to avoid evil casting later, when we need to call
101 // functions that only exist on BrowserRootView (versus RootView). 90 // functions that only exist on BrowserRootView (versus RootView).
102 BrowserRootView* root_view_; 91 BrowserRootView* root_view_;
103 92
104 // A pointer to our NonClientFrameView as a BrowserNonClientFrameView. 93 // A pointer to our NonClientFrameView as a BrowserNonClientFrameView.
105 BrowserNonClientFrameView* browser_frame_view_; 94 BrowserNonClientFrameView* browser_frame_view_;
106 95
107 // The BrowserView is our ClientView. This is a pointer to it. 96 // The BrowserView is our ClientView. This is a pointer to it.
108 BrowserView* browser_view_; 97 BrowserView* browser_view_;
109 98
110 DISALLOW_COPY_AND_ASSIGN(BrowserFrame); 99 DISALLOW_COPY_AND_ASSIGN(BrowserFrame);
111 }; 100 };
112 101
113 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_ 102 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc ('k') | chrome/browser/ui/views/frame/browser_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698