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

Unified Diff: ash/mus/system_tray_delegate_mus.cc

Issue 2351893002: mash: Fix system tray clock 12/24 hour time setting (Closed)
Patch Set: review comments Created 4 years, 3 months 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: ash/mus/system_tray_delegate_mus.cc
diff --git a/ash/mus/system_tray_delegate_mus.cc b/ash/mus/system_tray_delegate_mus.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8add535aa2bf63f0e61f51d57121d91a21396604
--- /dev/null
+++ b/ash/mus/system_tray_delegate_mus.cc
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/mus/system_tray_delegate_mus.h"
+
+#include "ash/common/system/tray/system_tray_notifier.h"
+#include "ash/common/wm_shell.h"
+#include "base/i18n/time_formatting.h"
+#include "base/logging.h"
+
+namespace ash {
+namespace {
+
+SystemTrayDelegateMus* g_instance = nullptr;
+
+} // namespace
+
+SystemTrayDelegateMus::SystemTrayDelegateMus()
+ : hour_clock_type_(base::GetHourClockType()) {
+ DCHECK(!g_instance);
+ g_instance = this;
+}
+
+SystemTrayDelegateMus::~SystemTrayDelegateMus() {
+ DCHECK_EQ(this, g_instance);
+ g_instance = nullptr;
+}
+
+// static
+SystemTrayDelegateMus* SystemTrayDelegateMus::Get() {
+ return g_instance;
+}
+
+base::HourClockType SystemTrayDelegateMus::GetHourClockType() const {
+ return hour_clock_type_;
+}
+
+void SystemTrayDelegateMus::SetUse24HourClock(bool use_24_hour) {
+ hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock;
+ WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged();
+}
+
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698