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