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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_window.h"
11 #include "ui/views/window/dialog_delegate.h"
19 // Dialog widget that contains the Desktop User Manager webui.
20 class UserManagerView
: public views::DialogDelegateView
{
22 // Shows the User Manager or re-activates an existing one, focusing the
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
);
29 // Hide the User Manager.
32 // Returns whether or not the User Manager is showing.
33 static bool IsShowing();
36 friend struct base::DefaultDeleter
<UserManagerView
>;
39 virtual ~UserManagerView();
41 // Creates a new UserManagerView instance for the |guest_profile| and
43 static void OnGuestProfileCreated(scoped_ptr
<UserManagerView
> instance
,
44 Profile
* guest_profile
,
45 const std::string
& url
);
47 // Creates dialog and initializes UI.
48 void Init(Profile
* guest_profile
, const GURL
& url
);
51 virtual gfx::Size
GetPreferredSize() const OVERRIDE
;
53 // views::DialogDelegateView:
54 virtual bool CanResize() const OVERRIDE
;
55 virtual bool CanMaximize() const OVERRIDE
;
56 virtual base::string16
GetWindowTitle() const OVERRIDE
;
57 virtual int GetDialogButtons() const OVERRIDE
;
58 virtual void WindowClosing() OVERRIDE
;
59 virtual bool UseNewStyleForThisDialog() const OVERRIDE
;
61 views::WebView
* web_view_
;
63 scoped_ptr
<AutoKeepAlive
> keep_alive_
;
64 // An open User Manager window. There can only be one open at a time. This
65 // is reset to NULL when the window is closed.
66 static UserManagerView
* instance_
;
68 DISALLOW_COPY_AND_ASSIGN(UserManagerView
);
71 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_