Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / browser / api / system_cpu / system_cpu_api.cc
blob5cfe69b0ff4cd6b99bd37db9b22fd0e7e49eef5b
1 // Copyright 2013 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 "base/command_line.h"
6 #include "extensions/browser/api/system_cpu/cpu_info_provider.h"
7 #include "extensions/browser/api/system_cpu/system_cpu_api.h"
8 #include "extensions/common/features/base_feature_provider.h"
10 namespace extensions {
12 using api::system_cpu::CpuInfo;
14 SystemCpuGetInfoFunction::SystemCpuGetInfoFunction() {
17 SystemCpuGetInfoFunction::~SystemCpuGetInfoFunction() {
20 bool SystemCpuGetInfoFunction::RunAsync() {
21 CpuInfoProvider::Get()->StartQueryInfo(
22 base::Bind(&SystemCpuGetInfoFunction::OnGetCpuInfoCompleted, this));
23 return true;
26 void SystemCpuGetInfoFunction::OnGetCpuInfoCompleted(bool success) {
27 if (success)
28 SetResult(CpuInfoProvider::Get()->cpu_info().ToValue().release());
29 else
30 SetError("Error occurred when querying cpu information.");
31 SendResponse(success);
34 } // namespace extensions