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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/webui/version_handler_chromeos.h"
8 #include "base/task_runner_util.h"
9 #include "content/public/browser/browser_thread.h"
10 #include "content/public/browser/web_ui.h"
12 VersionHandlerChromeOS::VersionHandlerChromeOS()
13 : weak_factory_(this) {
16 VersionHandlerChromeOS::~VersionHandlerChromeOS() {
19 void VersionHandlerChromeOS::HandleRequestVersionInfo(
20 const base::ListValue
* args
) {
21 // Start the asynchronous load of the version.
22 base::PostTaskAndReplyWithResult(
23 content::BrowserThread::GetBlockingPool(),
25 base::Bind(&chromeos::version_loader::GetVersion
,
26 chromeos::version_loader::VERSION_FULL
),
27 base::Bind(&VersionHandlerChromeOS::OnVersion
,
28 weak_factory_
.GetWeakPtr()));
30 // Parent class takes care of the rest.
31 VersionHandler::HandleRequestVersionInfo(args
);
34 void VersionHandlerChromeOS::OnVersion(const std::string
& version
) {
35 base::StringValue
arg(version
);
36 web_ui()->CallJavascriptFunction("returnOsVersion", arg
);