OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 10 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 11 #include "chrome/browser/chromeos/login/oobe_screen.h" |
11 | 12 |
12 namespace base { | 13 namespace base { |
13 class DictionaryValue; | 14 class DictionaryValue; |
14 } | 15 } |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 | 18 |
| 19 // CoreOobeView contains the API and general interface between the UI specific |
| 20 // (Handlers) and the non-UI specific (Model) classes. |
| 21 // |
| 22 // The Model -> Handler API is declared inside of CoreOobeView, ie, Model |
| 23 // classes invoke these methods which are defined inside of the Handlers. |
| 24 // |
| 25 // The Handler -> Model API is declared inside of CoreOobeView::Delegate, ie, |
| 26 // Handler classes invoke these methods which are defined inside of the Models. |
| 27 // |
| 28 // Moving all of the existing Views and View::Delegates into this one class will |
| 29 // help decouple the current Model/View/Handler setup, which will enable the |
| 30 // UI-agnostic code to diverge from the UI implementation as it no longer needs |
| 31 // a 1-1 association. Further, the entire API will be visible from one spot; |
| 32 // this will enable significant deduplication. |
18 class CoreOobeView { | 33 class CoreOobeView { |
19 public: | 34 public: |
20 virtual ~CoreOobeView() {} | 35 class Delegate { |
| 36 public: |
| 37 virtual ~Delegate(); |
21 | 38 |
| 39 // Called when enable debugging screen has exited. |
| 40 virtual void OnEnableDebuggingScreenViewExit(bool success); |
| 41 |
| 42 // Called when the |view| has been destroyed and should no longer be used. |
| 43 virtual void OnViewDestroyed(CoreOobeView* view); |
| 44 }; |
| 45 |
| 46 virtual ~CoreOobeView(); |
| 47 |
| 48 // Set the CoreOobeView::Delegate instance so that derived CoreOobeView types |
| 49 // (aka JS Handlers) can call into generic login code (aka Models). |
| 50 virtual void SetDelegate(Delegate* delegate); |
| 51 |
| 52 // Called when the given |screen| should be shown. |
| 53 virtual void Show(OobeScreen screen); |
| 54 virtual void Hide(OobeScreen screen); |
| 55 |
| 56 // Associated with CoreOobeView: |
22 virtual void ShowSignInError(int login_attempts, | 57 virtual void ShowSignInError(int login_attempts, |
23 const std::string& error_text, | 58 const std::string& error_text, |
24 const std::string& help_link_text, | 59 const std::string& help_link_text, |
25 HelpAppLauncher::HelpTopic help_topic_id) = 0; | 60 HelpAppLauncher::HelpTopic help_topic_id); |
26 virtual void ShowTpmError() = 0; | 61 virtual void ShowTpmError(); |
27 virtual void ShowSignInUI(const std::string& email) = 0; | 62 virtual void ShowSignInUI(const std::string& email); |
28 virtual void ResetSignInUI(bool force_online) = 0; | 63 virtual void ResetSignInUI(bool force_online); |
29 virtual void ClearUserPodPassword() = 0; | 64 virtual void ClearUserPodPassword(); |
30 virtual void RefocusCurrentPod() = 0; | 65 virtual void RefocusCurrentPod(); |
31 virtual void ShowPasswordChangedScreen(bool show_password_error, | 66 virtual void ShowPasswordChangedScreen(bool show_password_error, |
32 const std::string& email) = 0; | 67 const std::string& email); |
33 virtual void SetUsageStats(bool checked) = 0; | 68 virtual void SetUsageStats(bool checked); |
34 virtual void SetOemEulaUrl(const std::string& oem_eula_url) = 0; | 69 virtual void SetOemEulaUrl(const std::string& oem_eula_url); |
35 virtual void SetTpmPassword(const std::string& tmp_password) = 0; | 70 virtual void SetTpmPassword(const std::string& tmp_password); |
36 virtual void ClearErrors() = 0; | 71 virtual void ClearErrors(); |
37 virtual void ReloadContent(const base::DictionaryValue& dictionary) = 0; | 72 virtual void ReloadContent(const base::DictionaryValue& dictionary); |
38 virtual void ShowControlBar(bool show) = 0; | 73 virtual void ShowControlBar(bool show); |
39 virtual void ShowPinKeyboard(bool show) = 0; | 74 virtual void ShowPinKeyboard(bool show); |
40 virtual void SetClientAreaSize(int width, int height) = 0; | 75 virtual void SetClientAreaSize(int width, int height); |
41 virtual void ShowDeviceResetScreen() = 0; | 76 virtual void ShowDeviceResetScreen(); |
42 virtual void ShowEnableDebuggingScreen() = 0; | 77 virtual void ShowEnableDebuggingScreen(); |
43 virtual void InitDemoModeDetection() = 0; | 78 virtual void InitDemoModeDetection(); |
44 virtual void StopDemoModeDetection() = 0; | 79 virtual void StopDemoModeDetection(); |
45 virtual void UpdateKeyboardState() = 0; | 80 virtual void UpdateKeyboardState(); |
46 virtual void ShowActiveDirectoryPasswordChangeScreen( | 81 virtual void ShowActiveDirectoryPasswordChangeScreen( |
47 const std::string& username) = 0; | 82 const std::string& username); |
48 }; | 83 }; |
49 | 84 |
50 } // namespace chromeos | 85 } // namespace chromeos |
51 | 86 |
52 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_VIEW_H_ | 87 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_CORE_OOBE_VIEW_H_ |
OLD | NEW |