summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/web_modal.gypi2
-rw-r--r--components/web_modal/modal_dialog_host.cc15
-rw-r--r--components/web_modal/modal_dialog_host.h45
-rw-r--r--components/web_modal/web_contents_modal_dialog_host.cc9
-rw-r--r--components/web_modal/web_contents_modal_dialog_host.h43
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