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

Unified Diff: chrome/browser/ui/webui/demo_ui/strings/strings_demo.cc

Issue 925333002: Demo UI made with a help of WUG toolkit (DO NOT SEND TO CQ). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « chrome/browser/ui/webui/demo_ui/strings/strings_demo.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/demo_ui/strings/strings_demo.cc
diff --git a/chrome/browser/ui/webui/demo_ui/strings/strings_demo.cc b/chrome/browser/ui/webui/demo_ui/strings/strings_demo.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5a985fc460ecad905ff88f5b939bfcf632b1040d
--- /dev/null
+++ b/chrome/browser/ui/webui/demo_ui/strings/strings_demo.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 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 "chrome/browser/ui/webui/demo_ui/strings/strings_demo.h"
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/strings/stringprintf.h"
+#include "base/time/time.h"
+#include "base/timer/timer.h"
+
+StringsDemo::StringsDemo() : timer_(true, true) {
+}
+
+StringsDemo::~StringsDemo() {
+}
+
+void StringsDemo::Register() {
+ SetFactory(
+ [](content::BrowserContext*)
+ -> gen::StringsDemoViewModel* { return new StringsDemo(); });
+}
+
+void StringsDemo::Initialize() {
+ timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1),
+ base::Bind(&StringsDemo::UpdateClock, base::Unretained(this)));
+}
+
+void StringsDemo::UpdateClock() {
+ base::Time::Exploded now;
+ base::Time::Now().LocalExplode(&now);
+ GetContextEditor()
+ .SetString(kContextKeyHours, base::StringPrintf("%02d", now.hour))
+ .SetString(kContextKeyMinutes, base::StringPrintf("%02d", now.minute))
+ .SetString(kContextKeySeconds, base::StringPrintf("%02d", now.second));
+}
« no previous file with comments | « chrome/browser/ui/webui/demo_ui/strings/strings_demo.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698