summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorgbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-15 00:16:47 +0000
committergbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-15 00:16:47 +0000
commit010152f1c2f749b629ad20d90df33d13355b5797 (patch)
tree2425644209cfc1f34ae5719c63030a70aae48e58 /apps
parent093cc2119996683baed6074ad764d86aab55e782 (diff)
downloadchromium_src-010152f1c2f749b629ad20d90df33d13355b5797.zip
chromium_src-010152f1c2f749b629ad20d90df33d13355b5797.tar.gz
chromium_src-010152f1c2f749b629ad20d90df33d13355b5797.tar.bz2
[WebModals] New API for browser-scoped popup management.
This interface follows the WebContents-scoped WebContentsModalDialogManager closely, the main difference being the change in scope -- the popup manager is intended to manage popups (bubbles and web-modals) scoped both at the per-WebContents level as well as at the browser/system level. The policy for the manager is not known yet, so this change is setting up the API which will be used to register popups with the manager, and the lifecycle which the manager uses to display them. The critical facts about a popup are expected to be: 1. Whether it is user-initiated. 2. If it is scoped to a particular WebContents (and if so, which one), 3. If it is overlappable. Other important management facts about popups may be added later. The lifecycle operation is all driven through an interface called SinglePopupManager which is a one-per-window scoped manager owned by the PopupManager. These classes take charge of showing and hiding their popups depending on the state of the browser window, as governed by whatever state change observations made by the overall PopupManager relate to its policy. When a window is closed by direct user action, the manager notifies the overall BubbleManager, which then removes the window from the management queue and can show another window. A window may also be closed by direct command from the overall BubbleManager, for example if it is superceded by another user-initiated popup. BUG=375393 TBR=yoz Review URL: https://codereview.chromium.org/287123002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'apps')
-rw-r--r--apps/app_window.cc5
-rw-r--r--apps/app_window.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/apps/app_window.cc b/apps/app_window.cc
index e2d837d..db1f543 100644
--- a/apps/app_window.cc
+++ b/apps/app_window.cc
@@ -264,6 +264,7 @@ void AppWindow::Init(const GURL& url,
content::WebContentsObserver::Observe(web_contents);
}
delegate_->InitWebContents(web_contents);
+
WebContentsModalDialogManager::CreateForWebContents(web_contents);
// TODO(jamescook): Delegate out this creation.
extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
@@ -286,6 +287,10 @@ void AppWindow::Init(const GURL& url,
native_app_window_.reset(delegate_->CreateNativeAppWindow(this, new_params));
+ popup_manager_.reset(
+ new web_modal::PopupManager(GetWebContentsModalDialogHost()));
+ popup_manager_->RegisterWith(web_contents);
+
// Prevent the browser process from shutting down while this window exists.
AppsClient::Get()->IncrementKeepAliveCount();
UpdateExtensionAppIcon();
diff --git a/apps/app_window.h b/apps/app_window.h
index f2e0e98..9873eed 100644
--- a/apps/app_window.h
+++ b/apps/app_window.h
@@ -8,6 +8,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/sessions/session_id.h"
+#include "components/web_modal/popup_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -522,6 +523,10 @@ class AppWindow : public content::NotificationObserver,
scoped_ptr<AppWindowContents> app_window_contents_;
scoped_ptr<Delegate> delegate_;
+ // Manages popup windows (bubbles, tab-modals) visible overlapping the
+ // app window.
+ scoped_ptr<web_modal::PopupManager> popup_manager_;
+
base::WeakPtrFactory<AppWindow> image_loader_ptr_factory_;
// Bit field of FullscreenType.