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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 (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/options/chromeos/display_options_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/display_options_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 ash::DisplayManager::MultiDisplayMode display_mode; 297 ash::DisplayManager::MultiDisplayMode display_mode;
298 if (display_manager->IsInMirrorMode()) 298 if (display_manager->IsInMirrorMode())
299 display_mode = ash::DisplayManager::MIRRORING; 299 display_mode = ash::DisplayManager::MIRRORING;
300 else if (display_manager->IsInUnifiedMode()) 300 else if (display_manager->IsInUnifiedMode())
301 display_mode = ash::DisplayManager::UNIFIED; 301 display_mode = ash::DisplayManager::UNIFIED;
302 else 302 else
303 display_mode = ash::DisplayManager::EXTENDED; 303 display_mode = ash::DisplayManager::EXTENDED;
304 base::FundamentalValue mode(static_cast<int>(display_mode)); 304 base::FundamentalValue mode(static_cast<int>(display_mode));
305 305
306 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); 306 int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id();
307 scoped_ptr<base::ListValue> js_displays(new base::ListValue); 307 std::unique_ptr<base::ListValue> js_displays(new base::ListValue);
308 for (const gfx::Display& display : displays) { 308 for (const gfx::Display& display : displays) {
309 const ash::DisplayInfo& display_info = 309 const ash::DisplayInfo& display_info =
310 display_manager->GetDisplayInfo(display.id()); 310 display_manager->GetDisplayInfo(display.id());
311 base::DictionaryValue* js_display = new base::DictionaryValue(); 311 base::DictionaryValue* js_display = new base::DictionaryValue();
312 js_display->SetString("id", base::Int64ToString(display.id())); 312 js_display->SetString("id", base::Int64ToString(display.id()));
313 js_display->SetString("name", 313 js_display->SetString("name",
314 display_manager->GetDisplayNameForId(display.id())); 314 display_manager->GetDisplayNameForId(display.id()));
315 base::DictionaryValue* display_bounds = 315 base::DictionaryValue* display_bounds =
316 ConvertBoundsToValue(display.bounds()); 316 ConvertBoundsToValue(display.bounds());
317 js_display->Set("bounds", display_bounds); 317 js_display->Set("bounds", display_bounds);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 432
433 int position = 0; 433 int position = 0;
434 dictionary->GetInteger("layoutType", &position); 434 dictionary->GetInteger("layoutType", &position);
435 int offset = 0; 435 int offset = 0;
436 dictionary->GetInteger("offset", &offset); 436 dictionary->GetInteger("offset", &offset);
437 437
438 builder.AddDisplayPlacement( 438 builder.AddDisplayPlacement(
439 display_id, parent_id, 439 display_id, parent_id,
440 static_cast<display::DisplayPlacement::Position>(position), offset); 440 static_cast<display::DisplayPlacement::Position>(position), offset);
441 } 441 }
442 scoped_ptr<display::DisplayLayout> layout = builder.Build(); 442 std::unique_ptr<display::DisplayLayout> layout = builder.Build();
443 if (!display::DisplayLayout::Validate( 443 if (!display::DisplayLayout::Validate(
444 display_manager->GetCurrentDisplayIdList(), *layout)) { 444 display_manager->GetCurrentDisplayIdList(), *layout)) {
445 LOG(ERROR) << "Invalid layout: " << layout->ToString(); 445 LOG(ERROR) << "Invalid layout: " << layout->ToString();
446 return; 446 return;
447 } 447 }
448 448
449 VLOG(1) << "Updating display layout: " << layout->ToString(); 449 VLOG(1) << "Updating display layout: " << layout->ToString();
450 GetDisplayConfigurationController()->SetDisplayLayout(std::move(layout), 450 GetDisplayConfigurationController()->SetDisplayLayout(std::move(layout),
451 true /* user_action */); 451 true /* user_action */);
452 } 452 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 bool enable = false; 555 bool enable = false;
556 if (!args->GetBoolean(0, &enable)) 556 if (!args->GetBoolean(0, &enable))
557 NOTREACHED(); 557 NOTREACHED();
558 558
559 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays( 559 GetDisplayManager()->SetDefaultMultiDisplayModeForCurrentDisplays(
560 enable ? ash::DisplayManager::UNIFIED : ash::DisplayManager::EXTENDED); 560 enable ? ash::DisplayManager::UNIFIED : ash::DisplayManager::EXTENDED);
561 } 561 }
562 562
563 } // namespace options 563 } // namespace options
564 } // namespace chromeos 564 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698