| 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_STATUS_STATUS_AREA_VIEW_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_CHROMEOS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/chromeos/status/status_area_view.h" | 9 #include "chrome/browser/chromeos/status/status_area_view.h" |
| 10 | 10 |
| 11 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 11 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
| 12 #include "chrome/browser/chromeos/system/timezone_settings.h" | 12 #include "chrome/browser/chromeos/system/timezone_settings.h" |
| 13 #include "chrome/browser/chromeos/view_ids.h" | 13 #include "chrome/browser/chromeos/view_ids.h" |
| 14 | 14 |
| 15 class ClockMenuButton; | 15 class ClockMenuButton; |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 | 18 |
| 19 class StatusAreaViewChromeos : public StatusAreaView, | 19 class StatusAreaViewChromeos : public StatusAreaView, |
| 20 public PowerManagerClient::Observer, | 20 public PowerManagerClient::Observer, |
| 21 public system::TimezoneSettings::Observer { | 21 public system::TimezoneSettings::Observer { |
| 22 public: | 22 public: |
| 23 // The type of screen the host window is on. | 23 // The type of screen the host window is on. |
| 24 enum ScreenMode { | 24 enum ScreenMode { |
| 25 LOGIN_MODE_VIEWS, // The host is for the views-based OOBE/login screens. | |
| 26 LOGIN_MODE_WEBUI, // The host is for the WebUI OOBE/login screens. | 25 LOGIN_MODE_WEBUI, // The host is for the WebUI OOBE/login screens. |
| 27 BROWSER_MODE, // The host is for browser. | 26 BROWSER_MODE, // The host is for browser. |
| 28 SCREEN_LOCKER_MODE, // The host is for screen locker. | 27 SCREEN_LOCKER_MODE, // The host is for screen locker. |
| 29 }; | 28 }; |
| 30 | 29 |
| 30 // True if the browser is visible (i.e. not login/OOBE). |
| 31 static bool IsBrowserMode(); |
| 32 |
| 33 // True if not logged in into user session (i.e. login/OOBE). |
| 34 // It's not always !IsBrowserMode() as there's SCREEN_LOCKER_MODE which |
| 35 // is inside user session, using login host and browser is not available. |
| 36 static bool IsLoginMode(); |
| 37 |
| 38 // True if user is logged in but browser session is not available |
| 39 // as screen lock is active. |
| 40 static bool IsScreenLockMode(); |
| 41 |
| 42 // Sets current screen mode. |
| 43 static void SetScreenMode(ScreenMode mode); |
| 44 |
| 31 explicit StatusAreaViewChromeos(); | 45 explicit StatusAreaViewChromeos(); |
| 32 virtual ~StatusAreaViewChromeos(); | 46 virtual ~StatusAreaViewChromeos(); |
| 33 | 47 |
| 34 void Init(StatusAreaButton::Delegate* delegate, ScreenMode screen_mode); | 48 void Init(StatusAreaButton::Delegate* delegate); |
| 35 | 49 |
| 36 // PowerManagerClient::Observer: | 50 // PowerManagerClient::Observer: |
| 37 virtual void SystemResumed() OVERRIDE; | 51 virtual void SystemResumed() OVERRIDE; |
| 38 | 52 |
| 39 // TimezoneSettings::Observer: | 53 // TimezoneSettings::Observer: |
| 40 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE; | 54 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE; |
| 41 | 55 |
| 42 // Sets default use 24hour clock mode. | 56 // Sets default use 24hour clock mode. |
| 43 void SetDefaultUse24HourClock(bool use_24hour_clock); | 57 void SetDefaultUse24HourClock(bool use_24hour_clock); |
| 44 | 58 |
| 45 // Convenience function to add buttons to a status area for ChromeOS. | 59 // Convenience function to add buttons to a status area for ChromeOS. |
| 46 // |clock_button| (if non-NULL) is set to the ClockMenuButton that is created | 60 // |clock_button| (if non-NULL) is set to the ClockMenuButton that is created |
| 47 // by this method. | 61 // by this method. |
| 48 static void AddChromeosButtons(StatusAreaView* status_area, | 62 static void AddChromeosButtons(StatusAreaView* status_area, |
| 49 StatusAreaButton::Delegate* delegate, | 63 StatusAreaButton::Delegate* delegate, |
| 50 ScreenMode screen_mode, | |
| 51 ClockMenuButton** clock_button); | 64 ClockMenuButton** clock_button); |
| 52 | 65 |
| 53 private: | 66 private: |
| 67 // Current screen mode of the status area. |
| 68 static ScreenMode screen_mode_; |
| 69 |
| 54 void UpdateClockText(); | 70 void UpdateClockText(); |
| 55 | 71 |
| 56 DISALLOW_COPY_AND_ASSIGN(StatusAreaViewChromeos); | 72 DISALLOW_COPY_AND_ASSIGN(StatusAreaViewChromeos); |
| 57 }; | 73 }; |
| 58 | 74 |
| 59 } // namespace chromeos | 75 } // namespace chromeos |
| 60 | 76 |
| 61 #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_CHROMEOS_H_ | 77 #endif // CHROME_BROWSER_CHROMEOS_STATUS_STATUS_AREA_VIEW_CHROMEOS_H_ |
| OLD | NEW |