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

Side by Side Diff: chrome/browser/ui/webui/version_handler_chromeos.cc

Issue 2695123007: CrOS: Add firmware version to about://version (Closed)
Patch Set: nit Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/version_handler_chromeos.h" 5 #include "chrome/browser/ui/webui/version_handler_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/task_scheduler/post_task.h" 8 #include "base/task_scheduler/post_task.h"
9 #include "content/public/browser/web_ui.h" 9 #include "content/public/browser/web_ui.h"
10 10
11 VersionHandlerChromeOS::VersionHandlerChromeOS() 11 VersionHandlerChromeOS::VersionHandlerChromeOS() : weak_factory_(this) {}
12 : weak_factory_(this) {
13 }
14 12
15 VersionHandlerChromeOS::~VersionHandlerChromeOS() { 13 VersionHandlerChromeOS::~VersionHandlerChromeOS() {}
16 }
17 14
18 void VersionHandlerChromeOS::HandleRequestVersionInfo( 15 void VersionHandlerChromeOS::HandleRequestVersionInfo(
19 const base::ListValue* args) { 16 const base::ListValue* args) {
20 // Start the asynchronous load of the versions. 17 // Start the asynchronous load of the versions.
21 base::PostTaskWithTraitsAndReplyWithResult( 18 base::PostTaskWithTraitsAndReplyWithResult(
22 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( 19 FROM_HERE, base::TaskTraits().MayBlock().WithPriority(
23 base::TaskPriority::BACKGROUND), 20 base::TaskPriority::BACKGROUND),
24 base::Bind(&chromeos::version_loader::GetVersion, 21 base::Bind(&chromeos::version_loader::GetVersion,
25 chromeos::version_loader::VERSION_FULL), 22 chromeos::version_loader::VERSION_FULL),
26 base::Bind(&VersionHandlerChromeOS::OnVersion, 23 base::Bind(&VersionHandlerChromeOS::OnVersion,
27 weak_factory_.GetWeakPtr())); 24 weak_factory_.GetWeakPtr()));
28 base::PostTaskWithTraitsAndReplyWithResult( 25 base::PostTaskWithTraitsAndReplyWithResult(
29 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( 26 FROM_HERE, base::TaskTraits().MayBlock().WithPriority(
30 base::TaskPriority::BACKGROUND), 27 base::TaskPriority::BACKGROUND),
28 base::Bind(&chromeos::version_loader::GetFirmware),
29 base::Bind(&VersionHandlerChromeOS::OnOSFirmware,
30 weak_factory_.GetWeakPtr()));
31 base::PostTaskWithTraitsAndReplyWithResult(
32 FROM_HERE, base::TaskTraits().MayBlock().WithPriority(
33 base::TaskPriority::BACKGROUND),
31 base::Bind(&chromeos::version_loader::GetARCVersion), 34 base::Bind(&chromeos::version_loader::GetARCVersion),
32 base::Bind(&VersionHandlerChromeOS::OnARCVersion, 35 base::Bind(&VersionHandlerChromeOS::OnARCVersion,
33 weak_factory_.GetWeakPtr())); 36 weak_factory_.GetWeakPtr()));
34 37
35 // Parent class takes care of the rest. 38 // Parent class takes care of the rest.
36 VersionHandler::HandleRequestVersionInfo(args); 39 VersionHandler::HandleRequestVersionInfo(args);
37 } 40 }
38 41
39 void VersionHandlerChromeOS::OnVersion(const std::string& version) { 42 void VersionHandlerChromeOS::OnVersion(const std::string& version) {
40 base::StringValue arg(version); 43 base::StringValue arg(version);
41 web_ui()->CallJavascriptFunctionUnsafe("returnOsVersion", arg); 44 web_ui()->CallJavascriptFunctionUnsafe("returnOsVersion", arg);
42 } 45 }
43 46
47 void VersionHandlerChromeOS::OnOSFirmware(const std::string& version) {
48 base::StringValue arg(version);
49 web_ui()->CallJavascriptFunctionUnsafe("returnOsFirmwareVersion", arg);
50 }
51
44 void VersionHandlerChromeOS::OnARCVersion(const std::string& version) { 52 void VersionHandlerChromeOS::OnARCVersion(const std::string& version) {
45 base::StringValue arg(version); 53 base::StringValue arg(version);
46 web_ui()->CallJavascriptFunctionUnsafe("returnARCVersion", arg); 54 web_ui()->CallJavascriptFunctionUnsafe("returnARCVersion", arg);
47 } 55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698