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

Side by Side 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, 9 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/demo_ui/strings/strings_demo.h"
6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/strings/stringprintf.h"
10 #include "base/time/time.h"
11 #include "base/timer/timer.h"
12
13 StringsDemo::StringsDemo() : timer_(true, true) {
14 }
15
16 StringsDemo::~StringsDemo() {
17 }
18
19 void StringsDemo::Register() {
20 SetFactory(
21 [](content::BrowserContext*)
22 -> gen::StringsDemoViewModel* { return new StringsDemo(); });
23 }
24
25 void StringsDemo::Initialize() {
26 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1),
27 base::Bind(&StringsDemo::UpdateClock, base::Unretained(this)));
28 }
29
30 void StringsDemo::UpdateClock() {
31 base::Time::Exploded now;
32 base::Time::Now().LocalExplode(&now);
33 GetContextEditor()
34 .SetString(kContextKeyHours, base::StringPrintf("%02d", now.hour))
35 .SetString(kContextKeyMinutes, base::StringPrintf("%02d", now.minute))
36 .SetString(kContextKeySeconds, base::StringPrintf("%02d", now.second));
37 }
OLDNEW
« 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