Chromium Code Reviews| 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/x/active_window_watcher_x_observer.h" | 13 #include "ui/base/x/active_window_watcher_x_observer.h" |
| 14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
| 15 #include "third_party/skia/include/core/SkRegion.h" | |
| 15 | 16 |
| 16 class Profile; | 17 class Profile; |
| 17 | 18 |
| 18 namespace extensions { | 19 namespace extensions { |
| 19 class Extension; | 20 class Extension; |
| 21 struct DraggableRegion; | |
| 20 } | 22 } |
| 21 | 23 |
| 22 class ShellWindowGtk : public ShellWindow, | 24 class ShellWindowGtk : public ShellWindow, |
| 23 public ExtensionViewGtk::Container, | 25 public ExtensionViewGtk::Container, |
| 24 public ui::ActiveWindowWatcherXObserver { | 26 public ui::ActiveWindowWatcherXObserver { |
| 25 public: | 27 public: |
| 26 ShellWindowGtk(Profile* profile, | 28 ShellWindowGtk(Profile* profile, |
| 27 const extensions::Extension* extension, | 29 const extensions::Extension* extension, |
| 28 const GURL& url, | 30 const GURL& url, |
| 29 const CreateParams& params); | 31 const CreateParams& params); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 48 virtual void FlashFrame(bool flash) OVERRIDE; | 50 virtual void FlashFrame(bool flash) OVERRIDE; |
| 49 virtual bool IsAlwaysOnTop() const OVERRIDE; | 51 virtual bool IsAlwaysOnTop() const OVERRIDE; |
| 50 | 52 |
| 51 // ActiveWindowWatcherXObserver implementation. | 53 // ActiveWindowWatcherXObserver implementation. |
| 52 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; | 54 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 // ShellWindow implementation. | 57 // ShellWindow implementation. |
| 56 virtual void SetFullscreen(bool fullscreen) OVERRIDE; | 58 virtual void SetFullscreen(bool fullscreen) OVERRIDE; |
| 57 virtual bool IsFullscreenOrPending() const OVERRIDE; | 59 virtual bool IsFullscreenOrPending() const OVERRIDE; |
| 60 virtual void UpdateDraggableRegions( | |
| 61 const std::vector<extensions::DraggableRegion>& regions) OVERRIDE; | |
| 58 | 62 |
| 59 virtual ~ShellWindowGtk(); | 63 virtual ~ShellWindowGtk(); |
| 60 | 64 |
| 61 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnMainWindowDeleteEvent, | 65 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnMainWindowDeleteEvent, |
| 62 GdkEvent*); | 66 GdkEvent*); |
| 63 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnConfigure, | 67 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnConfigure, |
| 64 GdkEventConfigure*); | 68 GdkEventConfigure*); |
| 65 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnWindowState, | 69 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnWindowState, |
| 66 GdkEventWindowState*); | 70 GdkEventWindowState*); |
| 71 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnButtonPress, | |
| 72 GdkEventButton*); | |
| 67 | 73 |
| 68 GtkWindow* window_; | 74 GtkWindow* window_; |
| 69 GdkWindowState state_; | 75 GdkWindowState state_; |
| 70 | 76 |
| 71 // True if the window manager thinks the window is active. Not all window | 77 // 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 | 78 // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case |
| 73 // this will always be true. | 79 // this will always be true. |
| 74 bool is_active_; | 80 bool is_active_; |
| 75 | 81 |
| 76 // The position and size of the current window. | 82 // The position and size of the current window. |
| 77 gfx::Rect bounds_; | 83 gfx::Rect bounds_; |
| 78 | 84 |
| 79 // The position and size of the non-maximized, non-fullscreen window. | 85 // The position and size of the non-maximized, non-fullscreen window. |
| 80 gfx::Rect restored_bounds_; | 86 gfx::Rect restored_bounds_; |
| 81 | 87 |
| 82 // True if the RVH is in fullscreen mode. The window may not actually be in | 88 // True if the RVH is in fullscreen mode. The window may not actually be in |
| 83 // fullscreen, however: some WMs don't support fullscreen. | 89 // fullscreen, however: some WMs don't support fullscreen. |
| 84 bool content_thinks_its_fullscreen_; | 90 bool content_thinks_its_fullscreen_; |
| 85 | 91 |
| 92 // The region is treated as title bar, can be dragged to move, | |
| 93 // double clicked to maximize, and right clicked to open context menu. | |
| 94 scoped_ptr<SkRegion> draggable_region_; | |
|
Evan Stade
2012/08/08 21:01:42
why isn't this just an SkRegion? (empty by default
| |
| 95 | |
| 96 // True if the window shows without frame. | |
| 97 bool frameless_; | |
| 98 | |
| 86 DISALLOW_COPY_AND_ASSIGN(ShellWindowGtk); | 99 DISALLOW_COPY_AND_ASSIGN(ShellWindowGtk); |
| 87 }; | 100 }; |
| 88 | 101 |
| 89 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ | 102 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ |
| OLD | NEW |