| Index: chrome/browser/ui/views/extensions/app_base_window_views.h
|
| diff --git a/chrome/browser/ui/views/extensions/shell_window_views.h b/chrome/browser/ui/views/extensions/app_base_window_views.h
|
| similarity index 68%
|
| rename from chrome/browser/ui/views/extensions/shell_window_views.h
|
| rename to chrome/browser/ui/views/extensions/app_base_window_views.h
|
| index 18beabf4d4b353d88d2d5c25beb27e91ef7a69f6..8166bfc645526038c409c59513eecbe4a68fb055 100644
|
| --- a/chrome/browser/ui/views/extensions/shell_window_views.h
|
| +++ b/chrome/browser/ui/views/extensions/app_base_window_views.h
|
| @@ -2,20 +2,18 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_
|
| -#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_
|
| +#ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_APP_BASE_WINDOW_VIEWS_H_
|
| +#define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_APP_BASE_WINDOW_VIEWS_H_
|
|
|
| -#include "chrome/browser/ui/base_window.h"
|
| -#include "chrome/browser/ui/extensions/native_shell_window.h"
|
| -#include "chrome/browser/ui/extensions/shell_window.h"
|
| +#include "chrome/browser/ui/extensions/app_base_window.h"
|
| #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h"
|
| -#include "third_party/skia/include/core/SkRegion.h"
|
| #include "ui/gfx/image/image_skia.h"
|
| #include "ui/gfx/rect.h"
|
| #include "ui/views/widget/widget_delegate.h"
|
|
|
| class ExtensionKeybindingRegistryViews;
|
| class Profile;
|
| +class SkRegion;
|
|
|
| namespace content {
|
| class WebContents;
|
| @@ -23,17 +21,22 @@ class WebContents;
|
|
|
| namespace extensions {
|
| class Extension;
|
| +class ShellWindow;
|
| }
|
|
|
| namespace views {
|
| class WebView;
|
| }
|
|
|
| -class ShellWindowViews : public NativeShellWindow,
|
| - public views::WidgetDelegateView {
|
| +class AppBaseWindowViews : public AppBaseWindow,
|
| + public views::WidgetDelegateView {
|
| public:
|
| - ShellWindowViews(ShellWindow* shell_window,
|
| - const ShellWindow::CreateParams& params);
|
| + AppBaseWindowViews(ShellWindow* shell_window,
|
| + const ShellWindow::CreateParams& params);
|
| + virtual ~AppBaseWindowViews();
|
| +
|
| + // This must be called after construction (i.e. in AppBaseWindow::Create).
|
| + void Initialize(const ShellWindow::CreateParams& params);
|
|
|
| bool frameless() const { return frameless_; }
|
| SkRegion* draggable_region() { return draggable_region_.get(); }
|
| @@ -61,8 +64,6 @@ class ShellWindowViews : public NativeShellWindow,
|
|
|
| // WidgetDelegate implementation.
|
| virtual views::View* GetContentsView() OVERRIDE;
|
| - virtual views::NonClientFrameView* CreateNonClientFrameView(
|
| - views::Widget* widget) OVERRIDE;
|
| virtual bool CanResize() const OVERRIDE;
|
| virtual bool CanMaximize() const OVERRIDE;
|
| virtual views::Widget* GetWidget() OVERRIDE;
|
| @@ -79,13 +80,12 @@ class ShellWindowViews : public NativeShellWindow,
|
| virtual void OnWidgetMove() OVERRIDE;
|
|
|
| protected:
|
| - // views::View implementation.
|
| - virtual void Layout() OVERRIDE;
|
| - virtual void ViewHierarchyChanged(
|
| - bool is_add, views::View *parent, views::View *child) OVERRIDE;
|
| - virtual gfx::Size GetMinimumSize() OVERRIDE;
|
| - virtual gfx::Size GetMaximumSize() OVERRIDE;
|
| - virtual void OnFocus() OVERRIDE;
|
| + ShellWindow* shell_window() { return shell_window_; }
|
| + views::WebView* web_view() { return web_view_; }
|
| + views::Widget* window() { return window_; }
|
| + ExtensionKeybindingRegistryViews* extension_keybinding_registry() {
|
| + return extension_keybinding_registry_.get();
|
| + }
|
|
|
| Profile* profile() { return shell_window_->profile(); }
|
| content::WebContents* web_contents() {
|
| @@ -95,16 +95,26 @@ class ShellWindowViews : public NativeShellWindow,
|
| return shell_window_->extension();
|
| }
|
|
|
| - // views::WidgetDelegate implementation.
|
| - virtual void SaveWindowPlacement(const gfx::Rect& bounds,
|
| - ui::WindowShowState show_state) OVERRIDE;
|
| + // InitializeWindow() must be implemented by the implementation class.
|
| + virtual void InitializeWindow(const gfx::Rect& initial_bounds) = 0;
|
| +
|
| + // Defaults to a noop. Implement to handle any necessary syncing on resize.
|
| + virtual void OnViewWasResized();
|
|
|
| private:
|
| - friend class ShellWindowFrameView;
|
| + // views::View implementation.
|
| + virtual void Layout() OVERRIDE;
|
| + virtual void ViewHierarchyChanged(
|
| + bool is_add, views::View *parent, views::View *child) OVERRIDE;
|
| + virtual gfx::Size GetMinimumSize() OVERRIDE;
|
| + virtual gfx::Size GetMaximumSize() OVERRIDE;
|
| + virtual void OnFocus() OVERRIDE;
|
|
|
| - virtual ~ShellWindowViews();
|
| + // views::WidgetDelegate implementation.
|
| + virtual void SaveWindowPlacement(const gfx::Rect& bounds,
|
| + ui::WindowShowState show_state) OVERRIDE;
|
|
|
| - // NativeShellWindow implementation.
|
| + // AppBaseWindow implementation.
|
| virtual void SetFullscreen(bool fullscreen) OVERRIDE;
|
| virtual bool IsFullscreenOrPending() const OVERRIDE;
|
| virtual void UpdateWindowIcon() OVERRIDE;
|
| @@ -115,26 +125,35 @@ class ShellWindowViews : public NativeShellWindow,
|
| const content::NativeWebKeyboardEvent& event) OVERRIDE;
|
| virtual void RenderViewHostChanged() OVERRIDE;
|
|
|
| - void OnViewWasResized();
|
| -
|
| - ShellWindow* shell_window_; // weak - ShellWindow owns NativeShellWindow.
|
| + // Weak ptr to the ShellWindow instance that owns this.
|
| + ShellWindow* shell_window_;
|
|
|
| + // Pointer to the child web view (owned by the view hierarchy).
|
| views::WebView* web_view_;
|
| +
|
| + // Unowned window ptr, initialized in InitializeWindow.
|
| views::Widget* window_;
|
| - bool is_fullscreen_;
|
|
|
| - scoped_ptr<SkRegion> draggable_region_;
|
| + // Tracks the fullscreen state.
|
| + bool is_fullscreen_;
|
|
|
| + // True if the ShellWindow frame type == FRAME_NONE.
|
| bool frameless_;
|
| +
|
| + // Minimum / maximum window size.
|
| gfx::Size minimum_size_;
|
| gfx::Size maximum_size_;
|
|
|
| + // Draggable region for frameless windows.
|
| + scoped_ptr<SkRegion> draggable_region_;
|
| +
|
| // The class that registers for keyboard shortcuts for extension commands.
|
| scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
|
|
|
| + // Passes unhandled keyboard events to the focus manager or OS.
|
| UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(ShellWindowViews);
|
| + DISALLOW_COPY_AND_ASSIGN(AppBaseWindowViews);
|
| };
|
|
|
| -#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_SHELL_WINDOW_VIEWS_H_
|
| +#endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_APP_BASE_WINDOW_VIEWS_H_
|
|
|