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_COCOA_PROFILES_USER_MANAGER_MAC_H_
6#define CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_
7
8#import <Cocoa/Cocoa.h>
9
10#include "base/mac/scoped_nsobject.h"
11#include "base/memory/scoped_ptr.h"
12#include "chrome/browser/profiles/profile.h"
13#include "chrome/browser/profiles/profile_window.h"
14
15class UserManagerMac;
16@class UserManagerWindowController;
17
18namespace content {
19class NavigationController;
20class WebContents;
21}
22
23// Dialog widget that contains the Desktop User Manager webui.
24class UserManagerMac {
25 public:
26  // Shows the User Manager or re-activates an existing one, focusing the
27  // profile given by |profile_path_to_focus|. Based on the value of
28  // |tutorial_mode|, a tutorial could be shown, in which case
29  // |profile_path_to_focus| is ignored.
30  static void Show(const base::FilePath& profile_path_to_focus,
31                   profiles::UserManagerTutorialMode tutorial_mode);
32
33  // Hide the User Manager.
34  static void Hide();
35
36  // Returns whether or not the User Manager is showing.
37  static bool IsShowing();
38
39  // Called by the cocoa window controller when its window closes and the
40  // controller destroyed itself. Deletes the instance.
41  void WindowWasClosed();
42
43 private:
44  explicit UserManagerMac(Profile* profile);
45  virtual ~UserManagerMac();
46
47  // Creates a new UserManagerMac instance for the |guest_profile| and
48  // shows the |url|.
49  static void OnGuestProfileCreated(Profile* guest_profile,
50                                    const std::string& url);
51
52  // An open User Manager window. There can only be one open at a time. This
53  // is reset to NULL when the window is closed.
54  static UserManagerMac* instance_;  // Weak.
55
56  // Controller of the window.
57  base::scoped_nsobject<UserManagerWindowController> window_controller_;
58
59  DISALLOW_COPY_AND_ASSIGN(UserManagerMac);
60};
61
62#endif  // CHROME_BROWSER_UI_COCOA_PROFILES_USER_MANAGER_MAC_H_
63