diff options
author | wittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-26 05:02:53 +0000 |
---|---|---|
committer | wittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-26 05:02:53 +0000 |
commit | b2646378c4b7d7e869b619f645ef72f3f030c79c (patch) | |
tree | 41f81ec3f7464e8be56a61c448128a0542c50ad6 | |
parent | 65739d2375124a4715768118c082815b5483c87e (diff) | |
download | chromium_src-b2646378c4b7d7e869b619f645ef72f3f030c79c.zip chromium_src-b2646378c4b7d7e869b619f645ef72f3f030c79c.tar.gz chromium_src-b2646378c4b7d7e869b619f645ef72f3f030c79c.tar.bz2 |
Remove the WebContentsModalDialog interface
This CL is part 6 of 6 in the work to remove the WebContentsModalDialog
interface. Now that all references to WebContentsModalDialog are
gone, we can remove the class and the inheritance of the class by the
platform-specific UI code.
This builds on part 5 in https://codereview.chromium.org/12283024.
BUG=157161
Review URL: https://chromiumcodereview.appspot.com/12288018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184589 0039d316-1c4b-4281-b951-d872f2087c98
15 files changed, 37 insertions, 89 deletions
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h b/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h index 899e6cf..ac2f34c 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h @@ -10,11 +10,9 @@ #include "base/memory/scoped_nsobject.h" // This class implements an alert that has a constrained window look and feel -// (close button on top right, WebUI style buttons, etc...). To use this class -// subclass WebContentsModalDialog and create an instance of this class. -// The alert can be shown by using the window accessor and calling -// -[window orderFont:]. Normally this would be done by -// ConstrainedWindowSheetController. +// (close button on top right, WebUI style buttons, etc...). The alert can be +// shown by using the window accessor and calling -[window orderFont:]. Normally +// this would be done by ConstrainedWindowSheetController. @interface ConstrainedWindowAlert : NSObject { @private scoped_nsobject<NSTextField> informativeTextField_; diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.mm index 78462e1..7fda80b 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.mm +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.mm @@ -10,7 +10,6 @@ #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.h" #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h" #import "chrome/browser/ui/cocoa/hover_close_button.h" -#import "chrome/browser/ui/web_contents_modal_dialog.h" #include "skia/ext/skia_utils_mac.h" #include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" #include "ui/base/cocoa/window_size_constants.h" diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.mm index 199c4f9..5d73a8f 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.mm +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.mm @@ -5,7 +5,6 @@ #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.h" #include "base/memory/scoped_nsobject.h" -#include "chrome/browser/ui/web_contents_modal_dialog.h" #include "skia/ext/skia_utils_mac.h" namespace constrained_window { diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h index 18b3dac..ca8712d 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h @@ -12,11 +12,11 @@ // A NSWindow subclass that gives a custom look (rounded corners and white // background). // -// Note that WebContentsModalDialog is the web contents modal dialog +// Note that ConstrainedWindowMac is the web contents modal dialog // controller. ConstrainedWindowCustomWindow is the custom NSWindow that gives // us the new look (rounded corners and white background). // -// If a WebContentsModalDialog is using ConstrainedWindowAlert to display its UI +// If a ConstrainedWindowMac is using ConstrainedWindowAlert to display its UI // then it doesn't have to use this class. On the other hand, if it has some // custom UI (say from a nib) then it should use this class. @interface ConstrainedWindowCustomWindow : ChromeEventProcessingWindow diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm index 18b5298..a875eac 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm @@ -7,7 +7,6 @@ #import "base/memory/scoped_nsobject.h" #import "chrome/browser/ui/chrome_style.h" #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h" -#import "chrome/browser/ui/web_contents_modal_dialog.h" #include "skia/ext/skia_utils_mac.h" @implementation ConstrainedWindowCustomWindow diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h index 93c6c44..c4ba316 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h @@ -8,7 +8,7 @@ #import <Cocoa/Cocoa.h> #include "base/memory/scoped_nsobject.h" -#include "chrome/browser/ui/web_contents_modal_dialog.h" +#include "chrome/browser/ui/native_web_contents_modal_dialog.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -28,8 +28,7 @@ class ConstrainedWindowMacDelegate { // Constrained window implementation for Mac. // Normally an instance of this class is owned by the delegate. The delegate // should delete the instance when the window is closed. -class ConstrainedWindowMac : public WebContentsModalDialog, - public content::NotificationObserver { +class ConstrainedWindowMac : public content::NotificationObserver { public: ConstrainedWindowMac( ConstrainedWindowMacDelegate* delegate, @@ -37,13 +36,12 @@ class ConstrainedWindowMac : public WebContentsModalDialog, id<ConstrainedWindowSheet> sheet); virtual ~ConstrainedWindowMac(); - // WebContentsModalDialog implementation. - virtual void ShowWebContentsModalDialog() OVERRIDE; + void ShowWebContentsModalDialog(); // Closes the constrained window and deletes this instance. - virtual void CloseWebContentsModalDialog() OVERRIDE; - virtual void FocusWebContentsModalDialog() OVERRIDE; - virtual void PulseWebContentsModalDialog() OVERRIDE; - virtual NativeWebContentsModalDialog GetNativeDialog() OVERRIDE; + void CloseWebContentsModalDialog(); + void FocusWebContentsModalDialog(); + void PulseWebContentsModalDialog(); + NativeWebContentsModalDialog GetNativeDialog(); // content::NotificationObserver: virtual void Observe(int type, @@ -56,7 +54,7 @@ class ConstrainedWindowMac : public WebContentsModalDialog, ConstrainedWindowMacDelegate* delegate_; // weak, owns us. - // The WebContents that owns and constrains this WebContentsModalDialog. Weak. + // The WebContents that owns and constrains this ConstrainedWindowMac. Weak. content::WebContents* web_contents_; scoped_nsprotocol<id<ConstrainedWindowSheet>> sheet_; diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm index 3a58323..095a1f0 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm @@ -14,7 +14,6 @@ #include "chrome/browser/extensions/bundle_installer.h" #import "chrome/browser/ui/chrome_style.h" #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" -#include "chrome/browser/ui/web_contents_modal_dialog.h" #include "chrome/common/extensions/extension.h" #include "content/public/browser/page_navigator.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/ui/cocoa/login_prompt_cocoa.mm b/chrome/browser/ui/cocoa/login_prompt_cocoa.mm index a259ccf..a53808c 100644 --- a/chrome/browser/ui/cocoa/login_prompt_cocoa.mm +++ b/chrome/browser/ui/cocoa/login_prompt_cocoa.mm @@ -82,7 +82,7 @@ class LoginHandlerMac : public LoginHandler, } virtual void CloseDialog() OVERRIDE { - // The hosting WebContentsModalDialog may have been freed. + // The hosting dialog may have been freed. if (constrained_window_) constrained_window_->CloseWebContentsModalDialog(); } diff --git a/chrome/browser/ui/gtk/constrained_window_gtk.h b/chrome/browser/ui/gtk/constrained_window_gtk.h index 9646665..8ba9e75 100644 --- a/chrome/browser/ui/gtk/constrained_window_gtk.h +++ b/chrome/browser/ui/gtk/constrained_window_gtk.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/ui/web_contents_modal_dialog.h" +#include "chrome/browser/ui/native_web_contents_modal_dialog.h" #include "ui/base/gtk/gtk_signal.h" #include "ui/base/gtk/owned_widget_gtk.h" @@ -26,7 +26,7 @@ class ConstrainedWindowGtkDelegate { // Returns the widget that will be put in the constrained window's container. virtual GtkWidget* GetWidgetRoot() = 0; - // Returns the widget that should get focus when WebContentsModalDialog is + // Returns the widget that should get focus when ConstrainedWindowGtk is // focused. virtual GtkWidget* GetFocusWidget() = 0; @@ -43,10 +43,10 @@ class ConstrainedWindowGtkDelegate { virtual ~ConstrainedWindowGtkDelegate(); }; -// WebContentsModalDialog implementation for the GTK port. Unlike the Win32 +// Web contents modal dialog implementation for the GTK port. Unlike the Win32 // system, ConstrainedWindowGtk doesn't draw draggable fake windows and instead // just centers the dialog. It is thus an order of magnitude simpler. -class ConstrainedWindowGtk : public WebContentsModalDialog { +class ConstrainedWindowGtk { public: typedef ChromeWebContentsViewDelegateGtk TabContentsViewType; @@ -54,12 +54,11 @@ class ConstrainedWindowGtk : public WebContentsModalDialog { ConstrainedWindowGtkDelegate* delegate); virtual ~ConstrainedWindowGtk(); - // Overridden from WebContentsModalDialog: - virtual void ShowWebContentsModalDialog() OVERRIDE; - virtual void CloseWebContentsModalDialog() OVERRIDE; - virtual void FocusWebContentsModalDialog() OVERRIDE; - virtual void PulseWebContentsModalDialog() OVERRIDE; - virtual NativeWebContentsModalDialog GetNativeDialog() OVERRIDE; + void ShowWebContentsModalDialog(); + void CloseWebContentsModalDialog(); + void FocusWebContentsModalDialog(); + void PulseWebContentsModalDialog(); + NativeWebContentsModalDialog GetNativeDialog(); // Called when the result of GetBackgroundColor may have changed. void BackgroundColorChanged(); @@ -74,15 +73,13 @@ class ConstrainedWindowGtk : public WebContentsModalDialog { TabContentsViewType* ContainingView(); private: - friend class WebContentsModalDialog; - // Signal callbacks. CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, gboolean, OnKeyPress, GdkEventKey*); CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, void, OnHierarchyChanged, GtkWidget*); - // The WebContents that owns and constrains this WebContentsModalDialog. + // The WebContents that owns and constrains this ConstrainedWindowGtk. content::WebContents* web_contents_; // The top level widget container that exports to our WebContentsView. diff --git a/chrome/browser/ui/views/constrained_window_views.h b/chrome/browser/ui/views/constrained_window_views.h index 88fe027..8041849 100644 --- a/chrome/browser/ui/views/constrained_window_views.h +++ b/chrome/browser/ui/views/constrained_window_views.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_ #include "base/compiler_specific.h" -#include "chrome/browser/ui/web_contents_modal_dialog.h" +#include "chrome/browser/ui/native_web_contents_modal_dialog.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/rect.h" #include "ui/views/widget/widget.h" @@ -26,24 +26,23 @@ class WidgetDelegate; /////////////////////////////////////////////////////////////////////////////// // ConstrainedWindowViews // -// A WebContentsModalDialog implementation that implements the dialog as a -// child HWND with a custom window frame. The ConstrainedWindowViews owns -// itself and will be deleted soon after being closed. +// A web contents modal dialog that implements the dialog as a child HWND with +// a custom window frame. The ConstrainedWindowViews owns itself and will be +// deleted soon after being closed. // -class ConstrainedWindowViews : public views::Widget, - public WebContentsModalDialog { +class ConstrainedWindowViews : public views::Widget { public: ConstrainedWindowViews(gfx::NativeView parent, bool off_the_record, views::WidgetDelegate* widget_delegate); virtual ~ConstrainedWindowViews(); - // Overridden from WebContentsModalDialog: - virtual void ShowWebContentsModalDialog() OVERRIDE; - virtual void CloseWebContentsModalDialog() OVERRIDE; - virtual void FocusWebContentsModalDialog() OVERRIDE; - virtual void PulseWebContentsModalDialog() OVERRIDE; - virtual NativeWebContentsModalDialog GetNativeDialog() OVERRIDE; + // TODO(wittman): Remove in favor of native equivalents. + void ShowWebContentsModalDialog(); + void CloseWebContentsModalDialog(); + void FocusWebContentsModalDialog(); + void PulseWebContentsModalDialog(); + NativeWebContentsModalDialog GetNativeDialog(); // Factory function for the class (temporary). static ConstrainedWindowViews* Create(content::WebContents* web_contents, diff --git a/chrome/browser/ui/web_contents_modal_dialog.h b/chrome/browser/ui/web_contents_modal_dialog.h deleted file mode 100644 index f052645..0000000 --- a/chrome/browser/ui/web_contents_modal_dialog.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) 2012 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 CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_H_ -#define CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_H_ - -#include "chrome/browser/ui/native_web_contents_modal_dialog.h" - -/////////////////////////////////////////////////////////////////////////////// -// WebContentsModalDialog -// -// This interface represents a window that is constrained to a -// WebContentsView's bounds. -// -class WebContentsModalDialog { - public: - // Makes the web contents modal dialog visible. Only one web contents modal - // dialog is shown at a time per tab. - virtual void ShowWebContentsModalDialog() = 0; - - // Closes the web contents modal dialog. - virtual void CloseWebContentsModalDialog() = 0; - - // Sets focus on the web contents modal dialog. - virtual void FocusWebContentsModalDialog() = 0; - - // Runs a pulse animation for the web contents modal dialog. - virtual void PulseWebContentsModalDialog() = 0; - - // Returns the native representation of the web contents modal dialog. - virtual NativeWebContentsModalDialog GetNativeDialog() = 0; - - protected: - virtual ~WebContentsModalDialog() {} -}; - -#endif // CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_H_ diff --git a/chrome/browser/ui/web_contents_modal_dialog_manager.cc b/chrome/browser/ui/web_contents_modal_dialog_manager.cc index 1e4ead1..dedb704 100644 --- a/chrome/browser/ui/web_contents_modal_dialog_manager.cc +++ b/chrome/browser/ui/web_contents_modal_dialog_manager.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" -#include "chrome/browser/ui/web_contents_modal_dialog.h" #include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h" #include "chrome/common/render_messages.h" #include "content/public/browser/navigation_details.h" diff --git a/chrome/browser/ui/web_contents_modal_dialog_manager.h b/chrome/browser/ui/web_contents_modal_dialog_manager.h index e14b05f0..8b7e6ee 100644 --- a/chrome/browser/ui/web_contents_modal_dialog_manager.h +++ b/chrome/browser/ui/web_contents_modal_dialog_manager.h @@ -13,7 +13,6 @@ #include "content/public/browser/web_contents_user_data.h" #include "ui/gfx/native_widget_types.h" -class WebContentsModalDialog; class WebContentsModalDialogManagerDelegate; // Per-WebContents class to manage WebContents-modal dialogs. @@ -48,6 +47,8 @@ class WebContentsModalDialogManager // Called when a WebContentsModalDialogs we own is about to be closed. virtual void WillClose(NativeWebContentsModalDialog dialog) OVERRIDE; + // Overridden from WebContentsModalDialog: + // For testing. class TestApi { public: diff --git a/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.cc b/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.cc index 4455a7c..f08d00a 100644 --- a/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.cc +++ b/chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.cc @@ -12,7 +12,6 @@ #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/browser/ui/web_contents_modal_dialog.h" #include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "chrome/common/url_constants.h" #include "content/public/browser/web_ui.h" diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index f8d6506..fc5d0d4 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -1783,7 +1783,6 @@ 'browser/ui/views/wrench_menu.h', 'browser/ui/web_applications/web_app_ui.cc', 'browser/ui/web_applications/web_app_ui.h', - 'browser/ui/web_contents_modal_dialog.h', 'browser/ui/web_contents_modal_dialog_manager.cc', 'browser/ui/web_contents_modal_dialog_manager.h', 'browser/ui/web_contents_modal_dialog_manager_delegate.cc', |