| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_USER_MANAGER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_USER_MANAGER_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_USER_MANAGER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_USER_MANAGER_VIEW_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "ui/views/window/dialog_delegate.h" | 9 #include "ui/views/window/dialog_delegate.h" |
| 10 | 10 |
| 11 class AutoKeepAlive; | 11 class AutoKeepAlive; |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 class WebView; | 14 class WebView; |
| 15 } | 15 } |
| 16 | 16 |
| 17 // Dialog widget that contains the Desktop User Manager webui. | 17 // Dialog widget that contains the Desktop User Manager webui. |
| 18 class UserManagerView : public views::DialogDelegateView { | 18 class UserManagerView : public views::DialogDelegateView { |
| 19 public: | 19 public: |
| 20 // Shows the User Manager or re-activates an existing one. | 20 // Shows the User Manager or re-activates an existing one, focusing the |
| 21 static void Show(const base::FilePath& profile_path_to_focus); | 21 // profile given by |profile_path_to_focus|. If |show_tutorial| is true, |
| 22 // then the user manager tutorial will be shown. |
| 23 static void Show(const base::FilePath& profile_path_to_focus, |
| 24 bool show_tutorial); |
| 22 | 25 |
| 23 // Hide the User Manager. | 26 // Hide the User Manager. |
| 24 static void Hide(); | 27 static void Hide(); |
| 25 | 28 |
| 26 // Returns whether or not the User Manager is showing. | 29 // Returns whether or not the User Manager is showing. |
| 27 static bool IsShowing(); | 30 static bool IsShowing(); |
| 28 | 31 |
| 29 private: | 32 private: |
| 30 explicit UserManagerView(Profile* profile); | 33 explicit UserManagerView(Profile* profile); |
| 31 virtual ~UserManagerView(); | 34 virtual ~UserManagerView(); |
| 32 | 35 |
| 33 // If the |guest_profile| has been initialized succesfully (according to | 36 // If the |guest_profile| has been initialized succesfully (according to |
| 34 // |status|), creates a new UserManagerView instance with the user with path | 37 // |status|), creates a new UserManagerView instance with the user with path |
| 35 // |profile_path_to_focus| focused. | 38 // |profile_path_to_focus| focused. |
| 36 static void OnGuestProfileCreated(const base::FilePath& profile_path_to_focus, | 39 static void OnGuestProfileCreated(const base::FilePath& profile_path_to_focus, |
| 40 bool show_tutorial, |
| 37 Profile* guest_profile, | 41 Profile* guest_profile, |
| 38 Profile::CreateStatus status); | 42 Profile::CreateStatus status); |
| 39 | 43 |
| 40 // views::View: | 44 // views::View: |
| 41 virtual gfx::Size GetPreferredSize() OVERRIDE; | 45 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 42 | 46 |
| 43 // views::DialogDelegateView: | 47 // views::DialogDelegateView: |
| 44 virtual bool CanResize() const OVERRIDE; | 48 virtual bool CanResize() const OVERRIDE; |
| 45 virtual bool CanMaximize() const OVERRIDE; | 49 virtual bool CanMaximize() const OVERRIDE; |
| 46 virtual base::string16 GetWindowTitle() const OVERRIDE; | 50 virtual base::string16 GetWindowTitle() const OVERRIDE; |
| 47 virtual int GetDialogButtons() const OVERRIDE; | 51 virtual int GetDialogButtons() const OVERRIDE; |
| 48 virtual void WindowClosing() OVERRIDE; | 52 virtual void WindowClosing() OVERRIDE; |
| 49 virtual bool UseNewStyleForThisDialog() const OVERRIDE; | 53 virtual bool UseNewStyleForThisDialog() const OVERRIDE; |
| 50 | 54 |
| 51 views::WebView* web_view_; | 55 views::WebView* web_view_; |
| 52 | 56 |
| 53 scoped_ptr<AutoKeepAlive> keep_alive_; | 57 scoped_ptr<AutoKeepAlive> keep_alive_; |
| 54 // An open User Manager window. There can only be one open at a time. This | 58 // An open User Manager window. There can only be one open at a time. This |
| 55 // is reset to NULL when the window is closed. | 59 // is reset to NULL when the window is closed. |
| 56 static UserManagerView* instance_; | 60 static UserManagerView* instance_; |
| 57 | 61 |
| 58 DISALLOW_COPY_AND_ASSIGN(UserManagerView); | 62 DISALLOW_COPY_AND_ASSIGN(UserManagerView); |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 #endif // CHROME_BROWSER_UI_VIEWS_USER_MANAGER_VIEW_H_ | 65 #endif // CHROME_BROWSER_UI_VIEWS_USER_MANAGER_VIEW_H_ |
| OLD | NEW |