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

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

Issue 7005006: Add options menu on Windows. (Closed) Base URL: svn://chrome-svn/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_PANELS_PANEL_BROWSER_FRAME_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_FRAME_VIEW_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_FRAME_VIEW_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_FRAME_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/scoped_ptr.h"
10 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" 11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
11 #include "chrome/browser/ui/views/tab_icon_view.h" 12 #include "chrome/browser/ui/views/tab_icon_view.h"
13 #include "ui/base/models/simple_menu_model.h"
12 #include "views/controls/button/button.h" 14 #include "views/controls/button/button.h"
13 #include "views/controls/menu/view_menu_delegate.h" 15 #include "views/controls/menu/view_menu_delegate.h"
14 16
15 class PanelBrowserView; 17 class PanelBrowserView;
16 namespace views { 18 namespace views {
17 class ImageButton; 19 class ImageButton;
18 class Label; 20 class Label;
21 class Menu2;
19 class MenuButton; 22 class MenuButton;
20 } 23 }
21 24
22 class PanelBrowserFrameView : public BrowserNonClientFrameView, 25 class PanelBrowserFrameView : public BrowserNonClientFrameView,
23 public views::ButtonListener, 26 public views::ButtonListener,
24 public views::ViewMenuDelegate, 27 public views::ViewMenuDelegate,
28 public ui::SimpleMenuModel::Delegate,
25 public TabIconView::TabIconViewModel { 29 public TabIconView::TabIconViewModel {
26 public: 30 public:
27 PanelBrowserFrameView(BrowserFrame* frame, PanelBrowserView* browser_view); 31 PanelBrowserFrameView(BrowserFrame* frame, PanelBrowserView* browser_view);
28 virtual ~PanelBrowserFrameView(); 32 virtual ~PanelBrowserFrameView();
29 33
30 void UpdateTitleBar(); 34 void UpdateTitleBar();
31 void OnActivationChanged(bool active); 35 void OnActivationChanged(bool active);
32 36
33 protected: 37 protected:
34 // Overridden from BrowserNonClientFrameView: 38 // Overridden from BrowserNonClientFrameView:
(...skipping 23 matching lines...) Expand all
58 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE; 62 virtual bool OnMouseDragged(const views::MouseEvent& event) OVERRIDE;
59 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; 63 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
60 64
61 // Overridden from views::ButtonListener: 65 // Overridden from views::ButtonListener:
62 virtual void ButtonPressed(views::Button* sender, const views::Event& event) 66 virtual void ButtonPressed(views::Button* sender, const views::Event& event)
63 OVERRIDE; 67 OVERRIDE;
64 68
65 // Overridden from views::ViewMenuDelegate: 69 // Overridden from views::ViewMenuDelegate:
66 virtual void RunMenu(View* source, const gfx::Point& pt) OVERRIDE; 70 virtual void RunMenu(View* source, const gfx::Point& pt) OVERRIDE;
67 71
72 // Overridden from ui::SimpleMenuModel::Delegate:
73 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
74 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
75 virtual bool GetAcceleratorForCommandId(
76 int command_id, ui::Accelerator* accelerator) OVERRIDE;
77 virtual void ExecuteCommand(int command_id) OVERRIDE;
78
68 // Overridden from TabIconView::TabIconViewModel: 79 // Overridden from TabIconView::TabIconViewModel:
69 virtual bool ShouldTabIconViewAnimate() const OVERRIDE; 80 virtual bool ShouldTabIconViewAnimate() const OVERRIDE;
70 virtual SkBitmap GetFaviconForTabIconView() OVERRIDE; 81 virtual SkBitmap GetFaviconForTabIconView() OVERRIDE;
71 82
72 private: 83 private:
73 friend class PanelBrowserViewTest; 84 friend class PanelBrowserViewTest;
74 FRIEND_TEST_ALL_PREFIXES(PanelBrowserViewTest, CreatePanel); 85 FRIEND_TEST_ALL_PREFIXES(PanelBrowserViewTest, CreatePanel);
86 FRIEND_TEST_ALL_PREFIXES(PanelBrowserViewTest, CreateOptionsMenu);
75 87
76 enum PaintState { 88 enum PaintState {
77 NOT_PAINTED, 89 NOT_PAINTED,
78 PAINT_AS_INACTIVE, 90 PAINT_AS_INACTIVE,
79 PAINT_AS_ACTIVE 91 PAINT_AS_ACTIVE
80 }; 92 };
81 93
94 static const int kMinimizeAllCommand = 0;
jennb 2011/05/10 22:38:44 Could these commands be enums?
jianli 2011/05/10 23:46:58 Done.
95 static const int kRestoreAllCommand = 1;
96 static const int kCloseAllCommand = 2;
97 static const int kAboutCommand = 3;
98
82 // Returns the thickness of the entire nonclient left, right, and bottom 99 // Returns the thickness of the entire nonclient left, right, and bottom
83 // borders, including both the window frame and any client edge. 100 // borders, including both the window frame and any client edge.
84 int NonClientBorderThickness() const; 101 int NonClientBorderThickness() const;
85 102
86 // Returns the height of the entire nonclient top border, including the window 103 // Returns the height of the entire nonclient top border, including the window
87 // frame, any title area, and any connected client edge. 104 // frame, any title area, and any connected client edge.
88 int NonClientTopBorderHeight() const; 105 int NonClientTopBorderHeight() const;
89 106
90 // Update control styles to indicate if the title bar is active or not, i.e. 107 // Update control styles to indicate if the title bar is active or not, i.e.
91 // changing the font and color of title text. 108 // changing the font and color of title text.
92 void UpdateControlStyles(PaintState paint_state); 109 void UpdateControlStyles(PaintState paint_state);
93 110
94 // Custom draw the frame. 111 // Custom draw the frame.
95 void PaintFrameBorder(gfx::Canvas* canvas); 112 void PaintFrameBorder(gfx::Canvas* canvas);
96 void PaintClientEdge(gfx::Canvas* canvas); 113 void PaintClientEdge(gfx::Canvas* canvas);
97 114
115 void CreateOptionsMenu();
116 void CreateOptionsMenuItems();
117
98 // The frame that hosts this view. This is a weak reference such that frame_ 118 // The frame that hosts this view. This is a weak reference such that frame_
99 // will always be valid in the lifetime of this view. 119 // will always be valid in the lifetime of this view.
100 BrowserFrame* frame_; 120 BrowserFrame* frame_;
101 121
102 // The client view hosted within this non-client frame view that is 122 // The client view hosted within this non-client frame view that is
103 // guaranteed to be freed before the client view. 123 // guaranteed to be freed before the client view.
104 // (see comments about view hierarchies in non_client_view.h) 124 // (see comments about view hierarchies in non_client_view.h)
105 PanelBrowserView* browser_view_; 125 PanelBrowserView* browser_view_;
106 126
107 PaintState paint_state_; 127 PaintState paint_state_;
108 views::MenuButton* options_button_; 128 views::MenuButton* options_button_;
109 views::ImageButton* close_button_; 129 views::ImageButton* close_button_;
110 TabIconView* title_icon_; 130 TabIconView* title_icon_;
111 views::Label* title_label_; 131 views::Label* title_label_;
112 gfx::Rect client_view_bounds_; 132 gfx::Rect client_view_bounds_;
113 std::wstring accessible_name_; 133 std::wstring accessible_name_;
134 scoped_ptr<views::Menu2> options_menu_;
135 scoped_ptr<ui::SimpleMenuModel> options_menu_contents_;
136
137 // The flag to indicate if menu items to manipulate all panels are enabled
138 // or not. This is true when we have more than one panel up.
139 bool option_menu_manipulate_all_enabled_;
jennb 2011/05/10 22:38:44 Seems like this should be queried from the panel m
jianli 2011/05/10 23:46:58 Removed. See my comment in other place.
140
141 // The flag to indicate if "Restore All" is enabled (vs. Minimize All). This
142 // is true when all panels are minimized.
143 bool option_menu_restore_all_enabled_;
114 144
115 DISALLOW_COPY_AND_ASSIGN(PanelBrowserFrameView); 145 DISALLOW_COPY_AND_ASSIGN(PanelBrowserFrameView);
116 }; 146 };
117 147
118 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_FRAME_VIEW_H_ 148 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_FRAME_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698