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

Side by Side Diff: chrome/browser/ui/webui/chromeos/set_time_ui.cc

Issue 854063002: Update {virtual,override,final} to follow C++11 style chrome/browser/ui/webui/chromeos. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/ui/webui/chromeos/set_time_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/set_time_ui.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/build_time.h" 9 #include "base/build_time.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 18 matching lines...) Expand all
29 class SetTimeMessageHandler : public content::WebUIMessageHandler, 29 class SetTimeMessageHandler : public content::WebUIMessageHandler,
30 public chromeos::SystemClockClient::Observer, 30 public chromeos::SystemClockClient::Observer,
31 public system::TimezoneSettings::Observer { 31 public system::TimezoneSettings::Observer {
32 public: 32 public:
33 SetTimeMessageHandler() { 33 SetTimeMessageHandler() {
34 system::TimezoneSettings::GetInstance()->AddObserver(this); 34 system::TimezoneSettings::GetInstance()->AddObserver(this);
35 chromeos::DBusThreadManager::Get()->GetSystemClockClient()->AddObserver( 35 chromeos::DBusThreadManager::Get()->GetSystemClockClient()->AddObserver(
36 this); 36 this);
37 } 37 }
38 38
39 virtual ~SetTimeMessageHandler() { 39 ~SetTimeMessageHandler() override {
40 system::TimezoneSettings::GetInstance()->RemoveObserver(this); 40 system::TimezoneSettings::GetInstance()->RemoveObserver(this);
41 chromeos::DBusThreadManager::Get()->GetSystemClockClient()->RemoveObserver( 41 chromeos::DBusThreadManager::Get()->GetSystemClockClient()->RemoveObserver(
42 this); 42 this);
43 } 43 }
44 44
45 // WebUIMessageHandler: 45 // WebUIMessageHandler:
46 virtual void RegisterMessages() override { 46 void RegisterMessages() override {
47 web_ui()->RegisterMessageCallback( 47 web_ui()->RegisterMessageCallback(
48 "setTimeInSeconds", 48 "setTimeInSeconds",
49 base::Bind(&SetTimeMessageHandler::OnSetTime, base::Unretained(this))); 49 base::Bind(&SetTimeMessageHandler::OnSetTime, base::Unretained(this)));
50 web_ui()->RegisterMessageCallback( 50 web_ui()->RegisterMessageCallback(
51 "setTimezone", 51 "setTimezone",
52 base::Bind(&SetTimeMessageHandler::OnSetTimezone, 52 base::Bind(&SetTimeMessageHandler::OnSetTimezone,
53 base::Unretained(this))); 53 base::Unretained(this)));
54 } 54 }
55 55
56 private: 56 private:
57 // system::SystemClockClient::Observer: 57 // system::SystemClockClient::Observer:
58 virtual void SystemClockUpdated() override { 58 void SystemClockUpdated() override {
59 web_ui()->CallJavascriptFunction("settime.TimeSetter.updateTime"); 59 web_ui()->CallJavascriptFunction("settime.TimeSetter.updateTime");
60 } 60 }
61 61
62 // system::TimezoneSettings::Observer: 62 // system::TimezoneSettings::Observer:
63 virtual void TimezoneChanged(const icu::TimeZone& timezone) override { 63 void TimezoneChanged(const icu::TimeZone& timezone) override {
64 base::StringValue timezone_id( 64 base::StringValue timezone_id(
65 system::TimezoneSettings::GetTimezoneID(timezone)); 65 system::TimezoneSettings::GetTimezoneID(timezone));
66 web_ui()->CallJavascriptFunction("settime.TimeSetter.setTimezone", 66 web_ui()->CallJavascriptFunction("settime.TimeSetter.setTimezone",
67 timezone_id); 67 timezone_id);
68 } 68 }
69 69
70 // Handler for Javascript call to set the system clock when the user sets a 70 // Handler for Javascript call to set the system clock when the user sets a
71 // new time. Expects the time as the number of seconds since the Unix 71 // new time. Expects the time as the number of seconds since the Unix
72 // epoch, treated as a double. 72 // epoch, treated as a double.
73 void OnSetTime(const base::ListValue* args) { 73 void OnSetTime(const base::ListValue* args) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 source->AddResourcePath("set_time.js", IDR_SET_TIME_JS); 132 source->AddResourcePath("set_time.js", IDR_SET_TIME_JS);
133 source->SetDefaultResource(IDR_SET_TIME_HTML); 133 source->SetDefaultResource(IDR_SET_TIME_HTML);
134 134
135 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source); 135 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
136 } 136 }
137 137
138 SetTimeUI::~SetTimeUI() { 138 SetTimeUI::~SetTimeUI() {
139 } 139 }
140 140
141 } // namespace chromeos 141 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/set_time_ui.h ('k') | chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698