| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APPS_NATIVE_APP_WINDOW_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_APPS_NATIVE_APP_WINDOW_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_APPS_NATIVE_APP_WINDOW_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_APPS_NATIVE_APP_WINDOW_GTK_H_ |
| 7 | 7 |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "apps/shell_window.h" | 10 #include "apps/app_window.h" |
| 11 #include "apps/ui/native_app_window.h" | 11 #include "apps/ui/native_app_window.h" |
| 12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" | 14 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" |
| 15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 16 #include "third_party/skia/include/core/SkRegion.h" | 16 #include "third_party/skia/include/core/SkRegion.h" |
| 17 #include "ui/base/gtk/gtk_signal.h" | 17 #include "ui/base/gtk/gtk_signal.h" |
| 18 #include "ui/base/x/active_window_watcher_x_observer.h" | 18 #include "ui/base/x/active_window_watcher_x_observer.h" |
| 19 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
| 20 #include "ui/gfx/x/x11_atom_cache.h" | 20 #include "ui/gfx/x/x11_atom_cache.h" |
| 21 | 21 |
| 22 class ExtensionKeybindingRegistryGtk; | 22 class ExtensionKeybindingRegistryGtk; |
| 23 | 23 |
| 24 namespace extensions { | 24 namespace extensions { |
| 25 class Extension; | 25 class Extension; |
| 26 } | 26 } |
| 27 | 27 |
| 28 class NativeAppWindowGtk : public apps::NativeAppWindow, | 28 class NativeAppWindowGtk : public apps::NativeAppWindow, |
| 29 public ExtensionViewGtk::Container, | 29 public ExtensionViewGtk::Container, |
| 30 public ui::ActiveWindowWatcherXObserver, | 30 public ui::ActiveWindowWatcherXObserver, |
| 31 public content::WebContentsObserver { | 31 public content::WebContentsObserver { |
| 32 public: | 32 public: |
| 33 NativeAppWindowGtk(apps::ShellWindow* shell_window, | 33 NativeAppWindowGtk(apps::AppWindow* app_window, |
| 34 const apps::ShellWindow::CreateParams& params); | 34 const apps::AppWindow::CreateParams& params); |
| 35 | 35 |
| 36 // ui::BaseWindow implementation. | 36 // ui::BaseWindow implementation. |
| 37 virtual bool IsActive() const OVERRIDE; | 37 virtual bool IsActive() const OVERRIDE; |
| 38 virtual bool IsMaximized() const OVERRIDE; | 38 virtual bool IsMaximized() const OVERRIDE; |
| 39 virtual bool IsMinimized() const OVERRIDE; | 39 virtual bool IsMinimized() const OVERRIDE; |
| 40 virtual bool IsFullscreen() const OVERRIDE; | 40 virtual bool IsFullscreen() const OVERRIDE; |
| 41 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; | 41 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; |
| 42 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; | 42 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; |
| 43 virtual ui::WindowShowState GetRestoredState() const OVERRIDE; | 43 virtual ui::WindowShowState GetRestoredState() const OVERRIDE; |
| 44 virtual gfx::Rect GetBounds() const OVERRIDE; | 44 virtual gfx::Rect GetBounds() const OVERRIDE; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // web_modal::WebContentsModalDialogHost implementation. | 88 // web_modal::WebContentsModalDialogHost implementation. |
| 89 virtual gfx::NativeView GetHostView() const OVERRIDE; | 89 virtual gfx::NativeView GetHostView() const OVERRIDE; |
| 90 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE; | 90 virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE; |
| 91 virtual gfx::Size GetMaximumDialogSize() OVERRIDE; | 91 virtual gfx::Size GetMaximumDialogSize() OVERRIDE; |
| 92 virtual void AddObserver( | 92 virtual void AddObserver( |
| 93 web_modal::ModalDialogHostObserver* observer) OVERRIDE; | 93 web_modal::ModalDialogHostObserver* observer) OVERRIDE; |
| 94 virtual void RemoveObserver( | 94 virtual void RemoveObserver( |
| 95 web_modal::ModalDialogHostObserver* observer) OVERRIDE; | 95 web_modal::ModalDialogHostObserver* observer) OVERRIDE; |
| 96 | 96 |
| 97 content::WebContents* web_contents() const { | 97 content::WebContents* web_contents() const { |
| 98 return shell_window_->web_contents(); | 98 return app_window_->web_contents(); |
| 99 } | 99 } |
| 100 const extensions::Extension* extension() const { | 100 const extensions::Extension* extension() const { |
| 101 return shell_window_->extension(); | 101 return app_window_->extension(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 virtual ~NativeAppWindowGtk(); | 104 virtual ~NativeAppWindowGtk(); |
| 105 | 105 |
| 106 // If the point (|x|, |y|) is within the resize border area of the window, | 106 // If the point (|x|, |y|) is within the resize border area of the window, |
| 107 // returns true and sets |edge| to the appropriate GdkWindowEdge value. | 107 // returns true and sets |edge| to the appropriate GdkWindowEdge value. |
| 108 // Otherwise, returns false. | 108 // Otherwise, returns false. |
| 109 bool GetWindowEdge(int x, int y, GdkWindowEdge* edge); | 109 bool GetWindowEdge(int x, int y, GdkWindowEdge* edge); |
| 110 | 110 |
| 111 CHROMEGTK_CALLBACK_1(NativeAppWindowGtk, gboolean, OnMainWindowDeleteEvent, | 111 CHROMEGTK_CALLBACK_1(NativeAppWindowGtk, gboolean, OnMainWindowDeleteEvent, |
| 112 GdkEvent*); | 112 GdkEvent*); |
| 113 CHROMEGTK_CALLBACK_1(NativeAppWindowGtk, gboolean, OnConfigure, | 113 CHROMEGTK_CALLBACK_1(NativeAppWindowGtk, gboolean, OnConfigure, |
| 114 GdkEventConfigure*); | 114 GdkEventConfigure*); |
| 115 CHROMEGTK_CALLBACK_1(NativeAppWindowGtk, gboolean, OnWindowState, | 115 CHROMEGTK_CALLBACK_1(NativeAppWindowGtk, gboolean, OnWindowState, |
| 116 GdkEventWindowState*); | 116 GdkEventWindowState*); |
| 117 CHROMEGTK_CALLBACK_1(NativeAppWindowGtk, gboolean, OnMouseMoveEvent, | 117 CHROMEGTK_CALLBACK_1(NativeAppWindowGtk, gboolean, OnMouseMoveEvent, |
| 118 GdkEventMotion*); | 118 GdkEventMotion*); |
| 119 CHROMEGTK_CALLBACK_1(NativeAppWindowGtk, gboolean, OnButtonPress, | 119 CHROMEGTK_CALLBACK_1(NativeAppWindowGtk, gboolean, OnButtonPress, |
| 120 GdkEventButton*); | 120 GdkEventButton*); |
| 121 // Callback for PropertyChange XEvents. | 121 // Callback for PropertyChange XEvents. |
| 122 CHROMEG_CALLBACK_1(NativeAppWindowGtk, GdkFilterReturn, | 122 CHROMEG_CALLBACK_1(NativeAppWindowGtk, GdkFilterReturn, |
| 123 OnXEvent, GdkXEvent*, GdkEvent*); | 123 OnXEvent, GdkXEvent*, GdkEvent*); |
| 124 | 124 |
| 125 void OnConfigureDebounced(); | 125 void OnConfigureDebounced(); |
| 126 | 126 |
| 127 apps::ShellWindow* shell_window_; // weak - ShellWindow owns NativeAppWindow. | 127 apps::AppWindow* app_window_; // weak - AppWindow owns NativeAppWindow. |
| 128 | 128 |
| 129 GtkWindow* window_; | 129 GtkWindow* window_; |
| 130 GdkWindowState state_; | 130 GdkWindowState state_; |
| 131 | 131 |
| 132 // True if the window manager thinks the window is active. Not all window | 132 // True if the window manager thinks the window is active. Not all window |
| 133 // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case | 133 // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case |
| 134 // this will always be true. | 134 // this will always be true. |
| 135 bool is_active_; | 135 bool is_active_; |
| 136 | 136 |
| 137 // The position and size of the current window. | 137 // The position and size of the current window. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 ui::X11AtomCache atom_cache_; | 184 ui::X11AtomCache atom_cache_; |
| 185 | 185 |
| 186 // True if we listen for the XEvent. | 186 // True if we listen for the XEvent. |
| 187 bool is_x_event_listened_; | 187 bool is_x_event_listened_; |
| 188 | 188 |
| 189 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowGtk); | 189 DISALLOW_COPY_AND_ASSIGN(NativeAppWindowGtk); |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 #endif // CHROME_BROWSER_UI_GTK_APPS_NATIVE_APP_WINDOW_GTK_H_ | 192 #endif // CHROME_BROWSER_UI_GTK_APPS_NATIVE_APP_WINDOW_GTK_H_ |
| OLD | NEW |