| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/cocoa/profiles/user_manager_mac.h" | 5 #include "chrome/browser/ui/cocoa/profiles/user_manager_mac.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #import "chrome/browser/app_controller_mac.h" | 10 #import "chrome/browser/app_controller_mac.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 12 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "chrome/browser/profiles/profile_metrics.h" | 14 #include "chrome/browser/profiles/profile_metrics.h" |
| 15 #include "chrome/browser/profiles/profiles_state.h" | 15 #include "chrome/browser/profiles/profiles_state.h" |
| 16 #include "chrome/browser/signin/signin_promo.h" | 16 #include "chrome/browser/signin/signin_promo.h" |
| 17 #include "chrome/browser/ui/browser_dialogs.h" | 17 #include "chrome/browser/ui/browser_dialogs.h" |
| 18 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 18 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 19 #include "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 19 #include "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
| 20 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" | 20 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_sh
eet.h" |
| 21 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi
ndow.h" | 21 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_wi
ndow.h" |
| 22 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" | 22 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" |
| 23 #include "chrome/browser/ui/user_manager.h" | 23 #include "chrome/browser/ui/user_manager.h" |
| 24 #include "chrome/grit/chromium_strings.h" | 24 #include "chrome/grit/chromium_strings.h" |
| 25 #include "components/signin/core/common/profile_management_switches.h" |
| 25 #include "components/web_modal/web_contents_modal_dialog_host.h" | 26 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 26 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 27 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 27 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 28 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| 28 #include "content/public/browser/native_web_keyboard_event.h" | 29 #include "content/public/browser/native_web_keyboard_event.h" |
| 29 #include "content/public/browser/render_widget_host_view.h" | 30 #include "content/public/browser/render_widget_host_view.h" |
| 30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 31 #include "content/public/browser/web_contents_delegate.h" | 32 #include "content/public/browser/web_contents_delegate.h" |
| 32 #include "ui/base/l10n/l10n_util_mac.h" | 33 #include "ui/base/l10n/l10n_util_mac.h" |
| 33 #include "ui/events/keycodes/keyboard_codes.h" | 34 #include "ui/events/keycodes/keyboard_codes.h" |
| 34 | 35 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 59 instance_->CloseReauthDialog(); | 60 instance_->CloseReauthDialog(); |
| 60 } | 61 } |
| 61 | 62 |
| 62 // The modal dialog host the User Manager uses to display the reauth dialog. | 63 // The modal dialog host the User Manager uses to display the reauth dialog. |
| 63 class UserManagerModalHost : public web_modal::WebContentsModalDialogHost { | 64 class UserManagerModalHost : public web_modal::WebContentsModalDialogHost { |
| 64 public: | 65 public: |
| 65 UserManagerModalHost(gfx::NativeView host_view) | 66 UserManagerModalHost(gfx::NativeView host_view) |
| 66 : host_view_(host_view) {} | 67 : host_view_(host_view) {} |
| 67 | 68 |
| 68 gfx::Size GetMaximumDialogSize() override { | 69 gfx::Size GetMaximumDialogSize() override { |
| 69 return gfx::Size( | 70 return switches::UsePasswordSeparatedSigninFlow() ? |
| 70 UserManager::kReauthDialogWidth, UserManager::kReauthDialogHeight); | 71 gfx::Size(UserManager::kReauthDialogWidth, |
| 72 UserManager::kReauthDialogHeight) : |
| 73 gfx::Size(UserManager::kPasswordCombinedReauthDialogWidth, |
| 74 UserManager::kPasswordCombinedReauthDialogHeight); |
| 71 } | 75 } |
| 72 | 76 |
| 73 ~UserManagerModalHost() override {} | 77 ~UserManagerModalHost() override {} |
| 74 | 78 |
| 75 gfx::NativeView GetHostView() const override { | 79 gfx::NativeView GetHostView() const override { |
| 76 return host_view_; | 80 return host_view_; |
| 77 } | 81 } |
| 78 | 82 |
| 79 gfx::Point GetDialogPosition(const gfx::Size& size) override { | 83 gfx::Point GetDialogPosition(const gfx::Size& size) override { |
| 80 return gfx::Point(0, 0); | 84 return gfx::Point(0, 0); |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 ProfileMetrics::LogTimeToOpenUserManager( | 518 ProfileMetrics::LogTimeToOpenUserManager( |
| 515 base::Time::Now() - user_manager_started_showing_); | 519 base::Time::Now() - user_manager_started_showing_); |
| 516 user_manager_started_showing_ = base::Time(); | 520 user_manager_started_showing_ = base::Time(); |
| 517 } | 521 } |
| 518 | 522 |
| 519 void UserManagerMac::WindowWasClosed() { | 523 void UserManagerMac::WindowWasClosed() { |
| 520 CloseReauthDialog(); | 524 CloseReauthDialog(); |
| 521 instance_ = NULL; | 525 instance_ = NULL; |
| 522 delete this; | 526 delete this; |
| 523 } | 527 } |
| OLD | NEW |