| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profile_signin_confirmation_dialog_views.
h" | 5 #include "chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.
h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_dialogs.h" | 11 #include "chrome/browser/ui/browser_dialogs.h" |
| 12 #include "chrome/browser/ui/browser_navigator.h" | 12 #include "chrome/browser/ui/browser_navigator.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/browser/ui/host_desktop.h" | 14 #include "chrome/browser/ui/host_desktop.h" |
| 15 #include "chrome/browser/ui/views/constrained_window_views.h" | 15 #include "chrome/browser/ui/views/constrained_window_views.h" |
| 16 #include "components/web_modal/web_contents_modal_dialog_manager.h" | |
| 17 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | |
| 18 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 19 #include "google_apis/gaia/gaia_auth_util.h" | 17 #include "google_apis/gaia/gaia_auth_util.h" |
| 20 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
| 21 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 22 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/gfx/font.h" | 22 #include "ui/gfx/font.h" |
| 25 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
| 26 #include "ui/gfx/range/range.h" | 24 #include "ui/gfx/range/range.h" |
| 27 #include "ui/views/background.h" | 25 #include "ui/views/background.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 46 profile, | 44 profile, |
| 47 username, | 45 username, |
| 48 delegate); | 46 delegate); |
| 49 } | 47 } |
| 50 } // namespace chrome | 48 } // namespace chrome |
| 51 | 49 |
| 52 ProfileSigninConfirmationDialogViews::ProfileSigninConfirmationDialogViews( | 50 ProfileSigninConfirmationDialogViews::ProfileSigninConfirmationDialogViews( |
| 53 Browser* browser, | 51 Browser* browser, |
| 54 const std::string& username, | 52 const std::string& username, |
| 55 ui::ProfileSigninConfirmationDelegate* delegate) | 53 ui::ProfileSigninConfirmationDelegate* delegate) |
| 56 : browser_(browser), | 54 : browser_(browser), |
| 57 username_(username), | 55 username_(username), |
| 58 delegate_(delegate), | 56 delegate_(delegate), |
| 59 prompt_for_new_profile_(true), | 57 prompt_for_new_profile_(true), |
| 60 continue_signin_button_(NULL) { | 58 continue_signin_button_(NULL) { |
| 61 } | 59 } |
| 62 | 60 |
| 63 ProfileSigninConfirmationDialogViews::~ProfileSigninConfirmationDialogViews() {} | 61 ProfileSigninConfirmationDialogViews::~ProfileSigninConfirmationDialogViews() {} |
| 64 | 62 |
| 65 // static | 63 // static |
| 66 void ProfileSigninConfirmationDialogViews::ShowDialog( | 64 void ProfileSigninConfirmationDialogViews::ShowDialog( |
| 67 Browser* browser, | 65 Browser* browser, |
| 68 Profile* profile, | 66 Profile* profile, |
| 69 const std::string& username, | 67 const std::string& username, |
| 70 ui::ProfileSigninConfirmationDelegate* delegate) { | 68 ui::ProfileSigninConfirmationDelegate* delegate) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 delegate_ = NULL; | 134 delegate_ = NULL; |
| 137 } | 135 } |
| 138 return true; | 136 return true; |
| 139 } | 137 } |
| 140 | 138 |
| 141 void ProfileSigninConfirmationDialogViews::OnClosed() { | 139 void ProfileSigninConfirmationDialogViews::OnClosed() { |
| 142 Cancel(); | 140 Cancel(); |
| 143 } | 141 } |
| 144 | 142 |
| 145 ui::ModalType ProfileSigninConfirmationDialogViews::GetModalType() const { | 143 ui::ModalType ProfileSigninConfirmationDialogViews::GetModalType() const { |
| 146 return ui::MODAL_TYPE_WINDOW; | 144 return ui::MODAL_TYPE_CHILD; |
| 147 } | 145 } |
| 148 | 146 |
| 149 void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged( | 147 void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged( |
| 150 const ViewHierarchyChangedDetails& details) { | 148 const ViewHierarchyChangedDetails& details) { |
| 151 if (!details.is_add || details.child != this) | 149 if (!details.is_add || details.child != this) |
| 152 return; | 150 return; |
| 153 | 151 |
| 154 const SkColor kPromptBarBackgroundColor = | 152 const SkColor kPromptBarBackgroundColor = |
| 155 ui::GetSigninConfirmationPromptBarColor( | 153 ui::GetSigninConfirmationPromptBarColor( |
| 156 ui::kSigninConfirmationPromptBarBackgroundAlpha); | 154 ui::kSigninConfirmationPromptBarBackgroundAlpha); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 views::Button* sender, | 250 views::Button* sender, |
| 253 const ui::Event& event) { | 251 const ui::Event& event) { |
| 254 DCHECK(prompt_for_new_profile_); | 252 DCHECK(prompt_for_new_profile_); |
| 255 DCHECK_EQ(continue_signin_button_, sender); | 253 DCHECK_EQ(continue_signin_button_, sender); |
| 256 if (delegate_) { | 254 if (delegate_) { |
| 257 delegate_->OnContinueSignin(); | 255 delegate_->OnContinueSignin(); |
| 258 delegate_ = NULL; | 256 delegate_ = NULL; |
| 259 } | 257 } |
| 260 GetWidget()->Close(); | 258 GetWidget()->Close(); |
| 261 } | 259 } |
| OLD | NEW |