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

Side by Side Diff: extensions/browser/api/system_display/system_display_api.cc

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 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 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 "extensions/browser/api/system_display/system_display_api.h" 5 #include "extensions/browser/api/system_display/system_display_api.h"
6 6
7 #include <memory>
7 #include <string> 8 #include <string>
8 9
9 #include "build/build_config.h" 10 #include "build/build_config.h"
10 #include "extensions/browser/api/system_display/display_info_provider.h" 11 #include "extensions/browser/api/system_display/display_info_provider.h"
11 #include "extensions/common/api/system_display.h" 12 #include "extensions/common/api/system_display.h"
12 13
13 #if defined(OS_CHROMEOS) 14 #if defined(OS_CHROMEOS)
14 #include "base/memory/scoped_ptr.h"
15 #include "extensions/common/manifest_handlers/kiosk_mode_info.h" 15 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
16 #include "ui/gfx/screen.h" 16 #include "ui/gfx/screen.h"
17 #endif 17 #endif
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 using api::system_display::DisplayUnitInfo; 21 using api::system_display::DisplayUnitInfo;
22 22
23 namespace SetDisplayProperties = api::system_display::SetDisplayProperties; 23 namespace SetDisplayProperties = api::system_display::SetDisplayProperties;
24 24
25 bool SystemDisplayGetInfoFunction::RunSync() { 25 bool SystemDisplayGetInfoFunction::RunSync() {
26 DisplayInfo all_displays_info = 26 DisplayInfo all_displays_info =
27 DisplayInfoProvider::Get()->GetAllDisplaysInfo(); 27 DisplayInfoProvider::Get()->GetAllDisplaysInfo();
28 results_ = api::system_display::GetInfo::Results::Create(all_displays_info); 28 results_ = api::system_display::GetInfo::Results::Create(all_displays_info);
29 return true; 29 return true;
30 } 30 }
31 31
32 bool SystemDisplaySetDisplayPropertiesFunction::RunSync() { 32 bool SystemDisplaySetDisplayPropertiesFunction::RunSync() {
33 #if !defined(OS_CHROMEOS) 33 #if !defined(OS_CHROMEOS)
34 SetError("Function available only on ChromeOS."); 34 SetError("Function available only on ChromeOS.");
35 return false; 35 return false;
36 #else 36 #else
37 if (extension() && !KioskModeInfo::IsKioskEnabled(extension())) { 37 if (extension() && !KioskModeInfo::IsKioskEnabled(extension())) {
38 SetError("The extension needs to be kiosk enabled to use the function."); 38 SetError("The extension needs to be kiosk enabled to use the function.");
39 return false; 39 return false;
40 } 40 }
41 std::string error; 41 std::string error;
42 scoped_ptr<SetDisplayProperties::Params> params( 42 std::unique_ptr<SetDisplayProperties::Params> params(
43 SetDisplayProperties::Params::Create(*args_)); 43 SetDisplayProperties::Params::Create(*args_));
44 bool result = 44 bool result =
45 DisplayInfoProvider::Get()->SetInfo(params->id, params->info, &error); 45 DisplayInfoProvider::Get()->SetInfo(params->id, params->info, &error);
46 if (!result) 46 if (!result)
47 SetError(error); 47 SetError(error);
48 return result; 48 return result;
49 #endif 49 #endif
50 } 50 }
51 51
52 bool SystemDisplayEnableUnifiedDesktopFunction::RunSync() { 52 bool SystemDisplayEnableUnifiedDesktopFunction::RunSync() {
53 #if !defined(OS_CHROMEOS) 53 #if !defined(OS_CHROMEOS)
54 SetError("Function available only on ChromeOS."); 54 SetError("Function available only on ChromeOS.");
55 return false; 55 return false;
56 #else 56 #else
57 scoped_ptr<api::system_display::EnableUnifiedDesktop::Params> params( 57 std::unique_ptr<api::system_display::EnableUnifiedDesktop::Params> params(
58 api::system_display::EnableUnifiedDesktop::Params::Create(*args_)); 58 api::system_display::EnableUnifiedDesktop::Params::Create(*args_));
59 DisplayInfoProvider::Get()->EnableUnifiedDesktop(params->enabled); 59 DisplayInfoProvider::Get()->EnableUnifiedDesktop(params->enabled);
60 return true; 60 return true;
61 #endif 61 #endif
62 } 62 }
63 63
64 } // namespace extensions 64 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698