Commit 1923b3b0 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

Make components/web_modal a real component.

It had some layering workarounds in the past for cocoa, but it can
now be a component for better code health.

Bug: 828273
Change-Id: Iaa84cc4cdbb466ba696b7322e6f7f7d6ab914002
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1933827Reviewed-by: default avatarMike Wittman <wittman@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718881}
parent 9be9d586
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
assert(!is_android && !is_ios) assert(!is_android && !is_ios)
static_library("web_modal") { component("web_modal") {
sources = [ sources = [
"modal_dialog_host.cc", "modal_dialog_host.cc",
"modal_dialog_host.h", "modal_dialog_host.h",
...@@ -15,8 +15,11 @@ static_library("web_modal") { ...@@ -15,8 +15,11 @@ static_library("web_modal") {
"web_contents_modal_dialog_manager.h", "web_contents_modal_dialog_manager.h",
"web_contents_modal_dialog_manager_delegate.cc", "web_contents_modal_dialog_manager_delegate.cc",
"web_contents_modal_dialog_manager_delegate.h", "web_contents_modal_dialog_manager_delegate.h",
"web_modal_export.h",
] ]
defines = [ "WEB_MODAL_IMPLEMENTATION" ]
public_deps = [ public_deps = [
"//base", "//base",
"//content/public/browser", "//content/public/browser",
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef COMPONENTS_WEB_MODAL_MODAL_DIALOG_HOST_H_ #ifndef COMPONENTS_WEB_MODAL_MODAL_DIALOG_HOST_H_
#define COMPONENTS_WEB_MODAL_MODAL_DIALOG_HOST_H_ #define COMPONENTS_WEB_MODAL_MODAL_DIALOG_HOST_H_
#include "components/web_modal/web_modal_export.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
namespace gfx { namespace gfx {
...@@ -16,7 +17,7 @@ namespace web_modal { ...@@ -16,7 +17,7 @@ namespace web_modal {
// Observer to be implemented to update modal dialogs when the host indicates // Observer to be implemented to update modal dialogs when the host indicates
// their position needs to be changed. // their position needs to be changed.
class ModalDialogHostObserver { class WEB_MODAL_EXPORT ModalDialogHostObserver {
public: public:
virtual ~ModalDialogHostObserver(); virtual ~ModalDialogHostObserver();
...@@ -25,7 +26,7 @@ class ModalDialogHostObserver { ...@@ -25,7 +26,7 @@ class ModalDialogHostObserver {
}; };
// Interface for supporting positioning of modal dialogs over a window/widget. // Interface for supporting positioning of modal dialogs over a window/widget.
class ModalDialogHost { class WEB_MODAL_EXPORT ModalDialogHost {
public: public:
virtual ~ModalDialogHost(); virtual ~ModalDialogHost();
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_HOST_H_ #define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_HOST_H_
#include "components/web_modal/modal_dialog_host.h" #include "components/web_modal/modal_dialog_host.h"
#include "components/web_modal/web_modal_export.h"
namespace gfx { namespace gfx {
class Size; class Size;
...@@ -17,7 +18,7 @@ namespace web_modal { ...@@ -17,7 +18,7 @@ namespace web_modal {
// to draw outside the browser window. WebContentsModalDialogHost adds a // to draw outside the browser window. WebContentsModalDialogHost adds a
// GetMaximumDialogSize method in order for positioning code to be able to take // GetMaximumDialogSize method in order for positioning code to be able to take
// this into account. // this into account.
class WebContentsModalDialogHost : public ModalDialogHost { class WEB_MODAL_EXPORT WebContentsModalDialogHost : public ModalDialogHost {
public: public:
~WebContentsModalDialogHost() override; ~WebContentsModalDialogHost() override;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/web_modal/single_web_contents_dialog_manager.h" #include "components/web_modal/single_web_contents_dialog_manager.h"
#include "components/web_modal/web_modal_export.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
...@@ -20,7 +21,7 @@ namespace web_modal { ...@@ -20,7 +21,7 @@ namespace web_modal {
class WebContentsModalDialogManagerDelegate; class WebContentsModalDialogManagerDelegate;
// Per-WebContents class to manage WebContents-modal dialogs. // Per-WebContents class to manage WebContents-modal dialogs.
class WebContentsModalDialogManager class WEB_MODAL_EXPORT WebContentsModalDialogManager
: public SingleWebContentsDialogManagerDelegate, : public SingleWebContentsDialogManagerDelegate,
public content::WebContentsObserver, public content::WebContentsObserver,
public content::WebContentsUserData<WebContentsModalDialogManager> { public content::WebContentsUserData<WebContentsModalDialogManager> {
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_DELEGATE_H_ #ifndef COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_DELEGATE_H_
#define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_DELEGATE_H_ #define COMPONENTS_WEB_MODAL_WEB_CONTENTS_MODAL_DIALOG_MANAGER_DELEGATE_H_
#include "components/web_modal/web_modal_export.h"
namespace content { namespace content {
class WebContents; class WebContents;
} }
...@@ -13,7 +15,7 @@ namespace web_modal { ...@@ -13,7 +15,7 @@ namespace web_modal {
class WebContentsModalDialogHost; class WebContentsModalDialogHost;
class WebContentsModalDialogManagerDelegate { class WEB_MODAL_EXPORT WebContentsModalDialogManagerDelegate {
public: public:
// Changes the blocked state of |web_contents|. WebContentses are considered // Changes the blocked state of |web_contents|. WebContentses are considered
// blocked while displaying a web contents modal dialog. During that time // blocked while displaying a web contents modal dialog. During that time
......
// Copyright 2019 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_WEB_MODAL_EXPORT_H_
#define COMPONENTS_WEB_MODAL_WEB_MODAL_EXPORT_H_
#if defined(COMPONENT_BUILD)
#if defined(WIN32)
#if defined(WEB_MODAL_IMPLEMENTATION)
#define WEB_MODAL_EXPORT __declspec(dllexport)
#else
#define WEB_MODAL_EXPORT __declspec(dllimport)
#endif // defined(WEB_MODAL_IMPLEMENTATION)
#else // defined(WIN32)
#if defined(WEB_MODAL_IMPLEMENTATION)
#define WEB_MODAL_EXPORT __attribute__((visibility("default")))
#else
#define WEB_MODAL_EXPORT
#endif
#endif
#else // defined(COMPONENT_BUILD)
#define WEB_MODAL_EXPORT
#endif
#endif // COMPONENTS_WEB_MODAL_WEB_MODAL_EXPORT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment