| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BACKGROUND_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_BACKGROUND_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_BACKGROUND_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_BACKGROUND_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/chromeos/boot_times_loader.h" | |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | |
| 11 #include "chrome/browser/chromeos/login/login_html_dialog.h" | 9 #include "chrome/browser/chromeos/login/login_html_dialog.h" |
| 12 #include "chrome/browser/chromeos/status/status_area_host.h" | 10 #include "chrome/browser/chromeos/status/status_area_host.h" |
| 13 #include "chrome/browser/chromeos/version_loader.h" | 11 #include "chrome/browser/chromeos/login/version_info_updater.h" |
| 14 #include "chrome/browser/policy/cloud_policy_subsystem.h" | |
| 15 #include "views/view.h" | 12 #include "views/view.h" |
| 16 | 13 |
| 17 namespace views { | 14 namespace views { |
| 18 class Label; | 15 class Label; |
| 19 class TextButton; | 16 class TextButton; |
| 20 class Widget; | 17 class Widget; |
| 21 class WidgetDelegate; | 18 class WidgetDelegate; |
| 22 } | 19 } |
| 23 | 20 |
| 24 class DOMView; | 21 class DOMView; |
| 25 class GURL; | 22 class GURL; |
| 26 class Profile; | 23 class Profile; |
| 27 | 24 |
| 28 namespace chromeos { | 25 namespace chromeos { |
| 29 | 26 |
| 30 class OobeProgressBar; | 27 class OobeProgressBar; |
| 31 class ShutdownButton; | 28 class ShutdownButton; |
| 32 class StatusAreaView; | 29 class StatusAreaView; |
| 33 | 30 |
| 34 // View used to render the background during login. BackgroundView contains | 31 // View used to render the background during login. BackgroundView contains |
| 35 // StatusAreaView. | 32 // StatusAreaView. |
| 36 class BackgroundView : public views::View, | 33 class BackgroundView : public views::View, |
| 37 public StatusAreaHost, | 34 public StatusAreaHost, |
| 38 public chromeos::LoginHtmlDialog::Delegate, | 35 public LoginHtmlDialog::Delegate, |
| 39 public policy::CloudPolicySubsystem::Observer { | 36 public VersionInfoUpdater::Delegate { |
| 40 public: | 37 public: |
| 41 enum LoginStep { | 38 enum LoginStep { |
| 42 SELECT_NETWORK, | 39 SELECT_NETWORK, |
| 43 EULA, | 40 EULA, |
| 44 SIGNIN, | 41 SIGNIN, |
| 45 REGISTRATION, | 42 REGISTRATION, |
| 46 PICTURE, | 43 PICTURE, |
| 47 | 44 |
| 48 // Steps count, must be the last in the enum. | 45 // Steps count, must be the last in the enum. |
| 49 STEPS_COUNT | 46 STEPS_COUNT |
| 50 }; | 47 }; |
| 51 | 48 |
| 52 BackgroundView(); | 49 BackgroundView(); |
| 53 virtual ~BackgroundView(); | 50 virtual ~BackgroundView(); |
| 54 | 51 |
| 55 // Initializes the background view. It backgroun_url is given (non empty), | 52 // Initializes the background view. It background_url is given (non empty), |
| 56 // it creates a DOMView background area that renders a webpage. | 53 // it creates a DOMView background area that renders a webpage. |
| 57 void Init(const GURL& background_url); | 54 void Init(const GURL& background_url); |
| 58 | 55 |
| 59 // Enable/disable shutdown button. | 56 // Enable/disable shutdown button. |
| 60 void EnableShutdownButton(bool enable); | 57 void EnableShutdownButton(bool enable); |
| 61 | 58 |
| 62 // Creates a window containing an instance of WizardContentsView as the root | 59 // Creates a window containing an instance of WizardContentsView as the root |
| 63 // view. The caller is responsible for showing (and closing) the returned | 60 // view. The caller is responsible for showing (and closing) the returned |
| 64 // widget. The BackgroundView is set in |view|. If background_url is non | 61 // widget. The BackgroundView is set in |view|. If background_url is non |
| 65 // empty, the content page of the url is displayed as a background. | 62 // empty, the content page of the url is displayed as a background. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 virtual bool ShouldOpenButtonOptions( | 112 virtual bool ShouldOpenButtonOptions( |
| 116 const views::View* button_view) const OVERRIDE; | 113 const views::View* button_view) const OVERRIDE; |
| 117 virtual void OpenButtonOptions(const views::View* button_view) OVERRIDE; | 114 virtual void OpenButtonOptions(const views::View* button_view) OVERRIDE; |
| 118 virtual ScreenMode GetScreenMode() const OVERRIDE; | 115 virtual ScreenMode GetScreenMode() const OVERRIDE; |
| 119 virtual TextStyle GetTextStyle() const OVERRIDE; | 116 virtual TextStyle GetTextStyle() const OVERRIDE; |
| 120 virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; | 117 virtual void ButtonVisibilityChanged(views::View* button_view) OVERRIDE; |
| 121 | 118 |
| 122 // Overridden from LoginHtmlDialog::Delegate: | 119 // Overridden from LoginHtmlDialog::Delegate: |
| 123 virtual void OnDialogClosed() OVERRIDE {} | 120 virtual void OnDialogClosed() OVERRIDE {} |
| 124 | 121 |
| 122 // Overridden from VersionInfoUpdater::Delegate: |
| 123 virtual void OnOSVersionLabelTextUpdated( |
| 124 const std::string& os_version_label_text) OVERRIDE; |
| 125 virtual void OnBootTimesLabelTextUpdated( |
| 126 const std::string& boot_times_label_text) OVERRIDE; |
| 127 |
| 125 private: | 128 private: |
| 126 // Creates and adds the status_area. | 129 // Creates and adds the status_area. |
| 127 void InitStatusArea(); | 130 void InitStatusArea(); |
| 128 // Creates and adds the labels for version and boot time. | 131 // Creates and adds the labels for version and boot time. |
| 129 void InitInfoLabels(); | 132 void InitInfoLabels(); |
| 130 // Creates and add OOBE progress bar. | 133 // Creates and add OOBE progress bar. |
| 131 void InitProgressBar(); | 134 void InitProgressBar(); |
| 132 | 135 |
| 133 // Invokes SetWindowType for the window. This is invoked during startup and | 136 // Invokes SetWindowType for the window. This is invoked during startup and |
| 134 // after we've painted. | 137 // after we've painted. |
| 135 void UpdateWindowType(); | 138 void UpdateWindowType(); |
| 136 | 139 |
| 137 // Update the version label. | |
| 138 void UpdateVersionLabel(); | |
| 139 | |
| 140 // Check and update enterprise domain. | |
| 141 void UpdateEnterpriseInfo(); | |
| 142 | |
| 143 // Set enterprise domain name. | |
| 144 void SetEnterpriseInfo(const std::string& domain_name, | |
| 145 const std::string& status_text); | |
| 146 | |
| 147 // Callback from chromeos::VersionLoader giving the version. | |
| 148 void OnVersion(VersionLoader::Handle handle, std::string version); | |
| 149 // Callback from chromeos::InfoLoader giving the boot times. | |
| 150 void OnBootTimes( | |
| 151 BootTimesLoader::Handle handle, BootTimesLoader::BootTimes boot_times); | |
| 152 | |
| 153 // policy::CloudPolicySubsystem::Observer methods: | |
| 154 virtual void OnPolicyStateChanged( | |
| 155 policy::CloudPolicySubsystem::PolicySubsystemState state, | |
| 156 policy::CloudPolicySubsystem::ErrorDetails error_details); | |
| 157 | |
| 158 // All of these variables could be NULL. | 140 // All of these variables could be NULL. |
| 159 StatusAreaView* status_area_; | 141 StatusAreaView* status_area_; |
| 160 views::Label* os_version_label_; | 142 views::Label* os_version_label_; |
| 161 views::Label* boot_times_label_; | 143 views::Label* boot_times_label_; |
| 162 OobeProgressBar* progress_bar_; | 144 OobeProgressBar* progress_bar_; |
| 163 ShutdownButton* shutdown_button_; | 145 ShutdownButton* shutdown_button_; |
| 164 | 146 |
| 165 // Handles asynchronously loading the version. | |
| 166 VersionLoader version_loader_; | |
| 167 // Used to request the version. | |
| 168 CancelableRequestConsumer version_consumer_; | |
| 169 | |
| 170 // Handles asynchronously loading the boot times. | |
| 171 BootTimesLoader boot_times_loader_; | |
| 172 // Used to request the boot times. | |
| 173 CancelableRequestConsumer boot_times_consumer_; | |
| 174 | |
| 175 // True if running official BUILD. | 147 // True if running official BUILD. |
| 176 bool is_official_build_; | 148 bool is_official_build_; |
| 177 | 149 |
| 178 // DOMView for rendering a webpage as a background. | 150 // DOMView for rendering a webpage as a background. |
| 179 DOMView* background_area_; | 151 DOMView* background_area_; |
| 180 | 152 |
| 181 // Information pieces for version label. | |
| 182 std::string version_text_; | |
| 183 std::string enterprise_domain_text_; | |
| 184 std::string enterprise_status_text_; | |
| 185 | |
| 186 // Proxy settings dialog that can be invoked from network menu. | 153 // Proxy settings dialog that can be invoked from network menu. |
| 187 scoped_ptr<LoginHtmlDialog> proxy_settings_dialog_; | 154 scoped_ptr<LoginHtmlDialog> proxy_settings_dialog_; |
| 188 | 155 |
| 189 // CloudPolicySubsysterm observer registrar | 156 // Updates version info. |
| 190 scoped_ptr<policy::CloudPolicySubsystem::ObserverRegistrar> | 157 VersionInfoUpdater version_info_updater_; |
| 191 cloud_policy_registrar_; | |
| 192 | 158 |
| 193 DISALLOW_COPY_AND_ASSIGN(BackgroundView); | 159 DISALLOW_COPY_AND_ASSIGN(BackgroundView); |
| 194 }; | 160 }; |
| 195 | 161 |
| 196 } // namespace chromeos | 162 } // namespace chromeos |
| 197 | 163 |
| 198 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_BACKGROUND_VIEW_H_ | 164 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_BACKGROUND_VIEW_H_ |
| OLD | NEW |