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 "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/profiles/profile_window.h" | 13 #include "chrome/browser/profiles/profile_window.h" |
14 | 14 |
15 @class UserManagerWindowController; | 15 @class UserManagerWindowController; |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class NavigationController; | 18 class NavigationController; |
19 class WebContents; | 19 class WebContents; |
20 } | 20 } |
21 | 21 |
22 // Dialog widget that contains the Desktop User Manager webui. | 22 // Dialog widget that contains the Desktop User Manager webui. This object |
| 23 // should always be created from the UserManager::Show() method. Note that only |
| 24 // one User Manager will exist at a time. |
23 class UserManagerMac { | 25 class UserManagerMac { |
24 public: | 26 public: |
25 // Shows the User Manager or re-activates an existing one, focusing the | |
26 // profile given by |profile_path_to_focus|. Based on the value of | |
27 // |tutorial_mode|, a tutorial could be shown, in which case | |
28 // |profile_path_to_focus| is ignored. | |
29 static void Show(const base::FilePath& profile_path_to_focus, | |
30 profiles::UserManagerTutorialMode tutorial_mode); | |
31 | |
32 // Hide the User Manager. | |
33 static void Hide(); | |
34 | |
35 // Returns whether or not the User Manager is showing. | |
36 static bool IsShowing(); | |
37 | |
38 // Called by the cocoa window controller when its window closes and the | 27 // Called by the cocoa window controller when its window closes and the |
39 // controller destroyed itself. Deletes the instance. | 28 // controller destroyed itself. Deletes the instance. |
40 void WindowWasClosed(); | 29 void WindowWasClosed(); |
41 | 30 |
| 31 // Called from the UserManager class once the |guest_profile| is ready. Will |
| 32 // construct a UserManagerMac object and show |url|. |
| 33 static void OnGuestProfileCreated(Profile* guest_profile, |
| 34 const std::string& url); |
| 35 |
| 36 UserManagerWindowController* window_controller() { |
| 37 return window_controller_.get(); |
| 38 } |
| 39 |
42 private: | 40 private: |
43 explicit UserManagerMac(Profile* profile); | 41 explicit UserManagerMac(Profile* profile); |
44 virtual ~UserManagerMac(); | 42 virtual ~UserManagerMac(); |
45 | 43 |
46 // Creates a new UserManagerMac instance for the |guest_profile| and | |
47 // shows the |url|. | |
48 static void OnGuestProfileCreated(Profile* guest_profile, | |
49 const std::string& url); | |
50 | |
51 // An open User Manager window. There can only be one open at a time. This | |
52 // is reset to NULL when the window is closed. | |
53 static UserManagerMac* instance_; // Weak. | |
54 | |
55 // Controller of the window. | 44 // Controller of the window. |
56 base::scoped_nsobject<UserManagerWindowController> window_controller_; | 45 base::scoped_nsobject<UserManagerWindowController> window_controller_; |
57 | 46 |
58 DISALLOW_COPY_AND_ASSIGN(UserManagerMac); | 47 DISALLOW_COPY_AND_ASSIGN(UserManagerMac); |
59 }; | 48 }; |
60 | 49 |
61 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_ | 50 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_ |
OLD | NEW |