| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "chrome/browser/ui/webui/version_handler_chromeos.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "base/task_runner_util.h" | |
| 9 #include "content/public/browser/browser_thread.h" | |
| 10 #include "content/public/browser/web_ui.h" | |
| 11 | |
| 12 VersionHandlerChromeOS::VersionHandlerChromeOS() | |
| 13 : weak_factory_(this) { | |
| 14 } | |
| 15 | |
| 16 VersionHandlerChromeOS::~VersionHandlerChromeOS() { | |
| 17 } | |
| 18 | |
| 19 void VersionHandlerChromeOS::HandleRequestVersionInfo( | |
| 20 const base::ListValue* args) { | |
| 21 // Start the asynchronous load of the version. | |
| 22 base::PostTaskAndReplyWithResult( | |
| 23 content::BrowserThread::GetBlockingPool(), | |
| 24 FROM_HERE, | |
| 25 base::Bind(&chromeos::version_loader::GetVersion, | |
| 26 chromeos::version_loader::VERSION_FULL), | |
| 27 base::Bind(&VersionHandlerChromeOS::OnVersion, | |
| 28 weak_factory_.GetWeakPtr())); | |
| 29 | |
| 30 // Parent class takes care of the rest. | |
| 31 VersionHandler::HandleRequestVersionInfo(args); | |
| 32 } | |
| 33 | |
| 34 void VersionHandlerChromeOS::OnVersion(const std::string& version) { | |
| 35 base::StringValue arg(version); | |
| 36 web_ui()->CallJavascriptFunction("returnOsVersion", arg); | |
| 37 } | |
| OLD | NEW |