| OLD | NEW |
| 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_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/ui/constrained_window.h" | 9 #include "chrome/browser/ui/web_contents_modal_dialog.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| 12 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class WebContents; | 15 class WebContents; |
| 16 } | 16 } |
| 17 namespace views { | 17 namespace views { |
| 18 namespace internal { | 18 namespace internal { |
| 19 class NativeWidgetDelegate; | 19 class NativeWidgetDelegate; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 44 // Creates a platform-specific implementation of NativeConstrainedWindow. | 44 // Creates a platform-specific implementation of NativeConstrainedWindow. |
| 45 static NativeConstrainedWindow* CreateNativeConstrainedWindow( | 45 static NativeConstrainedWindow* CreateNativeConstrainedWindow( |
| 46 NativeConstrainedWindowDelegate* delegate); | 46 NativeConstrainedWindowDelegate* delegate); |
| 47 | 47 |
| 48 virtual views::NativeWidget* AsNativeWidget() = 0; | 48 virtual views::NativeWidget* AsNativeWidget() = 0; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 /////////////////////////////////////////////////////////////////////////////// | 51 /////////////////////////////////////////////////////////////////////////////// |
| 52 // ConstrainedWindowViews | 52 // ConstrainedWindowViews |
| 53 // | 53 // |
| 54 // A ConstrainedWindow implementation that implements a Constrained Window as | 54 // A WebContentsModalDialog implementation that implements the dialog as a |
| 55 // a child HWND with a custom window frame. The ConstrainedWindowViews owns | 55 // child HWND with a custom window frame. The ConstrainedWindowViews owns |
| 56 // itself and will be deleted soon after being closed. | 56 // itself and will be deleted soon after being closed. |
| 57 // | 57 // |
| 58 class ConstrainedWindowViews : public views::Widget, | 58 class ConstrainedWindowViews : public views::Widget, |
| 59 public ConstrainedWindow, | 59 public WebContentsModalDialog, |
| 60 public NativeConstrainedWindowDelegate { | 60 public NativeConstrainedWindowDelegate { |
| 61 public: | 61 public: |
| 62 ConstrainedWindowViews(content::WebContents* web_contents, | 62 ConstrainedWindowViews(content::WebContents* web_contents, |
| 63 views::WidgetDelegate* widget_delegate); | 63 views::WidgetDelegate* widget_delegate); |
| 64 virtual ~ConstrainedWindowViews(); | 64 virtual ~ConstrainedWindowViews(); |
| 65 | 65 |
| 66 // Returns the WebContents that constrains this Constrained Window. | 66 // Returns the WebContents that constrains this Constrained Window. |
| 67 content::WebContents* owner() const { return web_contents_; } | 67 content::WebContents* owner() const { return web_contents_; } |
| 68 | 68 |
| 69 // Overridden from ConstrainedWindow: | 69 // Overridden from WebContentsModalDialog: |
| 70 virtual void ShowConstrainedWindow() OVERRIDE; | 70 virtual void ShowWebContentsModalDialog() OVERRIDE; |
| 71 virtual void CloseConstrainedWindow() OVERRIDE; | 71 virtual void CloseWebContentsModalDialog() OVERRIDE; |
| 72 virtual void FocusConstrainedWindow() OVERRIDE; | 72 virtual void FocusWebContentsModalDialog() OVERRIDE; |
| 73 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; | 73 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; |
| 74 | 74 |
| 75 // Default insets for the dialog: | 75 // Default insets for the dialog: |
| 76 static gfx::Insets GetDefaultInsets(); | 76 static gfx::Insets GetDefaultInsets(); |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 void NotifyTabHelperWillClose(); | 79 void NotifyTabHelperWillClose(); |
| 80 | 80 |
| 81 // Overridden from views::Widget: | 81 // Overridden from views::Widget: |
| 82 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 82 virtual views::NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
| 83 | 83 |
| 84 // Overridden from NativeConstrainedWindowDelegate: | 84 // Overridden from NativeConstrainedWindowDelegate: |
| 85 virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE; | 85 virtual void OnNativeConstrainedWindowDestroyed() OVERRIDE; |
| 86 virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE; | 86 virtual void OnNativeConstrainedWindowMouseActivate() OVERRIDE; |
| 87 virtual views::internal::NativeWidgetDelegate* | 87 virtual views::internal::NativeWidgetDelegate* |
| 88 AsNativeWidgetDelegate() OVERRIDE; | 88 AsNativeWidgetDelegate() OVERRIDE; |
| 89 virtual int GetNonClientComponent(const gfx::Point& point) OVERRIDE; | 89 virtual int GetNonClientComponent(const gfx::Point& point) OVERRIDE; |
| 90 | 90 |
| 91 content::WebContents* web_contents_; | 91 content::WebContents* web_contents_; |
| 92 | 92 |
| 93 NativeConstrainedWindow* native_constrained_window_; | 93 NativeConstrainedWindow* native_constrained_window_; |
| 94 | 94 |
| 95 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViews); | 95 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowViews); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ | 98 #endif // CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ |
| OLD | NEW |