| 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 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/profiles/profile_window.h" | 15 #include "chrome/browser/profiles/profile_window.h" |
| 16 #include "components/signin/core/browser/signin_metrics.h" | 16 #include "components/signin/core/browser/signin_metrics.h" |
| 17 | 17 |
| 18 @class ReauthDialogWindowController; | 18 @class DialogWindowController; |
| 19 @class UserManagerWindowController; | 19 @class UserManagerWindowController; |
| 20 | 20 |
| 21 // Dialog widget that contains the Desktop User Manager webui. This object | 21 // Dialog widget that contains the Desktop User Manager webui. This object |
| 22 // should always be created from the UserManager::Show() method. Note that only | 22 // should always be created from the UserManager::Show() method. Note that only |
| 23 // one User Manager will exist at a time. | 23 // one User Manager will exist at a time. |
| 24 class UserManagerMac { | 24 class UserManagerMac { |
| 25 public: | 25 public: |
| 26 // Called by the cocoa window controller when its window closes and the | 26 // Called by the cocoa window controller when its window closes and the |
| 27 // controller destroyed itself. Deletes the instance. | 27 // controller destroyed itself. Deletes the instance. |
| 28 void WindowWasClosed(); | 28 void WindowWasClosed(); |
| 29 | 29 |
| 30 // Called from the UserManager class once the |system_profile| is ready. Will | 30 // Called from the UserManager class once the |system_profile| is ready. Will |
| 31 // construct a UserManagerMac object and show |url|. | 31 // construct a UserManagerMac object and show |url|. |
| 32 static void OnSystemProfileCreated(const base::Time& start_time, | 32 static void OnSystemProfileCreated(const base::Time& start_time, |
| 33 Profile* system_profile, | 33 Profile* system_profile, |
| 34 const std::string& url); | 34 const std::string& url); |
| 35 | 35 |
| 36 UserManagerWindowController* window_controller() { | 36 UserManagerWindowController* window_controller() { |
| 37 return window_controller_.get(); | 37 return window_controller_.get(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void set_user_manager_started_showing( | 40 void set_user_manager_started_showing( |
| 41 const base::Time& user_manager_started_showing) { | 41 const base::Time& user_manager_started_showing) { |
| 42 user_manager_started_showing_ = user_manager_started_showing; | 42 user_manager_started_showing_ = user_manager_started_showing; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void LogTimeToOpen(); | 45 void LogTimeToOpen(); |
| 46 | 46 |
| 47 void ShowReauthDialog(content::BrowserContext* browser_context, | 47 void ShowDialog(content::BrowserContext* browser_context, |
| 48 const std::string& email, | 48 const std::string& email, |
| 49 signin_metrics::Reason reason); | 49 const GURL& url); |
| 50 void CloseReauthDialog(); | 50 void CloseDialog(); |
| 51 | 51 |
| 52 void DisplayErrorMessage(); | 52 void DisplayErrorMessage(); |
| 53 | 53 |
| 54 void SetSigninProfilePath(const base::FilePath& profile_path); | 54 void SetSigninProfilePath(const base::FilePath& profile_path); |
| 55 base::FilePath GetSigninProfilePath(); | 55 base::FilePath GetSigninProfilePath(); |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 explicit UserManagerMac(Profile* profile); | 58 explicit UserManagerMac(Profile* profile); |
| 59 virtual ~UserManagerMac(); | 59 virtual ~UserManagerMac(); |
| 60 | 60 |
| 61 // Controller of the window. | 61 // Controller of the window. |
| 62 base::scoped_nsobject<UserManagerWindowController> window_controller_; | 62 base::scoped_nsobject<UserManagerWindowController> window_controller_; |
| 63 | 63 |
| 64 base::scoped_nsobject<ReauthDialogWindowController> reauth_window_; | 64 base::scoped_nsobject<DialogWindowController> reauth_window_; |
| 65 | 65 |
| 66 base::Time user_manager_started_showing_; | 66 base::Time user_manager_started_showing_; |
| 67 | 67 |
| 68 base::FilePath signin_profile_path_; | 68 base::FilePath signin_profile_path_; |
| 69 | 69 |
| 70 DISALLOW_COPY_AND_ASSIGN(UserManagerMac); | 70 DISALLOW_COPY_AND_ASSIGN(UserManagerMac); |
| 71 }; | 71 }; |
| 72 | 72 |
| 73 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_ | 73 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_ |
| OLD | NEW |