OLD | NEW |
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_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/timer.h" | 10 #include "base/timer.h" |
11 #include "chrome/browser/ui/extensions/native_shell_window.h" | 11 #include "chrome/browser/ui/extensions/native_shell_window.h" |
12 #include "chrome/browser/ui/extensions/shell_window.h" | 12 #include "chrome/browser/ui/extensions/shell_window.h" |
13 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" | 13 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" |
14 #include "third_party/skia/include/core/SkRegion.h" | 14 #include "third_party/skia/include/core/SkRegion.h" |
15 #include "ui/base/gtk/gtk_signal.h" | 15 #include "ui/base/gtk/gtk_signal.h" |
16 #include "ui/base/x/active_window_watcher_x_observer.h" | 16 #include "ui/base/x/active_window_watcher_x_observer.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 | 18 |
19 class ExtensionKeybindingRegistryGtk; | 19 class ExtensionKeybindingRegistryGtk; |
20 class Profile; | 20 class Profile; |
21 | 21 |
22 namespace extensions { | 22 namespace extensions { |
23 class Extension; | 23 class Extension; |
24 struct DraggableRegion; | |
25 } | 24 } |
26 | 25 |
27 class ShellWindowGtk : public NativeShellWindow, | 26 class ShellWindowGtk : public NativeShellWindow, |
28 public ExtensionViewGtk::Container, | 27 public ExtensionViewGtk::Container, |
29 public ui::ActiveWindowWatcherXObserver { | 28 public ui::ActiveWindowWatcherXObserver { |
30 public: | 29 public: |
31 ShellWindowGtk(ShellWindow* shell_window, | 30 ShellWindowGtk(ShellWindow* shell_window, |
32 const ShellWindow::CreateParams& params); | 31 const ShellWindow::CreateParams& params); |
33 | 32 |
34 // BaseWindow implementation. | 33 // BaseWindow implementation. |
(...skipping 20 matching lines...) Expand all Loading... |
55 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; | 54 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; |
56 | 55 |
57 private: | 56 private: |
58 // NativeShellWindow implementation. | 57 // NativeShellWindow implementation. |
59 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 58 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
60 virtual bool IsFullscreenOrPending() const OVERRIDE; | 59 virtual bool IsFullscreenOrPending() const OVERRIDE; |
61 virtual void UpdateWindowIcon() OVERRIDE; | 60 virtual void UpdateWindowIcon() OVERRIDE; |
62 virtual void UpdateWindowTitle() OVERRIDE; | 61 virtual void UpdateWindowTitle() OVERRIDE; |
63 virtual void HandleKeyboardEvent( | 62 virtual void HandleKeyboardEvent( |
64 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 63 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
| 64 virtual void UpdateDraggableRegions( |
| 65 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; |
65 | 66 |
66 content::WebContents* web_contents() const { | 67 content::WebContents* web_contents() const { |
67 return shell_window_->web_contents(); | 68 return shell_window_->web_contents(); |
68 } | 69 } |
69 const extensions::Extension* extension() const { | 70 const extensions::Extension* extension() const { |
70 return shell_window_->extension(); | 71 return shell_window_->extension(); |
71 } | 72 } |
72 virtual void UpdateDraggableRegions( | |
73 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; | |
74 virtual void UpdateLegacyDraggableRegions( | |
75 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; | |
76 | 73 |
77 virtual ~ShellWindowGtk(); | 74 virtual ~ShellWindowGtk(); |
78 | 75 |
79 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnMainWindowDeleteEvent, | 76 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnMainWindowDeleteEvent, |
80 GdkEvent*); | 77 GdkEvent*); |
81 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnConfigure, | 78 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnConfigure, |
82 GdkEventConfigure*); | 79 GdkEventConfigure*); |
83 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnWindowState, | 80 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnWindowState, |
84 GdkEventWindowState*); | 81 GdkEventWindowState*); |
85 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnButtonPress, | 82 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnButtonPress, |
(...skipping 16 matching lines...) Expand all Loading... |
102 | 99 |
103 // The position and size of the non-maximized, non-fullscreen window. | 100 // The position and size of the non-maximized, non-fullscreen window. |
104 gfx::Rect restored_bounds_; | 101 gfx::Rect restored_bounds_; |
105 | 102 |
106 // True if the RVH is in fullscreen mode. The window may not actually be in | 103 // True if the RVH is in fullscreen mode. The window may not actually be in |
107 // fullscreen, however: some WMs don't support fullscreen. | 104 // fullscreen, however: some WMs don't support fullscreen. |
108 bool content_thinks_its_fullscreen_; | 105 bool content_thinks_its_fullscreen_; |
109 | 106 |
110 // The region is treated as title bar, can be dragged to move | 107 // The region is treated as title bar, can be dragged to move |
111 // and double clicked to maximize. | 108 // and double clicked to maximize. |
112 SkRegion draggable_region_; | 109 scoped_ptr<SkRegion> draggable_region_; |
113 | 110 |
114 // If true, don't call gdk_window_raise() when we get a click in the title | 111 // If true, don't call gdk_window_raise() when we get a click in the title |
115 // bar or window border. This is to work around a compiz bug. | 112 // bar or window border. This is to work around a compiz bug. |
116 bool suppress_window_raise_; | 113 bool suppress_window_raise_; |
117 | 114 |
118 // True if the window shows without frame. | 115 // True if the window shows without frame. |
119 bool frameless_; | 116 bool frameless_; |
120 | 117 |
121 // The timer used to save the window position for session restore. | 118 // The timer used to save the window position for session restore. |
122 base::OneShotTimer<ShellWindowGtk> window_configure_debounce_timer_; | 119 base::OneShotTimer<ShellWindowGtk> window_configure_debounce_timer_; |
123 | 120 |
124 // The Extension Keybinding Registry responsible for registering listeners for | 121 // The Extension Keybinding Registry responsible for registering listeners for |
125 // accelerators that are sent to the window, that are destined to be turned | 122 // accelerators that are sent to the window, that are destined to be turned |
126 // into events and sent to the extension. | 123 // into events and sent to the extension. |
127 scoped_ptr<ExtensionKeybindingRegistryGtk> extension_keybinding_registry_; | 124 scoped_ptr<ExtensionKeybindingRegistryGtk> extension_keybinding_registry_; |
128 | 125 |
129 DISALLOW_COPY_AND_ASSIGN(ShellWindowGtk); | 126 DISALLOW_COPY_AND_ASSIGN(ShellWindowGtk); |
130 }; | 127 }; |
131 | 128 |
132 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ | 129 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ |
OLD | NEW |