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

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

Issue 319013002: Reland Fix Views web-modal dialog widget creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert MediaGalleriesScanResultDialogViews::AcceptDialogForTesting. Created 6 years, 6 months 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/pdf_password_dialog.cc
diff --git a/chrome/browser/ui/views/pdf_password_dialog.cc b/chrome/browser/ui/views/pdf_password_dialog.cc
index b012d4f2283a2a2dbb392038837d7604a4a0b308..cffd1c9a16c26b0ae59fa3833b4261c4bde73cae 100644
--- a/chrome/browser/ui/views/pdf_password_dialog.cc
+++ b/chrome/browser/ui/views/pdf_password_dialog.cc
@@ -4,9 +4,7 @@
#include "chrome/browser/ui/pdf/pdf_tab_helper.h"
-#include "components/web_modal/web_contents_modal_dialog_host.h"
-#include "components/web_modal/web_contents_modal_dialog_manager.h"
-#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
+#include "chrome/browser/ui/views/constrained_window_views.h"
#include "content/public/browser/web_contents.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -18,8 +16,7 @@
namespace {
-// PDFPasswordDialogViews runs a tab-modal dialog that asks the user for a
-// password.
+// Runs a tab-modal dialog that asks the user for a password.
class PDFPasswordDialogViews : public views::DialogDelegate {
public:
PDFPasswordDialogViews(content::WebContents* web_contents,
@@ -46,8 +43,6 @@ class PDFPasswordDialogViews : public views::DialogDelegate {
// The message box view whose commands we handle.
views::MessageBoxView* message_box_view_;
- views::Widget* dialog_;
-
PasswordDialogClosedCallback callback_;
DISALLOW_COPY_AND_ASSIGN(PDFPasswordDialogViews);
@@ -58,7 +53,6 @@ PDFPasswordDialogViews::PDFPasswordDialogViews(
const base::string16& prompt,
const PasswordDialogClosedCallback& callback)
: message_box_view_(NULL),
- dialog_(NULL),
callback_(callback) {
views::MessageBoxView::InitParams init_params(prompt);
init_params.options = views::MessageBoxView::HAS_PROMPT_FIELD;
@@ -66,16 +60,7 @@ PDFPasswordDialogViews::PDFPasswordDialogViews(
views::kUnrelatedControlVerticalSpacing;
message_box_view_ = new views::MessageBoxView(init_params);
message_box_view_->text_box()->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
-
- web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager =
- web_modal::WebContentsModalDialogManager::FromWebContents(web_contents);
- web_modal::WebContentsModalDialogManagerDelegate* modal_delegate =
- web_contents_modal_dialog_manager->delegate();
- DCHECK(modal_delegate);
- dialog_ = views::Widget::CreateWindowAsFramelessChild(
- this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView());
- web_contents_modal_dialog_manager->ShowModalDialog(
- dialog_->GetNativeView());
+ ShowWebModalDialogViews(this, web_contents);
}
PDFPasswordDialogViews::~PDFPasswordDialogViews() {
@@ -138,11 +123,7 @@ void PDFPasswordDialogViews::DeleteDelegate() {
}
ui::ModalType PDFPasswordDialogViews::GetModalType() const {
-#if defined(USE_ASH)
return ui::MODAL_TYPE_CHILD;
-#else
- return views::WidgetDelegate::GetModalType();
-#endif
}
} // namespace
« no previous file with comments | « chrome/browser/ui/views/login_prompt_views.cc ('k') | chrome/browser/ui/views/signed_certificate_timestamps_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698