Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3307)

Unified Diff: chrome/browser/ui/views/constrained_window_views.cc

Issue 11647017: Rename platform-independent ConstrainedWindow types to WebContentsModalDialog types (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/constrained_window_views.cc
diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc
index fa4b931e13bbcf2e724643cfe29ae5dcb54cefc3..6401215a3735df6b1881b609e26f79d7d0a6e833 100644
--- a/chrome/browser/ui/views/constrained_window_views.cc
+++ b/chrome/browser/ui/views/constrained_window_views.cc
@@ -12,9 +12,9 @@
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_service.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/toolbar/toolbar_model.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/common/chrome_constants.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
@@ -383,7 +383,7 @@ void ConstrainedWindowFrameView::OnThemeChanged() {
void ConstrainedWindowFrameView::ButtonPressed(
views::Button* sender, const ui::Event& event) {
if (sender == close_button_)
- container_->CloseConstrainedWindow();
+ container_->CloseWebContentsModalDialog();
}
int ConstrainedWindowFrameView::NonClientBorderThickness() const {
@@ -549,7 +549,7 @@ class ConstrainedWindowFrameViewAsh : public ash::CustomFrameViewAsh {
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE {
if (sender == close_button())
- container_->CloseConstrainedWindow();
+ container_->CloseWebContentsModalDialog();
}
private:
@@ -584,9 +584,9 @@ ConstrainedWindowViews::ConstrainedWindowViews(
#endif
Init(params);
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- constrained_window_tab_helper->AddConstrainedDialog(this);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ web_contents_modal_dialog_manager->AddDialog(this);
#if defined(USE_ASH)
GetNativeWindow()->SetProperty(ash::kConstrainedWindowKey, true);
views::corewm::SetModalParent(GetNativeWindow(),
@@ -597,12 +597,12 @@ ConstrainedWindowViews::ConstrainedWindowViews(
ConstrainedWindowViews::~ConstrainedWindowViews() {
}
-void ConstrainedWindowViews::ShowConstrainedWindow() {
+void ConstrainedWindowViews::ShowWebContentsModalDialog() {
Show();
- FocusConstrainedWindow();
+ FocusWebContentsModalDialog();
}
-void ConstrainedWindowViews::CloseConstrainedWindow() {
+void ConstrainedWindowViews::CloseWebContentsModalDialog() {
#if defined(USE_ASH)
gfx::NativeView view = web_contents_->GetNativeView();
// Allow the parent to animate again.
@@ -613,11 +613,11 @@ void ConstrainedWindowViews::CloseConstrainedWindow() {
Close();
}
-void ConstrainedWindowViews::FocusConstrainedWindow() {
- ConstrainedWindowTabHelper* helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- if ((!helper->delegate() ||
- helper->delegate()->ShouldFocusConstrainedWindow()) &&
+void ConstrainedWindowViews::FocusWebContentsModalDialog() {
+ WebContentsModalDialogManager* manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ if ((!manager->delegate() ||
+ manager->delegate()->ShouldFocusWebContentsModalDialog()) &&
widget_delegate() &&
widget_delegate()->GetInitiallyFocusedView()) {
widget_delegate()->GetInitiallyFocusedView()->RequestFocus();
@@ -637,9 +637,9 @@ void ConstrainedWindowViews::NotifyTabHelperWillClose() {
if (!web_contents_)
return;
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- constrained_window_tab_helper->WillClose(this);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ web_contents_modal_dialog_manager->WillClose(this);
}
views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() {

Powered by Google App Engine
This is Rietveld 408576698