| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 OneClickSigninDialogView::OneClickSigninDialogView( | 69 OneClickSigninDialogView::OneClickSigninDialogView( |
| 69 const base::string16& email, | 70 const base::string16& email, |
| 70 std::unique_ptr<OneClickSigninLinksDelegate> delegate, | 71 std::unique_ptr<OneClickSigninLinksDelegate> delegate, |
| 71 const BrowserWindow::StartSyncCallback& start_sync_callback) | 72 const BrowserWindow::StartSyncCallback& start_sync_callback) |
| 72 : delegate_(std::move(delegate)), | 73 : delegate_(std::move(delegate)), |
| 73 email_(email), | 74 email_(email), |
| 74 start_sync_callback_(start_sync_callback), | 75 start_sync_callback_(start_sync_callback), |
| 75 advanced_link_(nullptr), | 76 advanced_link_(nullptr), |
| 76 learn_more_link_(nullptr) { | 77 learn_more_link_(nullptr) { |
| 77 DCHECK(!start_sync_callback_.is_null()); | 78 DCHECK(!start_sync_callback_.is_null()); |
| 79 chrome::RecordDialogCreation(chrome::DialogIdentifier::ONE_CLICK_SIGNIN); |
| 78 } | 80 } |
| 79 | 81 |
| 80 OneClickSigninDialogView::~OneClickSigninDialogView() { | 82 OneClickSigninDialogView::~OneClickSigninDialogView() { |
| 81 if (!start_sync_callback_.is_null()) { | 83 if (!start_sync_callback_.is_null()) { |
| 82 base::ResetAndReturn(&start_sync_callback_) | 84 base::ResetAndReturn(&start_sync_callback_) |
| 83 .Run(OneClickSigninSyncStarter::UNDO_SYNC); | 85 .Run(OneClickSigninSyncStarter::UNDO_SYNC); |
| 84 } | 86 } |
| 85 } | 87 } |
| 86 | 88 |
| 87 void OneClickSigninDialogView::Init() { | 89 void OneClickSigninDialogView::Init() { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 .Run(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); | 153 .Run(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST); |
| 152 GetWidget()->Close(); | 154 GetWidget()->Close(); |
| 153 } | 155 } |
| 154 } | 156 } |
| 155 | 157 |
| 156 bool OneClickSigninDialogView::Accept() { | 158 bool OneClickSigninDialogView::Accept() { |
| 157 base::ResetAndReturn(&start_sync_callback_) | 159 base::ResetAndReturn(&start_sync_callback_) |
| 158 .Run(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); | 160 .Run(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); |
| 159 return true; | 161 return true; |
| 160 } | 162 } |
| OLD | NEW |