OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "chrome/browser/profiles/profile_keyed_service.h" | 10 #include "chrome/browser/profiles/profile_keyed_service.h" |
11 | 11 |
12 class Profile; | 12 class Browser; |
13 | 13 |
14 // The LoginUIService helps track per-profile information for the login UI - | 14 // The LoginUIService helps track per-profile information for the login UI - |
15 // for example, whether there is login UI currently on-screen. | 15 // for example, whether there is login UI currently on-screen. |
16 class LoginUIService : public ProfileKeyedService { | 16 class LoginUIService : public ProfileKeyedService { |
17 public: | 17 public: |
18 // Various UI components implement this API to allow LoginUIService to | 18 // Various UI components implement this API to allow LoginUIService to |
19 // manipulate their associated login UI. | 19 // manipulate their associated login UI. |
20 class LoginUI { | 20 class LoginUI { |
21 public: | 21 public: |
22 // Invoked when the login UI should be brought to the foreground. | 22 // Invoked when the login UI should be brought to the foreground. |
23 virtual void FocusUI() = 0; | 23 virtual void FocusUI() = 0; |
24 | 24 |
25 // Invoked when the login UI should be closed. This can be invoked if the | 25 // Invoked when the login UI should be closed. This can be invoked if the |
26 // user takes an action that should display new login UI. | 26 // user takes an action that should display new login UI. |
27 virtual void CloseUI() = 0; | 27 virtual void CloseUI() = 0; |
28 protected: | 28 protected: |
29 virtual ~LoginUI() {} | 29 virtual ~LoginUI() {} |
30 }; | 30 }; |
31 | 31 |
32 // Creates a LoginUIService associated with the passed |profile|. |profile| | 32 // Creates a LoginUIService |
Andrew T Wilson (Slow)
2012/06/27 22:32:36
Remove this comment since it adds nothing?
jam
2012/06/27 22:39:30
Done.
| |
33 // is used to create a new browser in the case that ShowLoginUI() is invoked | 33 LoginUIService(); |
34 // when no browser windows are open (e.g. via the Mac menu bar). | |
jam
2012/06/27 21:43:27
this comment wasn't right, i.e. Mac menu bar goes
| |
35 explicit LoginUIService(Profile* profile); | |
36 virtual ~LoginUIService(); | 34 virtual ~LoginUIService(); |
37 | 35 |
38 // Gets the currently active login UI, or null if no login UI is active. | 36 // Gets the currently active login UI, or null if no login UI is active. |
39 LoginUI* current_login_ui() const { | 37 LoginUI* current_login_ui() const { |
40 return ui_; | 38 return ui_; |
41 } | 39 } |
42 | 40 |
43 // Sets the currently active login UI. It is illegal to call this if there is | 41 // Sets the currently active login UI. It is illegal to call this if there is |
44 // already login UI visible. | 42 // already login UI visible. |
45 void SetLoginUI(LoginUI* ui); | 43 void SetLoginUI(LoginUI* ui); |
46 | 44 |
47 // Called when login UI is closed. If the passed UI is the current login UI, | 45 // Called when login UI is closed. If the passed UI is the current login UI, |
48 // sets current_login_ui() to null. | 46 // sets current_login_ui() to null. |
49 void LoginUIClosed(LoginUI* ui); | 47 void LoginUIClosed(LoginUI* ui); |
50 | 48 |
51 // Brings the login UI to the foreground, or if there is no login UI, | 49 // Brings the login UI to the foreground, or if there is no login UI, |
52 // navigates to the login UI page in a new browser tab. | 50 // navigates to the login UI page in a new browser tab. |
Andrew T Wilson (Slow)
2012/06/27 22:32:36
Update this comment, since it sounds like we use t
jam
2012/06/27 22:39:30
Done.
| |
53 // Virtual for mocking purposes. | 51 // Virtual for mocking purposes. |
54 virtual void ShowLoginUI(); | 52 virtual void ShowLoginUI(Browser* browser); |
55 | 53 |
56 private: | 54 private: |
57 // Weak pointer to the currently active login UI, or null if none. | 55 // Weak pointer to the currently active login UI, or null if none. |
58 LoginUI* ui_; | 56 LoginUI* ui_; |
59 | 57 |
60 // Weak pointer to the profile this service is associated with. | |
61 Profile* profile_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(LoginUIService); | 58 DISALLOW_COPY_AND_ASSIGN(LoginUIService); |
64 }; | 59 }; |
65 | 60 |
66 | |
67 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ | 61 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_LOGIN_UI_SERVICE_H_ |
OLD | NEW |