| 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 "chrome/browser/ui/extensions/shell_window.h" | 10 #include "chrome/browser/ui/extensions/shell_window.h" |
| 11 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" | 11 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" |
| 12 #include "ui/base/gtk/gtk_signal.h" | 12 #include "ui/base/gtk/gtk_signal.h" |
| 13 #include "ui/base/ui_base_types.h" |
| 13 #include "ui/base/x/active_window_watcher_x_observer.h" | 14 #include "ui/base/x/active_window_watcher_x_observer.h" |
| 15 #include "ui/base/x/x11_util.h" |
| 14 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 17 #include "third_party/skia/include/core/SkRegion.h" |
| 15 | 18 |
| 16 class Profile; | 19 class Profile; |
| 17 | 20 |
| 18 namespace extensions { | 21 namespace extensions { |
| 19 class Extension; | 22 class Extension; |
| 23 struct DraggableRegion; |
| 20 } | 24 } |
| 21 | 25 |
| 22 class ShellWindowGtk : public ShellWindow, | 26 class ShellWindowGtk : public ShellWindow, |
| 23 public ExtensionViewGtk::Container, | 27 public ExtensionViewGtk::Container, |
| 24 public ui::ActiveWindowWatcherXObserver { | 28 public ui::ActiveWindowWatcherXObserver { |
| 25 public: | 29 public: |
| 26 ShellWindowGtk(Profile* profile, | 30 ShellWindowGtk(Profile* profile, |
| 27 const extensions::Extension* extension, | 31 const extensions::Extension* extension, |
| 28 const GURL& url, | 32 const GURL& url, |
| 29 const CreateParams& params); | 33 const CreateParams& params); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 48 virtual void FlashFrame(bool flash) OVERRIDE; | 52 virtual void FlashFrame(bool flash) OVERRIDE; |
| 49 virtual bool IsAlwaysOnTop() const OVERRIDE; | 53 virtual bool IsAlwaysOnTop() const OVERRIDE; |
| 50 | 54 |
| 51 // ActiveWindowWatcherXObserver implementation. | 55 // ActiveWindowWatcherXObserver implementation. |
| 52 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; | 56 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; |
| 53 | 57 |
| 54 private: | 58 private: |
| 55 // ShellWindow implementation. | 59 // ShellWindow implementation. |
| 56 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 60 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
| 57 virtual bool IsFullscreenOrPending() const OVERRIDE; | 61 virtual bool IsFullscreenOrPending() const OVERRIDE; |
| 62 virtual void UpdateDraggableRegions( |
| 63 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; |
| 58 | 64 |
| 59 virtual ~ShellWindowGtk(); | 65 virtual ~ShellWindowGtk(); |
| 60 | 66 |
| 61 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnMainWindowDeleteEvent, | 67 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnMainWindowDeleteEvent, |
| 62 GdkEvent*); | 68 GdkEvent*); |
| 63 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnConfigure, | 69 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnConfigure, |
| 64 GdkEventConfigure*); | 70 GdkEventConfigure*); |
| 65 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnWindowState, | 71 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnWindowState, |
| 66 GdkEventWindowState*); | 72 GdkEventWindowState*); |
| 73 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnButtonPress, |
| 74 GdkEventButton*); |
| 67 | 75 |
| 68 GtkWindow* window_; | 76 GtkWindow* window_; |
| 69 GdkWindowState state_; | 77 GdkWindowState state_; |
| 70 | 78 |
| 71 // True if the window manager thinks the window is active. Not all window | 79 // True if the window manager thinks the window is active. Not all window |
| 72 // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case | 80 // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case |
| 73 // this will always be true. | 81 // this will always be true. |
| 74 bool is_active_; | 82 bool is_active_; |
| 75 | 83 |
| 76 // The position and size of the current window. | 84 // The position and size of the current window. |
| 77 gfx::Rect bounds_; | 85 gfx::Rect bounds_; |
| 78 | 86 |
| 79 // The position and size of the non-maximized, non-fullscreen window. | 87 // The position and size of the non-maximized, non-fullscreen window. |
| 80 gfx::Rect restored_bounds_; | 88 gfx::Rect restored_bounds_; |
| 81 | 89 |
| 82 // True if the RVH is in fullscreen mode. The window may not actually be in | 90 // True if the RVH is in fullscreen mode. The window may not actually be in |
| 83 // fullscreen, however: some WMs don't support fullscreen. | 91 // fullscreen, however: some WMs don't support fullscreen. |
| 84 bool content_thinks_its_fullscreen_; | 92 bool content_thinks_its_fullscreen_; |
| 85 | 93 |
| 94 // The region is treated as title bar, can be dragged to move |
| 95 // and double clicked to maximize. |
| 96 SkRegion draggable_region_; |
| 97 |
| 98 // If true, don't call gdk_window_raise() when we get a click in the title |
| 99 // bar or window border. This is to work around a compiz bug. |
| 100 bool suppress_window_raise_; |
| 101 |
| 102 // Keep track of the last click time and the last click position so we can |
| 103 // filter out extra GDK_BUTTON_PRESS events when a double click happens. |
| 104 guint32 last_click_time_; |
| 105 gfx::Point last_click_position_; |
| 106 |
| 107 // True if the window shows without frame. |
| 108 bool frameless_; |
| 109 |
| 86 DISALLOW_COPY_AND_ASSIGN(ShellWindowGtk); | 110 DISALLOW_COPY_AND_ASSIGN(ShellWindowGtk); |
| 87 }; | 111 }; |
| 88 | 112 |
| 89 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ | 113 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ |
| OLD | NEW |