Index: apps/ui/views/native_app_window_views.h |
diff --git a/chrome/browser/ui/views/apps/native_app_window_views.h b/apps/ui/views/native_app_window_views.h |
similarity index 69% |
copy from chrome/browser/ui/views/apps/native_app_window_views.h |
copy to apps/ui/views/native_app_window_views.h |
index ebcf654e57fe3ca75c87beac48c52a29d84af64b..f7bc603a2f5a191f1605f2c53e4bf6a833484ccb 100644 |
--- a/chrome/browser/ui/views/apps/native_app_window_views.h |
+++ b/apps/ui/views/native_app_window_views.h |
@@ -2,29 +2,19 @@ |
// 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_APPS_NATIVE_APP_WINDOW_VIEWS_H_ |
-#define CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ |
+#ifndef APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_ |
+#define APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_ |
-#include "apps/app_window.h" |
#include "apps/ui/native_app_window.h" |
#include "base/observer_list.h" |
#include "content/public/browser/web_contents_observer.h" |
-#include "third_party/skia/include/core/SkRegion.h" |
-#include "ui/gfx/image/image_skia.h" |
#include "ui/gfx/rect.h" |
-#include "ui/views/context_menu_controller.h" |
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
#include "ui/views/widget/widget.h" |
#include "ui/views/widget/widget_delegate.h" |
#include "ui/views/widget/widget_observer.h" |
-#if defined(USE_ASH) |
-namespace ash { |
-class ImmersiveFullscreenController; |
-} |
-#endif |
- |
-class ExtensionKeybindingRegistryViews; |
+class SkRegion; |
namespace apps { |
class AppWindowFrameView; |
@@ -49,9 +39,10 @@ class MenuRunner; |
class WebView; |
} |
+// A NativeAppWindow backed by a views::Widget. This class may be used alone |
+// as a stub or subclassed (for example, ChromeNativeAppWindowViews). |
class NativeAppWindowViews : public apps::NativeAppWindow, |
public content::WebContentsObserver, |
- public views::ContextMenuController, |
public views::WidgetDelegateView, |
public views::WidgetObserver { |
public: |
@@ -63,36 +54,18 @@ class NativeAppWindowViews : public apps::NativeAppWindow, |
SkRegion* shape() { return shape_.get(); } |
protected: |
- // Called before views::Widget::Init() to allow subclasses to customize |
- // the InitParams that would be passed. |
- virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params, |
- views::Widget* widget); |
+ apps::AppWindow* app_window() { return app_window_; } |
+ const apps::AppWindow* app_window() const { return app_window_; } |
- // ui::BaseWindow implementation that subclasses may override. |
- virtual void Show() OVERRIDE; |
- virtual void Activate() OVERRIDE; |
- |
- content::BrowserContext* browser_context() { |
- return app_window_->browser_context(); |
- } |
- |
- const extensions::Extension* extension() { return app_window_->extension(); } |
+ views::Widget* window() { return window_; } |
const views::Widget* window() const { return window_; } |
- virtual void InitializeDefaultWindow( |
- const apps::AppWindow::CreateParams& create_params); |
- virtual void InitializePanelWindow( |
- const apps::AppWindow::CreateParams& create_params); |
- |
- private: |
- friend class ShapedAppWindowTargeterTest; |
- |
- void OnViewWasResized(); |
- |
- bool ShouldUseChromeStyleFrame() const; |
+ views::WebView* web_view() { return web_view_; } |
- // Caller owns the returned object. |
- apps::AppWindowFrameView* CreateAppWindowFrameView(); |
+ // Initializes |window_| for |app_window|. |
+ virtual void InitializeWindow( |
+ apps::AppWindow* app_window, |
+ const apps::AppWindow::CreateParams& create_params); |
// ui::BaseWindow implementation. |
virtual bool IsActive() const OVERRIDE; |
@@ -103,9 +76,11 @@ class NativeAppWindowViews : public apps::NativeAppWindow, |
virtual gfx::Rect GetRestoredBounds() const OVERRIDE; |
virtual ui::WindowShowState GetRestoredState() const OVERRIDE; |
virtual gfx::Rect GetBounds() const OVERRIDE; |
+ virtual void Show() OVERRIDE; |
virtual void ShowInactive() OVERRIDE; |
virtual void Hide() OVERRIDE; |
virtual void Close() OVERRIDE; |
+ virtual void Activate() OVERRIDE; |
virtual void Deactivate() OVERRIDE; |
virtual void Maximize() OVERRIDE; |
virtual void Minimize() OVERRIDE; |
@@ -115,11 +90,6 @@ class NativeAppWindowViews : public apps::NativeAppWindow, |
virtual bool IsAlwaysOnTop() const OVERRIDE; |
virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; |
- // Overridden from views::ContextMenuController: |
- virtual void ShowContextMenuForView(views::View* source, |
- const gfx::Point& p, |
- ui::MenuSourceType source_type) OVERRIDE; |
- |
// WidgetDelegate implementation. |
virtual void OnWidgetMove() OVERRIDE; |
virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
@@ -127,8 +97,6 @@ class NativeAppWindowViews : public apps::NativeAppWindow, |
virtual bool CanMaximize() const OVERRIDE; |
virtual base::string16 GetWindowTitle() const OVERRIDE; |
virtual bool ShouldShowWindowTitle() const OVERRIDE; |
- virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE; |
- virtual gfx::ImageSkia GetWindowIcon() OVERRIDE; |
virtual bool ShouldShowWindowIcon() const OVERRIDE; |
virtual void SaveWindowPlacement(const gfx::Rect& bounds, |
ui::WindowShowState show_state) OVERRIDE; |
@@ -136,8 +104,6 @@ class NativeAppWindowViews : public apps::NativeAppWindow, |
virtual views::Widget* GetWidget() OVERRIDE; |
virtual const views::Widget* GetWidget() const OVERRIDE; |
virtual views::View* GetContentsView() OVERRIDE; |
- virtual views::NonClientFrameView* CreateNonClientFrameView( |
- views::Widget* widget) OVERRIDE; |
virtual bool WidgetHasHitTestMask() const OVERRIDE; |
virtual void GetWidgetHitTestMask(gfx::Path* mask) const OVERRIDE; |
virtual bool ShouldDescendIntoChildForEventHandling( |
@@ -161,11 +127,9 @@ class NativeAppWindowViews : public apps::NativeAppWindow, |
virtual void Layout() OVERRIDE; |
virtual void ViewHierarchyChanged( |
const ViewHierarchyChangedDetails& details) OVERRIDE; |
- virtual gfx::Size GetPreferredSize() OVERRIDE; |
virtual gfx::Size GetMinimumSize() OVERRIDE; |
virtual gfx::Size GetMaximumSize() OVERRIDE; |
virtual void OnFocus() OVERRIDE; |
- virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
// NativeAppWindow implementation. |
virtual void SetFullscreen(int fullscreen_types) OVERRIDE; |
@@ -195,12 +159,15 @@ class NativeAppWindowViews : public apps::NativeAppWindow, |
virtual void RemoveObserver( |
web_modal::ModalDialogHostObserver* observer) OVERRIDE; |
- content::WebContents* web_contents() { return app_window_->web_contents(); } |
+ private: |
+ friend class ShapedAppWindowTargeterTest; |
+ |
+ // Informs modal dialogs that they need to update their positions. |
+ void OnViewWasResized(); |
apps::AppWindow* app_window_; // Not owned. |
views::WebView* web_view_; |
views::Widget* window_; |
- bool is_fullscreen_; |
// Custom shape of the window. If this is not set then the window has a |
// default shape, usually rectangular. |
@@ -210,31 +177,13 @@ class NativeAppWindowViews : public apps::NativeAppWindow, |
bool frameless_; |
bool transparent_background_; |
- gfx::Size preferred_size_; |
bool resizable_; |
- // The class that registers for keyboard shortcuts for extension commands. |
- scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; |
- |
views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
-#if defined(USE_ASH) |
- // Used to put non-frameless windows into immersive fullscreen on ChromeOS. In |
- // immersive fullscreen, the window header (title bar and window controls) |
- // slides onscreen as an overlay when the mouse is hovered at the top of the |
- // screen. |
- scoped_ptr<ash::ImmersiveFullscreenController> |
- immersive_fullscreen_controller_; |
-#endif |
- |
ObserverList<web_modal::ModalDialogHostObserver> observer_list_; |
- base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_; |
- |
- // Used to show the system menu. |
- scoped_ptr<views::MenuRunner> menu_runner_; |
- |
DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews); |
}; |
-#endif // CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_ |
+#endif // APPS_UI_VIEWS_NATIVE_APP_WINDOW_VIEWS_H_ |