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