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/panels/panel_browser_window_gtk.h

Issue 9956145: Remove wrench button from panel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 8 years, 8 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) 2012 The Chromium Authors. All rights reserved. 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 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_WINDOW_GTK_H_ 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ 6 #define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 10 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
11 #include "chrome/browser/ui/gtk/menu_gtk.h"
12 #include "chrome/browser/ui/panels/native_panel.h" 11 #include "chrome/browser/ui/panels/native_panel.h"
13 #include "ui/base/animation/animation_delegate.h" 12 #include "ui/base/animation/animation_delegate.h"
14 13
15 class Panel; 14 class Panel;
16 class PanelBoundsAnimation; 15 class PanelBoundsAnimation;
17 class PanelDragGtk; 16 class PanelDragGtk;
18 class PanelSettingsMenuModel;
19 class NativePanelTestingGtk; 17 class NativePanelTestingGtk;
20 18
21 class PanelBrowserWindowGtk : public BrowserWindowGtk, 19 class PanelBrowserWindowGtk : public BrowserWindowGtk,
22 public MenuGtk::Delegate,
23 public MessageLoopForUI::Observer, 20 public MessageLoopForUI::Observer,
24 public NativePanel, 21 public NativePanel,
25 public ui::AnimationDelegate { 22 public ui::AnimationDelegate {
26 public: 23 public:
27 PanelBrowserWindowGtk(Browser* browser, Panel* panel, 24 PanelBrowserWindowGtk(Browser* browser, Panel* panel,
28 const gfx::Rect& bounds); 25 const gfx::Rect& bounds);
29 virtual ~PanelBrowserWindowGtk(); 26 virtual ~PanelBrowserWindowGtk();
30 27
31 // BrowserWindowGtk override 28 // BrowserWindowGtk override
32 virtual void Init() OVERRIDE; 29 virtual void Init() OVERRIDE;
33 30
34 // BrowserWindow overrides 31 // BrowserWindow overrides
35 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 32 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
36 virtual void ShowSettingsMenu(GtkWidget* widget,
37 GdkEventButton* event) OVERRIDE;
38 virtual TitleDecoration GetWindowTitle(std::string* title) const OVERRIDE; 33 virtual TitleDecoration GetWindowTitle(std::string* title) const OVERRIDE;
39 34
40 virtual bool ShouldShowCloseButton() const OVERRIDE; 35 virtual bool ShouldShowCloseButton() const OVERRIDE;
41 36
42 // Overrides BrowserWindowGtk::NotificationObserver::Observe 37 // Overrides BrowserWindowGtk::NotificationObserver::Observe
43 virtual void Observe(int type, 38 virtual void Observe(int type,
44 const content::NotificationSource& source, 39 const content::NotificationSource& source,
45 const content::NotificationDetails& details) OVERRIDE; 40 const content::NotificationDetails& details) OVERRIDE;
46 41
47 protected: 42 protected:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 CHROMEGTK_CALLBACK_2(PanelBrowserWindowGtk, gboolean, OnDragFailed, 151 CHROMEGTK_CALLBACK_2(PanelBrowserWindowGtk, gboolean, OnDragFailed,
157 GdkDragContext*, GtkDragResult); 152 GdkDragContext*, GtkDragResult);
158 153
159 // When a drag is ending, a fake button release event is passed to the drag 154 // When a drag is ending, a fake button release event is passed to the drag
160 // widget to fake letting go of the mouse button. We need a callback for 155 // widget to fake letting go of the mouse button. We need a callback for
161 // this event because it is the only way to catch drag end events when the 156 // this event because it is the only way to catch drag end events when the
162 // user presses space or return. 157 // user presses space or return.
163 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, OnDragButtonReleased, 158 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, OnDragButtonReleased,
164 GdkEventButton*); 159 GdkEventButton*);
165 160
166 // Callbacks for mouse enter leave events.
167 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, OnEnterNotify,
168 GdkEventCrossing*);
169 CHROMEGTK_CALLBACK_1(PanelBrowserWindowGtk, gboolean, OnLeaveNotify,
170 GdkEventCrossing*);
171
172 // Tests will set this to false to prevent actual GTK drags from being 161 // Tests will set this to false to prevent actual GTK drags from being
173 // triggered as that generates extra unwanted signals and focus grabs. 162 // triggered as that generates extra unwanted signals and focus grabs.
174 bool system_drag_disabled_for_testing_; 163 bool system_drag_disabled_for_testing_;
175 164
176 // A copy of the last button press event, used to initiate a drag. 165 // A copy of the last button press event, used to initiate a drag.
177 GdkEvent* last_mouse_down_; 166 GdkEvent* last_mouse_down_;
178 167
179 // A GtkInivisible used to track the drag event. GtkInvisibles are of the 168 // A GtkInivisible used to track the drag event. GtkInvisibles are of the
180 // type GInitiallyUnowned, but the widget initialization code sinks the 169 // type GInitiallyUnowned, but the widget initialization code sinks the
181 // reference, so we can't use an OwnedWidgetGtk here. 170 // reference, so we can't use an OwnedWidgetGtk here.
182 GtkWidget* drag_widget_; 171 GtkWidget* drag_widget_;
183 172
184 // Due to a bug in GTK+, we need to force the end of a drag when we get a 173 // Due to a bug in GTK+, we need to force the end of a drag when we get a
185 // mouse release event on the the dragged widget, otherwise, we don't know 174 // mouse release event on the the dragged widget, otherwise, we don't know
186 // when the drag has ended when the user presses space or enter. We queue 175 // when the drag has ended when the user presses space or enter. We queue
187 // a task to end the drag and only run it if GTK+ didn't send us the 176 // a task to end the drag and only run it if GTK+ didn't send us the
188 // drag-failed event. 177 // drag-failed event.
189 base::WeakPtrFactory<PanelBrowserWindowGtk> drag_end_factory_; 178 base::WeakPtrFactory<PanelBrowserWindowGtk> drag_end_factory_;
190 179
191 scoped_ptr<Panel> panel_; 180 scoped_ptr<Panel> panel_;
192 gfx::Rect bounds_; 181 gfx::Rect bounds_;
193 182
194 scoped_ptr<PanelSettingsMenuModel> settings_menu_model_;
195 scoped_ptr<MenuGtk> settings_menu_;
196
197 scoped_ptr<PanelDragGtk> drag_helper_; 183 scoped_ptr<PanelDragGtk> drag_helper_;
198 184
199 // Size of window frame. Empty until the window has been allocated and sized. 185 // Size of window frame. Empty until the window has been allocated and sized.
200 gfx::Size frame_size_; 186 gfx::Size frame_size_;
201 187
202 // Indicates that the panel is currently drawing attention. 188 // Indicates that the panel is currently drawing attention.
203 bool is_drawing_attention_; 189 bool is_drawing_attention_;
204 190
205 // Disable ExpansionState changes on mouse click for a short duration. 191 // Disable ExpansionState changes on mouse click for a short duration.
206 // This is needed in case the window gains focus as result of mouseDown while 192 // This is needed in case the window gains focus as result of mouseDown while
207 // being already expanded and drawing attention - in this case, we don't 193 // being already expanded and drawing attention - in this case, we don't
208 // want to minimize it on subsequent mouseUp. 194 // want to minimize it on subsequent mouseUp.
209 // We use time interval because the window may gain focus in various ways 195 // We use time interval because the window may gain focus in various ways
210 // (via keyboard for example) which are not distinguishable at this point. 196 // (via keyboard for example) which are not distinguishable at this point.
211 // Apparently this disable interval is not affecting the user in other cases. 197 // Apparently this disable interval is not affecting the user in other cases.
212 base::Time disableMinimizeUntilTime_; 198 base::Time disableMinimizeUntilTime_;
213 199
214 // Used to animate the bounds change. 200 // Used to animate the bounds change.
215 scoped_ptr<PanelBoundsAnimation> bounds_animator_; 201 scoped_ptr<PanelBoundsAnimation> bounds_animator_;
216 gfx::Rect animation_start_bounds_; 202 gfx::Rect animation_start_bounds_;
217 203
218 // This records the bounds set on the last animation progress notification. 204 // This records the bounds set on the last animation progress notification.
219 // We need this for the case where a new bounds animation starts before the 205 // We need this for the case where a new bounds animation starts before the
220 // current one completes. In this case, we want to start the new animation 206 // current one completes. In this case, we want to start the new animation
221 // from where the last one left. 207 // from where the last one left.
222 gfx::Rect last_animation_progressed_bounds_; 208 gfx::Rect last_animation_progressed_bounds_;
223 209
224 // Whether mouse is in the window. We show the wrench icon when a panel
225 // window has focus or mouse is in a panel window.
226 bool window_has_mouse_;
227
228 // The close button is not shown when panel is in icon only mode in overflow. 210 // The close button is not shown when panel is in icon only mode in overflow.
229 bool show_close_button_; 211 bool show_close_button_;
230 212
231 content::NotificationRegistrar registrar_; 213 content::NotificationRegistrar registrar_;
232 214
233 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk); 215 DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk);
234 }; 216 };
235 217
236 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_ 218 #endif // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view_browsertest.cc ('k') | chrome/browser/ui/panels/panel_browser_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698