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. |
23 class UserManagerMac { | 23 class UserManagerMac { |
24 public: | 24 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 | 25 // Called by the cocoa window controller when its window closes and the |
39 // controller destroyed itself. Deletes the instance. | 26 // controller destroyed itself. Deletes the instance. |
40 void WindowWasClosed(); | 27 void WindowWasClosed(); |
41 | 28 |
42 private: | |
43 explicit UserManagerMac(Profile* profile); | |
44 virtual ~UserManagerMac(); | |
45 | |
46 // Creates a new UserManagerMac instance for the |guest_profile| and | 29 // Creates a new UserManagerMac instance for the |guest_profile| and |
47 // shows the |url|. | 30 // shows the |url|. |
48 static void OnGuestProfileCreated(Profile* guest_profile, | 31 static void OnGuestProfileCreated(Profile* guest_profile, |
Alexei Svitkine (slow)
2014/09/18 20:54:04
This is a very strange name for a method when look
Mike Lerman
2014/09/19 15:49:30
Comment added.
The UserManager always operates as
| |
49 const std::string& url); | 32 const std::string& url); |
50 | 33 |
51 // An open User Manager window. There can only be one open at a time. This | 34 UserManagerWindowController* get_window_controller() { |
Alexei Svitkine (slow)
2014/09/18 20:54:04
Remove get_ prefixed, it's used for non-trivial me
Mike Lerman
2014/09/19 15:49:30
Done.
| |
52 // is reset to NULL when the window is closed. | 35 return window_controller_.get(); |
53 static UserManagerMac* instance_; // Weak. | 36 } |
37 | |
38 private: | |
39 explicit UserManagerMac(Profile* profile); | |
40 virtual ~UserManagerMac(); | |
54 | 41 |
55 // Controller of the window. | 42 // Controller of the window. |
56 base::scoped_nsobject<UserManagerWindowController> window_controller_; | 43 base::scoped_nsobject<UserManagerWindowController> window_controller_; |
57 | 44 |
58 DISALLOW_COPY_AND_ASSIGN(UserManagerMac); | 45 DISALLOW_COPY_AND_ASSIGN(UserManagerMac); |
59 }; | 46 }; |
60 | 47 |
61 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_ | 48 #endif // CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_ |
OLD | NEW |