| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.h" | 6 #include "chrome/browser/extensions/api/system_info_cpu/system_info_cpu_api.h" |
| 7 #include "chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h" | 7 #include "chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/extensions/features/base_feature_provider.h" | 9 #include "chrome/common/extensions/features/base_feature_provider.h" |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 using api::system_info_cpu::CpuInfo; | 13 using api::system_info_cpu::CpuInfo; |
| 14 | 14 |
| 15 SystemInfoCpuGetFunction::SystemInfoCpuGetFunction() { | 15 SystemInfoCpuGetFunction::SystemInfoCpuGetFunction() { |
| 16 } | 16 } |
| 17 | 17 |
| 18 SystemInfoCpuGetFunction::~SystemInfoCpuGetFunction() { | 18 SystemInfoCpuGetFunction::~SystemInfoCpuGetFunction() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 bool SystemInfoCpuGetFunction::RunImpl() { | 21 bool SystemInfoCpuGetFunction::RunImpl() { |
| 22 CpuInfoProvider::Get()->StartQueryInfo( | 22 CpuInfoProvider::Get()->StartQueryInfo( |
| 23 base::Bind(&SystemInfoCpuGetFunction::OnGetCpuInfoCompleted, this)); | 23 base::Bind(&SystemInfoCpuGetFunction::OnGetCpuInfoCompleted, this)); |
| 24 return true; | 24 return true; |
| 25 } | 25 } |
| 26 | 26 |
| 27 void SystemInfoCpuGetFunction::OnGetCpuInfoCompleted(const CpuInfo& info, | 27 void SystemInfoCpuGetFunction::OnGetCpuInfoCompleted(bool success) { |
| 28 bool success) { | |
| 29 if (success) | 28 if (success) |
| 30 SetResult(info.ToValue().release()); | 29 SetResult(CpuInfoProvider::Get()->cpu_info().ToValue().release()); |
| 31 else | 30 else |
| 32 SetError("Error occurred when querying cpu information."); | 31 SetError("Error occurred when querying cpu information."); |
| 33 SendResponse(success); | 32 SendResponse(success); |
| 34 } | 33 } |
| 35 | 34 |
| 36 } // namespace extensions | 35 } // namespace extensions |
| OLD | NEW |