diff options
author | rfevang@chromium.org <rfevang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-09 22:19:30 +0000 |
---|---|---|
committer | rfevang@chromium.org <rfevang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-09 22:19:30 +0000 |
commit | 00517a8e5c65640584eb1cdc1fa6edf16dc238c5 (patch) | |
tree | 32f8d9813d88cf92c786e1b75d0ccf52028bca00 /components | |
parent | e09d37a7d32cc2292868105646d90400fa3bb614 (diff) | |
download | chromium_src-00517a8e5c65640584eb1cdc1fa6edf16dc238c5.zip chromium_src-00517a8e5c65640584eb1cdc1fa6edf16dc238c5.tar.gz chromium_src-00517a8e5c65640584eb1cdc1fa6edf16dc238c5.tar.bz2 |
Don't enforce maximum dialog size for browser modal dialogs.
These dialogs are not contained by the browser window, so allow them to have whatever size they want to have.
BUG=288493
Review URL: https://codereview.chromium.org/24265007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227820 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/web_modal.gypi | 2 | ||||
-rw-r--r-- | components/web_modal/modal_dialog_host.cc | 15 | ||||
-rw-r--r-- | components/web_modal/modal_dialog_host.h | 45 | ||||
-rw-r--r-- | components/web_modal/web_contents_modal_dialog_host.cc | 9 | ||||
-rw-r--r-- | components/web_modal/web_contents_modal_dialog_host.h | 43 |
5 files changed, 68 insertions, 46 deletions
diff --git a/components/web_modal.gypi b/components/web_modal.gypi index f2db7d4..ad7d4fd 100644 --- a/components/web_modal.gypi +++ b/components/web_modal.gypi @@ -19,6 +19,8 @@ 'WEB_MODAL_IMPLEMENTATION', ], 'sources': [ + 'web_modal/modal_dialog_host.cc', + 'web_modal/modal_dialog_host.h', 'web_modal/native_web_contents_modal_dialog.h', 'web_modal/native_web_contents_modal_dialog_manager.h', 'web_modal/web_contents_modal_dialog_host.cc', diff --git a/components/web_modal/modal_dialog_host.cc b/components/web_modal/modal_dialog_host.cc new file mode 100644 index 0000000..61ddbc2 --- /dev/null +++ b/components/web_modal/modal_dialog_host.cc @@ -0,0 +1,15 @@ +// Copyright 2013 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. + +#include "components/web_modal/modal_dialog_host.h" + +namespace web_modal { + +ModalDialogHostObserver::~ModalDialogHostObserver() { +} + +ModalDialogHost::~ModalDialogHost() { +} + +} // namespace web_modal diff --git a/components/web_modal/modal_dialog_host.h b/components/web_modal/modal_dialog_host.h new file mode 100644 index 0000000..821684d --- /dev/null +++ b/components/web_modal/modal_dialog_host.h @@ -0,0 +1,45 @@ +// Copyright 2013 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 COMPONENTS_WEB_MODAL_MODAL_DIALOG_HOST_H_ +#define COMPONENTS_WEB_MODAL_MODAL_DIALOG_HOST_H_ + +#include "ui/gfx/native_widget_types.h" + +namespace gfx { +class Point; +class Size; +} // namespace gfx + +namespace web_modal { + +// Observer to be implemented to update modal dialogs when the host indicates +// their position needs to be changed. +class ModalDialogHostObserver { + public: + virtual ~ModalDialogHostObserver(); + + virtual void OnPositionRequiresUpdate() = 0; + virtual void OnHostDestroying() = 0; +}; + +// Interface for supporting positioning of modal dialogs over a window/widget. +class ModalDialogHost { + public: + virtual ~ModalDialogHost(); + + // Returns the view against which the dialog is positioned and parented. + virtual gfx::NativeView GetHostView() const = 0; + // Gets the position for the dialog in coordinates relative to the host + // view. + virtual gfx::Point GetDialogPosition(const gfx::Size& size) = 0; + + // Add/remove observer. + virtual void AddObserver(ModalDialogHostObserver* observer) = 0; + virtual void RemoveObserver(ModalDialogHostObserver* observer) = 0; +}; + +} // namespace web_modal + +#endif // COMPONENTS_WEB_MODAL_MODAL_DIALOG_HOST_H_ diff --git a/components/web_modal/web_contents_modal_dialog_host.cc b/components/web_modal/web_contents_modal_dialog_host.cc index 1dcaa00..8991387 100644 --- a/components/web_modal/web_contents_modal_dialog_host.cc +++ b/components/web_modal/web_contents_modal_dialog_host.cc @@ -6,16 +6,7 @@ namespace web_modal { -WebContentsModalDialogHostObserver::~WebContentsModalDialogHostObserver() { -} - -WebContentsModalDialogHostObserver::WebContentsModalDialogHostObserver() { -} - WebContentsModalDialogHost::~WebContentsModalDialogHost() { } -WebContentsModalDialogHost::WebContentsModalDialogHost() { -} - } // namespace web_modal diff --git a/components/web_modal/web_contents_modal_dialog_host.h b/components/web_modal/web_contents_modal_dialog_host.h index 73a3a7a..53dca44 100644 --- a/components/web_modal/web_contents_modal_dialog_host.h +++ b/components/web_modal/web_contents_modal_dialog_host.h @@ -5,55 +5,24 @@ #ifndef COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_HOST_H_ #define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_HOST_H_ -#include "ui/gfx/native_widget_types.h" +#include "components/web_modal/modal_dialog_host.h" namespace gfx { -class Point; class Size; } namespace web_modal { -// Observer to be implemented to update web contents modal dialogs when the host -// indicates their position needs to be changed. -class WebContentsModalDialogHostObserver { - public: - virtual ~WebContentsModalDialogHostObserver(); - - virtual void OnPositionRequiresUpdate() = 0; - virtual void OnHostDestroying() = 0; - - protected: - WebContentsModalDialogHostObserver(); - - private: - DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHostObserver); -}; - -// Interface for supporting positioning of web contents modal dialogs over a -// window/widget. -class WebContentsModalDialogHost { +// Unlike browser modal dialogs, web contents modal dialogs should not be able +// to draw outside the browser window. WebContentsModalDialogHost adds a +// GetMaximumDialogSize method in order for positioning code to be able to take +// this into account. +class WebContentsModalDialogHost : public ModalDialogHost { public: virtual ~WebContentsModalDialogHost(); - // Returns the view against which the dialog is positioned and parented. - virtual gfx::NativeView GetHostView() const = 0; - // Gets the position for the dialog in coordinates relative to the host - // view. - virtual gfx::Point GetDialogPosition(const gfx::Size& size) = 0; - // Returns the maximum dimensions a dialog can have. virtual gfx::Size GetMaximumDialogSize() = 0; - - // Add/remove observer. - virtual void AddObserver(WebContentsModalDialogHostObserver* observer) = 0; - virtual void RemoveObserver(WebContentsModalDialogHostObserver* observer) = 0; - - protected: - WebContentsModalDialogHost(); - - private: - DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogHost); }; } // namespace web_modal |