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_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/profiles/profile_window.h" | 10 #include "chrome/browser/profiles/profile_window.h" |
11 #include "ui/views/window/dialog_delegate.h" | 11 #include "ui/views/window/dialog_delegate.h" |
12 | 12 |
13 class AutoKeepAlive; | 13 class AutoKeepAlive; |
14 | 14 |
15 namespace views { | 15 namespace views { |
16 class WebView; | 16 class WebView; |
17 } | 17 } |
18 | 18 |
19 // Dialog widget that contains the Desktop User Manager webui. | 19 // Dialog widget that contains the Desktop User Manager webui. |
20 class UserManagerView : public views::DialogDelegateView { | 20 class UserManagerView : public views::DialogDelegateView { |
21 public: | 21 public: |
22 // Shows the User Manager or re-activates an existing one, focusing the | 22 // Do not call directly. To display the User Manager, use UserManager::Show(). |
23 // profile given by |profile_path_to_focus|. Based on the value of | |
24 // |tutorial_mode|, a tutorial could be shown, in which case | |
25 // |profile_path_to_focus| is ignored. | |
26 static void Show(const base::FilePath& profile_path_to_focus, | |
27 profiles::UserManagerTutorialMode tutorial_mode); | |
28 | |
29 // Hide the User Manager. | |
30 static void Hide(); | |
31 | |
32 // Returns whether or not the User Manager is showing. | |
33 static bool IsShowing(); | |
34 | |
35 private: | |
36 friend struct base::DefaultDeleter<UserManagerView>; | |
37 | |
38 UserManagerView(); | 23 UserManagerView(); |
39 virtual ~UserManagerView(); | |
40 | 24 |
41 // Creates a new UserManagerView instance for the |guest_profile| and | 25 // Creates a new UserManagerView instance for the |guest_profile| and |
42 // shows the |url|. | 26 // shows the |url|. |
43 static void OnGuestProfileCreated(scoped_ptr<UserManagerView> instance, | 27 static void OnGuestProfileCreated(scoped_ptr<UserManagerView> instance, |
44 const base::FilePath& profile_path_to_focus, | 28 const base::FilePath& profile_path_to_focus, |
45 Profile* guest_profile, | 29 Profile* guest_profile, |
46 const std::string& url); | 30 const std::string& url); |
47 | 31 |
| 32 private: |
| 33 virtual ~UserManagerView(); |
| 34 |
| 35 friend struct base::DefaultDeleter<UserManagerView>; |
| 36 |
48 // Creates dialog and initializes UI. | 37 // Creates dialog and initializes UI. |
49 void Init(const base::FilePath& profile_path_to_focus, | 38 void Init(const base::FilePath& profile_path_to_focus, |
50 Profile* guest_profile, | 39 Profile* guest_profile, |
51 const GURL& url); | 40 const GURL& url); |
52 | 41 |
53 // views::View: | 42 // views::View: |
54 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 43 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
55 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 44 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
56 | 45 |
57 // views::DialogDelegateView: | 46 // views::DialogDelegateView: |
58 virtual bool CanResize() const OVERRIDE; | 47 virtual bool CanResize() const OVERRIDE; |
59 virtual bool CanMaximize() const OVERRIDE; | 48 virtual bool CanMaximize() const OVERRIDE; |
60 virtual bool CanMinimize() const OVERRIDE; | 49 virtual bool CanMinimize() const OVERRIDE; |
61 virtual base::string16 GetWindowTitle() const OVERRIDE; | 50 virtual base::string16 GetWindowTitle() const OVERRIDE; |
62 virtual int GetDialogButtons() const OVERRIDE; | 51 virtual int GetDialogButtons() const OVERRIDE; |
63 virtual void WindowClosing() OVERRIDE; | 52 virtual void WindowClosing() OVERRIDE; |
64 virtual bool UseNewStyleForThisDialog() const OVERRIDE; | 53 virtual bool UseNewStyleForThisDialog() const OVERRIDE; |
65 | 54 |
66 views::WebView* web_view_; | 55 views::WebView* web_view_; |
67 | 56 |
68 scoped_ptr<AutoKeepAlive> keep_alive_; | 57 scoped_ptr<AutoKeepAlive> keep_alive_; |
69 // An open User Manager window. There can only be one open at a time. This | |
70 // is reset to NULL when the window is closed. | |
71 static UserManagerView* instance_; | |
72 | 58 |
73 DISALLOW_COPY_AND_ASSIGN(UserManagerView); | 59 DISALLOW_COPY_AND_ASSIGN(UserManagerView); |
74 }; | 60 }; |
75 | 61 |
76 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ | 62 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_ |
OLD | NEW |