| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/webui/signin/signin_email_confirmation_dialog.h" | 5 #include "chrome/browser/ui/webui/signin/signin_email_confirmation_dialog.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| 11 #include "base/metrics/user_metrics.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/webui/signin/signin_email_confirmation_ui.h" | 13 #include "chrome/browser/ui/webui/signin/signin_email_confirmation_ui.h" |
| 13 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 14 #include "chrome/grit/browser_resources.h" | 15 #include "chrome/grit/browser_resources.h" |
| 15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 16 #include "content/public/browser/user_metrics.h" | |
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/browser/web_contents_observer.h" | 18 #include "content/public/browser/web_contents_observer.h" |
| 19 #include "content/public/browser/web_ui.h" | 19 #include "content/public/browser/web_ui.h" |
| 20 #include "content/public/browser/web_ui_message_handler.h" | 20 #include "content/public/browser/web_ui_message_handler.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // Dialog size. | 25 // Dialog size. |
| 26 const int kDialogWidth = 512; | 26 const int kDialogWidth = 512; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 SigninEmailConfirmationDialog::~SigninEmailConfirmationDialog() {} | 75 SigninEmailConfirmationDialog::~SigninEmailConfirmationDialog() {} |
| 76 | 76 |
| 77 // static | 77 // static |
| 78 void SigninEmailConfirmationDialog::AskForConfirmation( | 78 void SigninEmailConfirmationDialog::AskForConfirmation( |
| 79 content::WebContents* contents, | 79 content::WebContents* contents, |
| 80 Profile* profile, | 80 Profile* profile, |
| 81 const std::string& last_email, | 81 const std::string& last_email, |
| 82 const std::string& email, | 82 const std::string& email, |
| 83 const Callback& callback) { | 83 const Callback& callback) { |
| 84 content::RecordAction( | 84 base::RecordAction(base::UserMetricsAction("Signin_Show_ImportDataPrompt")); |
| 85 base::UserMetricsAction("Signin_Show_ImportDataPrompt")); | |
| 86 SigninEmailConfirmationDialog* dialog = new SigninEmailConfirmationDialog( | 85 SigninEmailConfirmationDialog* dialog = new SigninEmailConfirmationDialog( |
| 87 contents, profile, last_email, email, callback); | 86 contents, profile, last_email, email, callback); |
| 88 dialog->ShowDialog(); | 87 dialog->ShowDialog(); |
| 89 } | 88 } |
| 90 | 89 |
| 91 void SigninEmailConfirmationDialog::ShowDialog() { | 90 void SigninEmailConfirmationDialog::ShowDialog() { |
| 92 gfx::Size minSize(kDialogWidth, kDialogMinHeight); | 91 gfx::Size minSize(kDialogWidth, kDialogMinHeight); |
| 93 gfx::Size maxSize(kDialogWidth, kDialogMaxHeight); | 92 gfx::Size maxSize(kDialogWidth, kDialogMaxHeight); |
| 94 ConstrainedWebDialogDelegate* dialog_delegate = | 93 ConstrainedWebDialogDelegate* dialog_delegate = |
| 95 ShowConstrainedWebDialogWithAutoResize(profile_, this, web_contents_, | 94 ShowConstrainedWebDialogWithAutoResize(profile_, this, web_contents_, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 191 |
| 193 void SigninEmailConfirmationDialog::OnCloseContents( | 192 void SigninEmailConfirmationDialog::OnCloseContents( |
| 194 content::WebContents* source, | 193 content::WebContents* source, |
| 195 bool* out_close_dialog) { | 194 bool* out_close_dialog) { |
| 196 *out_close_dialog = true; | 195 *out_close_dialog = true; |
| 197 } | 196 } |
| 198 | 197 |
| 199 bool SigninEmailConfirmationDialog::ShouldShowDialogTitle() const { | 198 bool SigninEmailConfirmationDialog::ShouldShowDialogTitle() const { |
| 200 return false; | 199 return false; |
| 201 } | 200 } |
| OLD | NEW |