diff options
author | tapted <tapted@chromium.org> | 2015-05-31 18:33:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-01 01:34:04 +0000 |
commit | 471072fecb35d340ab63ba53aea87f38c4444a7c (patch) | |
tree | ebf28b010800dd750158803df7c50ae2f066567a /components/web_modal | |
parent | 9a66ed01a85062d9ed2a70138597825bd1e4651f (diff) | |
download | chromium_src-471072fecb35d340ab63ba53aea87f38c4444a7c.zip chromium_src-471072fecb35d340ab63ba53aea87f38c4444a7c.tar.gz chromium_src-471072fecb35d340ab63ba53aea87f38c4444a7c.tar.bz2 |
web_modal: Remove unused SinglePopupManager[Delegate]
It's not currently used, and is giving PopupManager a virtual function
when it doesn't need to have any.
Also add wittman@ as an owner for components/web_modal.gypi.
BUG=492442
Review URL: https://codereview.chromium.org/1161513005
Cr-Commit-Position: refs/heads/master@{#332151}
Diffstat (limited to 'components/web_modal')
-rw-r--r-- | components/web_modal/BUILD.gn | 1 | ||||
-rw-r--r-- | components/web_modal/popup_manager.cc | 11 | ||||
-rw-r--r-- | components/web_modal/popup_manager.h | 27 | ||||
-rw-r--r-- | components/web_modal/single_popup_manager.h | 96 |
4 files changed, 11 insertions, 124 deletions
diff --git a/components/web_modal/BUILD.gn b/components/web_modal/BUILD.gn index 730d861..8250c4a 100644 --- a/components/web_modal/BUILD.gn +++ b/components/web_modal/BUILD.gn @@ -8,7 +8,6 @@ static_library("web_modal") { "modal_dialog_host.h", "popup_manager.cc", "popup_manager.h", - "single_popup_manager.h", "single_web_contents_dialog_manager.h", "web_contents_modal_dialog_host.cc", "web_contents_modal_dialog_host.h", diff --git a/components/web_modal/popup_manager.cc b/components/web_modal/popup_manager.cc index abc9ede..bde2915 100644 --- a/components/web_modal/popup_manager.cc +++ b/components/web_modal/popup_manager.cc @@ -40,17 +40,6 @@ PopupManager::PopupManager(WebContentsModalDialogHost* host) PopupManager::~PopupManager() { } -void PopupManager::ShowPopup(scoped_ptr<SinglePopupManager> manager) { - content::WebContents* web_contents = manager->GetBoundWebContents(); - // TODO(gbillock): get rid of this when we handle bubbles - DCHECK(web_contents); - - WebContentsModalDialogManager* wm_manager = - WebContentsModalDialogManager::FromWebContents(web_contents); - DCHECK(wm_manager); - wm_manager->ShowModalDialog(manager->popup()); -} - void PopupManager::ShowModalDialog(gfx::NativeWindow popup, content::WebContents* web_contents) { // TODO make a new native popup manager and call ShowPopup. diff --git a/components/web_modal/popup_manager.h b/components/web_modal/popup_manager.h index 32ade7a..510aaa2 100644 --- a/components/web_modal/popup_manager.h +++ b/components/web_modal/popup_manager.h @@ -7,7 +7,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "components/web_modal/single_popup_manager.h" +#include "ui/gfx/native_widget_types.h" namespace content { class WebContents; @@ -22,40 +22,35 @@ namespace web_modal { class WebContentsModalDialogHost; // Per-Browser class to manage popups (bubbles, web-modal dialogs). -class PopupManager : public SinglePopupManagerDelegate { +class PopupManager { public: // |host| may be null. - PopupManager(WebContentsModalDialogHost* host); + explicit PopupManager(WebContentsModalDialogHost* host); - ~PopupManager() override; + ~PopupManager(); // Returns the native view which will be the parent of managed popups. - virtual gfx::NativeView GetHostView() const; - - // Schedules a popup governed by the |manager| to be shown. The popup - // may be shown inline with this call, at a later time, or not at all. - virtual void ShowPopup(scoped_ptr<SinglePopupManager> manager); + gfx::NativeView GetHostView() const; // Temporary method: Provides compatibility with existing // WebContentsModalDialogManager code. - virtual void ShowModalDialog(gfx::NativeWindow popup, - content::WebContents* web_contents); + void ShowModalDialog(gfx::NativeWindow popup, + content::WebContents* web_contents); // Returns true if a web modal dialog is active and not closed in the // given |web_contents|. Note: this is intended for legacy use only; it will // be deleted at some point -- new code shouldn't use it. - virtual bool IsWebModalDialogActive( - const content::WebContents* web_contents) const; + bool IsWebModalDialogActive(const content::WebContents* web_contents) const; // Called when a native popup we own is about to be closed. - void WillClose(gfx::NativeWindow popup) override; + void WillClose(gfx::NativeWindow popup); // Called by views code to re-activate popups anchored to a particular tab // when that tab gets focus. Note that depending on the situation, more than // one popup may actually be shown (depending on overlappability). The // semantics are that the popups that would have been displayed had the tab // never lost focus are re-focused when tab focus is regained. - virtual void WasFocused(const content::WebContents* web_contents); + void WasFocused(const content::WebContents* web_contents); // WebContentsUserData-alike API for retrieving the associated window // PopupManager from a |web_contents|. Any window which doesn't have a popup @@ -68,7 +63,7 @@ class PopupManager : public SinglePopupManagerDelegate { void UnregisterWith(content::WebContents* web_contents); // DEPRECATED. - virtual void CloseAllDialogsForTesting(content::WebContents* web_contents); + void CloseAllDialogsForTesting(content::WebContents* web_contents); private: WebContentsModalDialogHost* host_; diff --git a/components/web_modal/single_popup_manager.h b/components/web_modal/single_popup_manager.h deleted file mode 100644 index 209b20a..0000000 --- a/components/web_modal/single_popup_manager.h +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2014 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_SINGLE_POPUP_MANAGER_H_ -#define COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_ - -#include "ui/gfx/native_widget_types.h" - -namespace content { -class WebContents; -} - -namespace web_modal { - -// Interface from SinglePopupManager to PopupManager. -class SinglePopupManagerDelegate { - public: - SinglePopupManagerDelegate() {} - virtual ~SinglePopupManagerDelegate() {} - - // Notify the delegate that the dialog is closing. The - // calling SinglePopupManager will be deleted before the end of this call. - virtual void WillClose(gfx::NativeWindow popup) = 0; - - private: - DISALLOW_COPY_AND_ASSIGN(SinglePopupManagerDelegate); -}; - -// Provides an interface for platform-specific UI implementation for popups. -// Each object will manage a single native popup window during its lifecycle. -// The rule of thumb is that only one popup will be shown at a time per tab. -// (Exceptions exist.) -// -// Implementation classes should accept a native popup at construction time -// and register to be notified when the dialog is closing, so that it can -// notify its delegate (WillClose method). -class SinglePopupManager { - public: - virtual ~SinglePopupManager() {} - - // If the manager returns non-null to this call, it is bound to a particular - // tab and will be hidden and shown if that tab visibility changes. - virtual content::WebContents* GetBoundWebContents() = 0; - - // Makes the popup visible. - virtual void Show() = 0; - - // Hides the popup without closing it. - virtual void Hide() = 0; - - // Closes the popup. - // This method must call WillClose() on the delegate. - // Important note: this object will be deleted at the close of that - // invocation. - virtual void Close() = 0; - - // Sets focus on the popup. - virtual void Focus() = 0; - - // Pulsates the popup to draw the user's attention to it. - virtual void Pulse() = 0; - - // Returns the popup under management by this object. - virtual gfx::NativeWindow popup() = 0; - - // Returns true if the popup under management was initiated by a user - // gesture. When this is true, the popup manager will hide any existing - // popups and move the newly-created native popup to the top of the display - // queue. - virtual bool HasUserGesture() = 0; - - // Returns true if the popup under management is tolerant of being overlapped - // by other popups. This may be true for large web-modals which cover most of - // the window real estate (e.g. print preview). - virtual bool MayBeOverlapped() = 0; - - // Returns true if the popup under management should close if there is a - // navigation underneath it, including the showing of any interstitial - // content. Popups which relate to the web content being displayed will - // ordinarily set this to true. - // TODO(gbillock): should be generalized in code location or by splitting - // the API to support the same-origin logic in WCMDM::DidNavigateMainFrame. - // TBD right now because we're not sure which knobs need to be set here. - virtual bool ShouldCloseOnNavigation() = 0; - - protected: - SinglePopupManager() {} - - private: - DISALLOW_COPY_AND_ASSIGN(SinglePopupManager); -}; - -} // namespace web_modal - -#endif // COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_ |