| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/sync/one_click_signin_dialog_view.h" | 5 #include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_dialogs.h" |
| 12 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 13 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "components/constrained_window/constrained_window_views.h" | 16 #include "components/constrained_window/constrained_window_views.h" |
| 16 #include "components/google/core/browser/google_util.h" | 17 #include "components/google/core/browser/google_util.h" |
| 17 #include "components/strings/grit/components_strings.h" | 18 #include "components/strings/grit/components_strings.h" |
| 18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/events/keycodes/keyboard_codes.h" | 21 #include "ui/events/keycodes/keyboard_codes.h" |
| 21 #include "ui/resources/grit/ui_resources.h" | 22 #include "ui/resources/grit/ui_resources.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 OneClickSigninDialogView::OneClickSigninDialogView( | 68 OneClickSigninDialogView::OneClickSigninDialogView( |
| 68 const base::string16& email, | 69 const base::string16& email, |
| 69 std::unique_ptr<OneClickSigninLinksDelegate> delegate, | 70 std::unique_ptr<OneClickSigninLinksDelegate> delegate, |
| 70 const BrowserWindow::StartSyncCallback& start_sync_callback) | 71 const BrowserWindow::StartSyncCallback& start_sync_callback) |
| 71 : delegate_(std::move(delegate)), | 72 : delegate_(std::move(delegate)), |
| 72 email_(email), | 73 email_(email), |
| 73 start_sync_callback_(start_sync_callback), | 74 start_sync_callback_(start_sync_callback), |
| 74 advanced_link_(nullptr), | 75 advanced_link_(nullptr), |
| 75 learn_more_link_(nullptr) { | 76 learn_more_link_(nullptr) { |
| 76 DCHECK(!start_sync_callback_.is_null()); | 77 DCHECK(!start_sync_callback_.is_null()); |
| 78 chrome::RecordDialogCreation(chrome::DialogIdentifier::ONE_CLICK_SIGNIN); |
| 77 } | 79 } |
| 78 | 80 |
| 79 OneClickSigninDialogView::~OneClickSigninDialogView() { | 81 OneClickSigninDialogView::~OneClickSigninDialogView() { |
| 80 if (!start_sync_callback_.is_null()) { | 82 if (!start_sync_callback_.is_null()) { |
| 81 base::ResetAndReturn(&start_sync_callback_) | 83 base::ResetAndReturn(&start_sync_callback_) |
| 82 .Run(OneClickSigninSyncStarter::UNDO_SYNC); | 84 .Run(OneClickSigninSyncStarter::UNDO_SYNC); |
| 83 } | 85 } |
| 84 } | 86 } |
| 85 | 87 |
| 86 void OneClickSigninDialogView::Init() { | 88 void OneClickSigninDialogView::Init() { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 .Run(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); | 152 .Run(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); |
| 151 GetWidget()->Close(); | 153 GetWidget()->Close(); |
| 152 } | 154 } |
| 153 } | 155 } |
| 154 | 156 |
| 155 bool OneClickSigninDialogView::Accept() { | 157 bool OneClickSigninDialogView::Accept() { |
| 156 base::ResetAndReturn(&start_sync_callback_) | 158 base::ResetAndReturn(&start_sync_callback_) |
| 157 .Run(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); | 159 .Run(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); |
| 158 return true; | 160 return true; |
| 159 } | 161 } |
| OLD | NEW |