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

Side by Side Diff: chrome/browser/ui/panels/panel_browser_frame_view.h

Issue 10908153: [Panel refactor] Deprecate old panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix views compile, no need to delete extra mac menu items cuz not using browser command updater any… Created 8 years, 3 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
« no previous file with comments | « chrome/browser/ui/panels/panel.cc ('k') | chrome/browser/ui/panels/panel_browser_frame_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_FRAME_VIEW_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_FRAME_VIEW_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/gtest_prod_util.h"
10 #include "base/message_loop.h"
11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
tfarina 2012/09/08 01:53:40 go, go, go :)
12 #include "chrome/browser/ui/views/tab_icon_view_model.h"
13 #include "ui/views/controls/button/button.h"
14
15 class PanelBrowserView;
16 class SkPaint;
17 class TabIconView;
18
19 namespace gfx {
20 class Font;
21 class ImageSkia;
22 }
23 namespace ui {
24 class LinearAnimation;
25 }
26 namespace views {
27 class ImageButton;
28 class Label;
29 }
30
31 class PanelBrowserFrameView : public BrowserNonClientFrameView,
32 public views::ButtonListener,
33 public chrome::TabIconViewModel {
34 public:
35 PanelBrowserFrameView(BrowserFrame* frame, PanelBrowserView* browser_view);
36 virtual ~PanelBrowserFrameView();
37
38 void UpdateTitleBar();
39 void UpdateTitleBarMinimizeRestoreButtonVisibility();
40
41 // Returns the height of the entire nonclient top border, including the window
42 // frame, any title area, and any connected client edge.
43 int NonClientTopBorderHeight() const;
44
45 // Returns the size of the non-client area, that is, the window size minus
46 // the size of the client area.
47 gfx::Size NonClientAreaSize() const;
48
49 // Returns true if the frame window is showing only the titlebar.
50 bool IsShowingTitlebarOnly() const;
51
52 protected:
53 // Overridden from BrowserNonClientFrameView:
54 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE;
55 virtual TabStripInsets GetTabStripInsets(bool restored) const OVERRIDE;
56 virtual int GetThemeBackgroundXInset() const OVERRIDE;
57 virtual void UpdateThrobber(bool running) OVERRIDE;
58
59 // Overridden from views::NonClientFrameView:
60 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
61 virtual gfx::Rect GetWindowBoundsForClientBounds(
62 const gfx::Rect& client_bounds) const OVERRIDE;
63 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
64 virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask)
65 OVERRIDE;
66 virtual void ResetWindowControls() OVERRIDE;
67 virtual void UpdateWindowIcon() OVERRIDE;
68
69 // Overridden from views::View:
70 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
71 virtual void OnThemeChanged() OVERRIDE;
72 virtual gfx::Size GetMinimumSize() OVERRIDE;
73 virtual gfx::Size GetMaximumSize() OVERRIDE;
74 virtual void Layout() OVERRIDE;
75 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
76 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
77 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE;
78 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
79 virtual void OnMouseCaptureLost() OVERRIDE;
80
81 // Overridden from views::ButtonListener:
82 virtual void ButtonPressed(views::Button* sender, const ui::Event& event)
83 OVERRIDE;
84
85 // Overridden from chrome::TabIconViewModel:
86 virtual bool ShouldTabIconViewAnimate() const OVERRIDE;
87 virtual gfx::ImageSkia GetFaviconForTabIconView() OVERRIDE;
88
89 private:
90 friend class PanelBrowserViewTest;
91 friend class NativePanelTestingWin;
92
93 enum PaintState {
94 NOT_PAINTED,
95 PAINT_AS_INACTIVE,
96 PAINT_AS_ACTIVE,
97 PAINT_AS_MINIMIZED,
98 PAINT_FOR_ATTENTION
99 };
100
101 // Returns the thickness of the entire nonclient left, right, and bottom
102 // borders, including both the window frame and any client edge.
103 int NonClientBorderThickness() const;
104
105 // Returns the width of the panel that is showing only an icon.
106 int IconOnlyWidth() const;
107
108 // Update control styles to indicate if the titlebar is active or not.
109 void UpdateControlStyles(PaintState paint_state);
110
111 // Custom draw the frame.
112 void PaintFrameBackground(gfx::Canvas* canvas);
113 void PaintFrameEdge(gfx::Canvas* canvas);
114 void PaintDivider(gfx::Canvas* canvas);
115
116 // Retrieves the drawing metrics based on the current painting state.
117 SkColor GetTitleColor(PaintState paint_state) const;
118 SkColor GetDefaultTitleColor(PaintState paint_state) const;
119 SkColor GetThemedTitleColor(PaintState paint_state) const;
120
121 const gfx::ImageSkia* GetFrameBackground(PaintState paint_state) const;
122 const gfx::ImageSkia* GetDefaultFrameBackground(PaintState paint_state) const;
123 const gfx::ImageSkia* GetThemedFrameBackground(PaintState paint_state) const;
124
125 bool UsingDefaultTheme(PaintState paint_state) const;
126
127 string16 GetTitleText() const;
128
129 bool CanResize() const;
130
131 // The client view hosted within this non-client frame view that is
132 // guaranteed to be freed before the client view.
133 // (see comments about view hierarchies in non_client_view.h)
134 PanelBrowserView* panel_browser_view_;
135
136 PaintState paint_state_;
137 views::ImageButton* close_button_;
138 views::ImageButton* minimize_button_;
139 views::ImageButton* restore_button_;
140 TabIconView* title_icon_;
141 views::Label* title_label_;
142 gfx::Rect client_view_bounds_;
143
144 DISALLOW_COPY_AND_ASSIGN(PanelBrowserFrameView);
145 };
146
147 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_FRAME_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel.cc ('k') | chrome/browser/ui/panels/panel_browser_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698