Commit 22724956 authored by dcheng's avatar dcheng Committed by Commit bot

Convert Pass()→std::move() in //ash (CrOS edition)

(╯^□^)╯︵ 

BUG=557422
R=derat@chromium.org

Review URL: https://codereview.chromium.org/1551133002

Cr-Commit-Position: refs/heads/master@{#367223}
parent 955d90dc
......@@ -868,7 +868,7 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) {
{
TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate;
ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate(
scoped_ptr<VolumeControlDelegate>(delegate).Pass());
scoped_ptr<VolumeControlDelegate>(delegate));
EXPECT_EQ(0, delegate->handle_volume_mute_count());
EXPECT_TRUE(ProcessInController(volume_mute));
EXPECT_EQ(1, delegate->handle_volume_mute_count());
......@@ -890,7 +890,7 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) {
DummyBrightnessControlDelegate* delegate =
new DummyBrightnessControlDelegate;
GetController()->SetBrightnessControlDelegate(
scoped_ptr<BrightnessControlDelegate>(delegate).Pass());
scoped_ptr<BrightnessControlDelegate>(delegate));
EXPECT_EQ(0, delegate->handle_brightness_down_count());
EXPECT_TRUE(ProcessInController(brightness_down));
EXPECT_EQ(1, delegate->handle_brightness_down_count());
......@@ -912,7 +912,7 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) {
DummyKeyboardBrightnessControlDelegate* delegate =
new DummyKeyboardBrightnessControlDelegate;
GetController()->SetKeyboardBrightnessControlDelegate(
scoped_ptr<KeyboardBrightnessControlDelegate>(delegate).Pass());
scoped_ptr<KeyboardBrightnessControlDelegate>(delegate));
EXPECT_EQ(0, delegate->handle_keyboard_brightness_down_count());
EXPECT_TRUE(ProcessInController(alt_brightness_down));
EXPECT_EQ(1, delegate->handle_keyboard_brightness_down_count());
......@@ -1146,7 +1146,7 @@ TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) {
DummyImeControlDelegate* delegate = new DummyImeControlDelegate;
GetController()->SetImeControlDelegate(
scoped_ptr<ImeControlDelegate>(delegate).Pass());
scoped_ptr<ImeControlDelegate>(delegate));
EXPECT_EQ(0, delegate->handle_next_ime_count());
EXPECT_FALSE(ProcessInController(shift_alt_press));
EXPECT_TRUE(ProcessInController(shift_alt));
......@@ -1408,7 +1408,7 @@ TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) {
DummyBrightnessControlDelegate* delegate =
new DummyBrightnessControlDelegate;
GetController()->SetBrightnessControlDelegate(
scoped_ptr<BrightnessControlDelegate>(delegate).Pass());
scoped_ptr<BrightnessControlDelegate>(delegate));
EXPECT_EQ(0, delegate->handle_brightness_down_count());
EXPECT_TRUE(ProcessInController(brightness_down));
EXPECT_EQ(1, delegate->handle_brightness_down_count());
......@@ -1428,7 +1428,7 @@ TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) {
EXPECT_TRUE(ProcessInController(volume_up));
TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate;
ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate(
scoped_ptr<VolumeControlDelegate>(delegate).Pass());
scoped_ptr<VolumeControlDelegate>(delegate));
EXPECT_EQ(0, delegate->handle_volume_mute_count());
EXPECT_TRUE(ProcessInController(volume_mute));
EXPECT_EQ(1, delegate->handle_volume_mute_count());
......@@ -1495,7 +1495,7 @@ class DeprecatedAcceleratorTester : public AcceleratorControllerTest {
// For testing the deprecated and new IME shortcuts.
DummyImeControlDelegate* delegate = new DummyImeControlDelegate;
GetController()->SetImeControlDelegate(
scoped_ptr<ImeControlDelegate>(delegate).Pass());
scoped_ptr<ImeControlDelegate>(delegate));
}
ui::Accelerator CreateAccelerator(const AcceleratorData& data) const {
......
......@@ -94,7 +94,7 @@ TEST_F(AcceleratorFilterTest, CanConsumeSystemKeys) {
scoped_ptr<ui::AcceleratorHistory>
accelerator_history(new ui::AcceleratorHistory());
::wm::AcceleratorFilter filter(
scoped_ptr< ::wm::AcceleratorDelegate>(new AcceleratorDelegate).Pass(),
scoped_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate),
accelerator_history.get());
aura::Window* root_window = Shell::GetPrimaryRootWindow();
......
......@@ -168,7 +168,7 @@ TEST_F(AcceleratorInteractiveUITest, MAYBE_ChromeOsAccelerators) {
// Test VOLUME_MUTE, VOLUME_DOWN, and VOLUME_UP.
TestVolumeControlDelegate* volume_delegate = new TestVolumeControlDelegate;
shell()->system_tray_delegate()->SetVolumeControlDelegate(
scoped_ptr<VolumeControlDelegate>(volume_delegate).Pass());
scoped_ptr<VolumeControlDelegate>(volume_delegate));
// VOLUME_MUTE.
EXPECT_EQ(0, volume_delegate->handle_volume_mute_count());
SendKeyPressSync(ui::VKEY_VOLUME_MUTE, false, false, false);
......
......@@ -4,6 +4,8 @@
#include "ash/accelerators/key_hold_detector.h"
#include <utility>
#include "ash/shell.h"
#include "base/message_loop/message_loop.h"
#include "ui/aura/window_tracker.h"
......@@ -43,8 +45,7 @@ void PostPressedEvent(ui::KeyEvent* event) {
} // namespace
KeyHoldDetector::KeyHoldDetector(scoped_ptr<Delegate> delegate)
: state_(INITIAL),
delegate_(delegate.Pass()) {}
: state_(INITIAL), delegate_(std::move(delegate)) {}
KeyHoldDetector::~KeyHoldDetector() {}
......
......@@ -4,6 +4,8 @@
#include "ash/accelerators/magnifier_key_scroller.h"
#include <utility>
#include "ash/accelerators/key_hold_detector.h"
#include "ash/ash_switches.h"
#include "ash/magnifier/magnification_controller.h"
......@@ -36,7 +38,7 @@ void MagnifierKeyScroller::SetEnabled(bool enabled) {
// static
scoped_ptr<ui::EventHandler> MagnifierKeyScroller::CreateHandler() {
scoped_ptr<KeyHoldDetector::Delegate> delegate(new MagnifierKeyScroller());
return scoped_ptr<ui::EventHandler>(new KeyHoldDetector(delegate.Pass()));
return scoped_ptr<ui::EventHandler>(new KeyHoldDetector(std::move(delegate)));
}
bool MagnifierKeyScroller::ShouldProcessEvent(const ui::KeyEvent* event) const {
......
......@@ -4,6 +4,8 @@
#include "ash/accelerators/spoken_feedback_toggler.h"
#include <utility>
#include "ash/accelerators/key_hold_detector.h"
#include "ash/accessibility_delegate.h"
#include "ash/shell.h"
......@@ -27,7 +29,7 @@ void SpokenFeedbackToggler::SetEnabled(bool enabled) {
// static
scoped_ptr<ui::EventHandler> SpokenFeedbackToggler::CreateHandler() {
scoped_ptr<KeyHoldDetector::Delegate> delegate(new SpokenFeedbackToggler());
return scoped_ptr<ui::EventHandler>(new KeyHoldDetector(delegate.Pass()));
return scoped_ptr<ui::EventHandler>(new KeyHoldDetector(std::move(delegate)));
}
bool SpokenFeedbackToggler::ShouldProcessEvent(
......
......@@ -4,6 +4,8 @@
#include "ash/display/display_color_manager_chromeos.h"
#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
......@@ -129,7 +131,7 @@ void DisplayColorManager::LoadCalibrationForDisplay(
blocking_pool_, FROM_HERE, request,
base::Bind(&DisplayColorManager::UpdateCalibrationData, AsWeakPtr(),
display->display_id(), display->product_id(),
base::Passed(data.Pass())));
base::Passed(std::move(data))));
}
void DisplayColorManager::UpdateCalibrationData(
......
......@@ -4,6 +4,8 @@
#include "ash/display/display_error_observer_chromeos.h"
#include <utility>
#include "ash/system/system_notifier.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
......@@ -52,7 +54,8 @@ void DisplayErrorObserver::OnDisplayModeChangeFailed(
message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
system_notifier::kNotifierDisplayError),
message_center::RichNotificationData(), NULL));
message_center::MessageCenter::Get()->AddNotification(notification.Pass());
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
base::string16
......
......@@ -4,6 +4,8 @@
#include "ash/display/resolution_notification_controller.h"
#include <utility>
#include "ash/display/display_info.h"
#include "ash/display/display_manager.h"
#include "ash/shell.h"
......@@ -235,7 +237,7 @@ void ResolutionNotificationController::CreateOrUpdateNotification(
data, new ResolutionChangeNotificationDelegate(
this, change_info_->timeout_count > 0)));
notification->SetSystemPriority();
message_center->AddNotification(notification.Pass());
message_center->AddNotification(std::move(notification));
}
void ResolutionNotificationController::OnTimerTick() {
......
......@@ -1062,7 +1062,7 @@ void Shell::Init(const ShellInitParams& init_params) {
// Set accelerator controller delegates.
accelerator_controller_->SetBrightnessControlDelegate(
scoped_ptr<ash::BrightnessControlDelegate>(
new ash::system::BrightnessControllerChromeos).Pass());
new ash::system::BrightnessControllerChromeos));
power_event_observer_.reset(new PowerEventObserver());
user_activity_notifier_.reset(
......
......@@ -4,6 +4,8 @@
#include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h"
#include <utility>
#include "ash/system/system_notifier.h"
#include "base/bind.h"
#include "base/callback.h"
......@@ -283,7 +285,8 @@ void BluetoothNotificationController::NotifyAdapterDiscoverable() {
message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
system_notifier::kNotifierBluetooth),
optional, NULL));
message_center::MessageCenter::Get()->AddNotification(notification.Pass());
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
void BluetoothNotificationController::NotifyPairing(
......@@ -311,7 +314,8 @@ void BluetoothNotificationController::NotifyPairing(
system_notifier::kNotifierBluetooth),
optional, new BluetoothPairingNotificationDelegate(
adapter_, device->GetAddress())));
message_center::MessageCenter::Get()->AddNotification(notification.Pass());
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
void BluetoothNotificationController::NotifyPairedDevice(
......@@ -336,7 +340,8 @@ void BluetoothNotificationController::NotifyPairedDevice(
message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
system_notifier::kNotifierBluetooth),
optional, NULL));
message_center::MessageCenter::Get()->AddNotification(notification.Pass());
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
} // namespace ash
......@@ -94,8 +94,7 @@ BatteryNotification::BatteryNotification(
MessageCenter* message_center,
TrayPower::NotificationState notification_state)
: message_center_(message_center) {
message_center_->AddNotification(
CreateNotification(notification_state).Pass());
message_center_->AddNotification(CreateNotification(notification_state));
}
BatteryNotification::~BatteryNotification() {
......@@ -106,8 +105,8 @@ BatteryNotification::~BatteryNotification() {
void BatteryNotification::Update(
TrayPower::NotificationState notification_state) {
if (message_center_->FindVisibleNotificationById(kBatteryNotificationId)) {
message_center_->UpdateNotification(
kBatteryNotificationId, CreateNotification(notification_state).Pass());
message_center_->UpdateNotification(kBatteryNotificationId,
CreateNotification(notification_state));
}
}
......
......@@ -4,6 +4,8 @@
#include "ash/system/chromeos/power/tray_power.h"
#include <utility>
#include "ash/accessibility_delegate.h"
#include "ash/ash_switches.h"
#include "ash/shell.h"
......@@ -230,7 +232,7 @@ bool TrayPower::MaybeShowUsbChargerNotification() {
system_notifier::kNotifierPower),
message_center::RichNotificationData(),
new UsbNotificationDelegate(this)));
message_center_->AddNotification(notification.Pass());
message_center_->AddNotification(std::move(notification));
return true;
} else if (!usb_charger_is_connected && usb_charger_was_connected_) {
// USB charger was unplugged or was identified as a different type while
......
......@@ -4,6 +4,8 @@
#include "ash/system/chromeos/screen_security/screen_capture_tray_item.h"
#include <utility>
#include "ash/shell.h"
#include "ash/system/system_notifier.h"
#include "grit/ash_resources.h"
......@@ -66,7 +68,8 @@ void ScreenCaptureTrayItem::CreateOrUpdateNotification() {
system_notifier::kNotifierScreenCapture),
data, new tray::ScreenNotificationDelegate(this)));
notification->SetSystemPriority();
message_center::MessageCenter::Get()->AddNotification(notification.Pass());
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
std::string ScreenCaptureTrayItem::GetNotificationId() {
......
......@@ -4,6 +4,8 @@
#include "ash/system/chromeos/screen_security/screen_share_tray_item.h"
#include <utility>
#include "ash/shell.h"
#include "ash/system/system_notifier.h"
#include "grit/ash_resources.h"
......@@ -74,7 +76,8 @@ void ScreenShareTrayItem::CreateOrUpdateNotification() {
system_notifier::kNotifierScreenShare),
data, new tray::ScreenNotificationDelegate(this)));
notification->SetSystemPriority();
message_center::MessageCenter::Get()->AddNotification(notification.Pass());
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
std::string ScreenShareTrayItem::GetNotificationId() {
......
......@@ -4,6 +4,8 @@
#include "ash/system/chromeos/session/logout_button_tray.h"
#include <utility>
#include "ash/shelf/shelf_types.h"
#include "ash/shell.h"
#include "ash/system/chromeos/session/logout_confirmation_controller.h"
......@@ -83,7 +85,7 @@ LogoutButton::LogoutButton(views::ButtonListener* listener)
insets += gfx::Insets(0, kLogoutButtonHorizontalExtraPadding,
0, kLogoutButtonHorizontalExtraPadding);
border->set_insets(insets);
SetBorder(border.Pass());
SetBorder(std::move(border));
set_animate_on_state_change(false);
SetMinSize(gfx::Size(0, kShelfItemHeight));
......
......@@ -4,6 +4,8 @@
#include "ash/system/chromeos/session/logout_confirmation_controller.h"
#include <utility>
#include "ash/session/session_state_delegate.h"
#include "ash/shell.h"
#include "ash/system/chromeos/session/logout_confirmation_dialog.h"
......@@ -56,7 +58,7 @@ void LogoutConfirmationController::ConfirmLogout(
void LogoutConfirmationController::SetClockForTesting(
scoped_ptr<base::TickClock> clock) {
clock_ = clock.Pass();
clock_ = std::move(clock);
}
void LogoutConfirmationController::OnLockStateChanged(bool locked) {
......
......@@ -5,6 +5,7 @@
#include "ash/system/chromeos/session/tray_session_length_limit.h"
#include <algorithm>
#include <utility>
#include "ash/shell.h"
#include "ash/system/chromeos/label_tray_view.h"
......@@ -161,9 +162,10 @@ void TraySessionLengthLimit::UpdateNotification() {
data, NULL /* delegate */));
notification->SetSystemPriority();
if (message_center->FindVisibleNotificationById(kNotificationId))
message_center->UpdateNotification(kNotificationId, notification.Pass());
message_center->UpdateNotification(kNotificationId,
std::move(notification));
else
message_center->AddNotification(notification.Pass());
message_center->AddNotification(std::move(notification));
last_limit_state_ = limit_state_;
}
......
......@@ -4,6 +4,8 @@
#include "ash/system/chromeos/supervised/tray_supervised_user.h"
#include <utility>
#include "ash/shell.h"
#include "ash/system/chromeos/label_tray_view.h"
#include "ash/system/system_notifier.h"
......@@ -100,7 +102,8 @@ void TraySupervisedUser::CreateOrUpdateNotification(
bundle.GetImageNamed(GetSupervisedUserIconId()),
system_notifier::kNotifierSupervisedUser,
base::Closure() /* null callback */));
message_center::MessageCenter::Get()->AddNotification(notification.Pass());
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
void TraySupervisedUser::CreateOrUpdateSupervisedWarningNotification() {
......
......@@ -4,6 +4,7 @@
#include "ash/system/chromeos/tray_display.h"
#include <utility>
#include <vector>
#include "ash/display/display_manager.h"
......@@ -401,7 +402,8 @@ void TrayDisplay::CreateOrUpdateNotification(
new message_center::HandleNotificationClickedDelegate(
base::Bind(&OpenSettings))));
message_center::MessageCenter::Get()->AddNotification(notification.Pass());
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));
}
views::View* TrayDisplay::CreateDefaultView(user::LoginStatus status) {
......
......@@ -4,6 +4,7 @@
#include "ash/virtual_keyboard_controller.h"
#include <utility>
#include <vector>
#include "ash/shell.h"
......@@ -47,7 +48,7 @@ class VirtualKeyboardControllerTest : public AshTestBase {
void SetEventBlocker(
scoped_ptr<ScopedDisableInternalMouseAndKeyboard> blocker) {
Shell::GetInstance()->maximize_mode_controller()->event_blocker_ =
blocker.Pass();
std::move(blocker);
}
void SetUp() override {
......@@ -103,7 +104,7 @@ TEST_F(VirtualKeyboardControllerTest, RestoreKeyboardDevices) {
->EnableMaximizeModeWindowManager(true);
scoped_ptr<ScopedDisableInternalMouseAndKeyboard> blocker(
new MockEventBlocker);
SetEventBlocker(blocker.Pass());
SetEventBlocker(std::move(blocker));
}
class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest,
......
......@@ -4,6 +4,8 @@
#include "ash/wm/cursor_manager_chromeos.h"
#include <utility>
#include "base/logging.h"
#include "ui/events/event.h"
#include "ui/keyboard/keyboard_util.h"
......@@ -12,10 +14,8 @@
namespace ash {
CursorManager::CursorManager(
scoped_ptr< ::wm::NativeCursorManager> delegate)
: ::wm::CursorManager(delegate.Pass()) {
}
CursorManager::CursorManager(scoped_ptr<::wm::NativeCursorManager> delegate)
: ::wm::CursorManager(std::move(delegate)) {}
CursorManager::~CursorManager() {
}
......
......@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include <math.h>
#include <utility>
#include <vector>
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/ash_switches.h"
#include "ash/display/display_manager.h"
#include "ash/shell.h"
......@@ -120,7 +121,7 @@ class MaximizeModeControllerTest : public test::AshTestBase {
scoped_ptr<base::TickClock> tick_clock(
test_tick_clock_ = new base::SimpleTestTickClock());
test_tick_clock_->Advance(base::TimeDelta::FromSeconds(1));
maximize_mode_controller()->SetTickClockForTest(tick_clock.Pass());
maximize_mode_controller()->SetTickClockForTest(std::move(tick_clock));
}
void AdvanceTickClock(const base::TimeDelta& delta) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment