Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: chrome/browser/ui/gtk/extensions/shell_window_gtk.h

Issue 10825240: Refactor ShellWindow to separate platform-specific code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/shell_window.h" 11 #include "chrome/browser/ui/extensions/shell_window.h"
11 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" 12 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h"
12 #include "ui/base/gtk/gtk_signal.h" 13 #include "ui/base/gtk/gtk_signal.h"
13 #include "ui/base/x/active_window_watcher_x_observer.h" 14 #include "ui/base/x/active_window_watcher_x_observer.h"
14 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
15 16
16 class Profile; 17 class Profile;
17 18
18 namespace extensions { 19 namespace extensions {
19 class Extension; 20 class Extension;
20 } 21 }
21 22
22 class ShellWindowGtk : public ShellWindow, 23 class ShellWindowGtk : public NativeShellWindow,
23 public ExtensionViewGtk::Container, 24 public ExtensionViewGtk::Container,
24 public ui::ActiveWindowWatcherXObserver { 25 public ui::ActiveWindowWatcherXObserver {
25 public: 26 public:
26 ShellWindowGtk(Profile* profile, 27 ShellWindowGtk(ShellWindow* shell_window,
27 const extensions::Extension* extension, 28 const ShellWindow::CreateParams& params);
28 const GURL& url,
29 const CreateParams& params);
30 29
31 // BaseWindow implementation. 30 // BaseWindow implementation.
32 virtual bool IsActive() const OVERRIDE; 31 virtual bool IsActive() const OVERRIDE;
33 virtual bool IsMaximized() const OVERRIDE; 32 virtual bool IsMaximized() const OVERRIDE;
34 virtual bool IsMinimized() const OVERRIDE; 33 virtual bool IsMinimized() const OVERRIDE;
35 virtual bool IsFullscreen() const OVERRIDE; 34 virtual bool IsFullscreen() const OVERRIDE;
36 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; 35 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
37 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; 36 virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
38 virtual gfx::Rect GetBounds() const OVERRIDE; 37 virtual gfx::Rect GetBounds() const OVERRIDE;
39 virtual void Show() OVERRIDE; 38 virtual void Show() OVERRIDE;
40 virtual void ShowInactive() OVERRIDE; 39 virtual void ShowInactive() OVERRIDE;
41 virtual void Close() OVERRIDE; 40 virtual void Close() OVERRIDE;
42 virtual void Activate() OVERRIDE; 41 virtual void Activate() OVERRIDE;
43 virtual void Deactivate() OVERRIDE; 42 virtual void Deactivate() OVERRIDE;
44 virtual void Maximize() OVERRIDE; 43 virtual void Maximize() OVERRIDE;
45 virtual void Minimize() OVERRIDE; 44 virtual void Minimize() OVERRIDE;
46 virtual void Restore() OVERRIDE; 45 virtual void Restore() OVERRIDE;
47 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 46 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
48 virtual void FlashFrame(bool flash) OVERRIDE; 47 virtual void FlashFrame(bool flash) OVERRIDE;
49 virtual bool IsAlwaysOnTop() const OVERRIDE; 48 virtual bool IsAlwaysOnTop() const OVERRIDE;
50 49
51 // ActiveWindowWatcherXObserver implementation. 50 // ActiveWindowWatcherXObserver implementation.
52 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE; 51 virtual void ActiveWindowChanged(GdkWindow* active_window) OVERRIDE;
53 52
54 private: 53 private:
55 // ShellWindow implementation. 54 // NativeShellWindow implementation.
56 virtual void SetFullscreen(bool fullscreen) OVERRIDE; 55 virtual void SetFullscreen(bool fullscreen) OVERRIDE;
57 virtual bool IsFullscreenOrPending() const OVERRIDE; 56 virtual bool IsFullscreenOrPending() const OVERRIDE;
57 virtual void UpdateWindowTitle() OVERRIDE;
58
59 content::WebContents* web_contents() const {
60 return shell_window_->web_contents();
61 }
62 const extensions::Extension* extension() const {
63 return shell_window_->extension();
64 }
58 65
59 virtual ~ShellWindowGtk(); 66 virtual ~ShellWindowGtk();
60 67
61 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnMainWindowDeleteEvent, 68 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnMainWindowDeleteEvent,
62 GdkEvent*); 69 GdkEvent*);
63 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnConfigure, 70 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnConfigure,
64 GdkEventConfigure*); 71 GdkEventConfigure*);
65 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnWindowState, 72 CHROMEGTK_CALLBACK_1(ShellWindowGtk, gboolean, OnWindowState,
66 GdkEventWindowState*); 73 GdkEventWindowState*);
67 74
75 ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow.
76
68 GtkWindow* window_; 77 GtkWindow* window_;
69 GdkWindowState state_; 78 GdkWindowState state_;
70 79
71 // True if the window manager thinks the window is active. Not all window 80 // 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 81 // managers keep track of this state (_NET_ACTIVE_WINDOW), in which case
73 // this will always be true. 82 // this will always be true.
74 bool is_active_; 83 bool is_active_;
75 84
76 // The position and size of the current window. 85 // The position and size of the current window.
77 gfx::Rect bounds_; 86 gfx::Rect bounds_;
78 87
79 // The position and size of the non-maximized, non-fullscreen window. 88 // The position and size of the non-maximized, non-fullscreen window.
80 gfx::Rect restored_bounds_; 89 gfx::Rect restored_bounds_;
81 90
82 // True if the RVH is in fullscreen mode. The window may not actually be in 91 // True if the RVH is in fullscreen mode. The window may not actually be in
83 // fullscreen, however: some WMs don't support fullscreen. 92 // fullscreen, however: some WMs don't support fullscreen.
84 bool content_thinks_its_fullscreen_; 93 bool content_thinks_its_fullscreen_;
85 94
86 DISALLOW_COPY_AND_ASSIGN(ShellWindowGtk); 95 DISALLOW_COPY_AND_ASSIGN(ShellWindowGtk);
87 }; 96 };
88 97
89 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_ 98 #endif // CHROME_BROWSER_UI_GTK_EXTENSIONS_SHELL_WINDOW_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/shell_window.cc ('k') | chrome/browser/ui/gtk/extensions/shell_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698