Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 11568036: Add countdown when session time is limited (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/system/ash_system_tray_delegate.cc
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index dc7b6621832c2b9053abbb447199f42a44e961e3..8c83abf8af8f8b66e25e761983b9a657176f5d08 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -31,6 +31,7 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
+#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/accessibility/accessibility_util.h"
@@ -183,6 +184,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
clock_type_(base::k24HourClock),
search_key_mapped_to_(input_method::kSearchKey),
screen_locked_(false),
+ is_session_length_limited_(false),
data_promo_notification_(new DataPromoNotification()),
volume_control_delegate_(new VolumeController()) {
// Register notifications on construction so that events such as
@@ -212,6 +214,14 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
this,
chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE,
content::NotificationService::AllSources());
+ registrar_.Add(
+ this,
+ chrome::NOTIFICATION_SESSION_LENGTH_UNLIMITED,
+ content::NotificationService::AllSources());
+ registrar_.Add(
+ this,
+ chrome::NOTIFICATION_REMAINING_SESSION_TIME_CHANGED,
+ content::NotificationService::AllSources());
}
virtual void Initialize() OVERRIDE {
@@ -772,6 +782,14 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
volume_control_delegate_.swap(delegate);
}
+ virtual bool GetSessionLengthLimited() OVERRIDE {
+ return is_session_length_limited_;
+ }
+
+ virtual base::TimeDelta GetRemainingSessionTime() OVERRIDE {
+ return remaining_session_time_;
+ }
+
private:
ash::SystemTray* GetPrimarySystemTray() {
return ash::Shell::GetInstance()->GetPrimarySystemTray();
@@ -1079,6 +1097,18 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
OnAccessibilityModeChanged(accessibility_status->notify);
break;
}
+ case chrome::NOTIFICATION_SESSION_LENGTH_UNLIMITED:
+ is_session_length_limited_ = false;
+ remaining_session_time_ = base::TimeDelta();
+ GetSystemTrayNotifier()->NotifySessionLengthUnlimited();
+ break;
+ case chrome::NOTIFICATION_REMAINING_SESSION_TIME_CHANGED:
+ is_session_length_limited_ = true;
+ remaining_session_time_ =
+ *content::Details<const base::TimeDelta>(details).ptr();
+ GetSystemTrayNotifier()->NotifyRemainingSessionTimeChanged(
+ remaining_session_time_);
+ break;
default:
NOTREACHED();
}
@@ -1254,6 +1284,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
base::HourClockType clock_type_;
int search_key_mapped_to_;
bool screen_locked_;
+ bool is_session_length_limited_;
+ base::TimeDelta remaining_session_time_;
scoped_refptr<device::BluetoothAdapter> bluetooth_adapter_;

Powered by Google App Engine
This is Rietveld 408576698