Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / views / profiles / user_manager_view.h
blobae9e7ca0ad482d017a1032efbd7a5f28c4051d56
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/auto_reset.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_window.h"
12 #include "ui/views/window/dialog_delegate.h"
14 class AutoKeepAlive;
16 namespace views {
17 class WebView;
20 // Dialog widget that contains the Desktop User Manager webui.
21 class UserManagerView : public views::DialogDelegateView {
22 public:
23 // Do not call directly. To display the User Manager, use UserManager::Show().
24 UserManagerView();
26 // Creates a new UserManagerView instance for the |system_profile| and shows
27 // the |url|.
28 static void OnSystemProfileCreated(scoped_ptr<UserManagerView> instance,
29 base::AutoReset<bool>* pending,
30 Profile* system_profile,
31 const std::string& url);
33 void set_user_manager_started_showing(
34 const base::Time& user_manager_started_showing) {
35 user_manager_started_showing_ = user_manager_started_showing;
38 // Logs how long it took the UserManager to open.
39 void LogTimeToOpen();
41 private:
42 ~UserManagerView() override;
44 friend struct base::DefaultDeleter<UserManagerView>;
46 // Creates dialog and initializes UI.
47 void Init(Profile* guest_profile, const GURL& url);
49 // views::View:
50 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
51 gfx::Size GetPreferredSize() const override;
53 // views::DialogDelegateView:
54 bool CanResize() const override;
55 bool CanMaximize() const override;
56 bool CanMinimize() const override;
57 base::string16 GetWindowTitle() const override;
58 int GetDialogButtons() const override;
59 void WindowClosing() override;
60 bool UseNewStyleForThisDialog() const override;
62 views::WebView* web_view_;
64 scoped_ptr<AutoKeepAlive> keep_alive_;
65 base::Time user_manager_started_showing_;
67 DISALLOW_COPY_AND_ASSIGN(UserManagerView);
70 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_USER_MANAGER_VIEW_H_