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