Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: chrome/browser/extensions/api/system_info_display/system_info_display_api.cc

Issue 18290002: [SystemInfo API] Finish TODOs in SystemInfoProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dev_rewrite_storage_info_api
Patch Set: Pass chromeos unit_tests Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/extensions/api/system_info_display/system_info_display_ api.h" 5 #include "chrome/browser/extensions/api/system_info_display/system_info_display_ api.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h" 8 #include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h"
9 9
10 namespace extensions { 10 namespace extensions {
11 11
12 using api::system_info_display::DisplayUnitInfo; 12 using api::system_info_display::DisplayUnitInfo;
13 13
14 namespace SetDisplayProperties = api::system_info_display::SetDisplayProperties; 14 namespace SetDisplayProperties = api::system_info_display::SetDisplayProperties;
15 15
16 bool SystemInfoDisplayGetDisplayInfoFunction::RunImpl() { 16 bool SystemInfoDisplayGetDisplayInfoFunction::RunImpl() {
17 DisplayInfoProvider::GetProvider()->RequestInfo( 17 DisplayInfoProvider::GetProvider()->RequestInfo(
18 base::Bind( 18 base::Bind(
19 &SystemInfoDisplayGetDisplayInfoFunction::OnGetDisplayInfoCompleted, 19 &SystemInfoDisplayGetDisplayInfoFunction::OnGetDisplayInfoCompleted,
20 this)); 20 this));
21 return true; 21 return true;
22 } 22 }
23 23
24 void SystemInfoDisplayGetDisplayInfoFunction::OnGetDisplayInfoCompleted( 24 void SystemInfoDisplayGetDisplayInfoFunction::OnGetDisplayInfoCompleted(
25 const DisplayInfo& info, bool success) { 25 bool success) {
26 if (success) { 26 if (success) {
27 results_ = api::system_info_display::GetDisplayInfo::Results::Create(info); 27 results_ = api::system_info_display::GetDisplayInfo::Results::Create(
28 DisplayInfoProvider::GetProvider()->display_info());
28 } else { 29 } else {
29 SetError("Error occurred when querying display information."); 30 SetError("Error occurred when querying display information.");
30 } 31 }
31 SendResponse(success); 32 SendResponse(success);
32 } 33 }
33 34
34 bool SystemInfoDisplaySetDisplayPropertiesFunction::RunImpl() { 35 bool SystemInfoDisplaySetDisplayPropertiesFunction::RunImpl() {
35 #if !defined(OS_CHROMEOS) 36 #if !defined(OS_CHROMEOS)
36 SetError("Function available only on ChromeOS."); 37 SetError("Function available only on ChromeOS.");
37 return false; 38 return false;
(...skipping 14 matching lines...) Expand all
52 } 53 }
53 54
54 void SystemInfoDisplaySetDisplayPropertiesFunction::OnPropertiesSet( 55 void SystemInfoDisplaySetDisplayPropertiesFunction::OnPropertiesSet(
55 bool success, const std::string& error) { 56 bool success, const std::string& error) {
56 if (!success) 57 if (!success)
57 SetError(error); 58 SetError(error);
58 SendResponse(success); 59 SendResponse(success);
59 } 60 }
60 61
61 } // namespace extensions 62 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698