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

Unified Diff: chrome/browser/ui/views/apps/native_app_window_views.h

Issue 171523005: BACKUP: NativeAppWindowView - before splitting CL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/apps/native_app_window_views.h
diff --git a/chrome/browser/ui/views/apps/native_app_window_views.h b/chrome/browser/ui/views/apps/native_app_window_views.h
index ebcf654e57fe3ca75c87beac48c52a29d84af64b..0b37501e1df2c28704d370b00672dfa98b184326 100644
--- a/chrome/browser/ui/views/apps/native_app_window_views.h
+++ b/chrome/browser/ui/views/apps/native_app_window_views.h
@@ -1,22 +1,15 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// 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_
-#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 "apps/ui/views/native_app_window_views.h"
+#include "base/memory/scoped_ptr.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"
+
+class ExtensionKeybindingRegistryViews;
#if defined(USE_ASH)
namespace ash {
@@ -24,43 +17,15 @@ class ImmersiveFullscreenController;
}
#endif
-class ExtensionKeybindingRegistryViews;
-
-namespace apps {
-class AppWindowFrameView;
-}
-
-namespace content {
-class BrowserContext;
-class RenderViewHost;
-class WebContents;
-}
-
-namespace extensions {
-class Extension;
-}
-
-namespace ui {
-class MenuModel;
-}
-
namespace views {
class MenuRunner;
-class WebView;
}
-class NativeAppWindowViews : public apps::NativeAppWindow,
- public content::WebContentsObserver,
- public views::ContextMenuController,
- public views::WidgetDelegateView,
- public views::WidgetObserver {
+class ChromeNativeAppWindowViews : public NativeAppWindowViews,
+ public views::ContextMenuController {
public:
- NativeAppWindowViews();
- virtual ~NativeAppWindowViews();
- void Init(apps::AppWindow* app_window,
- const apps::AppWindow::CreateParams& create_params);
-
- SkRegion* shape() { return shape_.get(); }
+ ChromeNativeAppWindowViews();
+ virtual ~ChromeNativeAppWindowViews();
protected:
// Called before views::Widget::Init() to allow subclasses to customize
@@ -68,155 +33,51 @@ class NativeAppWindowViews : public apps::NativeAppWindow,
virtual void OnBeforeWidgetInit(views::Widget::InitParams* init_params,
views::Widget* widget);
- // 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(); }
- const views::Widget* window() const { return window_; }
-
+ // Initializes a normal, non-panel app window.
virtual void InitializeDefaultWindow(
const apps::AppWindow::CreateParams& create_params);
+
+ // Initializes a panel window.
virtual void InitializePanelWindow(
const apps::AppWindow::CreateParams& create_params);
private:
- friend class ShapedAppWindowTargeterTest;
-
- void OnViewWasResized();
-
- bool ShouldUseChromeStyleFrame() const;
-
- // Caller owns the returned object.
- apps::AppWindowFrameView* CreateAppWindowFrameView();
-
- // ui::BaseWindow implementation.
- virtual bool IsActive() const OVERRIDE;
- virtual bool IsMaximized() const OVERRIDE;
- virtual bool IsMinimized() const OVERRIDE;
- virtual bool IsFullscreen() const OVERRIDE;
- virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
- virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
+ // ui::BaseWindow overrides:
virtual ui::WindowShowState GetRestoredState() const OVERRIDE;
- virtual gfx::Rect GetBounds() const OVERRIDE;
- virtual void ShowInactive() OVERRIDE;
- virtual void Hide() OVERRIDE;
- virtual void Close() OVERRIDE;
- virtual void Deactivate() OVERRIDE;
- virtual void Maximize() OVERRIDE;
- virtual void Minimize() OVERRIDE;
- virtual void Restore() OVERRIDE;
- virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
- virtual void FlashFrame(bool flash) OVERRIDE;
virtual bool IsAlwaysOnTop() const OVERRIDE;
- virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
- // Overridden from views::ContextMenuController:
+ // views::ContextMenuController overrides:
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;
- virtual bool CanResize() const OVERRIDE;
- virtual bool CanMaximize() const OVERRIDE;
- virtual base::string16 GetWindowTitle() const OVERRIDE;
- virtual bool ShouldShowWindowTitle() const OVERRIDE;
- virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE;
+ // views::WidgetDelegate overrides:
virtual gfx::ImageSkia GetWindowIcon() OVERRIDE;
- virtual bool ShouldShowWindowIcon() const OVERRIDE;
- virtual void SaveWindowPlacement(const gfx::Rect& bounds,
- ui::WindowShowState show_state) OVERRIDE;
- virtual void DeleteDelegate() OVERRIDE;
- 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(
- gfx::NativeView child,
- const gfx::Point& location) OVERRIDE;
-
- // WidgetObserver implementation.
- virtual void OnWidgetVisibilityChanged(views::Widget* widget,
- bool visible) OVERRIDE;
- virtual void OnWidgetActivationChanged(views::Widget* widget,
- bool active) OVERRIDE;
-
- // WebContentsObserver implementation.
- virtual void RenderViewCreated(
- content::RenderViewHost* render_view_host) OVERRIDE;
- virtual void RenderViewHostChanged(
- content::RenderViewHost* old_host,
- content::RenderViewHost* new_host) OVERRIDE;
-
- // views::View implementation.
- virtual void Layout() OVERRIDE;
- virtual void ViewHierarchyChanged(
- const ViewHierarchyChangedDetails& details) OVERRIDE;
+
+ // views::View overrides:
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.
+ // NativeAppWindow overrides:
virtual void SetFullscreen(int fullscreen_types) OVERRIDE;
virtual bool IsFullscreenOrPending() const OVERRIDE;
virtual bool IsDetached() const OVERRIDE;
- virtual void UpdateWindowIcon() OVERRIDE;
- virtual void UpdateWindowTitle() OVERRIDE;
virtual void UpdateBadgeIcon() OVERRIDE;
- virtual void UpdateDraggableRegions(
- const std::vector<extensions::DraggableRegion>& regions) OVERRIDE;
- virtual SkRegion* GetDraggableRegion() OVERRIDE;
- virtual void UpdateShape(scoped_ptr<SkRegion> region) OVERRIDE;
- virtual void HandleKeyboardEvent(
- const content::NativeWebKeyboardEvent& event) OVERRIDE;
- virtual bool IsFrameless() const OVERRIDE;
- virtual gfx::Insets GetFrameInsets() const OVERRIDE;
- virtual void HideWithApp() OVERRIDE;
- virtual void ShowWithApp() OVERRIDE;
- virtual void UpdateWindowMinMaxSize() OVERRIDE;
-
- // web_modal::WebContentsModalDialogHost implementation.
- virtual gfx::NativeView GetHostView() const OVERRIDE;
- virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE;
- virtual gfx::Size GetMaximumDialogSize() OVERRIDE;
- virtual void AddObserver(
- web_modal::ModalDialogHostObserver* observer) OVERRIDE;
- virtual void RemoveObserver(
- web_modal::ModalDialogHostObserver* observer) OVERRIDE;
-
- content::WebContents* web_contents() { return app_window_->web_contents(); }
-
- 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.
- scoped_ptr<SkRegion> shape_;
- scoped_ptr<SkRegion> draggable_region_;
+ // NativeAppWindowViews overrides:
+ void InitializeWindow(apps::AppWindow* app_window,
+ const apps::AppWindow::CreateParams& create_params)
+ OVERRIDE;
- bool frameless_;
- bool transparent_background_;
- gfx::Size preferred_size_;
- bool resizable_;
+ bool ShouldUseChromeStyleFrame() const;
- // The class that registers for keyboard shortcuts for extension commands.
- scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
+ // Caller owns the returned object.
+ apps::AppWindowFrameView* CreateAppWindowFrameView();
- views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
+ // True if the window is fullscreen or fullscreen is pending.
+ bool is_fullscreen_;
#if defined(USE_ASH)
// Used to put non-frameless windows into immersive fullscreen on ChromeOS. In
@@ -225,16 +86,18 @@ class NativeAppWindowViews : public apps::NativeAppWindow,
// screen.
scoped_ptr<ash::ImmersiveFullscreenController>
immersive_fullscreen_controller_;
-#endif
+#endif // defined(USE_ASH)
- ObserverList<web_modal::ModalDialogHostObserver> observer_list_;
+ // Only panel windows have an explicit preferred size.
+ gfx::Size preferred_size_;
- base::WeakPtrFactory<NativeAppWindowViews> weak_ptr_factory_;
+ // The class that registers for keyboard shortcuts for extension commands.
+ scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_;
// Used to show the system menu.
scoped_ptr<views::MenuRunner> menu_runner_;
- DISALLOW_COPY_AND_ASSIGN(NativeAppWindowViews);
+ DISALLOW_COPY_AND_ASSIGN(ChromeNativeAppWindowViews);
};
#endif // CHROME_BROWSER_UI_VIEWS_APPS_NATIVE_APP_WINDOW_VIEWS_H_

Powered by Google App Engine
This is Rietveld 408576698