diff options
author | dcheng <dcheng@chromium.org> | 2015-12-18 09:48:00 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-18 17:48:52 +0000 |
commit | e59eca16010c109a5e3e4922189c8b264d34caa9 (patch) | |
tree | 838815399c6364a99a465938df9978aeaf75c766 | |
parent | 5100baf1eac806abbdaaf8002887aacf652f34e5 (diff) | |
download | chromium_src-e59eca16010c109a5e3e4922189c8b264d34caa9.zip chromium_src-e59eca16010c109a5e3e4922189c8b264d34caa9.tar.gz chromium_src-e59eca16010c109a5e3e4922189c8b264d34caa9.tar.bz2 |
Convert Pass()→std::move() in //extensions
BUG=557422
Review URL: https://codereview.chromium.org/1537893002
Cr-Commit-Position: refs/heads/master@{#366120}
181 files changed, 906 insertions, 716 deletions
diff --git a/extensions/browser/api/alarms/alarm_manager.cc b/extensions/browser/api/alarms/alarm_manager.cc index ebfafb9..608c052 100644 --- a/extensions/browser/api/alarms/alarm_manager.cc +++ b/extensions/browser/api/alarms/alarm_manager.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/alarms/alarm_manager.h" +#include <utility> + #include "base/bind.h" #include "base/json/json_writer.h" #include "base/lazy_instance.h" @@ -44,9 +46,9 @@ class DefaultAlarmDelegate : public AlarmManager::Delegate { scoped_ptr<base::ListValue> args(new base::ListValue()); args->Append(alarm.js_alarm->ToValue().release()); scoped_ptr<Event> event(new Event( - events::ALARMS_ON_ALARM, alarms::OnAlarm::kEventName, args.Pass())); + events::ALARMS_ON_ALARM, alarms::OnAlarm::kEventName, std::move(args))); EventRouter::Get(browser_context_) - ->DispatchEventToExtension(extension_id, event.Pass()); + ->DispatchEventToExtension(extension_id, std::move(event)); } private: @@ -78,13 +80,12 @@ std::vector<Alarm> AlarmsFromValue(const base::ListValue* list) { scoped_ptr<base::ListValue> AlarmsToValue(const std::vector<Alarm>& alarms) { scoped_ptr<base::ListValue> list(new base::ListValue()); for (size_t i = 0; i < alarms.size(); ++i) { - scoped_ptr<base::DictionaryValue> alarm = - alarms[i].js_alarm->ToValue().Pass(); + scoped_ptr<base::DictionaryValue> alarm = alarms[i].js_alarm->ToValue(); alarm->Set(kAlarmGranularity, base::CreateTimeDeltaValue(alarms[i].granularity)); list->Append(alarm.release()); } - return list.Pass(); + return list; } } // namespace @@ -293,7 +294,8 @@ void AlarmManager::WriteToStorage(const std::string& extension_id) { alarms.reset(AlarmsToValue(list->second).release()); else alarms.reset(AlarmsToValue(std::vector<Alarm>()).release()); - storage->SetExtensionValue(extension_id, kRegisteredAlarms, alarms.Pass()); + storage->SetExtensionValue(extension_id, kRegisteredAlarms, + std::move(alarms)); } void AlarmManager::ReadFromStorage(const std::string& extension_id, diff --git a/extensions/browser/api/app_current_window_internal/app_current_window_internal_api.cc b/extensions/browser/api/app_current_window_internal/app_current_window_internal_api.cc index 6d9dc305..fa2a0c4d 100644 --- a/extensions/browser/api/app_current_window_internal/app_current_window_internal_api.cc +++ b/extensions/browser/api/app_current_window_internal/app_current_window_internal_api.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/app_current_window_internal/app_current_window_internal_api.h" +#include <utility> + #include "base/command_line.h" #include "extensions/browser/app_window/app_window.h" #include "extensions/browser/app_window/app_window_client.h" @@ -347,7 +349,7 @@ bool AppCurrentWindowInternalSetShapeFunction::RunWithWindow( region.reset(NULL); } - window->UpdateShape(region.Pass()); + window->UpdateShape(std::move(region)); return true; } diff --git a/extensions/browser/api/app_runtime/app_runtime_api.cc b/extensions/browser/api/app_runtime/app_runtime_api.cc index 83649a3..33e452e 100644 --- a/extensions/browser/api/app_runtime/app_runtime_api.cc +++ b/extensions/browser/api/app_runtime/app_runtime_api.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/app_runtime/app_runtime_api.h" +#include <utility> + #include "base/metrics/histogram.h" #include "base/time/time.h" #include "base/values.h" @@ -32,10 +34,10 @@ void DispatchOnEmbedRequestedEventImpl( args->Append(app_embedding_request_data.release()); scoped_ptr<Event> event(new Event(events::APP_RUNTIME_ON_EMBED_REQUESTED, app_runtime::OnEmbedRequested::kEventName, - args.Pass())); + std::move(args))); event->restrict_to_browser_context = context; EventRouter::Get(context) - ->DispatchEventWithLazyListener(extension_id, event.Pass()); + ->DispatchEventWithLazyListener(extension_id, std::move(event)); ExtensionPrefs::Get(context) ->SetLastLaunchTime(extension_id, base::Time::Now()); @@ -61,10 +63,10 @@ void DispatchOnLaunchedEventImpl(const std::string& extension_id, args->Append(launch_data.release()); scoped_ptr<Event> event(new Event(events::APP_RUNTIME_ON_LAUNCHED, app_runtime::OnLaunched::kEventName, - args.Pass())); + std::move(args))); event->restrict_to_browser_context = context; EventRouter::Get(context) - ->DispatchEventWithLazyListener(extension_id, event.Pass()); + ->DispatchEventWithLazyListener(extension_id, std::move(event)); ExtensionPrefs::Get(context) ->SetLastLaunchTime(extension_id, base::Time::Now()); } @@ -121,8 +123,8 @@ void AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent( content::BrowserContext* context, scoped_ptr<base::DictionaryValue> embed_app_data, const Extension* extension) { - DispatchOnEmbedRequestedEventImpl( - extension->id(), embed_app_data.Pass(), context); + DispatchOnEmbedRequestedEventImpl(extension->id(), std::move(embed_app_data), + context); } // static @@ -136,8 +138,8 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEvent( if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { launch_data.source = source_enum; } - DispatchOnLaunchedEventImpl( - extension->id(), source_enum, launch_data.ToValue().Pass(), context); + DispatchOnLaunchedEventImpl(extension->id(), source_enum, + launch_data.ToValue(), context); } // static @@ -147,10 +149,10 @@ void AppRuntimeEventRouter::DispatchOnRestartedEvent( scoped_ptr<base::ListValue> arguments(new base::ListValue()); scoped_ptr<Event> event(new Event(events::APP_RUNTIME_ON_RESTARTED, app_runtime::OnRestarted::kEventName, - arguments.Pass())); + std::move(arguments))); event->restrict_to_browser_context = context; EventRouter::Get(context) - ->DispatchEventToExtension(extension->id(), event.Pass()); + ->DispatchEventToExtension(extension->id(), std::move(event)); } // static @@ -183,8 +185,8 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEventWithFileEntries( items->Append(launch_item.release()); } launch_data->Set("items", items.release()); - DispatchOnLaunchedEventImpl( - extension->id(), source_enum, launch_data.Pass(), context); + DispatchOnLaunchedEventImpl(extension->id(), source_enum, + std::move(launch_data), context); } // static @@ -203,8 +205,8 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEventWithUrl( if (extensions::FeatureSwitch::trace_app_source()->IsEnabled()) { launch_data.source = source_enum; } - DispatchOnLaunchedEventImpl( - extension->id(), source_enum, launch_data.ToValue().Pass(), context); + DispatchOnLaunchedEventImpl(extension->id(), source_enum, + launch_data.ToValue(), context); } } // namespace extensions diff --git a/extensions/browser/api/audio/audio_api.cc b/extensions/browser/api/audio/audio_api.cc index e3efc48..947ecd6 100644 --- a/extensions/browser/api/audio/audio_api.cc +++ b/extensions/browser/api/audio/audio_api.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/audio/audio_api.h" +#include <utility> + #include "base/lazy_instance.h" #include "base/values.h" #include "extensions/browser/event_router.h" @@ -41,7 +43,7 @@ void AudioAPI::OnDeviceChanged() { scoped_ptr<Event> event(new Event( events::AUDIO_ON_DEVICE_CHANGED, audio::OnDeviceChanged::kEventName, scoped_ptr<base::ListValue>(new base::ListValue()))); - EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); + EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); } } @@ -50,8 +52,8 @@ void AudioAPI::OnLevelChanged(const std::string& id, int level) { scoped_ptr<base::ListValue> args = audio::OnLevelChanged::Create(id, level); scoped_ptr<Event> event(new Event(events::AUDIO_ON_LEVEL_CHANGED, audio::OnLevelChanged::kEventName, - args.Pass())); - EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); + std::move(args))); + EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); } } @@ -61,8 +63,8 @@ void AudioAPI::OnMuteChanged(bool is_input, bool is_muted) { audio::OnMuteChanged::Create(is_input, is_muted); scoped_ptr<Event> event(new Event(events::AUDIO_ON_MUTE_CHANGED, audio::OnMuteChanged::kEventName, - args.Pass())); - EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); + std::move(args))); + EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); } } @@ -71,8 +73,8 @@ void AudioAPI::OnDevicesChanged(const DeviceInfoList& devices) { scoped_ptr<base::ListValue> args = audio::OnDevicesChanged::Create(devices); scoped_ptr<Event> event(new Event(events::AUDIO_ON_DEVICES_CHANGED, audio::OnDevicesChanged::kEventName, - args.Pass())); - EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); + std::move(args))); + EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); } } diff --git a/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc b/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc index 3aabff5..a95c4e9 100644 --- a/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc +++ b/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.h" +#include <utility> + #include "base/memory/scoped_ptr.h" #include "base/values.h" #include "content/public/browser/browser_context.h" @@ -103,8 +105,8 @@ void BluetoothApiPairingDelegate::DispatchPairingEvent( bt_private::OnPairing::Create(pairing_event); scoped_ptr<Event> event(new Event(events::BLUETOOTH_PRIVATE_ON_PAIRING, bt_private::OnPairing::kEventName, - args.Pass())); - EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); + std::move(args))); + EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); } } // namespace extensions diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router.cc b/extensions/browser/api/bluetooth/bluetooth_event_router.cc index b60b827..613edd0a 100644 --- a/extensions/browser/api/bluetooth/bluetooth_event_router.cc +++ b/extensions/browser/api/bluetooth/bluetooth_event_router.cc @@ -6,6 +6,7 @@ #include <map> #include <string> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -194,7 +195,7 @@ void BluetoothEventRouter::SetDiscoveryFilter( } // extension is already running discovery, update it's discovery filter - iter->second->SetDiscoveryFilter(discovery_filter.Pass(), callback, + iter->second->SetDiscoveryFilter(std::move(discovery_filter), callback, error_callback); } @@ -381,8 +382,8 @@ void BluetoothEventRouter::DispatchAdapterStateEvent() { bluetooth::OnAdapterStateChanged::Create(state); scoped_ptr<Event> event( new Event(events::BLUETOOTH_ON_ADAPTER_STATE_CHANGED, - bluetooth::OnAdapterStateChanged::kEventName, args.Pass())); - EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); + bluetooth::OnAdapterStateChanged::kEventName, std::move(args))); + EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); } void BluetoothEventRouter::DispatchDeviceEvent( @@ -395,8 +396,9 @@ void BluetoothEventRouter::DispatchDeviceEvent( scoped_ptr<base::ListValue> args = bluetooth::OnDeviceAdded::Create(extension_device); - scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass())); - EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); + scoped_ptr<Event> event( + new Event(histogram_value, event_name, std::move(args))); + EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); } void BluetoothEventRouter::CleanUpForExtension( diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc index 91ea0be..d960a5f 100644 --- a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc +++ b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "extensions/browser/api/bluetooth/bluetooth_event_router.h" + #include <string> +#include <utility> #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -13,7 +16,6 @@ #include "content/public/test/test_browser_thread.h" #include "device/bluetooth/bluetooth_uuid.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" -#include "extensions/browser/api/bluetooth/bluetooth_event_router.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extensions_test.h" #include "extensions/common/api/bluetooth.h" @@ -108,7 +110,7 @@ TEST_F(BluetoothEventRouterTest, SetDiscoveryFilter) { device::BluetoothDiscoveryFilter::Transport::TRANSPORT_LE); df.CopyFrom(*discovery_filter); - router_->SetDiscoveryFilter(discovery_filter.Pass(), mock_adapter_, + router_->SetDiscoveryFilter(std::move(discovery_filter), mock_adapter_, kTestExtensionId, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); diff --git a/extensions/browser/api/bluetooth/bluetooth_private_api.cc b/extensions/browser/api/bluetooth/bluetooth_private_api.cc index d69a08a..4d3ee9c 100644 --- a/extensions/browser/api/bluetooth/bluetooth_private_api.cc +++ b/extensions/browser/api/bluetooth/bluetooth_private_api.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/bluetooth/bluetooth_private_api.h" +#include <utility> + #include "base/callback.h" #include "base/lazy_instance.h" #include "base/strings/string_util.h" @@ -444,7 +446,7 @@ bool BluetoothPrivateSetDiscoveryFilterFunction::DoWork( BluetoothAPI::Get(browser_context()) ->event_router() ->SetDiscoveryFilter( - discovery_filter.Pass(), adapter.get(), GetExtensionId(), + std::move(discovery_filter), adapter.get(), GetExtensionId(), base::Bind( &BluetoothPrivateSetDiscoveryFilterFunction::OnSuccessCallback, this), diff --git a/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc b/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc index ca01427..3f8fc65 100644 --- a/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc +++ b/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/command_line.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" @@ -107,9 +109,9 @@ class BluetoothPrivateApiTest : public ExtensionApiTest { bt_private::OnPairing::Create(pairing_event); scoped_ptr<Event> event(new Event(events::BLUETOOTH_PRIVATE_ON_PAIRING, bt_private::OnPairing::kEventName, - args.Pass())); - EventRouter::Get(browser()->profile())->DispatchEventToExtension( - kTestExtensionId, event.Pass()); + std::move(args))); + EventRouter::Get(browser()->profile()) + ->DispatchEventToExtension(kTestExtensionId, std::move(event)); } void DispatchAuthorizePairingEvent() { @@ -133,7 +135,7 @@ class BluetoothPrivateApiTest : public ExtensionApiTest { auto session_ptr = scoped_ptr<NiceMock<MockBluetoothDiscoverySession>>( mock_discovery_session_); - callback.Run(session_ptr.Pass()); + callback.Run(std::move(session_ptr)); } protected: diff --git a/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc index 9a643d2..94c4038 100644 --- a/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc +++ b/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" #include <stdint.h> +#include <utility> #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" @@ -306,9 +307,7 @@ void BluetoothSocketListenFunction::OnGetAdapter( name.reset(new std::string(*socket->name())); CreateService( - adapter, - bluetooth_uuid, - name.Pass(), + adapter, bluetooth_uuid, std::move(name), base::Bind(&BluetoothSocketListenFunction::OnCreateService, this), base::Bind(&BluetoothSocketListenFunction::OnCreateServiceError, this)); } @@ -371,7 +370,7 @@ void BluetoothSocketListenUsingRfcommFunction::CreateService( const device::BluetoothAdapter::CreateServiceErrorCallback& error_callback) { device::BluetoothAdapter::ServiceOptions service_options; - service_options.name = name.Pass(); + service_options.name = std::move(name); ListenOptions* options = params_->options.get(); if (options) { @@ -414,7 +413,7 @@ void BluetoothSocketListenUsingL2capFunction::CreateService( const device::BluetoothAdapter::CreateServiceErrorCallback& error_callback) { device::BluetoothAdapter::ServiceOptions service_options; - service_options.name = name.Pass(); + service_options.name = std::move(name); ListenOptions* options = params_->options.get(); if (options) { diff --git a/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc b/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc index f040ef2..4d54ee0 100644 --- a/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc +++ b/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h" +#include <utility> + #include "base/lazy_instance.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_socket.h" @@ -196,8 +198,8 @@ void BluetoothSocketEventDispatcher::ReceiveCallback( bluetooth_socket::OnReceive::Create(receive_info); scoped_ptr<Event> event(new Event(events::BLUETOOTH_SOCKET_ON_RECEIVE, bluetooth_socket::OnReceive::kEventName, - args.Pass())); - PostEvent(params, event.Pass()); + std::move(args))); + PostEvent(params, std::move(event)); // Post a task to delay the read until the socket is available, as // calling StartReceive at this point would error with ERR_IO_PENDING. @@ -231,8 +233,8 @@ void BluetoothSocketEventDispatcher::ReceiveErrorCallback( bluetooth_socket::OnReceiveError::Create(receive_error_info); scoped_ptr<Event> event( new Event(events::BLUETOOTH_SOCKET_ON_RECEIVE_ERROR, - bluetooth_socket::OnReceiveError::kEventName, args.Pass())); - PostEvent(params, event.Pass()); + bluetooth_socket::OnReceiveError::kEventName, std::move(args))); + PostEvent(params, std::move(event)); // Since we got an error, the socket is now "paused" until the application // "resumes" it. @@ -293,8 +295,8 @@ void BluetoothSocketEventDispatcher::AcceptCallback( bluetooth_socket::OnAccept::Create(accept_info); scoped_ptr<Event> event(new Event(events::BLUETOOTH_SOCKET_ON_ACCEPT, bluetooth_socket::OnAccept::kEventName, - args.Pass())); - PostEvent(params, event.Pass()); + std::move(args))); + PostEvent(params, std::move(event)); // Post a task to delay the accept until the socket is available, as // calling StartAccept at this point would error with ERR_IO_PENDING. @@ -328,8 +330,8 @@ void BluetoothSocketEventDispatcher::AcceptErrorCallback( bluetooth_socket::OnAcceptError::Create(accept_error_info); scoped_ptr<Event> event(new Event(events::BLUETOOTH_SOCKET_ON_ACCEPT_ERROR, bluetooth_socket::OnAcceptError::kEventName, - args.Pass())); - PostEvent(params, event.Pass()); + std::move(args))); + PostEvent(params, std::move(event)); // Since we got an error, the socket is now "paused" until the application // "resumes" it. @@ -346,12 +348,9 @@ void BluetoothSocketEventDispatcher::PostEvent(const SocketParams& params, DCHECK_CURRENTLY_ON(params.thread_id); BrowserThread::PostTask( - BrowserThread::UI, - FROM_HERE, - base::Bind(&DispatchEvent, - params.browser_context_id, - params.extension_id, - base::Passed(event.Pass()))); + BrowserThread::UI, FROM_HERE, + base::Bind(&DispatchEvent, params.browser_context_id, params.extension_id, + base::Passed(std::move(event)))); } // static @@ -368,7 +367,7 @@ void BluetoothSocketEventDispatcher::DispatchEvent( EventRouter* router = EventRouter::Get(context); if (router) - router->DispatchEventToExtension(extension_id, event.Pass()); + router->DispatchEventToExtension(extension_id, std::move(event)); } } // namespace api diff --git a/extensions/browser/api/cast_channel/cast_channel_api.cc b/extensions/browser/api/cast_channel/cast_channel_api.cc index 0b1fa2e..999ca51 100644 --- a/extensions/browser/api/cast_channel/cast_channel_api.cc +++ b/extensions/browser/api/cast_channel/cast_channel_api.cc @@ -6,6 +6,7 @@ #include <limits> #include <string> +#include <utility> #include "base/json/json_writer.h" #include "base/lazy_instance.h" @@ -125,7 +126,7 @@ void CastChannelAPI::SendEvent(const std::string& extension_id, DCHECK_CURRENTLY_ON(BrowserThread::UI); EventRouter* event_router = EventRouter::Get(GetBrowserContext()); if (event_router) { - event_router->DispatchEventToExtension(extension_id, event.Pass()); + event_router->DispatchEventToExtension(extension_id, std::move(event)); } } @@ -139,11 +140,11 @@ CastChannelAPI::GetFactoryInstance() { } void CastChannelAPI::SetSocketForTest(scoped_ptr<CastSocket> socket_for_test) { - socket_for_test_ = socket_for_test.Pass(); + socket_for_test_ = std::move(socket_for_test); } scoped_ptr<CastSocket> CastChannelAPI::GetSocketForTest() { - return socket_for_test_.Pass(); + return std::move(socket_for_test_); } content::BrowserContext* CastChannelAPI::GetBrowserContext() const { @@ -151,11 +152,11 @@ content::BrowserContext* CastChannelAPI::GetBrowserContext() const { } void CastChannelAPI::SetPingTimeoutTimerForTest(scoped_ptr<base::Timer> timer) { - injected_timeout_timer_ = timer.Pass(); + injected_timeout_timer_ = std::move(timer); } scoped_ptr<base::Timer> CastChannelAPI::GetInjectedTimeoutTimerForTest() { - return injected_timeout_timer_.Pass(); + return std::move(injected_timeout_timer_); } CastChannelAPI::~CastChannelAPI() {} @@ -325,20 +326,20 @@ void CastChannelOpenFunction::AsyncWorkStart() { // Wrap read delegate in a KeepAliveDelegate for timeout handling. api::cast_channel::KeepAliveDelegate* keep_alive = new api::cast_channel::KeepAliveDelegate( - socket, api_->GetLogger(), delegate.Pass(), ping_interval_, + socket, api_->GetLogger(), std::move(delegate), ping_interval_, liveness_timeout_); scoped_ptr<base::Timer> injected_timer = api_->GetInjectedTimeoutTimerForTest(); if (injected_timer) { keep_alive->SetTimersForTest( make_scoped_ptr(new base::Timer(false, false)), - injected_timer.Pass()); + std::move(injected_timer)); } delegate.reset(keep_alive); } api_->GetLogger()->LogNewSocketEvent(*socket); - socket->Connect(delegate.Pass(), + socket->Connect(std::move(delegate), base::Bind(&CastChannelOpenFunction::OnOpen, this)); } @@ -474,7 +475,7 @@ void CastChannelGetLogsFunction::AsyncWorkStart() { size_t length = 0; scoped_ptr<char[]> out = api_->GetLogger()->GetLogs(&length); if (out.get()) { - SetResult(new base::BinaryValue(out.Pass(), length)); + SetResult(new base::BinaryValue(std::move(out), length)); } else { SetError("Unable to get logs."); } @@ -510,11 +511,11 @@ void CastChannelOpenFunction::CastMessageHandler::OnError( scoped_ptr<base::ListValue> results = OnError::Create(channel_info, error_info); scoped_ptr<Event> event(new Event(events::CAST_CHANNEL_ON_ERROR, - OnError::kEventName, results.Pass())); + OnError::kEventName, std::move(results))); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(ui_dispatch_cb_, socket_->owner_extension_id(), - base::Passed(event.Pass()))); + base::Passed(std::move(event)))); } void CastChannelOpenFunction::CastMessageHandler::OnMessage( @@ -531,11 +532,11 @@ void CastChannelOpenFunction::CastMessageHandler::OnMessage( scoped_ptr<base::ListValue> results = OnMessage::Create(channel_info, message_info); scoped_ptr<Event> event(new Event(events::CAST_CHANNEL_ON_MESSAGE, - OnMessage::kEventName, results.Pass())); + OnMessage::kEventName, std::move(results))); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(ui_dispatch_cb_, socket_->owner_extension_id(), - base::Passed(event.Pass()))); + base::Passed(std::move(event)))); } void CastChannelOpenFunction::CastMessageHandler::Start() { diff --git a/extensions/browser/api/cast_channel/cast_channel_apitest.cc b/extensions/browser/api/cast_channel/cast_channel_apitest.cc index 5f3d066..42e8755 100644 --- a/extensions/browser/api/cast_channel/cast_channel_apitest.cc +++ b/extensions/browser/api/cast_channel/cast_channel_apitest.cc @@ -99,8 +99,7 @@ class CastChannelAPITest : public ExtensionApiTest { net::IPEndPoint ip_endpoint(ip_number, 8009); mock_cast_socket_ = new MockCastSocket; // Transfers ownership of the socket. - api->SetSocketForTest( - make_scoped_ptr<CastSocket>(mock_cast_socket_).Pass()); + api->SetSocketForTest(make_scoped_ptr<CastSocket>(mock_cast_socket_)); ON_CALL(*mock_cast_socket_, set_id(_)) .WillByDefault(SaveArg<0>(&channel_id_)); ON_CALL(*mock_cast_socket_, id()) diff --git a/extensions/browser/api/cast_channel/cast_framer.cc b/extensions/browser/api/cast_channel/cast_framer.cc index 3d20839..6e3075d 100644 --- a/extensions/browser/api/cast_channel/cast_framer.cc +++ b/extensions/browser/api/cast_channel/cast_framer.cc @@ -157,7 +157,7 @@ scoped_ptr<CastMessage> MessageFramer::Ingest(size_t num_bytes, } *message_length = body_size_; Reset(); - return parsed_message.Pass(); + return parsed_message; } break; default: diff --git a/extensions/browser/api/cast_channel/cast_socket.cc b/extensions/browser/api/cast_channel/cast_socket.cc index f6a5b48..04dcc6d 100644 --- a/extensions/browser/api/cast_channel/cast_socket.cc +++ b/extensions/browser/api/cast_channel/cast_socket.cc @@ -6,6 +6,7 @@ #include <stdlib.h> #include <string.h> +#include <utility> #include "base/bind.h" #include "base/callback_helpers.h" @@ -192,12 +193,12 @@ scoped_ptr<net::SSLClientSocket> CastSocketImpl::CreateSslSocket( context.transport_security_state = transport_security_state_.get(); scoped_ptr<net::ClientSocketHandle> connection(new net::ClientSocketHandle); - connection->SetSocket(socket.Pass()); + connection->SetSocket(std::move(socket)); net::HostPortPair host_and_port = net::HostPortPair::FromIPEndPoint( ip_endpoint_); return net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( - connection.Pass(), host_and_port, ssl_config, context); + std::move(connection), host_and_port, ssl_config, context); } scoped_refptr<net::X509Certificate> CastSocketImpl::ExtractPeerCert() { @@ -240,7 +241,7 @@ bool CastSocketImpl::VerifyChallengeReply() { void CastSocketImpl::SetTransportForTesting( scoped_ptr<CastTransport> transport) { - transport_ = transport.Pass(); + transport_ = std::move(transport); } void CastSocketImpl::Connect(scoped_ptr<CastTransport::Delegate> delegate, @@ -249,7 +250,7 @@ void CastSocketImpl::Connect(scoped_ptr<CastTransport::Delegate> delegate, VLOG_WITH_CONNECTION(1) << "Connect readyState = " << ready_state_; DCHECK_EQ(proto::CONN_STATE_START_CONNECT, connect_state_); - delegate_ = delegate.Pass(); + delegate_ = std::move(delegate); if (ready_state_ != READY_STATE_NONE) { logger_->LogSocketEventWithDetails( @@ -394,7 +395,7 @@ int CastSocketImpl::DoSslConnect() { DCHECK(connect_loop_callback_.IsCancelled()); VLOG_WITH_CONNECTION(1) << "DoSslConnect"; SetConnectState(proto::CONN_STATE_SSL_CONNECT_COMPLETE); - socket_ = CreateSslSocket(tcp_socket_.Pass()); + socket_ = CreateSslSocket(std::move(tcp_socket_)); int rv = socket_->Connect( base::Bind(&CastSocketImpl::DoConnectLoop, base::Unretained(this))); @@ -546,7 +547,7 @@ void CastSocketImpl::DoConnectCallback() { if (error_state_ == CHANNEL_ERROR_NONE) { SetReadyState(READY_STATE_OPEN); - transport_->SetReadDelegate(delegate_.Pass()); + transport_->SetReadDelegate(std::move(delegate_)); } else { CloseInternal(); } diff --git a/extensions/browser/api/cast_channel/cast_socket_unittest.cc b/extensions/browser/api/cast_channel/cast_socket_unittest.cc index f0fa670..ddf6473 100644 --- a/extensions/browser/api/cast_channel/cast_socket_unittest.cc +++ b/extensions/browser/api/cast_channel/cast_socket_unittest.cc @@ -4,6 +4,7 @@ #include "extensions/browser/api/cast_channel/cast_socket.h" +#include <utility> #include <vector> #include "base/memory/weak_ptr.h" @@ -358,7 +359,7 @@ class CastSocketTest : public testing::Test { .WillOnce(PostCompletionCallbackTask<1>(net::OK)); EXPECT_CALL(*socket_->GetMockTransport(), Start()); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_NONE)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -392,7 +393,7 @@ TEST_F(CastSocketTest, TestConnectAndClose) { socket_->SetupSslConnect(net::SYNCHRONOUS, net::OK); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_NONE)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -417,7 +418,7 @@ TEST_F(CastSocketTest, TestConnect) { socket_->AddReadResult(net::ASYNC, net::ERR_IO_PENDING); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_NONE)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -433,7 +434,7 @@ TEST_F(CastSocketTest, TestConnectFails) { socket_->SetupTcpConnect(net::ASYNC, net::ERR_FAILED); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_CONNECT_ERROR)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -497,7 +498,7 @@ TEST_F(CastSocketTest, TestConnectAuthMessageCorrupted) { .WillOnce(PostCompletionCallbackTask<1>(net::OK)); EXPECT_CALL(*socket_->GetMockTransport(), Start()); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_TRANSPORT_ERROR)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -524,7 +525,7 @@ TEST_F(CastSocketTest, TestConnectTcpConnectErrorAsync) { socket_->SetupTcpConnect(net::ASYNC, net::ERR_FAILED); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_CONNECT_ERROR)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -540,7 +541,7 @@ TEST_F(CastSocketTest, TestConnectTcpConnectErrorSync) { socket_->SetupTcpConnect(net::SYNCHRONOUS, net::ERR_FAILED); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_CONNECT_ERROR)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -555,7 +556,7 @@ TEST_F(CastSocketTest, TestConnectTcpTimeoutError) { socket_->SetupTcpConnectUnresponsive(); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_CONNECT_TIMEOUT)); EXPECT_CALL(*delegate_, OnError(CHANNEL_ERROR_CONNECT_TIMEOUT)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -576,7 +577,7 @@ TEST_F(CastSocketTest, TestConnectTcpSocketTimeoutError) { socket_->SetupTcpConnect(net::SYNCHRONOUS, net::ERR_CONNECTION_TIMED_OUT); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_CONNECT_TIMEOUT)); EXPECT_CALL(*delegate_, OnError(CHANNEL_ERROR_CONNECT_TIMEOUT)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -596,7 +597,7 @@ TEST_F(CastSocketTest, TestConnectSslConnectErrorAsync) { socket_->SetupSslConnect(net::SYNCHRONOUS, net::ERR_FAILED); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_AUTHENTICATION_ERROR)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -614,7 +615,7 @@ TEST_F(CastSocketTest, TestConnectSslConnectErrorSync) { socket_->SetupSslConnect(net::SYNCHRONOUS, net::ERR_FAILED); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_AUTHENTICATION_ERROR)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -634,7 +635,7 @@ TEST_F(CastSocketTest, TestConnectSslConnectTimeoutSync) { socket_->SetupSslConnect(net::SYNCHRONOUS, net::ERR_CONNECTION_TIMED_OUT); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_CONNECT_TIMEOUT)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -654,7 +655,7 @@ TEST_F(CastSocketTest, TestConnectSslConnectTimeoutAsync) { socket_->SetupSslConnect(net::ASYNC, net::ERR_CONNECTION_TIMED_OUT); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_CONNECT_TIMEOUT)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -673,7 +674,7 @@ TEST_F(CastSocketTest, TestConnectCertExtractionErrorAsync) { socket_->SetExtractCertResult(false); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_AUTHENTICATION_ERROR)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -692,7 +693,7 @@ TEST_F(CastSocketTest, TestConnectCertExtractionErrorSync) { socket_->SetExtractCertResult(false); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_AUTHENTICATION_ERROR)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -714,7 +715,7 @@ TEST_F(CastSocketTest, TestConnectChallengeSendError) { .WillOnce(PostCompletionCallbackTask<1>(net::ERR_CONNECTION_RESET)); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_SOCKET_ERROR)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -737,7 +738,7 @@ TEST_F(CastSocketTest, TestConnectChallengeReplyReceiveError) { EXPECT_CALL(*delegate_, OnError(CHANNEL_ERROR_SOCKET_ERROR)); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_SOCKET_ERROR)); EXPECT_CALL(*socket_->GetMockTransport(), Start()); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -763,7 +764,7 @@ TEST_F(CastSocketTest, TestConnectChallengeVerificationFails) { .WillOnce(PostCompletionCallbackTask<1>(net::OK)); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_AUTHENTICATION_ERROR)); EXPECT_CALL(*socket_->GetMockTransport(), Start()); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -801,7 +802,7 @@ TEST_F(CastSocketTest, TestConnectEndToEndWithRealTransportAsync) { socket_->AddWriteResultForData(net::ASYNC, test_message_str); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_NONE)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); @@ -844,7 +845,7 @@ TEST_F(CastSocketTest, TestConnectEndToEndWithRealTransportSync) { socket_->AddWriteResultForData(net::SYNCHRONOUS, test_message_str); EXPECT_CALL(handler_, OnConnectComplete(CHANNEL_ERROR_NONE)); - socket_->Connect(delegate_.Pass(), + socket_->Connect(std::move(delegate_), base::Bind(&CompleteHandler::OnConnectComplete, base::Unretained(&handler_))); RunPendingTasks(); diff --git a/extensions/browser/api/cast_channel/cast_test_util.cc b/extensions/browser/api/cast_channel/cast_test_util.cc index c21e051..eb5908b 100644 --- a/extensions/browser/api/cast_channel/cast_test_util.cc +++ b/extensions/browser/api/cast_channel/cast_test_util.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/cast_channel/cast_test_util.h" +#include <utility> + namespace extensions { namespace api { namespace cast_channel { @@ -22,7 +24,7 @@ CastTransport::Delegate* MockCastTransport::current_delegate() const { void MockCastTransport::SetReadDelegate( scoped_ptr<CastTransport::Delegate> delegate) { - delegate_ = delegate.Pass(); + delegate_ = std::move(delegate); } MockCastTransportDelegate::MockCastTransportDelegate() { diff --git a/extensions/browser/api/cast_channel/cast_test_util.h b/extensions/browser/api/cast_channel/cast_test_util.h index 70386c8..aacd20f 100644 --- a/extensions/browser/api/cast_channel/cast_test_util.h +++ b/extensions/browser/api/cast_channel/cast_test_util.h @@ -6,6 +6,7 @@ #define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_TEST_UTIL_H_ #include <string> +#include <utility> #include "base/message_loop/message_loop.h" #include "extensions/browser/api/cast_channel/cast_socket.h" @@ -70,7 +71,7 @@ class MockCastSocket : public CastSocket { // ptr. void Connect(scoped_ptr<CastTransport::Delegate> delegate, base::Callback<void(ChannelError)> callback) override { - delegate_ = delegate.Pass(); + delegate_ = std::move(delegate); ConnectRawPtr(delegate_.get(), callback); } diff --git a/extensions/browser/api/cast_channel/cast_transport.cc b/extensions/browser/api/cast_channel/cast_transport.cc index 0ce1db0..d1c9833 100644 --- a/extensions/browser/api/cast_channel/cast_transport.cc +++ b/extensions/browser/api/cast_channel/cast_transport.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/cast_channel/cast_transport.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/format_macros.h" @@ -143,7 +144,7 @@ proto::ErrorState CastTransportImpl::ErrorStateToProto(ChannelError state) { void CastTransportImpl::SetReadDelegate(scoped_ptr<Delegate> delegate) { DCHECK(CalledOnValidThread()); DCHECK(delegate); - delegate_ = delegate.Pass(); + delegate_ = std::move(delegate); if (started_) { delegate_->Start(); } diff --git a/extensions/browser/api/cast_channel/keep_alive_delegate.cc b/extensions/browser/api/cast_channel/keep_alive_delegate.cc index 4ab0f9c..fe1bd916 100644 --- a/extensions/browser/api/cast_channel/keep_alive_delegate.cc +++ b/extensions/browser/api/cast_channel/keep_alive_delegate.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "extensions/browser/api/cast_channel/keep_alive_delegate.h" + #include <string> +#include <utility> #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "extensions/browser/api/cast_channel/cast_message_util.h" #include "extensions/browser/api/cast_channel/cast_socket.h" -#include "extensions/browser/api/cast_channel/keep_alive_delegate.h" #include "extensions/browser/api/cast_channel/logger.h" #include "extensions/common/api/cast_channel/cast_channel.pb.h" #include "extensions/common/api/cast_channel/logging.pb.h" @@ -86,7 +88,7 @@ KeepAliveDelegate::KeepAliveDelegate( : started_(false), socket_(socket), logger_(logger), - inner_delegate_(inner_delegate.Pass()), + inner_delegate_(std::move(inner_delegate)), liveness_timeout_(liveness_timeout), ping_interval_(ping_interval) { DCHECK(ping_interval_ < liveness_timeout_); @@ -102,8 +104,8 @@ KeepAliveDelegate::~KeepAliveDelegate() { void KeepAliveDelegate::SetTimersForTest( scoped_ptr<base::Timer> injected_ping_timer, scoped_ptr<base::Timer> injected_liveness_timer) { - ping_timer_ = injected_ping_timer.Pass(); - liveness_timer_ = injected_liveness_timer.Pass(); + ping_timer_ = std::move(injected_ping_timer); + liveness_timer_ = std::move(injected_liveness_timer); } void KeepAliveDelegate::Start() { diff --git a/extensions/browser/api/cast_channel/logger.cc b/extensions/browser/api/cast_channel/logger.cc index e6d3a77..a44dcab 100644 --- a/extensions/browser/api/cast_channel/logger.cc +++ b/extensions/browser/api/cast_channel/logger.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/cast_channel/logger.h" #include <string> +#include <utility> #include "base/strings/string_util.h" #include "base/time/clock.h" @@ -99,7 +100,7 @@ scoped_ptr<char[]> Compress(const std::string& input, size_t* length) { if (success) *length = out_size - stream.avail_out; - return out.Pass(); + return out; } // Propagate any error fields set in |event| to |last_errors|. If any error @@ -126,7 +127,7 @@ Logger::AggregatedSocketEventLog::~AggregatedSocketEventLog() { } Logger::Logger(scoped_ptr<base::Clock> clock, base::Time unix_epoch_time) - : clock_(clock.Pass()), unix_epoch_time_(unix_epoch_time) { + : clock_(std::move(clock)), unix_epoch_time_(unix_epoch_time) { DCHECK(clock_); // Logger may not be necessarily be created on the IO thread, but logging diff --git a/extensions/browser/api/cast_channel/logger_unittest.cc b/extensions/browser/api/cast_channel/logger_unittest.cc index 13e00b7..bce4185 100644 --- a/extensions/browser/api/cast_channel/logger_unittest.cc +++ b/extensions/browser/api/cast_channel/logger_unittest.cc @@ -76,7 +76,7 @@ class CastChannelLoggerTest : public testing::Test { if (!log->ParseFromString(uncompressed)) return scoped_ptr<Log>(); - return log.Pass(); + return log; } protected: diff --git a/extensions/browser/api/declarative/declarative_rule.h b/extensions/browser/api/declarative/declarative_rule.h index 49692df..f53ba80 100644 --- a/extensions/browser/api/declarative/declarative_rule.h +++ b/extensions/browser/api/declarative/declarative_rule.h @@ -13,6 +13,7 @@ #include <limits> #include <set> #include <string> +#include <utility> #include <vector> #include "base/callback.h" @@ -452,7 +453,7 @@ DeclarativeRule<ConditionT, ActionT>::Create( scoped_ptr<ConditionSet> conditions = ConditionSet::Create( extension, url_matcher_condition_factory, rule->conditions, error); if (!error->empty()) - return error_result.Pass(); + return std::move(error_result); CHECK(conditions.get()); bool bad_message = false; @@ -464,16 +465,16 @@ DeclarativeRule<ConditionT, ActionT>::Create( // should be killed in case it is true. *error = "An action of a rule set had an invalid " "structure that should have been caught by the JSON validator."; - return error_result.Pass(); + return std::move(error_result); } if (!error->empty() || bad_message) - return error_result.Pass(); + return std::move(error_result); CHECK(actions.get()); if (!check_consistency.is_null() && !check_consistency.Run(conditions.get(), actions.get(), error)) { DCHECK(!error->empty()); - return error_result.Pass(); + return std::move(error_result); } CHECK(rule->priority.get()); @@ -483,7 +484,7 @@ DeclarativeRule<ConditionT, ActionT>::Create( Tags tags = rule->tags ? *rule->tags : Tags(); return scoped_ptr<DeclarativeRule>( new DeclarativeRule(rule_id, tags, extension_installation_time, - conditions.Pass(), actions.Pass(), priority)); + std::move(conditions), std::move(actions), priority)); } template<typename ConditionT, typename ActionT> diff --git a/extensions/browser/api/declarative/declarative_rule_unittest.cc b/extensions/browser/api/declarative/declarative_rule_unittest.cc index fd10b12..6fa3d2f 100644 --- a/extensions/browser/api/declarative/declarative_rule_unittest.cc +++ b/extensions/browser/api/declarative/declarative_rule_unittest.cc @@ -62,7 +62,7 @@ struct RecordingCondition { scoped_ptr<RecordingCondition> result(new RecordingCondition()); result->factory = url_matcher_condition_factory; result->value.reset(condition.DeepCopy()); - return result.Pass(); + return result; } }; typedef DeclarativeConditionSet<RecordingCondition> RecordingConditionSet; @@ -139,7 +139,7 @@ struct FulfillableCondition { const base::DictionaryValue* dict; if (!condition.GetAsDictionary(&dict)) { *error = "Expected dict"; - return result.Pass(); + return result; } if (!dict->GetInteger("url_id", &result->condition_set_id)) result->condition_set_id = -1; @@ -150,7 +150,7 @@ struct FulfillableCondition { result->condition_set_id, URLMatcherConditionSet::Conditions()); } - return result.Pass(); + return result; } }; diff --git a/extensions/browser/api/declarative/deduping_factory_unittest.cc b/extensions/browser/api/declarative/deduping_factory_unittest.cc index a10cb9c..1a7024a 100644 --- a/extensions/browser/api/declarative/deduping_factory_unittest.cc +++ b/extensions/browser/api/declarative/deduping_factory_unittest.cc @@ -73,7 +73,7 @@ scoped_refptr<const BaseClass> CreateFoo(const std::string& /*instance_type*/, scoped_ptr<base::DictionaryValue> CreateDictWithParameter(int parameter) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); dict->SetInteger("parameter", parameter); - return dict.Pass(); + return dict; } } // namespace diff --git a/extensions/browser/api/declarative/rules_cache_delegate.cc b/extensions/browser/api/declarative/rules_cache_delegate.cc index 03a4b49..0603d6c 100644 --- a/extensions/browser/api/declarative/rules_cache_delegate.cc +++ b/extensions/browser/api/declarative/rules_cache_delegate.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/declarative/rules_cache_delegate.h" +#include <utility> + #include "content/public/browser/browser_context.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" @@ -107,7 +109,7 @@ void RulesCacheDelegate::WriteToStorage(const std::string& extension_id, StateStore* store = ExtensionSystem::Get(browser_context_)->rules_store(); if (store) - store->SetExtensionValue(extension_id, storage_key_, value.Pass()); + store->SetExtensionValue(extension_id, storage_key_, std::move(value)); } void RulesCacheDelegate::CheckIfReady() { diff --git a/extensions/browser/api/declarative/rules_registry.cc b/extensions/browser/api/declarative/rules_registry.cc index 1dde7d5..ffbcb7f 100644 --- a/extensions/browser/api/declarative/rules_registry.cc +++ b/extensions/browser/api/declarative/rules_registry.cc @@ -43,7 +43,7 @@ scoped_ptr<base::Value> RulesToValue( scoped_ptr<base::ListValue> list(new base::ListValue()); for (size_t i = 0; i < rules.size(); ++i) list->Append(rules[i]->ToValue().release()); - return list.Pass(); + return std::move(list); } std::vector<linked_ptr<api::events::Rule>> RulesFromValue( @@ -313,7 +313,7 @@ void RulesRegistry::ReportInternalError(const std::string& extension_id, scoped_ptr<ExtensionError> error_instance(new InternalError( extension_id, base::ASCIIToUTF16(error), logging::LOG_ERROR)); ExtensionsBrowserClient::Get()->ReportError(browser_context_, - error_instance.Pass()); + std::move(error_instance)); } RulesRegistry::~RulesRegistry() { diff --git a/extensions/browser/api/declarative/rules_registry_unittest.cc b/extensions/browser/api/declarative/rules_registry_unittest.cc index a7499ee..4e76b2b 100644 --- a/extensions/browser/api/declarative/rules_registry_unittest.cc +++ b/extensions/browser/api/declarative/rules_registry_unittest.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/declarative/rules_registry.h" #include <algorithm> +#include <utility> #include "base/message_loop/message_loop.h" #include "base/values.h" @@ -133,7 +134,7 @@ TEST(RulesRegistryTest, FillOptionalIdentifiers) { " \"version\": \"1\"" "}"); scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(manifest.Pass()) + .SetManifest(std::move(manifest)) .SetID(kExtensionId) .Build(); registry->OnExtensionUninstalled(extension.get()); @@ -218,7 +219,7 @@ TEST(RulesRegistryTest, TwoRulesInManifest) { " ]" "}"); scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(manifest.Pass()) + .SetManifest(std::move(manifest)) .SetID(kExtensionId) .Build(); @@ -285,7 +286,7 @@ TEST(RulesRegistryTest, DeleteRuleInManifest) { " }]" "}"); scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(manifest.Pass()) + .SetManifest(std::move(manifest)) .SetID(kExtensionId) .Build(); diff --git a/extensions/browser/api/declarative_webrequest/webrequest_action.cc b/extensions/browser/api/declarative_webrequest/webrequest_action.cc index 7d028e7..2057ece 100644 --- a/extensions/browser/api/declarative_webrequest/webrequest_action.cc +++ b/extensions/browser/api/declarative_webrequest/webrequest_action.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/declarative_webrequest/webrequest_action.h" #include <limits> +#include <utility> #include "base/lazy_instance.h" #include "base/logging.h" @@ -60,7 +61,7 @@ scoped_ptr<helpers::RequestCookie> ParseRequestCookie( result->name.reset(new std::string(tmp)); if (dict->GetString(keys::kValueKey, &tmp)) result->value.reset(new std::string(tmp)); - return result.Pass(); + return result; } void ParseResponseCookieImpl(const base::DictionaryValue* dict, @@ -90,7 +91,7 @@ scoped_ptr<helpers::ResponseCookie> ParseResponseCookie( const base::DictionaryValue* dict) { scoped_ptr<helpers::ResponseCookie> result(new helpers::ResponseCookie); ParseResponseCookieImpl(dict, result.get()); - return result.Pass(); + return result; } scoped_ptr<helpers::FilterResponseCookie> ParseFilterResponseCookie( @@ -107,7 +108,7 @@ scoped_ptr<helpers::FilterResponseCookie> ParseFilterResponseCookie( result->age_lower_bound.reset(new int(int_tmp)); if (dict->GetBoolean(keys::kSessionCookieKey, &bool_tmp)) result->session_cookie.reset(new bool(bool_tmp)); - return result.Pass(); + return result; } // Helper function for WebRequestActions that can be instantiated by just @@ -159,7 +160,7 @@ scoped_refptr<const WebRequestAction> CreateRedirectRequestByRegExAction( return scoped_refptr<const WebRequestAction>(NULL); } return scoped_refptr<const WebRequestAction>( - new WebRequestRedirectByRegExAction(from_pattern.Pass(), to)); + new WebRequestRedirectByRegExAction(std::move(from_pattern), to)); } scoped_refptr<const WebRequestAction> CreateSetRequestHeaderAction( @@ -698,7 +699,7 @@ WebRequestRedirectByRegExAction::WebRequestRedirectByRegExAction( ACTION_REDIRECT_BY_REGEX_DOCUMENT, std::numeric_limits<int>::min(), STRATEGY_DEFAULT), - from_pattern_(from_pattern.Pass()), + from_pattern_(std::move(from_pattern)), to_pattern_(to_pattern.data(), to_pattern.size()) {} WebRequestRedirectByRegExAction::~WebRequestRedirectByRegExAction() {} diff --git a/extensions/browser/api/declarative_webrequest/webrequest_condition.cc b/extensions/browser/api/declarative_webrequest/webrequest_condition.cc index 28c28ce..ef72ea4 100644 --- a/extensions/browser/api/declarative_webrequest/webrequest_condition.cc +++ b/extensions/browser/api/declarative_webrequest/webrequest_condition.cc @@ -198,7 +198,7 @@ scoped_ptr<WebRequestCondition> WebRequestCondition::Create( return scoped_ptr<WebRequestCondition>(); } - return result.Pass(); + return result; } } // namespace extensions diff --git a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc index 17bdd22..a440c47 100644 --- a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc +++ b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc @@ -549,11 +549,10 @@ bool HeaderMatcher::HeaderMatchTest::Matches(const std::string& name, // WebRequestConditionAttributeRequestHeaders:: -WebRequestConditionAttributeRequestHeaders( - scoped_ptr<const HeaderMatcher> header_matcher, - bool positive) - : header_matcher_(header_matcher.Pass()), - positive_(positive) {} + WebRequestConditionAttributeRequestHeaders( + scoped_ptr<const HeaderMatcher> header_matcher, + bool positive) + : header_matcher_(std::move(header_matcher)), positive_(positive) {} WebRequestConditionAttributeRequestHeaders:: ~WebRequestConditionAttributeRequestHeaders() {} @@ -574,7 +573,7 @@ scoped_ptr<const HeaderMatcher> PrepareHeaderMatcher( HeaderMatcher::Create(value_as_list)); if (header_matcher.get() == NULL) *error = ErrorUtils::FormatErrorMessage(kInvalidValue, name); - return header_matcher.Pass(); + return header_matcher; } } // namespace @@ -596,7 +595,7 @@ WebRequestConditionAttributeRequestHeaders::Create( return scoped_refptr<const WebRequestConditionAttribute>( new WebRequestConditionAttributeRequestHeaders( - header_matcher.Pass(), name == keys::kRequestHeadersKey)); + std::move(header_matcher), name == keys::kRequestHeadersKey)); } int WebRequestConditionAttributeRequestHeaders::GetStages() const { @@ -644,11 +643,10 @@ bool WebRequestConditionAttributeRequestHeaders::Equals( // WebRequestConditionAttributeResponseHeaders:: -WebRequestConditionAttributeResponseHeaders( - scoped_ptr<const HeaderMatcher> header_matcher, - bool positive) - : header_matcher_(header_matcher.Pass()), - positive_(positive) {} + WebRequestConditionAttributeResponseHeaders( + scoped_ptr<const HeaderMatcher> header_matcher, + bool positive) + : header_matcher_(std::move(header_matcher)), positive_(positive) {} WebRequestConditionAttributeResponseHeaders:: ~WebRequestConditionAttributeResponseHeaders() {} @@ -670,7 +668,7 @@ WebRequestConditionAttributeResponseHeaders::Create( return scoped_refptr<const WebRequestConditionAttribute>( new WebRequestConditionAttributeResponseHeaders( - header_matcher.Pass(), name == keys::kResponseHeadersKey)); + std::move(header_matcher), name == keys::kResponseHeadersKey)); } int WebRequestConditionAttributeResponseHeaders::GetStages() const { diff --git a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc index 5c2fa34..c9b9b0c 100644 --- a/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc +++ b/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc @@ -401,7 +401,7 @@ scoped_ptr<base::DictionaryValue> GetDictionaryFromArray( dictionary->SetString(*name, *value); } } - return dictionary.Pass(); + return dictionary; } // Returns whether the response headers from |url_request| satisfy the match diff --git a/extensions/browser/api/device_permissions_manager.cc b/extensions/browser/api/device_permissions_manager.cc index f18e271..696c0ed 100644 --- a/extensions/browser/api/device_permissions_manager.cc +++ b/extensions/browser/api/device_permissions_manager.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/device_permissions_manager.h" +#include <utility> + #include "base/bind.h" #include "base/memory/singleton.h" #include "base/strings/string_number_conversions.h" @@ -334,7 +336,7 @@ scoped_ptr<base::Value> DevicePermissionEntry::ToValue() const { kDeviceLastUsed, base::Int64ToString(last_used_.ToInternalValue())); } - return entry_dict.Pass(); + return std::move(entry_dict); } base::string16 DevicePermissionEntry::GetPermissionMessageString() const { diff --git a/extensions/browser/api/device_permissions_prompt.cc b/extensions/browser/api/device_permissions_prompt.cc index 8a691ba..e89537b 100644 --- a/extensions/browser/api/device_permissions_prompt.cc +++ b/extensions/browser/api/device_permissions_prompt.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/device_permissions_prompt.h" +#include <utility> + #include "base/bind.h" #include "base/i18n/message_formatter.h" #include "base/scoped_observer.h" @@ -252,7 +254,7 @@ class HidDevicePermissionsPrompt : public DevicePermissionsPrompt::Prompt, base::Bind(&HidDevicePermissionsPrompt::AddCheckedDevice, this, base::Passed(&device_info))); #else - AddCheckedDevice(device_info.Pass(), true); + AddCheckedDevice(std::move(device_info), true); #endif // defined(OS_CHROMEOS) } } @@ -343,7 +345,7 @@ void DevicePermissionsPrompt::Prompt::AddCheckedDevice( scoped_ptr<DeviceInfo> device, bool allowed) { if (allowed) { - devices_.push_back(device.Pass()); + devices_.push_back(std::move(device)); if (observer_) { observer_->OnDevicesChanged(); } diff --git a/extensions/browser/api/display_source/display_source_api.cc b/extensions/browser/api/display_source/display_source_api.cc index 9b92f0f..9b57e6b 100644 --- a/extensions/browser/api/display_source/display_source_api.cc +++ b/extensions/browser/api/display_source/display_source_api.cc @@ -3,6 +3,9 @@ // found in the LICENSE file. #include "extensions/browser/api/display_source/display_source_api.h" + +#include <utility> + #include "extensions/browser/api/display_source/display_source_connection_delegate_factory.h" #include "extensions/common/api/display_source.h" @@ -43,7 +46,7 @@ void DisplaySourceGetAvailableSinksFunction::OnGetSinksCompleted( const DisplaySourceSinkInfoList& sinks) { scoped_ptr<base::ListValue> result = api::display_source::GetAvailableSinks::Results::Create(sinks); - Respond(ArgumentList(result.Pass())); + Respond(ArgumentList(std::move(result))); } void DisplaySourceGetAvailableSinksFunction::OnGetSinksFailed( @@ -86,7 +89,7 @@ void DisplaySourceRequestAuthenticationFunction::OnRequestAuthCompleted( const DisplaySourceAuthInfo& auth_info) { scoped_ptr<base::ListValue> result = api::display_source::RequestAuthentication::Results::Create(auth_info); - Respond(ArgumentList(result.Pass())); + Respond(ArgumentList(std::move(result))); } void DisplaySourceRequestAuthenticationFunction::OnRequestAuthFailed( diff --git a/extensions/browser/api/display_source/display_source_event_router.cc b/extensions/browser/api/display_source/display_source_event_router.cc index db6f9ab..a8c8a7b 100644 --- a/extensions/browser/api/display_source/display_source_event_router.cc +++ b/extensions/browser/api/display_source/display_source_event_router.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/display_source/display_source_event_router.h" +#include <utility> + #include "content/public/browser/browser_context.h" #include "extensions/browser/api/display_source/display_source_api.h" #include "extensions/browser/api/display_source/display_source_connection_delegate_factory.h" @@ -86,10 +88,10 @@ void DisplaySourceEventRouter::OnSinksUpdated( return; scoped_ptr<base::ListValue> args( api::display_source::OnSinksUpdated::Create(sinks)); - scoped_ptr<Event> sinks_updated_event( - new Event(events::DISPLAY_SOURCE_ON_SINKS_UPDATED, - api::display_source::OnSinksUpdated::kEventName, args.Pass())); - event_router->BroadcastEvent(sinks_updated_event.Pass()); + scoped_ptr<Event> sinks_updated_event(new Event( + events::DISPLAY_SOURCE_ON_SINKS_UPDATED, + api::display_source::OnSinksUpdated::kEventName, std::move(args))); + event_router->BroadcastEvent(std::move(sinks_updated_event)); } DisplaySourceEventRouter* DisplaySourceEventRouter::Create( diff --git a/extensions/browser/api/guest_view/extension_view/extension_view_internal_api.cc b/extensions/browser/api/guest_view/extension_view/extension_view_internal_api.cc index 425e01b..878c4b5 100644 --- a/extensions/browser/api/guest_view/extension_view/extension_view_internal_api.cc +++ b/extensions/browser/api/guest_view/extension_view/extension_view_internal_api.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/guest_view/extension_view/extension_view_internal_api.h" +#include <utility> + #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "components/crx_file/id_util.h" @@ -78,7 +80,7 @@ bool ExtensionViewInternalParseSrcFunction::RunAsync() { scoped_ptr<base::ListValue> result_list(new base::ListValue()); result_list->AppendBoolean(is_src_valid); result_list->AppendString(url.host()); - SetResultList(result_list.Pass()); + SetResultList(std::move(result_list)); SendResponse(true); return true; } diff --git a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc index ce1acc1..9d3d215 100644 --- a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc +++ b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h" +#include <utility> + #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -300,7 +302,7 @@ bool WebViewInternalExecuteCodeFunction::Init() { if (!InjectDetails::Populate(*details_value, details.get())) return false; - details_ = details.Pass(); + details_ = std::move(details); if (extension()) { set_host_id(HostID(HostID::EXTENSIONS, extension()->id())); diff --git a/extensions/browser/api/hid/hid_api.cc b/extensions/browser/api/hid/hid_api.cc index acd2e93..1564789 100644 --- a/extensions/browser/api/hid/hid_api.cc +++ b/extensions/browser/api/hid/hid_api.cc @@ -141,7 +141,7 @@ void HidGetUserSelectedDevicesFunction::OnDevicesChosen( const std::vector<scoped_refptr<HidDeviceInfo>>& devices) { HidDeviceManager* device_manager = HidDeviceManager::Get(browser_context()); CHECK(device_manager); - Respond(OneArgument(device_manager->GetApiDevicesFromList(devices).Pass())); + Respond(OneArgument(device_manager->GetApiDevicesFromList(devices))); } HidConnectFunction::HidConnectFunction() : connection_manager_(nullptr) { diff --git a/extensions/browser/api/hid/hid_device_manager.cc b/extensions/browser/api/hid/hid_device_manager.cc index 955b2a1..8f967867 100644 --- a/extensions/browser/api/hid/hid_device_manager.cc +++ b/extensions/browser/api/hid/hid_device_manager.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/hid/hid_device_manager.h" #include <limits> +#include <utility> #include <vector> #include "base/lazy_instance.h" @@ -141,7 +142,7 @@ scoped_ptr<base::ListValue> HidDeviceManager::GetApiDevicesFromList( PopulateHidDeviceInfo(&device_info, device); device_list->Append(device_info.ToValue().release()); } - return device_list.Pass(); + return device_list; } scoped_refptr<HidDeviceInfo> HidDeviceManager::GetDeviceInfo(int resource_id) { @@ -224,7 +225,7 @@ void HidDeviceManager::OnDeviceAdded(scoped_refptr<HidDeviceInfo> device_info) { scoped_ptr<base::ListValue> args( hid::OnDeviceAdded::Create(api_device_info)); DispatchEvent(events::HID_ON_DEVICE_ADDED, hid::OnDeviceAdded::kEventName, - args.Pass(), device_info); + std::move(args), device_info); } } } @@ -244,7 +245,8 @@ void HidDeviceManager::OnDeviceRemoved( DCHECK(enumeration_ready_); scoped_ptr<base::ListValue> args(hid::OnDeviceRemoved::Create(resource_id)); DispatchEvent(events::HID_ON_DEVICE_REMOVED, - hid::OnDeviceRemoved::kEventName, args.Pass(), device_info); + hid::OnDeviceRemoved::kEventName, std::move(args), + device_info); } } @@ -300,7 +302,7 @@ scoped_ptr<base::ListValue> HidDeviceManager::CreateApiDeviceList( } } - return api_devices.Pass(); + return api_devices; } void HidDeviceManager::OnEnumerationComplete( @@ -315,7 +317,7 @@ void HidDeviceManager::OnEnumerationComplete( for (const auto& params : pending_enumerations_) { scoped_ptr<base::ListValue> devices = CreateApiDeviceList(params->extension, params->filters); - params->callback.Run(devices.Pass()); + params->callback.Run(std::move(devices)); } pending_enumerations_.clear(); } @@ -325,10 +327,10 @@ void HidDeviceManager::DispatchEvent(events::HistogramValue histogram_value, scoped_ptr<base::ListValue> event_args, scoped_refptr<HidDeviceInfo> device_info) { scoped_ptr<Event> event( - new Event(histogram_value, event_name, event_args.Pass())); + new Event(histogram_value, event_name, std::move(event_args))); event->will_dispatch_callback = base::Bind( &WillDispatchDeviceEvent, weak_factory_.GetWeakPtr(), device_info); - event_router_->BroadcastEvent(event.Pass()); + event_router_->BroadcastEvent(std::move(event)); } } // namespace extensions diff --git a/extensions/browser/api/idle/idle_api_unittest.cc b/extensions/browser/api/idle/idle_api_unittest.cc index 96dc381..7e3b5a8 100644 --- a/extensions/browser/api/idle/idle_api_unittest.cc +++ b/extensions/browser/api/idle/idle_api_unittest.cc @@ -138,10 +138,10 @@ void IdleTest::SetUp() { idle_provider_ = new TestIdleProvider(); idle_manager_->SetIdleTimeProviderForTest( - scoped_ptr<IdleManager::IdleTimeProvider>(idle_provider_).Pass()); + scoped_ptr<IdleManager::IdleTimeProvider>(idle_provider_)); event_delegate_ = new testing::StrictMock<MockEventDelegate>(); idle_manager_->SetEventDelegateForTest( - scoped_ptr<IdleManager::EventDelegate>(event_delegate_).Pass()); + scoped_ptr<IdleManager::EventDelegate>(event_delegate_)); idle_manager_->Init(); } diff --git a/extensions/browser/api/idle/idle_manager.cc b/extensions/browser/api/idle/idle_manager.cc index 2eb16a8..695e52f 100644 --- a/extensions/browser/api/idle/idle_manager.cc +++ b/extensions/browser/api/idle/idle_manager.cc @@ -51,10 +51,10 @@ void DefaultEventDelegate::OnStateChanged(const std::string& extension_id, args->Append(IdleManager::CreateIdleValue(new_state)); scoped_ptr<Event> event(new Event(events::IDLE_ON_STATE_CHANGED, idle::OnStateChanged::kEventName, - args.Pass())); + std::move(args))); event->restrict_to_browser_context = context_; EventRouter::Get(context_) - ->DispatchEventToExtension(extension_id, event.Pass()); + ->DispatchEventToExtension(extension_id, std::move(event)); } void DefaultEventDelegate::RegisterObserver(EventRouter::Observer* observer) { @@ -197,13 +197,13 @@ base::StringValue* IdleManager::CreateIdleValue(ui::IdleState idle_state) { void IdleManager::SetEventDelegateForTest( scoped_ptr<EventDelegate> event_delegate) { DCHECK(thread_checker_.CalledOnValidThread()); - event_delegate_ = event_delegate.Pass(); + event_delegate_ = std::move(event_delegate); } void IdleManager::SetIdleTimeProviderForTest( scoped_ptr<IdleTimeProvider> idle_time_provider) { DCHECK(thread_checker_.CalledOnValidThread()); - idle_time_provider_ = idle_time_provider.Pass(); + idle_time_provider_ = std::move(idle_time_provider); } IdleMonitor* IdleManager::GetMonitor(const std::string& extension_id) { diff --git a/extensions/browser/api/management/management_api.cc b/extensions/browser/api/management/management_api.cc index d3d85e7..6414d73 100644 --- a/extensions/browser/api/management/management_api.cc +++ b/extensions/browser/api/management/management_api.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/management/management_api.h" #include <string> +#include <utility> #include <vector> #include "base/basictypes.h" @@ -243,7 +244,7 @@ scoped_ptr<management::ExtensionInfo> CreateExtensionInfo( GetAvailableLaunchTypes(extension, delegate))); } - return info.Pass(); + return info; } void AddExtensionInfo(const ExtensionSet& extensions, @@ -873,7 +874,7 @@ void ManagementEventRouter::BroadcastEvent( EventRouter::Get(browser_context_) ->BroadcastEvent(scoped_ptr<Event>( - new Event(histogram_value, event_name, args.Pass()))); + new Event(histogram_value, event_name, std::move(args)))); } ManagementAPI::ManagementAPI(content::BrowserContext* context) diff --git a/extensions/browser/api/mime_handler_private/mime_handler_private.cc b/extensions/browser/api/mime_handler_private/mime_handler_private.cc index 5a855d2..4a5bb42 100644 --- a/extensions/browser/api/mime_handler_private/mime_handler_private.cc +++ b/extensions/browser/api/mime_handler_private/mime_handler_private.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/mime_handler_private/mime_handler_private.h" +#include <utility> + #include "base/strings/string_util.h" #include "content/public/browser/stream_handle.h" #include "content/public/browser/stream_info.h" @@ -49,16 +51,15 @@ mojo::Map<mojo::String, mojo::String> CreateResponseHeadersMap( void MimeHandlerServiceImpl::Create( base::WeakPtr<StreamContainer> stream_container, mojo::InterfaceRequest<mime_handler::MimeHandlerService> request) { - new MimeHandlerServiceImpl(stream_container, request.Pass()); + new MimeHandlerServiceImpl(stream_container, std::move(request)); } MimeHandlerServiceImpl::MimeHandlerServiceImpl( base::WeakPtr<StreamContainer> stream_container, mojo::InterfaceRequest<mime_handler::MimeHandlerService> request) : stream_(stream_container), - binding_(this, request.Pass()), - weak_factory_(this) { -} + binding_(this, std::move(request)), + weak_factory_(this) {} MimeHandlerServiceImpl::~MimeHandlerServiceImpl() { } @@ -118,7 +119,7 @@ extensions::mime_handler::StreamInfoPtr TypeConverter< result->stream_url = info->handle->GetURL().spec(); result->response_headers = extensions::CreateResponseHeadersMap(info->response_headers.get()); - return result.Pass(); + return result; } } // namespace mojo diff --git a/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc b/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc index 7f36a399..d883358 100644 --- a/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc +++ b/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "extensions/browser/api/mime_handler_private/mime_handler_private.h" + +#include <utility> + #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "content/public/browser/stream_handle.h" #include "content/public/browser/stream_info.h" -#include "extensions/browser/api/mime_handler_private/mime_handler_private.h" #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" #include "testing/gtest/include/gtest/gtest.h" @@ -42,7 +45,7 @@ class MimeHandlerServiceImplTest : public testing::Test { stream_info->mime_type = "test/unit"; stream_info->original_url = GURL("test://extensions_unittests"); stream_container_.reset( - new StreamContainer(stream_info.Pass(), 1, true, GURL(), "")); + new StreamContainer(std::move(stream_info), 1, true, GURL(), "")); service_.reset(new MimeHandlerServiceImpl(stream_container_->GetWeakPtr(), mojo::GetProxy(&service_ptr_))); } @@ -53,7 +56,7 @@ class MimeHandlerServiceImplTest : public testing::Test { void AbortCallback() { abort_called_ = true; } void GetStreamInfoCallback(mime_handler::StreamInfoPtr stream_info) { - stream_info_ = stream_info.Pass(); + stream_info_ = std::move(stream_info); } base::MessageLoop message_loop_; diff --git a/extensions/browser/api/printer_provider/printer_provider_api.cc b/extensions/browser/api/printer_provider/printer_provider_api.cc index b5d16a8..71bae77 100644 --- a/extensions/browser/api/printer_provider/printer_provider_api.cc +++ b/extensions/browser/api/printer_provider/printer_provider_api.cc @@ -529,14 +529,14 @@ void PrinterProviderAPIImpl::DispatchGetPrintersRequested( scoped_ptr<Event> event( new Event(events::PRINTER_PROVIDER_ON_GET_PRINTERS_REQUESTED, api::printer_provider::OnGetPrintersRequested::kEventName, - internal_args.Pass())); + std::move(internal_args))); // This callback is called synchronously during |BroadcastEvent|, so // Unretained is safe. event->will_dispatch_callback = base::Bind(&PrinterProviderAPIImpl::WillRequestPrinters, base::Unretained(this), request_id); - event_router->BroadcastEvent(event.Pass()); + event_router->BroadcastEvent(std::move(event)); } void PrinterProviderAPIImpl::DispatchGetCapabilityRequested( @@ -568,9 +568,9 @@ void PrinterProviderAPIImpl::DispatchGetCapabilityRequested( scoped_ptr<Event> event( new Event(events::PRINTER_PROVIDER_ON_GET_CAPABILITY_REQUESTED, api::printer_provider::OnGetCapabilityRequested::kEventName, - internal_args.Pass())); + std::move(internal_args))); - event_router->DispatchEventToExtension(extension_id, event.Pass()); + event_router->DispatchEventToExtension(extension_id, std::move(event)); } void PrinterProviderAPIImpl::DispatchPrintRequested( @@ -615,8 +615,8 @@ void PrinterProviderAPIImpl::DispatchPrintRequested( scoped_ptr<Event> event( new Event(events::PRINTER_PROVIDER_ON_PRINT_REQUESTED, api::printer_provider::OnPrintRequested::kEventName, - internal_args.Pass())); - event_router->DispatchEventToExtension(extension_id, event.Pass()); + std::move(internal_args))); + event_router->DispatchEventToExtension(extension_id, std::move(event)); } const PrinterProviderPrintJob* PrinterProviderAPIImpl::GetPrintJob( @@ -653,8 +653,8 @@ void PrinterProviderAPIImpl::DispatchGetUsbPrinterInfoRequested( scoped_ptr<Event> event( new Event(events::PRINTER_PROVIDER_ON_GET_USB_PRINTER_INFO_REQUESTED, api::printer_provider::OnGetUsbPrinterInfoRequested::kEventName, - internal_args.Pass())); - event_router->DispatchEventToExtension(extension_id, event.Pass()); + std::move(internal_args))); + event_router->DispatchEventToExtension(extension_id, std::move(event)); } void PrinterProviderAPIImpl::OnGetPrintersResult( @@ -668,7 +668,7 @@ void PrinterProviderAPIImpl::OnGetPrintersResult( for (size_t i = 0; i < result.size(); ++i) { scoped_ptr<base::DictionaryValue> printer(result[i]->ToValue()); UpdatePrinterWithExtensionInfo(printer.get(), extension); - printer_list.Append(printer.Pass()); + printer_list.Append(std::move(printer)); } pending_get_printers_requests_.CompleteForExtension(extension->id(), diff --git a/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.cc b/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.cc index 6ffaa48..e032703 100644 --- a/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.cc +++ b/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/printer_provider_internal/printer_provider_internal_api.h" #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -238,7 +239,7 @@ void PrinterProviderInternalGetPrintDataFunction::OnBlob( extensions::BlobHolder* holder = extensions::BlobHolder::FromRenderProcessHost( render_frame_host()->GetProcess()); - holder->HoldBlobReference(blob.Pass()); + holder->HoldBlobReference(std::move(blob)); results_ = internal_api::GetPrintData::Results::Create(info); SetTransferredBlobUUIDs(uuids); diff --git a/extensions/browser/api/runtime/runtime_api.cc b/extensions/browser/api/runtime/runtime_api.cc index 1473a43..a42e466 100644 --- a/extensions/browser/api/runtime/runtime_api.cc +++ b/extensions/browser/api/runtime/runtime_api.cc @@ -116,9 +116,9 @@ void DispatchOnStartupEventImpl(BrowserContext* browser_context, scoped_ptr<base::ListValue> event_args(new base::ListValue()); scoped_ptr<Event> event(new Event(events::RUNTIME_ON_STARTUP, runtime::OnStartup::kEventName, - event_args.Pass())); + std::move(event_args))); EventRouter::Get(browser_context) - ->DispatchEventToExtension(extension_id, event.Pass()); + ->DispatchEventToExtension(extension_id, std::move(event)); } void SetUninstallURL(ExtensionPrefs* prefs, @@ -361,8 +361,8 @@ void RuntimeEventRouter::DispatchOnInstalledEvent( DCHECK(event_router); scoped_ptr<Event> event(new Event(events::RUNTIME_ON_INSTALLED, runtime::OnInstalled::kEventName, - event_args.Pass())); - event_router->DispatchEventWithLazyListener(extension_id, event.Pass()); + std::move(event_args))); + event_router->DispatchEventWithLazyListener(extension_id, std::move(event)); if (old_version.IsValid()) { const Extension* extension = @@ -382,9 +382,9 @@ void RuntimeEventRouter::DispatchOnInstalledEvent( sm_info->SetString(kInstallId, extension_id); scoped_ptr<Event> sm_event(new Event(events::RUNTIME_ON_INSTALLED, runtime::OnInstalled::kEventName, - sm_event_args.Pass())); + std::move(sm_event_args))); event_router->DispatchEventWithLazyListener((*i)->id(), - sm_event.Pass()); + std::move(sm_event)); } } } @@ -405,8 +405,8 @@ void RuntimeEventRouter::DispatchOnUpdateAvailableEvent( DCHECK(event_router); scoped_ptr<Event> event(new Event(events::RUNTIME_ON_UPDATE_AVAILABLE, runtime::OnUpdateAvailable::kEventName, - args.Pass())); - event_router->DispatchEventToExtension(extension_id, event.Pass()); + std::move(args))); + event_router->DispatchEventToExtension(extension_id, std::move(event)); } // static @@ -419,10 +419,10 @@ void RuntimeEventRouter::DispatchOnBrowserUpdateAvailableEvent( scoped_ptr<base::ListValue> args(new base::ListValue); EventRouter* event_router = EventRouter::Get(context); DCHECK(event_router); - scoped_ptr<Event> event( - new Event(events::RUNTIME_ON_BROWSER_UPDATE_AVAILABLE, - runtime::OnBrowserUpdateAvailable::kEventName, args.Pass())); - event_router->BroadcastEvent(event.Pass()); + scoped_ptr<Event> event(new Event( + events::RUNTIME_ON_BROWSER_UPDATE_AVAILABLE, + runtime::OnBrowserUpdateAvailable::kEventName, std::move(args))); + event_router->BroadcastEvent(std::move(event)); } // static @@ -440,7 +440,7 @@ void RuntimeEventRouter::DispatchOnRestartRequiredEvent( api::runtime::OnRestartRequired::Create(reason))); EventRouter* event_router = EventRouter::Get(context); DCHECK(event_router); - event_router->DispatchEventToExtension(app_id, event.Pass()); + event_router->DispatchEventToExtension(app_id, std::move(event)); } // static diff --git a/extensions/browser/api/serial/serial_apitest.cc b/extensions/browser/api/serial/serial_apitest.cc index ac22f66..780ef19 100644 --- a/extensions/browser/api/serial/serial_apitest.cc +++ b/extensions/browser/api/serial/serial_apitest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <string> +#include <utility> #include "chrome/browser/extensions/extension_apitest.h" #include "content/public/browser/browser_thread.h" @@ -53,9 +54,9 @@ class FakeSerialDeviceEnumerator : public device::SerialDeviceEnumerator { device0->path = "/dev/fakeserialmojo"; device::serial::DeviceInfoPtr device1(device::serial::DeviceInfo::New()); device1->path = "\\\\COM800\\"; - devices.push_back(device0.Pass()); - devices.push_back(device1.Pass()); - return devices.Pass(); + devices.push_back(std::move(device0)); + devices.push_back(std::move(device1)); + return devices; } }; @@ -138,8 +139,8 @@ void CreateTestSerialServiceOnFileThread( content::BrowserThread::IO)); scoped_ptr<device::SerialDeviceEnumerator> device_enumerator( new FakeSerialDeviceEnumerator); - new device::SerialServiceImpl(connection_factory, device_enumerator.Pass(), - request.Pass()); + new device::SerialServiceImpl( + connection_factory, std::move(device_enumerator), std::move(request)); } void CreateTestSerialService( diff --git a/extensions/browser/api/serial/serial_connection.cc b/extensions/browser/api/serial/serial_connection.cc index edf6a0d..cc46b12 100644 --- a/extensions/browser/api/serial/serial_connection.cc +++ b/extensions/browser/api/serial/serial_connection.cc @@ -395,7 +395,7 @@ TypeConverter<device::serial::HostControlSignalsPtr, output->has_rts = true; output->rts = *input.rts; } - return output.Pass(); + return output; } // static @@ -414,7 +414,7 @@ TypeConverter<device::serial::ConnectionOptionsPtr, output->has_cts_flow_control = true; output->cts_flow_control = *input.cts_flow_control; } - return output.Pass(); + return output; } } // namespace mojo diff --git a/extensions/browser/api/serial/serial_event_dispatcher.cc b/extensions/browser/api/serial/serial_event_dispatcher.cc index 7afa268..81f9457 100644 --- a/extensions/browser/api/serial/serial_event_dispatcher.cc +++ b/extensions/browser/api/serial/serial_event_dispatcher.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/serial/serial_event_dispatcher.h" +#include <utility> + #include "base/lazy_instance.h" #include "extensions/browser/api/serial/serial_connection.h" #include "extensions/browser/event_router.h" @@ -105,8 +107,8 @@ void SerialEventDispatcher::ReceiveCallback(const ReceiveParams& params, scoped_ptr<base::ListValue> args = serial::OnReceive::Create(receive_info); scoped_ptr<extensions::Event> event( new extensions::Event(extensions::events::SERIAL_ON_RECEIVE, - serial::OnReceive::kEventName, args.Pass())); - PostEvent(params, event.Pass()); + serial::OnReceive::kEventName, std::move(args))); + PostEvent(params, std::move(event)); } if (error != serial::RECEIVE_ERROR_NONE) { @@ -115,10 +117,10 @@ void SerialEventDispatcher::ReceiveCallback(const ReceiveParams& params, error_info.error = error; scoped_ptr<base::ListValue> args = serial::OnReceiveError::Create(error_info); - scoped_ptr<extensions::Event> event( - new extensions::Event(extensions::events::SERIAL_ON_RECEIVE_ERROR, - serial::OnReceiveError::kEventName, args.Pass())); - PostEvent(params, event.Pass()); + scoped_ptr<extensions::Event> event(new extensions::Event( + extensions::events::SERIAL_ON_RECEIVE_ERROR, + serial::OnReceiveError::kEventName, std::move(args))); + PostEvent(params, std::move(event)); if (ShouldPauseOnReceiveError(error)) { SerialConnection* connection = params.connections->Get(params.extension_id, params.connection_id); @@ -137,12 +139,10 @@ void SerialEventDispatcher::PostEvent(const ReceiveParams& params, scoped_ptr<extensions::Event> event) { DCHECK_CURRENTLY_ON(params.thread_id); - BrowserThread::PostTask(BrowserThread::UI, - FROM_HERE, - base::Bind(&DispatchEvent, - params.browser_context_id, - params.extension_id, - base::Passed(event.Pass()))); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(&DispatchEvent, params.browser_context_id, params.extension_id, + base::Passed(std::move(event)))); } // static @@ -158,7 +158,7 @@ void SerialEventDispatcher::DispatchEvent(void* browser_context_id, EventRouter* router = EventRouter::Get(context); if (router) - router->DispatchEventToExtension(extension_id, event.Pass()); + router->DispatchEventToExtension(extension_id, std::move(event)); } } // namespace api diff --git a/extensions/browser/api/serial/serial_service_factory.cc b/extensions/browser/api/serial/serial_service_factory.cc index 31cac07..10abe15 100644 --- a/extensions/browser/api/serial/serial_service_factory.cc +++ b/extensions/browser/api/serial/serial_service_factory.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/serial/serial_service_factory.h" +#include <utility> + #include "content/public/browser/browser_thread.h" #include "device/serial/serial_service_impl.h" @@ -17,7 +19,7 @@ const base::Callback<void( void BindToSerialServiceRequest( mojo::InterfaceRequest<device::serial::SerialService> request) { if (g_serial_service_test_factory) { - g_serial_service_test_factory->Run(request.Pass()); + g_serial_service_test_factory->Run(std::move(request)); return; } device::SerialServiceImpl::CreateOnMessageLoop( @@ -27,7 +29,7 @@ void BindToSerialServiceRequest( content::BrowserThread::IO), content::BrowserThread::GetMessageLoopProxyForThread( content::BrowserThread::UI), - request.Pass()); + std::move(request)); } void SetSerialServiceFactoryForTest(const base::Callback< diff --git a/extensions/browser/api/socket/socket_api.cc b/extensions/browser/api/socket/socket_api.cc index 5ae29fc..2cb37e7 100644 --- a/extensions/browser/api/socket/socket_api.cc +++ b/extensions/browser/api/socket/socket_api.cc @@ -75,7 +75,7 @@ bool SocketAsyncApiFunction::Respond() { return error_.empty(); } scoped_ptr<SocketResourceManagerInterface> SocketAsyncApiFunction::CreateSocketResourceManager() { return scoped_ptr<SocketResourceManagerInterface>( - new SocketResourceManager<Socket>()).Pass(); + new SocketResourceManager<Socket>()); } int SocketAsyncApiFunction::AddSocket(Socket* socket) { diff --git a/extensions/browser/api/socket/tls_socket.cc b/extensions/browser/api/socket/tls_socket.cc index 54d6fc8..737fb3f 100644 --- a/extensions/browser/api/socket/tls_socket.cc +++ b/extensions/browser/api/socket/tls_socket.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/socket/tls_socket.h" +#include <utility> + #include "base/callback_helpers.h" #include "base/logging.h" #include "extensions/browser/api/api_resource.h" @@ -53,11 +55,11 @@ void TlsConnectDone(scoped_ptr<net::SSLClientSocket> ssl_socket, // API. Set the handle of the socket to the new value, so that it can be // used for read/write/close/etc. scoped_ptr<extensions::TLSSocket> wrapper( - new extensions::TLSSocket(ssl_socket.Pass(), extension_id)); + new extensions::TLSSocket(std::move(ssl_socket), extension_id)); // Caller will end up deleting the prior TCPSocket, once it calls // SetSocket(..,wrapper). - callback.Run(wrapper.Pass(), result); + callback.Run(std::move(wrapper), result); } } // namespace @@ -69,8 +71,8 @@ const char kTLSSocketTypeInvalidError[] = TLSSocket::TLSSocket(scoped_ptr<net::StreamSocket> tls_socket, const std::string& owner_extension_id) - : ResumableTCPSocket(owner_extension_id), tls_socket_(tls_socket.Pass()) { -} + : ResumableTCPSocket(owner_extension_id), + tls_socket_(std::move(tls_socket)) {} TLSSocket::~TLSSocket() { Disconnect(); @@ -196,16 +198,16 @@ void TLSSocket::UpgradeSocketToTLS( << ", IsConnected: " << tcp_socket->IsConnected() << ", HasPendingRead: " << tcp_socket->HasPendingRead(); } - TlsConnectDone( - null_sock.Pass(), extension_id, callback, net::ERR_INVALID_ARGUMENT); + TlsConnectDone(std::move(null_sock), extension_id, callback, + net::ERR_INVALID_ARGUMENT); return; } net::IPEndPoint dest_host_port_pair; if (!tcp_socket->GetPeerAddress(&dest_host_port_pair)) { DVLOG(1) << "Could not get peer address."; - TlsConnectDone( - null_sock.Pass(), extension_id, callback, net::ERR_INVALID_ARGUMENT); + TlsConnectDone(std::move(null_sock), extension_id, callback, + net::ERR_INVALID_ARGUMENT); return; } @@ -218,8 +220,8 @@ void TLSSocket::UpgradeSocketToTLS( // host, using this hostname. if (host_info.family == url::CanonHostInfo::BROKEN) { DVLOG(1) << "Could not canonicalize hostname"; - TlsConnectDone( - null_sock.Pass(), extension_id, callback, net::ERR_INVALID_ARGUMENT); + TlsConnectDone(std::move(null_sock), extension_id, callback, + net::ERR_INVALID_ARGUMENT); return; } @@ -266,7 +268,7 @@ void TLSSocket::UpgradeSocketToTLS( // Create the socket. scoped_ptr<net::SSLClientSocket> ssl_socket( socket_factory->CreateSSLClientSocket( - socket_handle.Pass(), host_and_port, ssl_config, context)); + std::move(socket_handle), host_and_port, ssl_config, context)); DVLOG(1) << "Attempting to secure a connection to " << tcp_socket->hostname() << ":" << dest_host_port_pair.port(); diff --git a/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc b/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc index 0d20cd6..3bef4ca 100644 --- a/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc +++ b/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc @@ -91,7 +91,7 @@ TCPSocketAsyncApiFunction::~TCPSocketAsyncApiFunction() {} scoped_ptr<SocketResourceManagerInterface> TCPSocketAsyncApiFunction::CreateSocketResourceManager() { return scoped_ptr<SocketResourceManagerInterface>( - new SocketResourceManager<ResumableTCPSocket>()).Pass(); + new SocketResourceManager<ResumableTCPSocket>()); } ResumableTCPSocket* TCPSocketAsyncApiFunction::GetTcpSocket(int socket_id) { @@ -104,7 +104,7 @@ TCPSocketExtensionWithDnsLookupFunction:: scoped_ptr<SocketResourceManagerInterface> TCPSocketExtensionWithDnsLookupFunction::CreateSocketResourceManager() { return scoped_ptr<SocketResourceManagerInterface>( - new SocketResourceManager<ResumableTCPSocket>()).Pass(); + new SocketResourceManager<ResumableTCPSocket>()); } ResumableTCPSocket* TCPSocketExtensionWithDnsLookupFunction::GetTcpSocket( diff --git a/extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc b/extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc index b5bbd0c..f11908d 100644 --- a/extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc +++ b/extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/memory/ref_counted.h" #include "base/strings/stringprintf.h" #include "extensions/browser/api/dns/host_resolver_wrapper.h" @@ -64,7 +66,7 @@ IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketsTcpCreateGood) { ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); scoped_ptr<base::DictionaryValue> value = - base::DictionaryValue::From(result.Pass()); + base::DictionaryValue::From(std::move(result)); int socketId = -1; EXPECT_TRUE(value->GetInteger("socketId", &socketId)); ASSERT_TRUE(socketId > 0); diff --git a/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc b/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc index 83124b0..bdc2fbd 100644 --- a/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc +++ b/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.h" +#include <utility> + #include "base/lazy_instance.h" #include "extensions/browser/api/socket/tcp_socket.h" #include "extensions/browser/event_router.h" @@ -133,8 +135,8 @@ void TCPSocketEventDispatcher::ReadCallback( sockets_tcp::OnReceive::Create(receive_info); scoped_ptr<Event> event(new Event(events::SOCKETS_TCP_ON_RECEIVE, sockets_tcp::OnReceive::kEventName, - args.Pass())); - PostEvent(params, event.Pass()); + std::move(args))); + PostEvent(params, std::move(event)); // Post a task to delay the read until the socket is available, as // calling StartReceive at this point would error with ERR_IO_PENDING. @@ -155,8 +157,8 @@ void TCPSocketEventDispatcher::ReadCallback( sockets_tcp::OnReceiveError::Create(receive_error_info); scoped_ptr<Event> event(new Event(events::SOCKETS_TCP_ON_RECEIVE_ERROR, sockets_tcp::OnReceiveError::kEventName, - args.Pass())); - PostEvent(params, event.Pass()); + std::move(args))); + PostEvent(params, std::move(event)); // Since we got an error, the socket is now "paused" until the application // "resumes" it. @@ -173,12 +175,10 @@ void TCPSocketEventDispatcher::PostEvent(const ReadParams& params, scoped_ptr<Event> event) { DCHECK_CURRENTLY_ON(params.thread_id); - BrowserThread::PostTask(BrowserThread::UI, - FROM_HERE, - base::Bind(&DispatchEvent, - params.browser_context_id, - params.extension_id, - base::Passed(event.Pass()))); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(&DispatchEvent, params.browser_context_id, params.extension_id, + base::Passed(std::move(event)))); } // static @@ -194,7 +194,7 @@ void TCPSocketEventDispatcher::DispatchEvent(void* browser_context_id, EventRouter* event_router = EventRouter::Get(context); if (event_router) - event_router->DispatchEventToExtension(extension_id, event.Pass()); + event_router->DispatchEventToExtension(extension_id, std::move(event)); } } // namespace api diff --git a/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc b/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc index 24fad16..981f7f5 100644 --- a/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc +++ b/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc @@ -66,7 +66,7 @@ TCPServerSocketAsyncApiFunction::~TCPServerSocketAsyncApiFunction() {} scoped_ptr<SocketResourceManagerInterface> TCPServerSocketAsyncApiFunction::CreateSocketResourceManager() { return scoped_ptr<SocketResourceManagerInterface>( - new SocketResourceManager<ResumableTCPServerSocket>()).Pass(); + new SocketResourceManager<ResumableTCPServerSocket>()); } ResumableTCPServerSocket* TCPServerSocketAsyncApiFunction::GetTcpSocket( diff --git a/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc b/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc index 51100e5..c54724b 100644 --- a/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc +++ b/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/memory/ref_counted.h" #include "base/strings/stringprintf.h" #include "extensions/browser/api/dns/host_resolver_wrapper.h" @@ -62,7 +64,7 @@ IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPCreateGood) { socket_create_function.get(), "[]", browser_context())); ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); scoped_ptr<base::DictionaryValue> value = - base::DictionaryValue::From(result.Pass()); + base::DictionaryValue::From(std::move(result)); int socketId = -1; EXPECT_TRUE(value->GetInteger("socketId", &socketId)); ASSERT_TRUE(socketId > 0); diff --git a/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc b/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc index b33da6f..d4806a5 100644 --- a/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc +++ b/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h" +#include <utility> + #include "base/lazy_instance.h" #include "extensions/browser/api/socket/tcp_socket.h" #include "extensions/browser/event_router.h" @@ -136,8 +138,8 @@ void TCPServerSocketEventDispatcher::AcceptCallback( sockets_tcp_server::OnAccept::Create(accept_info); scoped_ptr<Event> event(new Event(events::SOCKETS_TCP_SERVER_ON_ACCEPT, sockets_tcp_server::OnAccept::kEventName, - args.Pass())); - PostEvent(params, event.Pass()); + std::move(args))); + PostEvent(params, std::move(event)); // Post a task to delay the "accept" until the socket is available, as // calling StartAccept at this point would error with ERR_IO_PENDING. @@ -153,10 +155,10 @@ void TCPServerSocketEventDispatcher::AcceptCallback( accept_error_info.result_code = result_code; scoped_ptr<base::ListValue> args = sockets_tcp_server::OnAcceptError::Create(accept_error_info); - scoped_ptr<Event> event( - new Event(events::SOCKETS_TCP_SERVER_ON_ACCEPT_ERROR, - sockets_tcp_server::OnAcceptError::kEventName, args.Pass())); - PostEvent(params, event.Pass()); + scoped_ptr<Event> event(new Event( + events::SOCKETS_TCP_SERVER_ON_ACCEPT_ERROR, + sockets_tcp_server::OnAcceptError::kEventName, std::move(args))); + PostEvent(params, std::move(event)); // Since we got an error, the socket is now "paused" until the application // "resumes" it. @@ -173,12 +175,10 @@ void TCPServerSocketEventDispatcher::PostEvent(const AcceptParams& params, scoped_ptr<Event> event) { DCHECK_CURRENTLY_ON(params.thread_id); - BrowserThread::PostTask(BrowserThread::UI, - FROM_HERE, - base::Bind(&DispatchEvent, - params.browser_context_id, - params.extension_id, - base::Passed(event.Pass()))); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(&DispatchEvent, params.browser_context_id, params.extension_id, + base::Passed(std::move(event)))); } // static @@ -194,7 +194,7 @@ void TCPServerSocketEventDispatcher::DispatchEvent( return; EventRouter* router = EventRouter::Get(context); if (router) - router->DispatchEventToExtension(extension_id, event.Pass()); + router->DispatchEventToExtension(extension_id, std::move(event)); } } // namespace api diff --git a/extensions/browser/api/sockets_udp/sockets_udp_api.cc b/extensions/browser/api/sockets_udp/sockets_udp_api.cc index 6832914..7fb9c11 100644 --- a/extensions/browser/api/sockets_udp/sockets_udp_api.cc +++ b/extensions/browser/api/sockets_udp/sockets_udp_api.cc @@ -25,7 +25,7 @@ UDPSocketAsyncApiFunction::~UDPSocketAsyncApiFunction() {} scoped_ptr<SocketResourceManagerInterface> UDPSocketAsyncApiFunction::CreateSocketResourceManager() { return scoped_ptr<SocketResourceManagerInterface>( - new SocketResourceManager<ResumableUDPSocket>()).Pass(); + new SocketResourceManager<ResumableUDPSocket>()); } ResumableUDPSocket* UDPSocketAsyncApiFunction::GetUdpSocket(int socket_id) { @@ -38,7 +38,7 @@ UDPSocketExtensionWithDnsLookupFunction:: scoped_ptr<SocketResourceManagerInterface> UDPSocketExtensionWithDnsLookupFunction::CreateSocketResourceManager() { return scoped_ptr<SocketResourceManagerInterface>( - new SocketResourceManager<ResumableUDPSocket>()).Pass(); + new SocketResourceManager<ResumableUDPSocket>()); } ResumableUDPSocket* UDPSocketExtensionWithDnsLookupFunction::GetUdpSocket( diff --git a/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc b/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc index 2d3d71f..d3391a97 100644 --- a/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc +++ b/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h" +#include <utility> + #include "base/lazy_instance.h" #include "extensions/browser/api/socket/udp_socket.h" #include "extensions/browser/event_router.h" @@ -118,8 +120,8 @@ void UDPSocketEventDispatcher::ReceiveCallback( sockets_udp::OnReceive::Create(receive_info); scoped_ptr<Event> event(new Event(events::SOCKETS_UDP_ON_RECEIVE, sockets_udp::OnReceive::kEventName, - args.Pass())); - PostEvent(params, event.Pass()); + std::move(args))); + PostEvent(params, std::move(event)); // Post a task to delay the read until the socket is available, as // calling StartReceive at this point would error with ERR_IO_PENDING. @@ -140,8 +142,8 @@ void UDPSocketEventDispatcher::ReceiveCallback( sockets_udp::OnReceiveError::Create(receive_error_info); scoped_ptr<Event> event(new Event(events::SOCKETS_UDP_ON_RECEIVE_ERROR, sockets_udp::OnReceiveError::kEventName, - args.Pass())); - PostEvent(params, event.Pass()); + std::move(args))); + PostEvent(params, std::move(event)); // Since we got an error, the socket is now "paused" until the application // "resumes" it. @@ -158,12 +160,10 @@ void UDPSocketEventDispatcher::PostEvent(const ReceiveParams& params, scoped_ptr<Event> event) { DCHECK_CURRENTLY_ON(params.thread_id); - BrowserThread::PostTask(BrowserThread::UI, - FROM_HERE, - base::Bind(&DispatchEvent, - params.browser_context_id, - params.extension_id, - base::Passed(event.Pass()))); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(&DispatchEvent, params.browser_context_id, params.extension_id, + base::Passed(std::move(event)))); } /*static*/ @@ -178,7 +178,7 @@ void UDPSocketEventDispatcher::DispatchEvent(void* browser_context_id, return; EventRouter* router = EventRouter::Get(context); if (router) - router->DispatchEventToExtension(extension_id, event.Pass()); + router->DispatchEventToExtension(extension_id, std::move(event)); } } // namespace api diff --git a/extensions/browser/api/storage/settings_storage_quota_enforcer.cc b/extensions/browser/api/storage/settings_storage_quota_enforcer.cc index 98c299b..9a9e9b7 100644 --- a/extensions/browser/api/storage/settings_storage_quota_enforcer.cc +++ b/extensions/browser/api/storage/settings_storage_quota_enforcer.cc @@ -133,13 +133,13 @@ ValueStore::WriteResult SettingsStorageQuotaEnforcer::Set( WriteResult result = HandleResult(delegate_->Set(options, key, value)); if (!result->status().ok()) - return result.Pass(); + return result; if (usage_calculated_) { used_total_ = new_used_total; used_per_setting_.swap(new_used_per_setting); } - return result.Pass(); + return result; } ValueStore::WriteResult SettingsStorageQuotaEnforcer::Set( @@ -166,14 +166,14 @@ ValueStore::WriteResult SettingsStorageQuotaEnforcer::Set( WriteResult result = HandleResult(delegate_->Set(options, values)); if (!result->status().ok()) - return result.Pass(); + return result; if (usage_calculated_) { used_total_ = new_used_total; used_per_setting_ = new_used_per_setting; } - return result.Pass(); + return result; } ValueStore::WriteResult SettingsStorageQuotaEnforcer::Remove( @@ -181,34 +181,34 @@ ValueStore::WriteResult SettingsStorageQuotaEnforcer::Remove( LazyCalculateUsage(); WriteResult result = HandleResult(delegate_->Remove(key)); if (!result->status().ok()) - return result.Pass(); + return result; Free(key); - return result.Pass(); + return result; } ValueStore::WriteResult SettingsStorageQuotaEnforcer::Remove( const std::vector<std::string>& keys) { WriteResult result = HandleResult(delegate_->Remove(keys)); if (!result->status().ok()) - return result.Pass(); + return result; for (const std::string& key : keys) Free(key); - return result.Pass(); + return result; } ValueStore::WriteResult SettingsStorageQuotaEnforcer::Clear() { LazyCalculateUsage(); WriteResult result = HandleResult(delegate_->Clear()); if (!result->status().ok()) - return result.Pass(); + return result; used_per_setting_.clear(); used_total_ = 0u; - return result.Pass(); + return result; } template <class T> diff --git a/extensions/browser/api/storage/storage_api.cc b/extensions/browser/api/storage/storage_api.cc index 2db23621..2f60176 100644 --- a/extensions/browser/api/storage/storage_api.cc +++ b/extensions/browser/api/storage/storage_api.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/storage/storage_api.h" #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -166,7 +167,7 @@ ExtensionFunction::ResponseValue StorageStorageAreaGetFunction::RunWithStorage( static_cast<base::DictionaryValue*>(input); ValueStore::ReadResult result = storage->Get(GetKeys(*as_dict)); if (!result->status().ok()) { - return UseReadResult(result.Pass()); + return UseReadResult(std::move(result)); } base::DictionaryValue* with_default_values = as_dict->DeepCopy(); diff --git a/extensions/browser/api/storage/storage_frontend.cc b/extensions/browser/api/storage/storage_frontend.cc index bc3687c..26d6ec8 100644 --- a/extensions/browser/api/storage/storage_frontend.cc +++ b/extensions/browser/api/storage/storage_frontend.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/storage/storage_frontend.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/files/file_path.h" @@ -49,9 +51,9 @@ class DefaultObserver : public SettingsObserver { settings_namespace))); scoped_ptr<Event> event(new Event(events::STORAGE_ON_CHANGED, api::storage::OnChanged::kEventName, - args.Pass())); + std::move(args))); EventRouter::Get(browser_context_) - ->DispatchEventToExtension(extension_id, event.Pass()); + ->DispatchEventToExtension(extension_id, std::move(event)); } private: diff --git a/extensions/browser/api/storage/storage_frontend_unittest.cc b/extensions/browser/api/storage/storage_frontend_unittest.cc index aa949e8..a434a3c 100644 --- a/extensions/browser/api/storage/storage_frontend_unittest.cc +++ b/extensions/browser/api/storage/storage_frontend_unittest.cc @@ -60,8 +60,8 @@ class ExtensionSettingsFrontendTest : public ExtensionsTest { protected: void ResetFrontend() { storage_factory_->Reset(new LeveldbSettingsStorageFactory()); - frontend_ = StorageFrontend::CreateForTesting(storage_factory_, - browser_context()).Pass(); + frontend_ = + StorageFrontend::CreateForTesting(storage_factory_, browser_context()); } base::ScopedTempDir temp_dir_; diff --git a/extensions/browser/api/system_display/system_display_apitest.cc b/extensions/browser/api/system_display/system_display_apitest.cc index 6d0c173..bab3988 100644 --- a/extensions/browser/api/system_display/system_display_apitest.cc +++ b/extensions/browser/api/system_display/system_display_apitest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/debug/leak_annotations.h" #include "base/strings/string_number_conversions.h" #include "extensions/browser/api/system_display/display_info_provider.h" @@ -89,7 +91,7 @@ class MockDisplayInfoProvider : public DisplayInfoProvider { } scoped_ptr<base::DictionaryValue> GetSetInfoValue() { - return set_info_value_.Pass(); + return std::move(set_info_value_); } std::string GetSetInfoDisplayId() const { return set_info_display_id_; } diff --git a/extensions/browser/api/system_info/system_info_api.cc b/extensions/browser/api/system_info/system_info_api.cc index a7c7fac..6a468bc 100644 --- a/extensions/browser/api/system_info/system_info_api.cc +++ b/extensions/browser/api/system_info/system_info_api.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/system_info/system_info_api.h" #include <set> +#include <utility> #include "base/bind.h" #include "base/lazy_instance.h" @@ -166,7 +167,7 @@ void SystemInfoEventRouter::OnRemovableStorageAttached( scoped_ptr<base::ListValue> args(new base::ListValue); args->Append(unit.ToValue().release()); DispatchEvent(events::SYSTEM_STORAGE_ON_ATTACHED, - system_storage::OnAttached::kEventName, args.Pass()); + system_storage::OnAttached::kEventName, std::move(args)); } void SystemInfoEventRouter::OnRemovableStorageDetached( @@ -178,7 +179,7 @@ void SystemInfoEventRouter::OnRemovableStorageDetached( args->AppendString(transient_id); DispatchEvent(events::SYSTEM_STORAGE_ON_DETACHED, - system_storage::OnDetached::kEventName, args.Pass()); + system_storage::OnDetached::kEventName, std::move(args)); } void SystemInfoEventRouter::OnDisplayAdded(const gfx::Display& new_display) { @@ -197,7 +198,7 @@ void SystemInfoEventRouter::OnDisplayMetricsChanged(const gfx::Display& display, void SystemInfoEventRouter::OnDisplayChanged() { scoped_ptr<base::ListValue> args(new base::ListValue()); DispatchEvent(events::SYSTEM_DISPLAY_ON_DISPLAY_CHANGED, - system_display::OnDisplayChanged::kEventName, args.Pass()); + system_display::OnDisplayChanged::kEventName, std::move(args)); } void SystemInfoEventRouter::DispatchEvent( @@ -205,7 +206,7 @@ void SystemInfoEventRouter::DispatchEvent( const std::string& event_name, scoped_ptr<base::ListValue> args) { ExtensionsBrowserClient::Get()->BroadcastEventToRenderers( - histogram_value, event_name, args.Pass()); + histogram_value, event_name, std::move(args)); } void AddEventListener(const std::string& event_name) { diff --git a/extensions/browser/api/usb/usb_api.cc b/extensions/browser/api/usb/usb_api.cc index 6979868..2af2878 100644 --- a/extensions/browser/api/usb/usb_api.cc +++ b/extensions/browser/api/usb/usb_api.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/usb/usb_api.h" #include <string> +#include <utility> #include <vector> #include "base/barrier_closure.h" @@ -463,12 +464,12 @@ void UsbTransferFunction::OnCompleted(UsbTransferStatus status, data->data(), length)); if (status == device::USB_TRANSFER_COMPLETED) { - Respond(OneArgument(transfer_info.Pass())); + Respond(OneArgument(std::move(transfer_info))); } else { scoped_ptr<base::ListValue> error_args(new base::ListValue()); - error_args->Append(transfer_info.Pass()); + error_args->Append(std::move(transfer_info)); // Returning arguments with an error is wrong but we're stuck with it. - Respond(ErrorWithArguments(error_args.Pass(), + Respond(ErrorWithArguments(std::move(error_args), ConvertTransferStatusToApi(status))); } } @@ -536,7 +537,7 @@ void UsbFindDevicesFunction::OnDeviceOpened( } void UsbFindDevicesFunction::OpenComplete() { - Respond(OneArgument(result_.Pass())); + Respond(OneArgument(std::move(result_))); } UsbGetDevicesFunction::UsbGetDevicesFunction() { @@ -588,7 +589,7 @@ void UsbGetDevicesFunction::OnGetDevicesComplete( } } - Respond(OneArgument(result.Pass())); + Respond(OneArgument(std::move(result))); } UsbGetUserSelectedDevicesFunction::UsbGetUserSelectedDevicesFunction() { @@ -642,7 +643,7 @@ void UsbGetUserSelectedDevicesFunction::OnDevicesChosen( result->Append(api_device.ToValue()); } - Respond(OneArgument(result.Pass())); + Respond(OneArgument(std::move(result))); } UsbGetConfigurationsFunction::UsbGetConfigurationsFunction() {} @@ -687,7 +688,7 @@ ExtensionFunction::ResponseAction UsbGetConfigurationsFunction::Run() { } configs->Append(api_config.ToValue()); } - return RespondNow(OneArgument(configs.Pass())); + return RespondNow(OneArgument(std::move(configs))); } UsbRequestAccessFunction::UsbRequestAccessFunction() { @@ -845,7 +846,7 @@ ExtensionFunction::ResponseAction UsbListInterfacesFunction::Run() { result->Append(config.interfaces[i]->ToValue()); } - return RespondNow(OneArgument(result.Pass())); + return RespondNow(OneArgument(std::move(result))); } else { return RespondNow(Error(kErrorNotConfigured)); } @@ -1210,7 +1211,7 @@ void UsbResetDeviceFunction::OnComplete(bool success) { scoped_ptr<base::ListValue> error_args(new base::ListValue()); error_args->AppendBoolean(false); // Returning arguments with an error is wrong but we're stuck with it. - Respond(ErrorWithArguments(error_args.Pass(), kErrorResetDevice)); + Respond(ErrorWithArguments(std::move(error_args), kErrorResetDevice)); } } diff --git a/extensions/browser/api/usb/usb_event_router.cc b/extensions/browser/api/usb/usb_event_router.cc index cb6a518..8c8acdd 100644 --- a/extensions/browser/api/usb/usb_event_router.cc +++ b/extensions/browser/api/usb/usb_event_router.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/usb/usb_event_router.h" +#include <utility> + #include "device/core/device_client.h" #include "device/usb/usb_device.h" #include "extensions/browser/api/device_permissions_manager.h" @@ -117,7 +119,7 @@ void UsbEventRouter::DispatchEvent(const std::string& event_name, event->will_dispatch_callback = base::Bind(&WillDispatchDeviceEvent, device); - event_router->BroadcastEvent(event.Pass()); + event_router->BroadcastEvent(std::move(event)); } } diff --git a/extensions/browser/api/web_request/form_data_parser_unittest.cc b/extensions/browser/api/web_request/form_data_parser_unittest.cc index c848bfa..d01deba 100644 --- a/extensions/browser/api/web_request/form_data_parser_unittest.cc +++ b/extensions/browser/api/web_request/form_data_parser_unittest.cc @@ -19,7 +19,7 @@ scoped_ptr<FormDataParser> InitParser(const std::string& content_type_header) { FormDataParser::CreateFromContentTypeHeader(&content_type_header)); if (parser.get() == NULL) return scoped_ptr<FormDataParser>(); - return parser.Pass(); + return parser; } // Attempts to run the parser corresponding to the |content_type_header| diff --git a/extensions/browser/api/web_request/upload_data_presenter.cc b/extensions/browser/api/web_request/upload_data_presenter.cc index 4c5e100..bdd80d6 100644 --- a/extensions/browser/api/web_request/upload_data_presenter.cc +++ b/extensions/browser/api/web_request/upload_data_presenter.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api/web_request/upload_data_presenter.h" +#include <utility> + #include "base/files/file_path.h" #include "base/strings/string_util.h" #include "base/values.h" @@ -83,7 +85,7 @@ scoped_ptr<base::Value> RawDataPresenter::Result() { if (!success_) return nullptr; - return list_.Pass(); + return std::move(list_); } void RawDataPresenter::FeedNextBytes(const char* bytes, size_t size) { @@ -138,7 +140,7 @@ scoped_ptr<base::Value> ParsedDataPresenter::Result() { if (!success_) return nullptr; - return dictionary_.Pass(); + return std::move(dictionary_); } // static diff --git a/extensions/browser/api/web_request/web_request_api.cc b/extensions/browser/api/web_request/web_request_api.cc index e6c175c..3b08ed5 100644 --- a/extensions/browser/api/web_request/web_request_api.cc +++ b/extensions/browser/api/web_request/web_request_api.cc @@ -5,6 +5,7 @@ #include "extensions/browser/api/web_request/web_request_api.h" #include <algorithm> +#include <utility> #include <vector> #include "base/bind.h" @@ -379,9 +380,9 @@ void SendOnMessageEventOnUI( } scoped_ptr<Event> event(new Event( - histogram_value, event_name, event_args.Pass(), browser_context, GURL(), - EventRouter::USER_GESTURE_UNKNOWN, event_filtering_info)); - event_router->DispatchEventToExtension(extension_id, event.Pass()); + histogram_value, event_name, std::move(event_args), browser_context, + GURL(), EventRouter::USER_GESTURE_UNKNOWN, event_filtering_info)); + event_router->DispatchEventToExtension(extension_id, std::move(event)); } void RemoveEventListenerOnIOThread( @@ -1254,7 +1255,7 @@ bool ExtensionWebRequestEventRouter::DispatchEvent( EventRouter::DispatchEventToSender( listener->ipc_sender.get(), browser_context, listener->extension_id, listener->histogram_value, listener->sub_event_name, - args_filtered.Pass(), EventRouter::USER_GESTURE_UNKNOWN, + std::move(args_filtered), EventRouter::USER_GESTURE_UNKNOWN, EventFilteringInfo()); if (listener->extra_info_spec & (ExtraInfoSpec::BLOCKING | ExtraInfoSpec::ASYNC_BLOCKING)) { @@ -1775,7 +1776,7 @@ scoped_ptr<base::DictionaryValue> SummarizeResponseDelta( SummarizeCookieModifications(delta.response_cookie_modifications)); } - return details.Pass(); + return details; } } // namespace @@ -1803,7 +1804,7 @@ void ExtensionWebRequestEventRouter::LogExtensionActivity( if (web_request_event_router_delegate_) { web_request_event_router_delegate_->LogExtensionActivity( reinterpret_cast<content::BrowserContext*>(browser_context_id), - is_incognito, extension_id, url, api_call, details.Pass()); + is_incognito, extension_id, url, api_call, std::move(details)); } } } @@ -2334,11 +2335,8 @@ bool WebRequestInternalEventHandledFunction::RunSync() { if (value->HasKey("cancel")) { // Don't allow cancel mixed with other keys. if (value->size() != 1) { - RespondWithError(event_name, - sub_event_name, - request_id, - response.Pass(), - keys::kInvalidBlockingResponse); + RespondWithError(event_name, sub_event_name, request_id, + std::move(response), keys::kInvalidBlockingResponse); return false; } @@ -2353,10 +2351,8 @@ bool WebRequestInternalEventHandledFunction::RunSync() { &new_url_str)); response->new_url = GURL(new_url_str); if (!response->new_url.is_valid()) { - RespondWithError(event_name, - sub_event_name, - request_id, - response.Pass(), + RespondWithError(event_name, sub_event_name, request_id, + std::move(response), ErrorUtils::FormatErrorMessage( keys::kInvalidRedirectUrl, new_url_str)); return false; @@ -2368,10 +2364,8 @@ bool WebRequestInternalEventHandledFunction::RunSync() { if (has_request_headers || has_response_headers) { if (has_request_headers && has_response_headers) { // Allow only one of the keys, not both. - RespondWithError(event_name, - sub_event_name, - request_id, - response.Pass(), + RespondWithError(event_name, sub_event_name, request_id, + std::move(response), keys::kInvalidHeaderKeyCombination); return false; } @@ -2398,29 +2392,21 @@ bool WebRequestInternalEventHandledFunction::RunSync() { if (!FromHeaderDictionary(header_value, &name, &value)) { std::string serialized_header; base::JSONWriter::Write(*header_value, &serialized_header); - RespondWithError(event_name, - sub_event_name, - request_id, - response.Pass(), + RespondWithError(event_name, sub_event_name, request_id, + std::move(response), ErrorUtils::FormatErrorMessage(keys::kInvalidHeader, serialized_header)); return false; } if (!net::HttpUtil::IsValidHeaderName(name)) { - RespondWithError(event_name, - sub_event_name, - request_id, - response.Pass(), - keys::kInvalidHeaderName); + RespondWithError(event_name, sub_event_name, request_id, + std::move(response), keys::kInvalidHeaderName); return false; } if (!net::HttpUtil::IsValidHeaderValue(value)) { - RespondWithError(event_name, - sub_event_name, - request_id, - response.Pass(), - ErrorUtils::FormatErrorMessage( - keys::kInvalidHeaderValue, name)); + RespondWithError( + event_name, sub_event_name, request_id, std::move(response), + ErrorUtils::FormatErrorMessage(keys::kInvalidHeaderValue, name)); return false; } if (has_request_headers) diff --git a/extensions/browser/api/web_request/web_request_api_helpers.cc b/extensions/browser/api/web_request/web_request_api_helpers.cc index 35060de..bb47a1a 100644 --- a/extensions/browser/api/web_request/web_request_api_helpers.cc +++ b/extensions/browser/api/web_request/web_request_api_helpers.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <cmath> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -240,7 +241,7 @@ scoped_ptr<base::Value> NetLogModificationCallback( deleted_headers->Append(new base::StringValue(*key)); } dict->Set("deleted_headers", deleted_headers); - return dict.Pass(); + return std::move(dict); } bool InDecreasingExtensionInstallationTimeOrder( diff --git a/extensions/browser/api_test_utils.cc b/extensions/browser/api_test_utils.cc index 83ed5fc..7d53624 100644 --- a/extensions/browser/api_test_utils.cc +++ b/extensions/browser/api_test_utils.cc @@ -4,6 +4,8 @@ #include "extensions/browser/api_test_utils.h" +#include <utility> + #include "base/json/json_reader.h" #include "base/memory/scoped_ptr.h" #include "base/values.h" @@ -131,7 +133,7 @@ base::Value* RunFunctionWithDelegateAndReturnSingleResult( content::BrowserContext* context, scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher) { return RunFunctionWithDelegateAndReturnSingleResult( - function, args, context, dispatcher.Pass(), NONE); + function, args, context, std::move(dispatcher), NONE); } base::Value* RunFunctionWithDelegateAndReturnSingleResult( @@ -143,7 +145,7 @@ base::Value* RunFunctionWithDelegateAndReturnSingleResult( scoped_refptr<ExtensionFunction> function_owner(function); // Without a callback the function will not generate a result. function->set_has_callback(true); - RunFunction(function, args, context, dispatcher.Pass(), flags); + RunFunction(function, args, context, std::move(dispatcher), flags); EXPECT_TRUE(function->GetError().empty()) << "Unexpected error: " << function->GetError(); const base::Value* single_result = NULL; @@ -170,7 +172,7 @@ base::Value* RunFunctionAndReturnSingleResult( new ExtensionFunctionDispatcher(context)); return RunFunctionWithDelegateAndReturnSingleResult( - function, args, context, dispatcher.Pass(), flags); + function, args, context, std::move(dispatcher), flags); } std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function, @@ -188,7 +190,7 @@ std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function, scoped_refptr<ExtensionFunction> function_owner(function); // Without a callback the function will not generate a result. function->set_has_callback(true); - RunFunction(function, args, context, dispatcher.Pass(), flags); + RunFunction(function, args, context, std::move(dispatcher), flags); EXPECT_FALSE(function->GetResultList()) << "Did not expect a result"; return function->GetError(); } @@ -198,7 +200,7 @@ bool RunFunction(UIThreadExtensionFunction* function, content::BrowserContext* context) { scoped_ptr<ExtensionFunctionDispatcher> dispatcher( new ExtensionFunctionDispatcher(context)); - return RunFunction(function, args, context, dispatcher.Pass(), NONE); + return RunFunction(function, args, context, std::move(dispatcher), NONE); } bool RunFunction(UIThreadExtensionFunction* function, @@ -209,8 +211,8 @@ bool RunFunction(UIThreadExtensionFunction* function, scoped_ptr<base::ListValue> parsed_args = ParseList(args); EXPECT_TRUE(parsed_args.get()) << "Could not parse extension function arguments: " << args; - return RunFunction( - function, parsed_args.Pass(), context, dispatcher.Pass(), flags); + return RunFunction(function, std::move(parsed_args), context, + std::move(dispatcher), flags); } bool RunFunction(UIThreadExtensionFunction* function, diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc index 4a508fc..98c21f3 100644 --- a/extensions/browser/app_window/app_window.cc +++ b/extensions/browser/app_window/app_window.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include <vector> #include "base/callback_helpers.h" @@ -574,7 +575,7 @@ void AppWindow::SetAppIconUrl(const GURL& url) { } void AppWindow::UpdateShape(scoped_ptr<SkRegion> region) { - native_app_window_->UpdateShape(region.Pass()); + native_app_window_->UpdateShape(std::move(region)); } void AppWindow::UpdateDraggableRegions( diff --git a/extensions/browser/app_window/app_window.h b/extensions/browser/app_window/app_window.h index b0a0c8e..0654073 100644 --- a/extensions/browser/app_window/app_window.h +++ b/extensions/browser/app_window/app_window.h @@ -6,6 +6,7 @@ #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_H_ #include <string> +#include <utility> #include <vector> #include "base/memory/scoped_ptr.h" @@ -361,7 +362,7 @@ class AppWindow : public content::WebContentsDelegate, bool is_ime_window() const { return is_ime_window_; } void SetAppWindowContentsForTesting(scoped_ptr<AppWindowContents> contents) { - app_window_contents_ = contents.Pass(); + app_window_contents_ = std::move(contents); } protected: diff --git a/extensions/browser/app_window/app_window_geometry_cache.cc b/extensions/browser/app_window/app_window_geometry_cache.cc index 4b3bb48..1413ce7 100644 --- a/extensions/browser/app_window/app_window_geometry_cache.cc +++ b/extensions/browser/app_window/app_window_geometry_cache.cc @@ -4,6 +4,8 @@ #include "extensions/browser/app_window/app_window_geometry_cache.h" +#include <utility> + #include "base/bind.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" @@ -132,7 +134,7 @@ void AppWindowGeometryCache::SyncToStorage() { OnGeometryCacheChanged(extension_id, it->first, bounds)); } - prefs_->SetGeometryCache(extension_id, dict.Pass()); + prefs_->SetGeometryCache(extension_id, std::move(dict)); } } diff --git a/extensions/browser/app_window/app_window_geometry_cache_unittest.cc b/extensions/browser/app_window/app_window_geometry_cache_unittest.cc index 1b42ec1..426d4af 100644 --- a/extensions/browser/app_window/app_window_geometry_cache_unittest.cc +++ b/extensions/browser/app_window/app_window_geometry_cache_unittest.cc @@ -4,6 +4,8 @@ #include "extensions/browser/app_window/app_window_geometry_cache.h" +#include <utility> + #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "base/prefs/mock_pref_change_callback.h" @@ -88,7 +90,7 @@ void AppWindowGeometryCacheTest::SetUp() { new user_prefs::PrefRegistrySyncable; // Prefs should be registered before the PrefService is created. ExtensionPrefs::RegisterProfilePrefs(pref_registry); - pref_service_ = factory.Create(pref_registry).Pass(); + pref_service_ = factory.Create(pref_registry); extension_prefs_.reset(ExtensionPrefs::Create( browser_context(), pref_service_.get(), @@ -128,7 +130,7 @@ void AppWindowGeometryCacheTest::AddGeometryAndLoadExtension( value->SetInteger("screen_bounds_h", screen_bounds.height()); value->SetInteger("state", state); dict->SetWithoutPathExpansion(window_id, value); - extension_prefs_->SetGeometryCache(extension_id, dict.Pass()); + extension_prefs_->SetGeometryCache(extension_id, std::move(dict)); LoadExtension(extension_id); } diff --git a/extensions/browser/content_verifier.cc b/extensions/browser/content_verifier.cc index 3c77892..ea464e81 100644 --- a/extensions/browser/content_verifier.cc +++ b/extensions/browser/content_verifier.cc @@ -5,6 +5,7 @@ #include "extensions/browser/content_verifier.h" #include <algorithm> +#include <utility> #include "base/files/file_path.h" #include "base/stl_util.h" @@ -165,7 +166,7 @@ void ContentVerifier::OnExtensionLoaded( scoped_ptr<ContentVerifierIOData::ExtensionData> data( new ContentVerifierIOData::ExtensionData( - image_paths.Pass(), + std::move(image_paths), extension->version() ? *extension->version() : base::Version())); content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, diff --git a/extensions/browser/content_verifier_io_data.cc b/extensions/browser/content_verifier_io_data.cc index 102c95b..d3353be 100644 --- a/extensions/browser/content_verifier_io_data.cc +++ b/extensions/browser/content_verifier_io_data.cc @@ -4,6 +4,8 @@ #include "extensions/browser/content_verifier_io_data.h" +#include <utility> + #include "content/public/browser/browser_thread.h" namespace extensions { @@ -11,7 +13,7 @@ namespace extensions { ContentVerifierIOData::ExtensionData::ExtensionData( scoped_ptr<std::set<base::FilePath>> browser_image_paths, const base::Version& version) { - this->browser_image_paths = browser_image_paths.Pass(); + this->browser_image_paths = std::move(browser_image_paths); this->version = version; } diff --git a/extensions/browser/error_map.cc b/extensions/browser/error_map.cc index b0083a8..66ca350 100644 --- a/extensions/browser/error_map.cc +++ b/extensions/browser/error_map.cc @@ -4,6 +4,8 @@ #include "extensions/browser/error_map.h" +#include <utility> + #include "base/lazy_instance.h" #include "base/stl_util.h" @@ -183,7 +185,7 @@ const ExtensionError* ErrorMap::AddError(scoped_ptr<ExtensionError> error) { iter = map_.insert(std::pair<std::string, ExtensionEntry*>( error->extension_id(), new ExtensionEntry)).first; } - return iter->second->AddError(error.Pass()); + return iter->second->AddError(std::move(error)); } void ErrorMap::RemoveErrors(const Filter& filter, diff --git a/extensions/browser/error_map_unittest.cc b/extensions/browser/error_map_unittest.cc index 07c6f58..0aa6385 100644 --- a/extensions/browser/error_map_unittest.cc +++ b/extensions/browser/error_map_unittest.cc @@ -4,6 +4,8 @@ #include "extensions/browser/error_map.h" +#include <utility> + #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/strings/string_number_conversions.h" @@ -150,7 +152,7 @@ TEST_F(ErrorMapUnitTest, DuplicateErrorsAreReplaced) { scoped_ptr<ExtensionError> runtime_error2 = CreateNewRuntimeError(kId, base::UintToString(1u)); const ExtensionError* weak_error = runtime_error2.get(); - ASSERT_TRUE(errors_.AddError(runtime_error2.Pass())); + ASSERT_TRUE(errors_.AddError(std::move(runtime_error2))); // We should only have three errors stored, since two of the four reported // were identical, and the older should have been replaced. diff --git a/extensions/browser/event_listener_map.cc b/extensions/browser/event_listener_map.cc index 8d1f5ca..1e1f3bf 100644 --- a/extensions/browser/event_listener_map.cc +++ b/extensions/browser/event_listener_map.cc @@ -4,6 +4,8 @@ #include "extensions/browser/event_listener_map.h" +#include <utility> + #include "base/values.h" #include "content/public/browser/render_process_host.h" #include "extensions/browser/event_router.h" @@ -22,8 +24,8 @@ scoped_ptr<EventListener> EventListener::ForExtension( const std::string& extension_id, content::RenderProcessHost* process, scoped_ptr<base::DictionaryValue> filter) { - return make_scoped_ptr(new EventListener( - event_name, extension_id, GURL(), process, filter.Pass())); + return make_scoped_ptr(new EventListener(event_name, extension_id, GURL(), + process, std::move(filter))); } // static @@ -32,8 +34,8 @@ scoped_ptr<EventListener> EventListener::ForURL( const GURL& listener_url, content::RenderProcessHost* process, scoped_ptr<base::DictionaryValue> filter) { - return make_scoped_ptr( - new EventListener(event_name, "", listener_url, process, filter.Pass())); + return make_scoped_ptr(new EventListener(event_name, "", listener_url, + process, std::move(filter))); } EventListener::~EventListener() {} @@ -53,8 +55,9 @@ scoped_ptr<EventListener> EventListener::Copy() const { scoped_ptr<DictionaryValue> filter_copy; if (filter_) filter_copy.reset(filter_->DeepCopy()); - return scoped_ptr<EventListener>(new EventListener( - event_name_, extension_id_, listener_url_, process_, filter_copy.Pass())); + return scoped_ptr<EventListener>(new EventListener(event_name_, extension_id_, + listener_url_, process_, + std::move(filter_copy))); } bool EventListener::IsLazy() const { @@ -78,9 +81,8 @@ EventListener::EventListener(const std::string& event_name, extension_id_(extension_id), listener_url_(listener_url), process_(process), - filter_(filter.Pass()), - matcher_id_(-1) { -} + filter_(std::move(filter)), + matcher_id_(-1) {} EventListenerMap::EventListenerMap(Delegate* delegate) : delegate_(delegate) { @@ -93,8 +95,8 @@ bool EventListenerMap::AddListener(scoped_ptr<EventListener> listener) { return false; if (listener->filter()) { scoped_ptr<EventMatcher> matcher(ParseEventMatcher(listener->filter())); - MatcherID id = - event_filter_.AddEventMatcher(listener->event_name(), matcher.Pass()); + MatcherID id = event_filter_.AddEventMatcher(listener->event_name(), + std::move(matcher)); listener->set_matcher_id(id); listeners_by_matcher_id_[id] = listener.get(); filtered_events_.insert(listener->event_name()); diff --git a/extensions/browser/event_listener_map_unittest.cc b/extensions/browser/event_listener_map_unittest.cc index c82e36f..0fa17d0 100644 --- a/extensions/browser/event_listener_map_unittest.cc +++ b/extensions/browser/event_listener_map_unittest.cc @@ -54,7 +54,7 @@ class EventListenerMapTest : public testing::Test { filter_list->Append(filter_dict.release()); filter->Set("url", filter_list.release()); - return filter.Pass(); + return filter; } scoped_ptr<Event> CreateNamedEvent(const std::string& event_name) { @@ -68,7 +68,7 @@ class EventListenerMapTest : public testing::Test { scoped_ptr<Event> result(new Event( events::FOR_TEST, event_name, make_scoped_ptr(new ListValue()), NULL, GURL(), EventRouter::USER_GESTURE_UNKNOWN, info)); - return result.Pass(); + return result; } protected: diff --git a/extensions/browser/event_router.cc b/extensions/browser/event_router.cc index 649856d..801923b 100644 --- a/extensions/browser/event_router.cc +++ b/extensions/browser/event_router.cc @@ -77,7 +77,7 @@ void NotifyEventDispatched(void* browser_context_id, ApiActivityMonitor* monitor = ExtensionsBrowserClient::Get()->GetApiActivityMonitor(context); if (monitor) - monitor->OnApiEventDispatched(extension_id, event_name, args.Pass()); + monitor->OnApiEventDispatched(extension_id, event_name, std::move(args)); } // A global identifier used to distinguish extension events. @@ -480,7 +480,7 @@ void EventRouter::DispatchEventWithLazyListener(const std::string& extension_id, bool has_listener = ExtensionHasEventListener(extension_id, event_name); if (!has_listener) AddLazyEventListener(event_name, extension_id); - DispatchEventToExtension(extension_id, event.Pass()); + DispatchEventToExtension(extension_id, std::move(event)); if (!has_listener) RemoveLazyEventListener(event_name, extension_id); } @@ -850,7 +850,7 @@ void EventRouter::OnExtensionUnloaded(content::BrowserContext* browser_context, Event::Event(events::HistogramValue histogram_value, const std::string& event_name, scoped_ptr<base::ListValue> event_args) - : Event(histogram_value, event_name, event_args.Pass(), nullptr) {} + : Event(histogram_value, event_name, std::move(event_args), nullptr) {} Event::Event(events::HistogramValue histogram_value, const std::string& event_name, @@ -858,7 +858,7 @@ Event::Event(events::HistogramValue histogram_value, BrowserContext* restrict_to_browser_context) : Event(histogram_value, event_name, - event_args.Pass(), + std::move(event_args), restrict_to_browser_context, GURL(), EventRouter::USER_GESTURE_UNKNOWN, @@ -873,7 +873,7 @@ Event::Event(events::HistogramValue histogram_value, const EventFilteringInfo& filter_info) : histogram_value(histogram_value), event_name(event_name), - event_args(event_args_tmp.Pass()), + event_args(std::move(event_args_tmp)), restrict_to_browser_context(restrict_to_browser_context), event_url(event_url), user_gesture(user_gesture), diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc index 83747f8..153d1f7 100644 --- a/extensions/browser/extension_function.cc +++ b/extensions/browser/extension_function.cc @@ -4,6 +4,8 @@ #include "extensions/browser/extension_function.h" +#include <utility> + #include "base/logging.h" #include "base/memory/singleton.h" #include "base/synchronization/lock.h" @@ -43,7 +45,7 @@ class ArgumentListResponseValue << "The best way to fix this problem is to exclusively use " << title_ << "(). SetResult() and |result_| are deprecated."; } else { - function->SetResultList(result.Pass()); + function->SetResultList(std::move(result)); } // It would be nice to DCHECK(error.empty()) but some legacy extension // function implementations... I'm looking at chrome.input.ime... do this @@ -69,7 +71,7 @@ class ErrorWithArgumentsResponseValue : public ArgumentListResponseValue { : ArgumentListResponseValue(function_name, title, function, - result.Pass()) { + std::move(result)) { function->SetError(error); } @@ -108,7 +110,7 @@ class RespondNowAction : public ExtensionFunction::ResponseActionObject { typedef base::Callback<void(bool)> SendResponseCallback; RespondNowAction(ExtensionFunction::ResponseValue result, const SendResponseCallback& send_response) - : result_(result.Pass()), send_response_(send_response) {} + : result_(std::move(result)), send_response_(send_response) {} ~RespondNowAction() override {} void Execute() override { send_response_.Run(result_->Apply()); } @@ -261,11 +263,11 @@ void ExtensionFunction::SetResult(base::Value* result) { void ExtensionFunction::SetResult(scoped_ptr<base::Value> result) { results_.reset(new base::ListValue()); - results_->Append(result.Pass()); + results_->Append(std::move(result)); } void ExtensionFunction::SetResultList(scoped_ptr<base::ListValue> results) { - results_ = results.Pass(); + results_ = std::move(results); } const base::ListValue* ExtensionFunction::GetResultList() const { @@ -293,8 +295,8 @@ ExtensionFunction::ResponseValue ExtensionFunction::OneArgument( base::Value* arg) { scoped_ptr<base::ListValue> args(new base::ListValue()); args->Append(arg); - return ResponseValue( - new ArgumentListResponseValue(name(), "OneArgument", this, args.Pass())); + return ResponseValue(new ArgumentListResponseValue(name(), "OneArgument", + this, std::move(args))); } ExtensionFunction::ResponseValue ExtensionFunction::OneArgument( @@ -308,14 +310,14 @@ ExtensionFunction::ResponseValue ExtensionFunction::TwoArguments( scoped_ptr<base::ListValue> args(new base::ListValue()); args->Append(arg1); args->Append(arg2); - return ResponseValue( - new ArgumentListResponseValue(name(), "TwoArguments", this, args.Pass())); + return ResponseValue(new ArgumentListResponseValue(name(), "TwoArguments", + this, std::move(args))); } ExtensionFunction::ResponseValue ExtensionFunction::ArgumentList( scoped_ptr<base::ListValue> args) { - return ResponseValue( - new ArgumentListResponseValue(name(), "ArgumentList", this, args.Pass())); + return ResponseValue(new ArgumentListResponseValue(name(), "ArgumentList", + this, std::move(args))); } ExtensionFunction::ResponseValue ExtensionFunction::Error( @@ -351,7 +353,7 @@ ExtensionFunction::ResponseValue ExtensionFunction::ErrorWithArguments( scoped_ptr<base::ListValue> args, const std::string& error) { return ResponseValue(new ErrorWithArgumentsResponseValue( - name(), "ErrorWithArguments", this, args.Pass(), error)); + name(), "ErrorWithArguments", this, std::move(args), error)); } ExtensionFunction::ResponseValue ExtensionFunction::BadMessage() { @@ -361,7 +363,7 @@ ExtensionFunction::ResponseValue ExtensionFunction::BadMessage() { ExtensionFunction::ResponseAction ExtensionFunction::RespondNow( ResponseValue result) { return ResponseAction(new RespondNowAction( - result.Pass(), base::Bind(&ExtensionFunction::SendResponse, this))); + std::move(result), base::Bind(&ExtensionFunction::SendResponse, this))); } ExtensionFunction::ResponseAction ExtensionFunction::RespondLater() { @@ -536,7 +538,8 @@ SyncExtensionFunction::~SyncExtensionFunction() { } ExtensionFunction::ResponseAction SyncExtensionFunction::Run() { - return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); + return RespondNow(RunSync() ? ArgumentList(std::move(results_)) + : Error(error_)); } // static @@ -551,7 +554,8 @@ SyncIOThreadExtensionFunction::~SyncIOThreadExtensionFunction() { } ExtensionFunction::ResponseAction SyncIOThreadExtensionFunction::Run() { - return RespondNow(RunSync() ? ArgumentList(results_.Pass()) : Error(error_)); + return RespondNow(RunSync() ? ArgumentList(std::move(results_)) + : Error(error_)); } // static diff --git a/extensions/browser/extension_function_dispatcher.cc b/extensions/browser/extension_function_dispatcher.cc index 60a3ce8a5..bcd8859 100644 --- a/extensions/browser/extension_function_dispatcher.cc +++ b/extensions/browser/extension_function_dispatcher.cc @@ -4,6 +4,8 @@ #include "extensions/browser/extension_function_dispatcher.h" +#include <utility> + #include "base/bind.h" #include "base/json/json_string_value_serializer.h" #include "base/lazy_instance.h" @@ -69,7 +71,7 @@ void NotifyApiFunctionCalled(const std::string& extension_id, ApiActivityMonitor* monitor = ExtensionsBrowserClient::Get()->GetApiActivityMonitor(browser_context); if (monitor) - monitor->OnApiFunctionCalled(extension_id, api_name, args.Pass()); + monitor->OnApiFunctionCalled(extension_id, api_name, std::move(args)); } // Separate copy of ExtensionAPI used for IO thread extension functions. We need @@ -282,9 +284,7 @@ void ExtensionFunctionDispatcher::DispatchOnIOThread( base::TimeTicks::Now()); if (violation_error.empty()) { scoped_ptr<base::ListValue> args(params.arguments.DeepCopy()); - NotifyApiFunctionCalled(extension->id(), - params.name, - args.Pass(), + NotifyApiFunctionCalled(extension->id(), params.name, std::move(args), static_cast<content::BrowserContext*>(profile_id)); UMA_HISTOGRAM_SPARSE_SLOWLY("Extensions.FunctionCalls", function->histogram_value()); @@ -395,8 +395,8 @@ void ExtensionFunctionDispatcher::DispatchWithCallbackInternal( // See crbug.com/39178. ExtensionsBrowserClient::Get()->PermitExternalProtocolHandler(); - NotifyApiFunctionCalled( - extension->id(), params.name, args.Pass(), browser_context_); + NotifyApiFunctionCalled(extension->id(), params.name, std::move(args), + browser_context_); UMA_HISTOGRAM_SPARSE_SLOWLY("Extensions.FunctionCalls", function->histogram_value()); tracked_objects::ScopedProfile scoped_profile( diff --git a/extensions/browser/extension_prefs.cc b/extensions/browser/extension_prefs.cc index e7436f8..466a5da 100644 --- a/extensions/browser/extension_prefs.cc +++ b/extensions/browser/extension_prefs.cc @@ -5,6 +5,7 @@ #include "extensions/browser/extension_prefs.h" #include <iterator> +#include <utility> #include "base/metrics/histogram_macros.h" #include "base/prefs/pref_service.h" @@ -349,7 +350,7 @@ ExtensionPrefs* ExtensionPrefs::Create( const std::vector<ExtensionPrefsObserver*>& early_observers, scoped_ptr<TimeProvider> time_provider) { return new ExtensionPrefs(browser_context, pref_service, root_dir, - extension_pref_value_map, time_provider.Pass(), + extension_pref_value_map, std::move(time_provider), extensions_disabled, early_observers); } @@ -1347,7 +1348,7 @@ ExtensionPrefs::GetInstalledExtensionsInfo() const { extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); } - return extensions_info.Pass(); + return extensions_info; } scoped_ptr<ExtensionPrefs::ExtensionsInfo> @@ -1370,7 +1371,7 @@ ExtensionPrefs::GetUninstalledExtensionsInfo() const { extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); } - return extensions_info.Pass(); + return extensions_info; } void ExtensionPrefs::SetDelayedInstallInfo( @@ -1500,7 +1501,7 @@ scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs:: extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release())); } - return extensions_info.Pass(); + return extensions_info; } bool ExtensionPrefs::WasAppDraggedByUser( @@ -1831,7 +1832,7 @@ ExtensionPrefs::ExtensionPrefs( prefs_(prefs), install_directory_(root_dir), extension_pref_value_map_(extension_pref_value_map), - time_provider_(time_provider.Pass()), + time_provider_(std::move(time_provider)), extensions_disabled_(extensions_disabled) { MakePathsRelative(); diff --git a/extensions/browser/extension_prefs_factory.cc b/extensions/browser/extension_prefs_factory.cc index e809bf1..e110bad 100644 --- a/extensions/browser/extension_prefs_factory.cc +++ b/extensions/browser/extension_prefs_factory.cc @@ -2,6 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "extensions/browser/extension_prefs_factory.h" + +#include <utility> + #include "base/command_line.h" #include "base/prefs/pref_service.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" @@ -9,7 +13,6 @@ #include "extensions/browser/extension_pref_value_map.h" #include "extensions/browser/extension_pref_value_map_factory.h" #include "extensions/browser/extension_prefs.h" -#include "extensions/browser/extension_prefs_factory.h" #include "extensions/browser/extensions_browser_client.h" #include "extensions/common/constants.h" @@ -31,7 +34,7 @@ void ExtensionPrefsFactory::SetInstanceForTesting( content::BrowserContext* context, scoped_ptr<ExtensionPrefs> prefs) { Disassociate(context); - Associate(context, prefs.Pass()); + Associate(context, std::move(prefs)); } ExtensionPrefsFactory::ExtensionPrefsFactory() diff --git a/extensions/browser/extension_registry.cc b/extensions/browser/extension_registry.cc index 9be2e70..49c499a 100644 --- a/extensions/browser/extension_registry.cc +++ b/extensions/browser/extension_registry.cc @@ -21,7 +21,7 @@ ExtensionRegistry* ExtensionRegistry::Get(content::BrowserContext* context) { scoped_ptr<ExtensionSet> ExtensionRegistry::GenerateInstalledExtensionsSet() const { - return GenerateInstalledExtensionsSet(EVERYTHING).Pass(); + return GenerateInstalledExtensionsSet(EVERYTHING); } scoped_ptr<ExtensionSet> ExtensionRegistry::GenerateInstalledExtensionsSet( @@ -37,7 +37,7 @@ scoped_ptr<ExtensionSet> ExtensionRegistry::GenerateInstalledExtensionsSet( installed_extensions->InsertAll(blacklisted_extensions_); if (include_mask & IncludeFlag::BLOCKED) installed_extensions->InsertAll(blocked_extensions_); - return installed_extensions.Pass(); + return installed_extensions; } void ExtensionRegistry::AddObserver(ExtensionRegistryObserver* observer) { diff --git a/extensions/browser/extension_throttle_entry.cc b/extensions/browser/extension_throttle_entry.cc index 963c70f..14fc057 100644 --- a/extensions/browser/extension_throttle_entry.cc +++ b/extensions/browser/extension_throttle_entry.cc @@ -5,6 +5,7 @@ #include "extensions/browser/extension_throttle_entry.h" #include <cmath> +#include <utility> #include "base/logging.h" #include "base/rand_util.h" @@ -55,7 +56,7 @@ scoped_ptr<base::Value> NetLogRejectedRequestCallback( dict->SetInteger("num_failures", num_failures); dict->SetInteger("release_after_ms", static_cast<int>(release_after.InMilliseconds())); - return dict.Pass(); + return std::move(dict); } ExtensionThrottleEntry::ExtensionThrottleEntry( diff --git a/extensions/browser/extension_throttle_manager.cc b/extensions/browser/extension_throttle_manager.cc index f59b1b3..6a9f253 100644 --- a/extensions/browser/extension_throttle_manager.cc +++ b/extensions/browser/extension_throttle_manager.cc @@ -4,6 +4,8 @@ #include "extensions/browser/extension_throttle_manager.h" +#include <utility> + #include "base/logging.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram.h" @@ -117,7 +119,7 @@ ExtensionThrottleManager::RegisterRequestUrl(const GURL& url) { void ExtensionThrottleManager::SetBackoffPolicyForTests( scoped_ptr<net::BackoffEntry::Policy> policy) { - backoff_policy_for_tests_ = policy.Pass(); + backoff_policy_for_tests_ = std::move(policy); } void ExtensionThrottleManager::OverrideEntryForTests( diff --git a/extensions/browser/guest_view/app_view/app_view_guest.cc b/extensions/browser/guest_view/app_view/app_view_guest.cc index 64bcd90..d5a4e85 100644 --- a/extensions/browser/guest_view/app_view/app_view_guest.cc +++ b/extensions/browser/guest_view/app_view/app_view_guest.cc @@ -4,6 +4,8 @@ #include "extensions/browser/guest_view/app_view/app_view_guest.h" +#include <utility> + #include "base/command_line.h" #include "components/guest_view/browser/guest_view_manager.h" #include "content/public/browser/render_process_host.h" @@ -270,7 +272,7 @@ void AppViewGuest::LaunchAppAndFireEvent( embed_request->SetString(appview::kEmbedderID, owner_host()); embed_request->Set(appview::kData, data.release()); AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent( - browser_context(), embed_request.Pass(), extension_host->extension()); + browser_context(), std::move(embed_request), extension_host->extension()); } void AppViewGuest::SetAppDelegateForTest(AppDelegate* delegate) { diff --git a/extensions/browser/guest_view/extension_options/extension_options_guest.cc b/extensions/browser/guest_view/extension_options/extension_options_guest.cc index 5806540..f594ade 100644 --- a/extensions/browser/guest_view/extension_options/extension_options_guest.cc +++ b/extensions/browser/guest_view/extension_options/extension_options_guest.cc @@ -4,6 +4,8 @@ #include "extensions/browser/guest_view/extension_options/extension_options_guest.h" +#include <utility> + #include "base/values.h" #include "components/crx_file/id_util.h" #include "components/guest_view/browser/guest_view_event.h" @@ -126,7 +128,7 @@ void ExtensionOptionsGuest::DidInitialize( void ExtensionOptionsGuest::GuestViewDidStopLoading() { scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); DispatchEventToView(new GuestViewEvent( - extension_options_internal::OnLoad::kEventName, args.Pass())); + extension_options_internal::OnLoad::kEventName, std::move(args))); } const char* ExtensionOptionsGuest::GetAPINamespace() const { diff --git a/extensions/browser/guest_view/extension_view/extension_view_guest.cc b/extensions/browser/guest_view/extension_view/extension_view_guest.cc index 0a341ff..d2db41e 100644 --- a/extensions/browser/guest_view/extension_view/extension_view_guest.cc +++ b/extensions/browser/guest_view/extension_view/extension_view_guest.cc @@ -4,6 +4,8 @@ #include "extensions/browser/guest_view/extension_view/extension_view_guest.h" +#include <utility> + #include "components/crx_file/id_util.h" #include "components/guest_view/browser/guest_view_event.h" #include "content/public/browser/render_process_host.h" @@ -127,7 +129,7 @@ void ExtensionViewGuest::DidCommitProvisionalLoadForFrame( scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); args->SetString(guest_view::kUrl, url_.spec()); DispatchEventToView( - new GuestViewEvent(extensionview::kEventLoadCommit, args.Pass())); + new GuestViewEvent(extensionview::kEventLoadCommit, std::move(args))); } void ExtensionViewGuest::DidNavigateMainFrame( diff --git a/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc b/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc index a5ae79bf44..ec44ed2 100644 --- a/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc +++ b/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc @@ -4,6 +4,8 @@ #include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h" +#include <utility> + #include "components/guest_view/browser/guest_view_base.h" #include "components/guest_view/browser/guest_view_manager.h" #include "components/guest_view/common/guest_view_constants.h" @@ -55,9 +57,10 @@ void ExtensionsGuestViewManagerDelegate::DispatchEvent( << " must have a histogram value"; content::WebContents* owner = guest->owner_web_contents(); - EventRouter::DispatchEventToSender( - owner, guest->browser_context(), guest->owner_host(), histogram_value, - event_name, event_args.Pass(), EventRouter::USER_GESTURE_UNKNOWN, info); + EventRouter::DispatchEventToSender(owner, guest->browser_context(), + guest->owner_host(), histogram_value, + event_name, std::move(event_args), + EventRouter::USER_GESTURE_UNKNOWN, info); } bool ExtensionsGuestViewManagerDelegate::IsGuestAvailableToContext( diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc index fe90ef7..b0b8feb 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc @@ -132,7 +132,7 @@ scoped_ptr<StreamContainer> MimeHandlerStreamManager::ReleaseStream( streams_by_extension_id_[result->extension_id()].erase(view_id); streams_.erase(stream); embedder_observers_.erase(view_id); - return result.Pass(); + return result; } void MimeHandlerStreamManager::OnExtensionUnloaded( diff --git a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc index 2341db12..d704b9f 100644 --- a/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc +++ b/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc @@ -4,6 +4,8 @@ #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h" +#include <utility> + #include "base/strings/stringprintf.h" #include "components/guest_view/common/guest_view_constants.h" #include "content/public/browser/browser_thread.h" @@ -39,7 +41,7 @@ StreamContainer::StreamContainer(scoped_ptr<content::StreamInfo> stream, bool embedded, const GURL& handler_url, const std::string& extension_id) - : stream_(stream.Pass()), + : stream_(std::move(stream)), embedded_(embedded), tab_id_(tab_id), handler_url_(handler_url), diff --git a/extensions/browser/guest_view/web_view/web_view_apitest.cc b/extensions/browser/guest_view/web_view/web_view_apitest.cc index 805fb9d..312545a 100644 --- a/extensions/browser/guest_view/web_view/web_view_apitest.cc +++ b/extensions/browser/guest_view/web_view/web_view_apitest.cc @@ -4,6 +4,8 @@ #include "extensions/browser/guest_view/web_view/web_view_apitest.h" +#include <utility> + #include "base/command_line.h" #include "base/path_service.h" #include "base/strings/string_util.h" @@ -69,7 +71,7 @@ static scoped_ptr<net::test_server::HttpResponse> UserAgentResponseHandler( new net::test_server::BasicHttpResponse); http_response->set_code(net::HTTP_MOVED_PERMANENTLY); http_response->AddCustomHeader("Location", redirect_target.spec()); - return http_response.Pass(); + return std::move(http_response); } class WebContentsHiddenObserver : public content::WebContentsObserver { @@ -109,7 +111,7 @@ scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( new net::test_server::BasicHttpResponse); http_response->set_code(net::HTTP_MOVED_PERMANENTLY); http_response->AddCustomHeader("Location", redirect_target.spec()); - return http_response.Pass(); + return std::move(http_response); } // Handles |request| by serving an empty response. diff --git a/extensions/browser/guest_view/web_view/web_view_find_helper.cc b/extensions/browser/guest_view/web_view/web_view_find_helper.cc index ecc35b4..725326a 100644 --- a/extensions/browser/guest_view/web_view/web_view_find_helper.cc +++ b/extensions/browser/guest_view/web_view/web_view_find_helper.cc @@ -41,7 +41,7 @@ void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled, args->SetBoolean(webview::kFindFinalUpdate, final_update); DCHECK(webview_guest_); webview_guest_->DispatchEventToView( - new GuestViewEvent(webview::kEventFindReply, args.Pass())); + new GuestViewEvent(webview::kEventFindReply, std::move(args))); } void WebViewFindHelper::EndFindSession(int session_request_id, bool canceled) { diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc index ce1d3d5..ca7c780 100644 --- a/extensions/browser/guest_view/web_view/web_view_guest.cc +++ b/extensions/browser/guest_view/web_view/web_view_guest.cc @@ -4,6 +4,8 @@ #include "extensions/browser/guest_view/web_view/web_view_guest.h" +#include <utility> + #include "base/message_loop/message_loop.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -369,7 +371,7 @@ void WebViewGuest::DidDropLink(const GURL& url) { scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); args->SetString(guest_view::kUrl, url.spec()); DispatchEventToView( - new GuestViewEvent(webview::kEventDropLink, args.Pass())); + new GuestViewEvent(webview::kEventDropLink, std::move(args))); } void WebViewGuest::DidInitialize(const base::DictionaryValue& create_params) { @@ -424,7 +426,7 @@ void WebViewGuest::ClearDataInternal(base::Time remove_since, void WebViewGuest::GuestViewDidStopLoading() { scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); DispatchEventToView( - new GuestViewEvent(webview::kEventLoadStop, args.Pass())); + new GuestViewEvent(webview::kEventLoadStop, std::move(args))); } void WebViewGuest::EmbedderFullscreenToggled(bool entered_fullscreen) { @@ -479,7 +481,7 @@ void WebViewGuest::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, args->SetInteger(webview::kNewHeight, new_size.height()); args->SetInteger(webview::kNewWidth, new_size.width()); DispatchEventToView( - new GuestViewEvent(webview::kEventSizeChanged, args.Pass())); + new GuestViewEvent(webview::kEventSizeChanged, std::move(args))); } bool WebViewGuest::IsAutoSizeSupported() const { @@ -495,7 +497,7 @@ void WebViewGuest::GuestZoomChanged(double old_zoom_level, args->SetDouble(webview::kOldZoomFactor, old_zoom_factor); args->SetDouble(webview::kNewZoomFactor, new_zoom_factor); DispatchEventToView( - new GuestViewEvent(webview::kEventZoomChange, args.Pass())); + new GuestViewEvent(webview::kEventZoomChange, std::move(args))); } void WebViewGuest::WillDestroy() { @@ -515,14 +517,14 @@ bool WebViewGuest::AddMessageToConsole(WebContents* source, args->SetInteger(webview::kLine, line_no); args->SetString(webview::kSourceId, source_id); DispatchEventToView( - new GuestViewEvent(webview::kEventConsoleMessage, args.Pass())); + new GuestViewEvent(webview::kEventConsoleMessage, std::move(args))); return true; } void WebViewGuest::CloseContents(WebContents* source) { scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); DispatchEventToView( - new GuestViewEvent(webview::kEventClose, args.Pass())); + new GuestViewEvent(webview::kEventClose, std::move(args))); } void WebViewGuest::FindReply(WebContents* source, @@ -573,7 +575,7 @@ void WebViewGuest::LoadProgressChanged(WebContents* source, double progress) { args->SetString(guest_view::kUrl, web_contents()->GetURL().spec()); args->SetDouble(webview::kProgress, progress); DispatchEventToView( - new GuestViewEvent(webview::kEventLoadProgress, args.Pass())); + new GuestViewEvent(webview::kEventLoadProgress, std::move(args))); } void WebViewGuest::LoadAbort(bool is_top_level, @@ -586,7 +588,7 @@ void WebViewGuest::LoadAbort(bool is_top_level, args->SetInteger(guest_view::kCode, error_code); args->SetString(guest_view::kReason, error_type); DispatchEventToView( - new GuestViewEvent(webview::kEventLoadAbort, args.Pass())); + new GuestViewEvent(webview::kEventLoadAbort, std::move(args))); } void WebViewGuest::SetContextMenuPosition(const gfx::Point& position) { @@ -638,7 +640,7 @@ void WebViewGuest::RendererResponsive(WebContents* source) { args->SetInteger(webview::kProcessId, web_contents()->GetRenderProcessHost()->GetID()); DispatchEventToView( - new GuestViewEvent(webview::kEventResponsive, args.Pass())); + new GuestViewEvent(webview::kEventResponsive, std::move(args))); } void WebViewGuest::RendererUnresponsive(WebContents* source) { @@ -646,7 +648,7 @@ void WebViewGuest::RendererUnresponsive(WebContents* source) { args->SetInteger(webview::kProcessId, web_contents()->GetRenderProcessHost()->GetID()); DispatchEventToView( - new GuestViewEvent(webview::kEventUnresponsive, args.Pass())); + new GuestViewEvent(webview::kEventUnresponsive, std::move(args))); } void WebViewGuest::Observe(int type, @@ -814,7 +816,7 @@ void WebViewGuest::DidCommitProvisionalLoadForFrame( args->SetInteger(webview::kInternalProcessId, web_contents()->GetRenderProcessHost()->GetID()); DispatchEventToView( - new GuestViewEvent(webview::kEventLoadCommit, args.Pass())); + new GuestViewEvent(webview::kEventLoadCommit, std::move(args))); find_helper_.CancelAllFindSessions(); } @@ -842,7 +844,7 @@ void WebViewGuest::DidStartProvisionalLoadForFrame( args->SetString(guest_view::kUrl, validated_url.spec()); args->SetBoolean(guest_view::kIsTopLevel, !render_frame_host->GetParent()); DispatchEventToView( - new GuestViewEvent(webview::kEventLoadStart, args.Pass())); + new GuestViewEvent(webview::kEventLoadStart, std::move(args))); } void WebViewGuest::RenderProcessGone(base::TerminationStatus status) { @@ -853,8 +855,7 @@ void WebViewGuest::RenderProcessGone(base::TerminationStatus status) { args->SetInteger(webview::kProcessId, web_contents()->GetRenderProcessHost()->GetID()); args->SetString(webview::kReason, TerminationStatusToString(status)); - DispatchEventToView( - new GuestViewEvent(webview::kEventExit, args.Pass())); + DispatchEventToView(new GuestViewEvent(webview::kEventExit, std::move(args))); } void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) { @@ -882,13 +883,13 @@ void WebViewGuest::ReportFrameNameChange(const std::string& name) { scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); args->SetString(webview::kName, name); DispatchEventToView( - new GuestViewEvent(webview::kEventFrameNameChanged, args.Pass())); + new GuestViewEvent(webview::kEventFrameNameChanged, std::move(args))); } void WebViewGuest::LoadHandlerCalled() { scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); DispatchEventToView( - new GuestViewEvent(webview::kEventContentLoad, args.Pass())); + new GuestViewEvent(webview::kEventContentLoad, std::move(args))); } void WebViewGuest::LoadRedirect(const GURL& old_url, @@ -899,7 +900,7 @@ void WebViewGuest::LoadRedirect(const GURL& old_url, args->SetString(webview::kNewURL, new_url.spec()); args->SetString(webview::kOldURL, old_url.spec()); DispatchEventToView( - new GuestViewEvent(webview::kEventLoadRedirect, args.Pass())); + new GuestViewEvent(webview::kEventLoadRedirect, std::move(args))); } void WebViewGuest::PushWebViewStateToIOThread() { @@ -1497,7 +1498,7 @@ void WebViewGuest::SetFullscreenState(bool is_fullscreen) { // on the embedder. scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); DispatchEventToView( - new GuestViewEvent(webview::kEventExitFullscreen, args.Pass())); + new GuestViewEvent(webview::kEventExitFullscreen, std::move(args))); } // Since we changed fullscreen state, sending a Resize message ensures that // renderer/ sees the change. diff --git a/extensions/browser/guest_view/web_view/web_view_permission_helper.cc b/extensions/browser/guest_view/web_view/web_view_permission_helper.cc index 46ded6b..462f23a 100644 --- a/extensions/browser/guest_view/web_view/web_view_permission_helper.cc +++ b/extensions/browser/guest_view/web_view/web_view_permission_helper.cc @@ -4,6 +4,8 @@ #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" +#include <utility> + #include "components/guest_view/browser/guest_view_event.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" @@ -332,19 +334,19 @@ int WebViewPermissionHelper::RequestPermission( switch (permission_type) { case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: { web_view_guest_->DispatchEventToView( - new GuestViewEvent(webview::kEventNewWindow, args.Pass())); + new GuestViewEvent(webview::kEventNewWindow, std::move(args))); break; } case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: { web_view_guest_->DispatchEventToView( - new GuestViewEvent(webview::kEventDialog, args.Pass())); + new GuestViewEvent(webview::kEventDialog, std::move(args))); break; } default: { args->SetString(webview::kPermission, PermissionTypeToString(permission_type)); web_view_guest_->DispatchEventToView(new GuestViewEvent( - webview::kEventPermissionRequest, args.Pass())); + webview::kEventPermissionRequest, std::move(args))); break; } } diff --git a/extensions/browser/load_monitoring_extension_host_queue.cc b/extensions/browser/load_monitoring_extension_host_queue.cc index e26070a..47e8557 100644 --- a/extensions/browser/load_monitoring_extension_host_queue.cc +++ b/extensions/browser/load_monitoring_extension_host_queue.cc @@ -5,6 +5,7 @@ #include "extensions/browser/load_monitoring_extension_host_queue.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -21,7 +22,7 @@ LoadMonitoringExtensionHostQueue::LoadMonitoringExtensionHostQueue( scoped_ptr<ExtensionHostQueue> delegate, base::TimeDelta monitor_time, const FinishedCallback& finished_callback) - : delegate_(delegate.Pass()), + : delegate_(std::move(delegate)), monitor_time_(monitor_time), finished_callback_(finished_callback), started_(false), @@ -29,15 +30,13 @@ LoadMonitoringExtensionHostQueue::LoadMonitoringExtensionHostQueue( num_loaded_(0u), max_awaiting_loading_(0u), max_active_loading_(0u), - weak_ptr_factory_(this) { -} + weak_ptr_factory_(this) {} LoadMonitoringExtensionHostQueue::LoadMonitoringExtensionHostQueue( scoped_ptr<ExtensionHostQueue> delegate) - : LoadMonitoringExtensionHostQueue(delegate.Pass(), + : LoadMonitoringExtensionHostQueue(std::move(delegate), base::TimeDelta::FromMinutes(1), - FinishedCallback()) { -} + FinishedCallback()) {} LoadMonitoringExtensionHostQueue::~LoadMonitoringExtensionHostQueue() { } diff --git a/extensions/browser/mojo/keep_alive_impl.cc b/extensions/browser/mojo/keep_alive_impl.cc index adfccaa..8f17582 100644 --- a/extensions/browser/mojo/keep_alive_impl.cc +++ b/extensions/browser/mojo/keep_alive_impl.cc @@ -4,6 +4,8 @@ #include "extensions/browser/mojo/keep_alive_impl.h" +#include <utility> + #include "base/bind.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/process_manager.h" @@ -14,7 +16,7 @@ namespace extensions { void KeepAliveImpl::Create(content::BrowserContext* context, const Extension* extension, mojo::InterfaceRequest<KeepAlive> request) { - new KeepAliveImpl(context, extension, request.Pass()); + new KeepAliveImpl(context, extension, std::move(request)); } KeepAliveImpl::KeepAliveImpl(content::BrowserContext* context, @@ -23,7 +25,7 @@ KeepAliveImpl::KeepAliveImpl(content::BrowserContext* context, : context_(context), extension_(extension), extension_registry_observer_(this), - binding_(this, request.Pass()) { + binding_(this, std::move(request)) { ProcessManager::Get(context_)->IncrementLazyKeepaliveCount(extension_); binding_.set_connection_error_handler( base::Bind(&KeepAliveImpl::OnDisconnected, base::Unretained(this))); diff --git a/extensions/browser/mojo/keep_alive_impl_unittest.cc b/extensions/browser/mojo/keep_alive_impl_unittest.cc index 72e61b36..92bd9dd 100644 --- a/extensions/browser/mojo/keep_alive_impl_unittest.cc +++ b/extensions/browser/mojo/keep_alive_impl_unittest.cc @@ -54,7 +54,8 @@ class KeepAliveTest : public ExtensionsTest { } void CreateKeepAlive(mojo::InterfaceRequest<KeepAlive> request) { - KeepAliveImpl::Create(browser_context(), extension_.get(), request.Pass()); + KeepAliveImpl::Create(browser_context(), extension_.get(), + std::move(request)); } const Extension* extension() { return extension_.get(); } diff --git a/extensions/browser/mojo/stash_backend.cc b/extensions/browser/mojo/stash_backend.cc index 381142d..8d5f480 100644 --- a/extensions/browser/mojo/stash_backend.cc +++ b/extensions/browser/mojo/stash_backend.cc @@ -4,6 +4,7 @@ #include "extensions/browser/mojo/stash_backend.h" +#include <utility> #include <vector> #include "base/bind.h" @@ -35,8 +36,7 @@ class StashServiceImpl : public StashService { StashServiceImpl::StashServiceImpl(mojo::InterfaceRequest<StashService> request, base::WeakPtr<StashBackend> backend) - : binding_(this, request.Pass()), backend_(backend) { -} + : binding_(this, std::move(request)), backend_(backend) {} StashServiceImpl::~StashServiceImpl() { } @@ -45,7 +45,7 @@ void StashServiceImpl::AddToStash( mojo::Array<StashedObjectPtr> stashed_objects) { if (!backend_) return; - backend_->AddToStash(stashed_objects.Pass()); + backend_->AddToStash(std::move(stashed_objects)); } void StashServiceImpl::RetrieveStash( @@ -102,7 +102,7 @@ StashBackend::~StashBackend() { void StashBackend::AddToStash(mojo::Array<StashedObjectPtr> stashed_objects) { for (size_t i = 0; i < stashed_objects.size(); i++) { stashed_objects_.push_back(make_scoped_ptr(new StashEntry( - stashed_objects[i].Pass(), + std::move(stashed_objects[i]), has_notified_ ? base::Closure() : base::Bind(&StashBackend::OnHandleReady, weak_factory_.GetWeakPtr())))); @@ -116,11 +116,11 @@ mojo::Array<StashedObjectPtr> StashBackend::RetrieveStash() { result.push_back(entry->Release()); } stashed_objects_.clear(); - return result.Pass(); + return result; } void StashBackend::BindToRequest(mojo::InterfaceRequest<StashService> request) { - new StashServiceImpl(request.Pass(), weak_factory_.GetWeakPtr()); + new StashServiceImpl(std::move(request), weak_factory_.GetWeakPtr()); } void StashBackend::OnHandleReady() { @@ -135,7 +135,7 @@ void StashBackend::OnHandleReady() { StashBackend::StashEntry::StashEntry(StashedObjectPtr stashed_object, const base::Closure& on_handle_readable) - : stashed_object_(stashed_object.Pass()), + : stashed_object_(std::move(stashed_object)), on_handle_readable_(on_handle_readable) { if (on_handle_readable_.is_null() || !stashed_object_->monitor_handles) return; @@ -153,7 +153,7 @@ StashBackend::StashEntry::~StashEntry() { StashedObjectPtr StashBackend::StashEntry::Release() { waiters_.clear(); - return stashed_object_.Pass(); + return std::move(stashed_object_); } void StashBackend::StashEntry::CancelHandleNotifications() { diff --git a/extensions/browser/mojo/stash_backend_unittest.cc b/extensions/browser/mojo/stash_backend_unittest.cc index be76bac..c054cc5 100644 --- a/extensions/browser/mojo/stash_backend_unittest.cc +++ b/extensions/browser/mojo/stash_backend_unittest.cc @@ -2,10 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "extensions/browser/mojo/stash_backend.h" + +#include <utility> + #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" -#include "extensions/browser/mojo/stash_backend.h" #include "mojo/application/public/interfaces/service_provider.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -28,7 +31,7 @@ mojo::ScopedHandle CreateReadableHandle() { MOJO_WRITE_DATA_FLAG_NONE); EXPECT_EQ(MOJO_RESULT_OK, result); EXPECT_EQ(1u, num_bytes); - return mojo::ScopedHandle::From(consumer_handle.Pass()); + return mojo::ScopedHandle::From(std::move(consumer_handle)); } } // namespace @@ -60,12 +63,12 @@ class StashServiceTest : public testing::Test { stash_service_->RetrieveStash(base::Bind( &StashServiceTest::StashRetrieved, base::Unretained(this), &stash)); WaitForEvent(EVENT_STASH_RETRIEVED); - return stash.Pass(); + return stash; } void StashRetrieved(mojo::Array<StashedObjectPtr>* output, mojo::Array<StashedObjectPtr> stash) { - *output = stash.Pass(); + *output = std::move(stash); EventReceived(EVENT_STASH_RETRIEVED); } @@ -107,15 +110,15 @@ TEST_F(StashServiceTest, AddTwiceAndRetrieve) { stashed_object->id = "test type"; stashed_object->data.push_back(1); stashed_object->stashed_handles = mojo::Array<mojo::ScopedHandle>(0); - stashed_objects.push_back(stashed_object.Pass()); - stash_service_->AddToStash(stashed_objects.Pass()); + stashed_objects.push_back(std::move(stashed_object)); + stash_service_->AddToStash(std::move(stashed_objects)); stashed_object = StashedObject::New(); stashed_object->id = "test type2"; stashed_object->data.push_back(2); stashed_object->data.push_back(3); stashed_object->stashed_handles = mojo::Array<mojo::ScopedHandle>(0); - stashed_objects.push_back(stashed_object.Pass()); - stash_service_->AddToStash(stashed_objects.Pass()); + stashed_objects.push_back(std::move(stashed_object)); + stash_service_->AddToStash(std::move(stashed_objects)); stashed_objects = RetrieveStash(); ASSERT_EQ(2u, stashed_objects.size()); EXPECT_EQ("test type", stashed_objects[0]->id); @@ -149,18 +152,18 @@ TEST_F(StashServiceTest, StashAndRetrieveHandles) { ASSERT_EQ(1u, num_bytes); stashed_object->stashed_handles.push_back( - mojo::ScopedHandle::From(producer.Pass())); + mojo::ScopedHandle::From(std::move(producer))); stashed_object->stashed_handles.push_back( - mojo::ScopedHandle::From(consumer.Pass())); - stashed_objects.push_back(stashed_object.Pass()); - stash_service_->AddToStash(stashed_objects.Pass()); + mojo::ScopedHandle::From(std::move(consumer))); + stashed_objects.push_back(std::move(stashed_object)); + stash_service_->AddToStash(std::move(stashed_objects)); stashed_objects = RetrieveStash(); ASSERT_EQ(1u, stashed_objects.size()); EXPECT_EQ("test type", stashed_objects[0]->id); ASSERT_EQ(2u, stashed_objects[0]->stashed_handles.size()); consumer = mojo::ScopedDataPipeConsumerHandle::From( - stashed_objects[0]->stashed_handles[1].Pass()); + std::move(stashed_objects[0]->stashed_handles[1])); result = mojo::Wait( consumer.get(), MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, nullptr); @@ -192,11 +195,11 @@ TEST_F(StashServiceTest, NotifyOnReadableHandle) { stashed_object->stashed_handles.push_back(mojo::ScopedHandle::From( mojo::GetProxy(&service_provider).PassMessagePipe())); - stash_entries.push_back(stashed_object.Pass()); - stash_service_->AddToStash(stash_entries.Pass()); + stash_entries.push_back(std::move(stashed_object)); + stash_service_->AddToStash(std::move(stash_entries)); mojo::MessagePipe pipe; - service_provider->ConnectToService("", pipe.handle0.Pass()); + service_provider->ConnectToService("", std::move(pipe.handle0)); WaitForEvent(EVENT_HANDLE_READY); EXPECT_EQ(1, handles_ready_); @@ -222,13 +225,13 @@ TEST_F(StashServiceTest, NotifyOnReadableDataPipeHandle) { ASSERT_EQ(MOJO_RESULT_OK, result); ASSERT_EQ(1u, num_bytes); stashed_object->stashed_handles.push_back( - mojo::ScopedHandle::From(producer_handle.Pass())); + mojo::ScopedHandle::From(std::move(producer_handle))); stashed_object->stashed_handles.push_back( - mojo::ScopedHandle::From(consumer_handle.Pass())); + mojo::ScopedHandle::From(std::move(consumer_handle))); stashed_object->data.push_back(1); - stash_entries.push_back(stashed_object.Pass()); - stash_service_->AddToStash(stash_entries.Pass()); + stash_entries.push_back(std::move(stashed_object)); + stash_service_->AddToStash(std::move(stash_entries)); WaitForEvent(EVENT_HANDLE_READY); EXPECT_EQ(1, handles_ready_); } @@ -241,15 +244,15 @@ TEST_F(StashServiceTest, NotifyOncePerStashOnReadableHandles) { stashed_object->monitor_handles = true; stashed_object->stashed_handles.push_back(CreateReadableHandle()); stashed_object->stashed_handles.push_back(CreateReadableHandle()); - stash_entries.push_back(stashed_object.Pass()); + stash_entries.push_back(std::move(stashed_object)); stashed_object = StashedObject::New(); stashed_object->id = "another test type"; stashed_object->data.push_back(2); stashed_object->monitor_handles = true; stashed_object->stashed_handles.push_back(CreateReadableHandle()); stashed_object->stashed_handles.push_back(CreateReadableHandle()); - stash_entries.push_back(stashed_object.Pass()); - stash_service_->AddToStash(stash_entries.Pass()); + stash_entries.push_back(std::move(stashed_object)); + stash_service_->AddToStash(std::move(stash_entries)); WaitForEvent(EVENT_HANDLE_READY); EXPECT_EQ(1, handles_ready_); @@ -259,8 +262,8 @@ TEST_F(StashServiceTest, NotifyOncePerStashOnReadableHandles) { stashed_object->monitor_handles = true; stashed_object->stashed_handles.push_back(CreateReadableHandle()); stashed_object->stashed_handles.push_back(CreateReadableHandle()); - stash_entries.push_back(stashed_object.Pass()); - stash_service_->AddToStash(stash_entries.Pass()); + stash_entries.push_back(std::move(stashed_object)); + stash_service_->AddToStash(std::move(stash_entries)); stash_service_->AddToStash(RetrieveStash()); WaitForEvent(EVENT_HANDLE_READY); @@ -279,9 +282,9 @@ TEST_F(StashServiceTest, ServiceWithDeletedBackend) { stashed_object->data.push_back(1); mojo::MessagePipe message_pipe; stashed_object->stashed_handles.push_back( - mojo::ScopedHandle::From(message_pipe.handle0.Pass())); - stashed_objects.push_back(stashed_object.Pass()); - stash_service_->AddToStash(stashed_objects.Pass()); + mojo::ScopedHandle::From(std::move(message_pipe.handle0))); + stashed_objects.push_back(std::move(stashed_object)); + stash_service_->AddToStash(std::move(stashed_objects)); stashed_objects = RetrieveStash(); ASSERT_EQ(0u, stashed_objects.size()); // Check that the stashed handle has been closed. diff --git a/extensions/browser/state_store.cc b/extensions/browser/state_store.cc index da65fd7..ababdd41 100644 --- a/extensions/browser/state_store.cc +++ b/extensions/browser/state_store.cc @@ -4,6 +4,8 @@ #include "extensions/browser/state_store.h" +#include <utility> + #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "content/public/browser/browser_context.h" @@ -88,7 +90,7 @@ StateStore::StateStore(content::BrowserContext* context, StateStore::StateStore(content::BrowserContext* context, scoped_ptr<ValueStore> value_store) - : store_(value_store.Pass()), + : store_(std::move(value_store)), task_queue_(new DelayedTaskQueue()), extension_registry_observer_(this) { extension_registry_observer_.Add(ExtensionRegistry::Get(context)); diff --git a/extensions/browser/test_extensions_browser_client.h b/extensions/browser/test_extensions_browser_client.h index be660e7..fd57b0d 100644 --- a/extensions/browser/test_extensions_browser_client.h +++ b/extensions/browser/test_extensions_browser_client.h @@ -6,6 +6,7 @@ #define EXTENSIONS_BROWSER_TEST_EXTENSIONS_BROWSER_CLIENT_H_ #include <string> +#include <utility> #include <vector> #include "base/callback.h" @@ -33,7 +34,7 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient { extension_system_factory_ = factory; } void set_extension_cache(scoped_ptr<ExtensionCache> extension_cache) { - extension_cache_ = extension_cache.Pass(); + extension_cache_ = std::move(extension_cache); } // Sets a factory to respond to calls of the CreateUpdateClient method. diff --git a/extensions/browser/updater/extension_downloader.cc b/extensions/browser/updater/extension_downloader.cc index 4e243b0..1c7dafb 100644 --- a/extensions/browser/updater/extension_downloader.cc +++ b/extensions/browser/updater/extension_downloader.cc @@ -268,7 +268,7 @@ void ExtensionDownloader::StartBlacklistUpdate( DCHECK(blacklist_fetch->base_url().SchemeIsCryptographic()); blacklist_fetch->AddExtension(kBlacklistAppID, version, &ping_data, std::string(), kDefaultInstallSource); - StartUpdateCheck(blacklist_fetch.Pass()); + StartUpdateCheck(std::move(blacklist_fetch)); } void ExtensionDownloader::SetWebstoreIdentityProvider( @@ -429,7 +429,7 @@ void ExtensionDownloader::StartUpdateCheck( "Extensions.UpdateCheckUrlLength", fetch_data->full_url().possibly_invalid_spec().length()); - manifests_queue_.ScheduleRequest(fetch_data.Pass()); + manifests_queue_.ScheduleRequest(std::move(fetch_data)); } } @@ -570,7 +570,7 @@ void ExtensionDownloader::HandleManifestResults( scoped_ptr<ExtensionFetch> fetch( new ExtensionFetch(update->extension_id, crx_url, update->package_hash, update->version, fetch_data->request_ids())); - FetchUpdatedExtension(fetch.Pass()); + FetchUpdatedExtension(std::move(fetch)); } // If the manifest response included a <daystart> element, we want to save @@ -686,9 +686,10 @@ void ExtensionDownloader::FetchUpdatedExtension( // Now get .crx file path and mark extension as used. extension_cache_->GetExtension(fetch_data->id, fetch_data->package_hash, &crx_path, &version); - NotifyDelegateDownloadFinished(fetch_data.Pass(), true, crx_path, false); + NotifyDelegateDownloadFinished(std::move(fetch_data), true, crx_path, + false); } else { - extensions_queue_.ScheduleRequest(fetch_data.Pass()); + extensions_queue_.ScheduleRequest(std::move(fetch_data)); } } } @@ -721,7 +722,7 @@ void ExtensionDownloader::CacheInstallDone( ping_results_.erase(fetch_data->id); if (should_download) { // Resume download from cached manifest data. - extensions_queue_.ScheduleRequest(fetch_data.Pass()); + extensions_queue_.ScheduleRequest(std::move(fetch_data)); } } @@ -797,7 +798,8 @@ void ExtensionDownloader::OnCRXFetchComplete( weak_ptr_factory_.GetWeakPtr(), base::Passed(&fetch_data), false)); } else { - NotifyDelegateDownloadFinished(fetch_data.Pass(), false, crx_path, true); + NotifyDelegateDownloadFinished(std::move(fetch_data), false, crx_path, + true); } } else if (IterateFetchCredentialsAfterFailure( &active_request, status, response_code)) { diff --git a/extensions/browser/updater/request_queue_impl.h b/extensions/browser/updater/request_queue_impl.h index 309dc82..9e88824 100644 --- a/extensions/browser/updater/request_queue_impl.h +++ b/extensions/browser/updater/request_queue_impl.h @@ -6,6 +6,7 @@ #define EXTENSIONS_BROWSER_UPDATER_REQUEST_QUEUE_IMPL_H_ #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/compiler_specific.h" @@ -41,14 +42,13 @@ int RequestQueue<T>::active_request_failure_count() { template <typename T> scoped_ptr<T> RequestQueue<T>::reset_active_request() { active_backoff_entry_.reset(); - return active_request_.Pass(); + return std::move(active_request_); } template <typename T> void RequestQueue<T>::ScheduleRequest(scoped_ptr<T> request) { - PushImpl( - request.Pass(), - scoped_ptr<net::BackoffEntry>(new net::BackoffEntry(backoff_policy_))); + PushImpl(std::move(request), scoped_ptr<net::BackoffEntry>( + new net::BackoffEntry(backoff_policy_))); StartNextRequest(); } @@ -124,7 +124,7 @@ void RequestQueue<T>::RetryRequest(const base::TimeDelta& min_backoff_delay) { active_backoff_entry_->SetCustomReleaseTime(base::TimeTicks::Now() + min_backoff_delay); } - PushImpl(active_request_.Pass(), active_backoff_entry_.Pass()); + PushImpl(std::move(active_request_), std::move(active_backoff_entry_)); } template <typename T> diff --git a/extensions/browser/user_script_loader.cc b/extensions/browser/user_script_loader.cc index 785e7c8..305f4dc 100644 --- a/extensions/browser/user_script_loader.cc +++ b/extensions/browser/user_script_loader.cc @@ -6,6 +6,7 @@ #include <set> #include <string> +#include <utility> #include "base/version.h" #include "content/public/browser/browser_context.h" @@ -262,7 +263,7 @@ void UserScriptLoader::StartLoad() { for (const UserScript& script : changed_scripts) changed_hosts_.insert(script.host_id()); - LoadScripts(user_scripts_.Pass(), changed_hosts_, added_script_ids, + LoadScripts(std::move(user_scripts_), changed_hosts_, added_script_ids, base::Bind(&UserScriptLoader::OnScriptsLoaded, weak_factory_.GetWeakPtr())); diff --git a/extensions/browser/value_store/leveldb_value_store.cc b/extensions/browser/value_store/leveldb_value_store.cc index 6ae15c4..cc6975b 100644 --- a/extensions/browser/value_store/leveldb_value_store.cc +++ b/extensions/browser/value_store/leveldb_value_store.cc @@ -4,6 +4,8 @@ #include "extensions/browser/value_store/leveldb_value_store.h" +#include <utility> + #include "base/files/file_util.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" @@ -167,7 +169,7 @@ ValueStore::ReadResult LeveldbValueStore::Get( settings->SetWithoutPathExpansion(*it, setting.release()); } - return MakeReadResult(settings.Pass(), status); + return MakeReadResult(std::move(settings), status); } ValueStore::ReadResult LeveldbValueStore::Get() { @@ -196,12 +198,12 @@ ValueStore::ReadResult LeveldbValueStore::Get() { Delete(key).ok() ? RESTORE_REPAIR_SUCCESS : RESTORE_DELETE_FAILURE, kInvalidJson)); } - settings->SetWithoutPathExpansion(key, value.Pass()); + settings->SetWithoutPathExpansion(key, std::move(value)); } if (it->status().IsNotFound()) { NOTREACHED() << "IsNotFound() but iterating over all keys?!"; - return MakeReadResult(settings.Pass(), status); + return MakeReadResult(std::move(settings), status); } if (!it->status().ok()) { @@ -209,7 +211,7 @@ ValueStore::ReadResult LeveldbValueStore::Get() { return MakeReadResult(status); } - return MakeReadResult(settings.Pass(), status); + return MakeReadResult(std::move(settings), status); } ValueStore::WriteResult LeveldbValueStore::Set( @@ -227,7 +229,7 @@ ValueStore::WriteResult LeveldbValueStore::Set( return MakeWriteResult(status); status.Merge(WriteToDb(&batch)); - return status.ok() ? MakeWriteResult(changes.Pass(), status) + return status.ok() ? MakeWriteResult(std::move(changes), status) : MakeWriteResult(status); } @@ -251,7 +253,7 @@ ValueStore::WriteResult LeveldbValueStore::Set( } status.Merge(WriteToDb(&batch)); - return status.ok() ? MakeWriteResult(changes.Pass(), status) + return status.ok() ? MakeWriteResult(std::move(changes), status) : MakeWriteResult(status); } @@ -289,7 +291,7 @@ ValueStore::WriteResult LeveldbValueStore::Remove( status.Merge(ToValueStoreError(ldb_status)); return MakeWriteResult(status); } - return MakeWriteResult(changes.Pass(), status); + return MakeWriteResult(std::move(changes), status); } ValueStore::WriteResult LeveldbValueStore::Clear() { @@ -310,7 +312,7 @@ ValueStore::WriteResult LeveldbValueStore::Clear() { } DeleteDbFile(); - return MakeWriteResult(changes.Pass(), read_result->status()); + return MakeWriteResult(std::move(changes), read_result->status()); } bool LeveldbValueStore::WriteToDbForTest(leveldb::WriteBatch* batch) { @@ -487,7 +489,7 @@ ValueStore::Status LeveldbValueStore::ReadFromDb( if (!value) return Status(CORRUPTION, FixCorruption(&key), kInvalidJson); - *setting = value.Pass(); + *setting = std::move(value); return Status(); } diff --git a/extensions/browser/value_store/testing_value_store.cc b/extensions/browser/value_store/testing_value_store.cc index 500e6e8..fee2aa0 100644 --- a/extensions/browser/value_store/testing_value_store.cc +++ b/extensions/browser/value_store/testing_value_store.cc @@ -4,6 +4,8 @@ #include "extensions/browser/value_store/testing_value_store.h" +#include <utility> + #include "base/logging.h" namespace { @@ -94,7 +96,7 @@ ValueStore::WriteResult TestingValueStore::Set( storage_.SetWithoutPathExpansion(it.key(), it.value().DeepCopy()); } } - return MakeWriteResult(changes.Pass(), status_); + return MakeWriteResult(std::move(changes), status_); } ValueStore::WriteResult TestingValueStore::Remove(const std::string& key) { @@ -115,7 +117,7 @@ ValueStore::WriteResult TestingValueStore::Remove( changes->push_back(ValueStoreChange(*it, old_value.release(), NULL)); } } - return MakeWriteResult(changes.Pass(), status_); + return MakeWriteResult(std::move(changes), status_); } ValueStore::WriteResult TestingValueStore::Clear() { diff --git a/extensions/browser/value_store/value_store.cc b/extensions/browser/value_store/value_store.cc index 88ebe2a..c198f10 100644 --- a/extensions/browser/value_store/value_store.cc +++ b/extensions/browser/value_store/value_store.cc @@ -4,6 +4,8 @@ #include "extensions/browser/value_store/value_store.h" +#include <utility> + #include "base/logging.h" // Implementation of Status. @@ -34,7 +36,7 @@ void ValueStore::Status::Merge(const Status& status) { ValueStore::ReadResultType::ReadResultType( scoped_ptr<base::DictionaryValue> settings, const Status& status) - : settings_(settings.Pass()), status_(status) { + : settings_(std::move(settings)), status_(status) { CHECK(settings_); } @@ -48,7 +50,7 @@ ValueStore::ReadResultType::~ReadResultType() {} ValueStore::WriteResultType::WriteResultType( scoped_ptr<ValueStoreChangeList> changes, const Status& status) - : changes_(changes.Pass()), status_(status) { + : changes_(std::move(changes)), status_(status) { CHECK(changes_); } diff --git a/extensions/browser/value_store/value_store.h b/extensions/browser/value_store/value_store.h index ca9d48c..cddc9aa 100644 --- a/extensions/browser/value_store/value_store.h +++ b/extensions/browser/value_store/value_store.h @@ -6,6 +6,7 @@ #define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_H_ #include <string> +#include <utility> #include <vector> #include "base/memory/scoped_ptr.h" @@ -92,7 +93,7 @@ class ValueStore { // Must only be called if there is no error. base::DictionaryValue& settings() { return *settings_; } scoped_ptr<base::DictionaryValue> PassSettings() { - return settings_.Pass(); + return std::move(settings_); } const Status& status() const { return status_; } @@ -117,7 +118,9 @@ class ValueStore { // Won't be present if the NO_GENERATE_CHANGES WriteOptions was given. // Only call if no error. ValueStoreChangeList& changes() { return *changes_; } - scoped_ptr<ValueStoreChangeList> PassChanges() { return changes_.Pass(); } + scoped_ptr<ValueStoreChangeList> PassChanges() { + return std::move(changes_); + } const Status& status() const { return status_; } @@ -147,7 +150,7 @@ class ValueStore { // Helpers for making a Read/WriteResult. template <typename T> static ReadResult MakeReadResult(scoped_ptr<T> arg, const Status& status) { - return ReadResult(new ReadResultType(arg.Pass(), status)); + return ReadResult(new ReadResultType(std::move(arg), status)); } static ReadResult MakeReadResult(const Status& status) { return ReadResult(new ReadResultType(status)); @@ -155,7 +158,7 @@ class ValueStore { template <typename T> static WriteResult MakeWriteResult(scoped_ptr<T> arg, const Status& status) { - return WriteResult(new WriteResultType(arg.Pass(), status)); + return WriteResult(new WriteResultType(std::move(arg), status)); } static WriteResult MakeWriteResult(const Status& status) { return WriteResult(new WriteResultType(status)); diff --git a/extensions/browser/value_store/value_store_frontend.cc b/extensions/browser/value_store/value_store_frontend.cc index 26c3a43..0a46fe0 100644 --- a/extensions/browser/value_store/value_store_frontend.cc +++ b/extensions/browser/value_store/value_store_frontend.cc @@ -4,6 +4,8 @@ #include "extensions/browser/value_store/value_store_frontend.h" +#include <utility> + #include "base/bind.h" #include "base/files/file_path.h" #include "base/logging.h" @@ -82,7 +84,7 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> { void RunCallback(const ValueStoreFrontend::ReadCallback& callback, scoped_ptr<base::Value> value) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - callback.Run(value.Pass()); + callback.Run(std::move(value)); } // The actual ValueStore that handles persisting the data to disk. Used diff --git a/extensions/browser/value_store/value_store_frontend_unittest.cc b/extensions/browser/value_store/value_store_frontend_unittest.cc index b3030f5..0ee4c5c 100644 --- a/extensions/browser/value_store/value_store_frontend_unittest.cc +++ b/extensions/browser/value_store/value_store_frontend_unittest.cc @@ -2,13 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "extensions/browser/value_store/value_store_frontend.h" + +#include <utility> + #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/path_service.h" #include "content/public/test/test_browser_thread.h" -#include "extensions/browser/value_store/value_store_frontend.h" #include "extensions/common/extension_paths.h" #include "testing/gtest/include/gtest/gtest.h" @@ -55,7 +58,7 @@ class ValueStoreFrontendTest : public testing::Test { protected: void GetAndWait(scoped_ptr<base::Value>* output, scoped_ptr<base::Value> result) { - *output = result.Pass(); + *output = std::move(result); base::MessageLoop::current()->QuitWhenIdle(); } diff --git a/extensions/browser/web_ui_user_script_loader.cc b/extensions/browser/web_ui_user_script_loader.cc index a3194c5..6954f25 100644 --- a/extensions/browser/web_ui_user_script_loader.cc +++ b/extensions/browser/web_ui_user_script_loader.cc @@ -4,6 +4,8 @@ #include "extensions/browser/web_ui_user_script_loader.h" +#include <utility> + #include "base/bind.h" #include "base/strings/string_util.h" #include "content/public/browser/browser_context.h" @@ -116,7 +118,7 @@ void WebUIUserScriptLoader::CreateWebUIURLFetchers( browser_context, render_process_id, render_view_id, file.url(), base::Bind(&WebUIUserScriptLoader::OnSingleWebUIURLFetchComplete, base::Unretained(this), &file))); - fetchers_.push_back(fetcher.Pass()); + fetchers_.push_back(std::move(fetcher)); } } } diff --git a/extensions/common/api/bluetooth/bluetooth_manifest_data.cc b/extensions/common/api/bluetooth/bluetooth_manifest_data.cc index cb85e08..94ba7fe 100644 --- a/extensions/common/api/bluetooth/bluetooth_manifest_data.cc +++ b/extensions/common/api/bluetooth/bluetooth_manifest_data.cc @@ -4,6 +4,8 @@ #include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" +#include <utility> + #include "extensions/common/api/bluetooth/bluetooth_manifest_permission.h" #include "extensions/common/manifest_constants.h" @@ -11,7 +13,7 @@ namespace extensions { BluetoothManifestData::BluetoothManifestData( scoped_ptr<BluetoothManifestPermission> permission) - : permission_(permission.Pass()) { + : permission_(std::move(permission)) { DCHECK(permission_); } @@ -63,7 +65,7 @@ scoped_ptr<BluetoothManifestData> BluetoothManifestData::FromValue( return scoped_ptr<BluetoothManifestData>(); return scoped_ptr<BluetoothManifestData>( - new BluetoothManifestData(permission.Pass())).Pass(); + new BluetoothManifestData(std::move(permission))); } BluetoothPermissionRequest::BluetoothPermissionRequest( diff --git a/extensions/common/api/bluetooth/bluetooth_manifest_permission.cc b/extensions/common/api/bluetooth/bluetooth_manifest_permission.cc index 08cc1b7a..c2c6d2c 100644 --- a/extensions/common/api/bluetooth/bluetooth_manifest_permission.cc +++ b/extensions/common/api/bluetooth/bluetooth_manifest_permission.cc @@ -88,7 +88,7 @@ scoped_ptr<BluetoothManifestPermission> BluetoothManifestPermission::FromValue( if (bluetooth->peripheral) { result->peripheral_ = *(bluetooth->peripheral); } - return result.Pass(); + return result; } bool BluetoothManifestPermission::CheckRequest( @@ -154,7 +154,7 @@ scoped_ptr<base::Value> BluetoothManifestPermission::ToValue() const { api::extensions_manifest_types::Bluetooth bluetooth; bluetooth.uuids.reset(new std::vector<std::string>(uuids_.begin(), uuids_.end())); - return bluetooth.ToValue().Pass(); + return bluetooth.ToValue(); } ManifestPermission* BluetoothManifestPermission::Diff( diff --git a/extensions/common/api/declarative/declarative_manifest_data.cc b/extensions/common/api/declarative/declarative_manifest_data.cc index 31f0ce0..0808887b 100644 --- a/extensions/common/api/declarative/declarative_manifest_data.cc +++ b/extensions/common/api/declarative/declarative_manifest_data.cc @@ -167,7 +167,7 @@ scoped_ptr<DeclarativeManifestData> DeclarativeManifestData::FromValue( result->event_rules_map_[event].push_back(rule); } - return result.Pass(); + return result; } std::vector<linked_ptr<DeclarativeManifestData::Rule>>& diff --git a/extensions/common/api/declarative/declarative_manifest_unittest.cc b/extensions/common/api/declarative/declarative_manifest_unittest.cc index 2940d48..fc785e5 100644 --- a/extensions/common/api/declarative/declarative_manifest_unittest.cc +++ b/extensions/common/api/declarative/declarative_manifest_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "extensions/browser/api_test_utils.h" #include "extensions/common/api/declarative/declarative_manifest_data.h" #include "extensions/common/manifest_test.h" @@ -49,7 +51,7 @@ TEST_F(DeclarativeManifestTest, ConditionMissingType) { " }" " ]" "}"); - ManifestData manifest(manifest_data.Pass(), "test"); + ManifestData manifest(std::move(manifest_data), "test"); LoadAndExpectError(manifest, "'type' is required and must be a string"); } @@ -69,7 +71,7 @@ TEST_F(DeclarativeManifestTest, ConditionNotDictionary) { " }" " ]" "}"); - ManifestData manifest(manifest_data.Pass(), "test"); + ManifestData manifest(std::move(manifest_data), "test"); LoadAndExpectError(manifest, "expected dictionary, got boolean"); } @@ -90,7 +92,7 @@ TEST_F(DeclarativeManifestTest, ActionMissingType) { " }" " ]" "}"); - ManifestData manifest(manifest_data.Pass(), "test"); + ManifestData manifest(std::move(manifest_data), "test"); LoadAndExpectError(manifest, "'type' is required and must be a string"); } @@ -111,7 +113,7 @@ TEST_F(DeclarativeManifestTest, ActionNotDictionary) { " }" " ]" "}"); - ManifestData manifest(manifest_data.Pass(), "test"); + ManifestData manifest(std::move(manifest_data), "test"); LoadAndExpectError(manifest, "expected dictionary, got list"); } @@ -123,7 +125,7 @@ TEST_F(DeclarativeManifestTest, EventRulesNotList) { " \"version\": \"1\"," " \"event_rules\": {}" "}"); - ManifestData manifest(manifest_data.Pass(), "test"); + ManifestData manifest(std::move(manifest_data), "test"); LoadAndExpectError(manifest, "'event_rules' expected list, got dictionary"); } @@ -135,7 +137,7 @@ TEST_F(DeclarativeManifestTest, EventRuleNotDictionary) { " \"version\": \"1\"," " \"event_rules\": [0,1,2]" "}"); - ManifestData manifest(manifest_data.Pass(), "test"); + ManifestData manifest(std::move(manifest_data), "test"); LoadAndExpectError(manifest, "expected dictionary, got integer"); } @@ -157,7 +159,7 @@ TEST_F(DeclarativeManifestTest, EventMissingFromRule) { " }" " ]" "}"); - ManifestData manifest(manifest_data.Pass(), "test"); + ManifestData manifest(std::move(manifest_data), "test"); LoadAndExpectError(manifest, "'event' is required"); } @@ -173,7 +175,7 @@ TEST_F(DeclarativeManifestTest, RuleFailedToPopulate) { " }" " ]" "}"); - ManifestData manifest(manifest_data.Pass(), "test"); + ManifestData manifest(std::move(manifest_data), "test"); LoadAndExpectError(manifest, "rule failed to populate"); } diff --git a/extensions/common/api/printer_provider/usb_printer_manifest_data.cc b/extensions/common/api/printer_provider/usb_printer_manifest_data.cc index 79c1eed..919364e 100644 --- a/extensions/common/api/printer_provider/usb_printer_manifest_data.cc +++ b/extensions/common/api/printer_provider/usb_printer_manifest_data.cc @@ -61,7 +61,7 @@ scoped_ptr<UsbPrinterManifestData> UsbPrinterManifestData::FromValue( } result->filters_.push_back(output); } - return result.Pass(); + return result; } bool UsbPrinterManifestData::SupportsDevice( diff --git a/extensions/common/api/sockets/sockets_manifest_data.cc b/extensions/common/api/sockets/sockets_manifest_data.cc index b68964c..9cedcf8 100644 --- a/extensions/common/api/sockets/sockets_manifest_data.cc +++ b/extensions/common/api/sockets/sockets_manifest_data.cc @@ -4,6 +4,8 @@ #include "extensions/common/api/sockets/sockets_manifest_data.h" +#include <utility> + #include "extensions/common/api/sockets/sockets_manifest_permission.h" #include "extensions/common/manifest_constants.h" @@ -11,7 +13,7 @@ namespace extensions { SocketsManifestData::SocketsManifestData( scoped_ptr<SocketsManifestPermission> permission) - : permission_(permission.Pass()) { + : permission_(std::move(permission)) { DCHECK(permission_); } @@ -44,7 +46,7 @@ scoped_ptr<SocketsManifestData> SocketsManifestData::FromValue( return scoped_ptr<SocketsManifestData>(); return scoped_ptr<SocketsManifestData>( - new SocketsManifestData(permission.Pass())).Pass(); + new SocketsManifestData(std::move(permission))); } } // namespace extensions diff --git a/extensions/common/api/sockets/sockets_manifest_permission.cc b/extensions/common/api/sockets/sockets_manifest_permission.cc index a5f0271..fa0c98a 100644 --- a/extensions/common/api/sockets/sockets_manifest_permission.cc +++ b/extensions/common/api/sockets/sockets_manifest_permission.cc @@ -193,7 +193,7 @@ scoped_ptr<SocketsManifestPermission> SocketsManifestPermission::FromValue( return scoped_ptr<SocketsManifestPermission>(); } } - return result.Pass(); + return result; } bool SocketsManifestPermission::CheckRequest( @@ -264,7 +264,7 @@ scoped_ptr<base::Value> SocketsManifestPermission::ToValue() const { sockets.tcp_server.reset(NULL); } - return scoped_ptr<base::Value>(sockets.ToValue().release()).Pass(); + return scoped_ptr<base::Value>(sockets.ToValue().release()); } ManifestPermission* SocketsManifestPermission::Diff( diff --git a/extensions/common/api/sockets/sockets_manifest_permission_unittest.cc b/extensions/common/api/sockets/sockets_manifest_permission_unittest.cc index bccce57..66fb8c3 100644 --- a/extensions/common/api/sockets/sockets_manifest_permission_unittest.cc +++ b/extensions/common/api/sockets/sockets_manifest_permission_unittest.cc @@ -42,7 +42,7 @@ static void AssertEmptyPermission(const SocketsManifestPermission* permission) { static scoped_ptr<base::Value> ParsePermissionJSON(const std::string& json) { scoped_ptr<base::Value> result(base::JSONReader::Read(json)); EXPECT_TRUE(result) << "Invalid JSON string: " << json; - return result.Pass(); + return result; } static scoped_ptr<SocketsManifestPermission> PermissionFromValue( @@ -51,7 +51,7 @@ static scoped_ptr<SocketsManifestPermission> PermissionFromValue( scoped_ptr<SocketsManifestPermission> permission( SocketsManifestPermission::FromValue(value, &error16)); EXPECT_TRUE(permission) << "Error parsing Value into permission: " << error16; - return permission.Pass(); + return permission; } static scoped_ptr<SocketsManifestPermission> PermissionFromJSON( diff --git a/extensions/common/cast/cast_cert_validator.cc b/extensions/common/cast/cast_cert_validator.cc index 1bfa4e0..bafbe6a 100644 --- a/extensions/common/cast/cast_cert_validator.cc +++ b/extensions/common/cast/cast_cert_validator.cc @@ -8,6 +8,7 @@ #include <openssl/evp.h> #include <openssl/rsa.h> #include <openssl/x509.h> +#include <utility> #include "base/logging.h" #include "base/strings/string_number_conversions.h" @@ -29,7 +30,7 @@ class CertVerificationContextImpl : public CertVerificationContext { public: // Takes ownership of the passed-in x509 object explicit CertVerificationContextImpl(net::ScopedX509 x509) - : x509_(x509.Pass()) {} + : x509_(std::move(x509)) {} VerificationResult VerifySignatureOverData( const base::StringPiece& signature, @@ -148,7 +149,8 @@ VerificationResult VerifyDeviceCert( } if (context) - context->reset(new CertVerificationContextImpl(device_cert_x509.Pass())); + context->reset( + new CertVerificationContextImpl(std::move(device_cert_x509))); return VerificationResult(); } diff --git a/extensions/common/event_filter.cc b/extensions/common/event_filter.cc index ff2d1f6..955671c 100644 --- a/extensions/common/event_filter.cc +++ b/extensions/common/event_filter.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <string> - #include "extensions/common/event_filter.h" +#include <string> +#include <utility> + #include "components/url_matcher/url_matcher_factory.h" #include "ipc/ipc_message.h" @@ -19,8 +20,7 @@ EventFilter::EventMatcherEntry::EventMatcherEntry( scoped_ptr<EventMatcher> event_matcher, URLMatcher* url_matcher, const URLMatcherConditionSet::Vector& condition_sets) - : event_matcher_(event_matcher.Pass()), - url_matcher_(url_matcher) { + : event_matcher_(std::move(event_matcher)), url_matcher_(url_matcher) { for (URLMatcherConditionSet::Vector::const_iterator it = condition_sets.begin(); it != condition_sets.end(); it++) condition_set_ids_.push_back((*it)->id()); @@ -68,7 +68,7 @@ EventFilter::AddEventMatcher(const std::string& event_name, } id_to_event_name_[id] = event_name; event_matchers_[event_name][id] = linked_ptr<EventMatcherEntry>( - new EventMatcherEntry(matcher.Pass(), &url_matcher_, condition_sets)); + new EventMatcherEntry(std::move(matcher), &url_matcher_, condition_sets)); return id; } diff --git a/extensions/common/event_filter_unittest.cc b/extensions/common/event_filter_unittest.cc index 0ae063c..bb5fe04 100644 --- a/extensions/common/event_filter_unittest.cc +++ b/extensions/common/event_filter_unittest.cc @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "extensions/common/event_filter.h" + #include <string> +#include <utility> #include "base/memory/scoped_ptr.h" #include "base/values.h" -#include "extensions/common/event_filter.h" #include "extensions/common/event_filtering_info.h" #include "extensions/common/event_matcher.h" #include "ipc/ipc_message.h" @@ -37,7 +39,7 @@ class EventFilterUnittest : public testing::Test { scoped_ptr<base::ListValue> ValueAsList(scoped_ptr<base::Value> value) { scoped_ptr<base::ListValue> result(new base::ListValue()); result->Append(value.release()); - return result.Pass(); + return result; } scoped_ptr<EventMatcher> AllURLs() { @@ -54,7 +56,7 @@ class EventFilterUnittest : public testing::Test { scoped_ptr<DictionaryValue> filter_dict(new DictionaryValue); filter_dict->Set("url", url_filter_list.release()); return scoped_ptr<EventMatcher>( - new EventMatcher(filter_dict.Pass(), MSG_ROUTING_NONE)); + new EventMatcher(std::move(filter_dict), MSG_ROUTING_NONE)); } EventFilter event_filter_; @@ -137,8 +139,9 @@ TEST_F(EventFilterUnittest, TestMultipleURLFiltersMatchOnAny) { filters->Append(HostSuffixDict("google.com").release()); filters->Append(HostSuffixDict("yahoo.com").release()); - scoped_ptr<EventMatcher> matcher(MatcherFromURLFilterList(filters.Pass())); - int id = event_filter_.AddEventMatcher("event1", matcher.Pass()); + scoped_ptr<EventMatcher> matcher( + MatcherFromURLFilterList(std::move(filters))); + int id = event_filter_.AddEventMatcher("event1", std::move(matcher)); { std::set<int> matches = event_filter_.MatchEvent("event1", @@ -209,9 +212,9 @@ TEST_F(EventFilterUnittest, RemoveEventMatcherReturnsEventName) { TEST_F(EventFilterUnittest, InvalidURLFilterCantBeAdded) { scoped_ptr<base::ListValue> filter_list(new base::ListValue()); filter_list->Append(new base::ListValue()); // Should be a dict. - scoped_ptr<EventMatcher> matcher(MatcherFromURLFilterList( - filter_list.Pass())); - int id1 = event_filter_.AddEventMatcher("event1", matcher.Pass()); + scoped_ptr<EventMatcher> matcher( + MatcherFromURLFilterList(std::move(filter_list))); + int id1 = event_filter_.AddEventMatcher("event1", std::move(matcher)); EXPECT_TRUE(event_filter_.IsURLMatcherEmpty()); ASSERT_EQ(-1, id1); } @@ -220,7 +223,7 @@ TEST_F(EventFilterUnittest, EmptyListOfURLFiltersMatchesAllURLs) { scoped_ptr<base::ListValue> filter_list(new base::ListValue()); scoped_ptr<EventMatcher> matcher(MatcherFromURLFilterList( scoped_ptr<ListValue>(new ListValue))); - int id = event_filter_.AddEventMatcher("event1", matcher.Pass()); + int id = event_filter_.AddEventMatcher("event1", std::move(matcher)); std::set<int> matches = event_filter_.MatchEvent("event1", google_event_, MSG_ROUTING_NONE); ASSERT_EQ(1u, matches.size()); @@ -249,7 +252,7 @@ TEST_F(EventFilterUnittest, EmptyURLsShouldBeMatchedByEmptyURLFiltersWithAnEmptyItem) { scoped_ptr<EventMatcher> matcher(MatcherFromURLFilterList(ValueAsList( scoped_ptr<Value>(new DictionaryValue())))); - int id = event_filter_.AddEventMatcher("event1", matcher.Pass()); + int id = event_filter_.AddEventMatcher("event1", std::move(matcher)); std::set<int> matches = event_filter_.MatchEvent( "event1", empty_url_event_, MSG_ROUTING_NONE); ASSERT_EQ(1u, matches.size()); diff --git a/extensions/common/event_filtering_info.cc b/extensions/common/event_filtering_info.cc index fe9ef29..3c39864 100644 --- a/extensions/common/event_filtering_info.cc +++ b/extensions/common/event_filtering_info.cc @@ -4,6 +4,8 @@ #include "extensions/common/event_filtering_info.h" +#include <utility> + #include "base/json/json_writer.h" #include "base/values.h" @@ -59,7 +61,7 @@ scoped_ptr<base::Value> EventFilteringInfo::AsValue() const { if (has_window_exposed_by_default_) result->SetBoolean("windowExposedByDefault", window_exposed_by_default_); - return result.Pass(); + return std::move(result); } bool EventFilteringInfo::IsEmpty() const { diff --git a/extensions/common/event_matcher.cc b/extensions/common/event_matcher.cc index a5e6fc5..05dfdd8 100644 --- a/extensions/common/event_matcher.cc +++ b/extensions/common/event_matcher.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/callback.h" - #include "extensions/common/event_matcher.h" +#include <utility> + +#include "base/callback.h" #include "extensions/common/event_filtering_info.h" namespace { @@ -19,9 +20,7 @@ const char kEventFilterServiceTypeKey[] = "serviceType"; EventMatcher::EventMatcher(scoped_ptr<base::DictionaryValue> filter, int routing_id) - : filter_(filter.Pass()), - routing_id_(routing_id) { -} + : filter_(std::move(filter)), routing_id_(routing_id) {} EventMatcher::~EventMatcher() { } diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc index 4232509..f51d893 100644 --- a/extensions/common/extension.cc +++ b/extensions/common/extension.cc @@ -4,6 +4,8 @@ #include "extensions/common/extension.h" +#include <utility> + #include "base/base64.h" #include "base/basictypes.h" #include "base/command_line.h" @@ -128,7 +130,7 @@ scoped_refptr<Extension> Extension::Create(const base::FilePath& path, return NULL; } - scoped_refptr<Extension> extension = new Extension(path, manifest.Pass()); + scoped_refptr<Extension> extension = new Extension(path, std::move(manifest)); extension->install_warnings_.swap(install_warnings); if (!extension->InitFromValue(flags, &error)) { diff --git a/extensions/common/extension_api.cc b/extensions/common/extension_api.cc index ec6fa18..afafa81 100644 --- a/extensions/common/extension_api.cc +++ b/extensions/common/extension_api.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <string> +#include <utility> #include <vector> #include "base/json/json_reader.h" @@ -60,7 +61,7 @@ scoped_ptr<base::ListValue> LoadSchemaList(const std::string& name, CHECK(result.get()) << error_message << " for schema " << schema; CHECK(result->IsType(base::Value::TYPE_LIST)) << " for schema " << schema; - return base::ListValue::From(result.Pass()); + return base::ListValue::From(std::move(result)); } const base::DictionaryValue* FindListItem(const base::ListValue* list, diff --git a/extensions/common/extension_builder.cc b/extensions/common/extension_builder.cc index b573128..9e41166 100644 --- a/extensions/common/extension_builder.cc +++ b/extensions/common/extension_builder.cc @@ -57,7 +57,7 @@ ExtensionBuilder& ExtensionBuilder::SetLocation(Manifest::Location location) { ExtensionBuilder& ExtensionBuilder::SetManifest( scoped_ptr<base::DictionaryValue> manifest) { - manifest_ = manifest.Pass(); + manifest_ = std::move(manifest); return *this; } diff --git a/extensions/common/features/base_feature_provider.cc b/extensions/common/features/base_feature_provider.cc index cae08d6..3b60e47 100644 --- a/extensions/common/features/base_feature_provider.cc +++ b/extensions/common/features/base_feature_provider.cc @@ -128,10 +128,11 @@ BaseFeatureProvider::BaseFeatureProvider(const base::DictionaryValue& root, feature.get())) continue; - features->push_back(feature.Pass()); + features->push_back(std::move(feature)); } - linked_ptr<ComplexFeature> feature(new ComplexFeature(features.Pass())); + linked_ptr<ComplexFeature> feature( + new ComplexFeature(std::move(features))); feature->set_name(iter.key()); features_[iter.key()] = feature; diff --git a/extensions/common/features/complex_feature_unittest.cc b/extensions/common/features/complex_feature_unittest.cc index d06a15a..0dd7c8f 100644 --- a/extensions/common/features/complex_feature_unittest.cc +++ b/extensions/common/features/complex_feature_unittest.cc @@ -28,7 +28,7 @@ TEST(ComplexFeatureTest, MultipleRulesWhitelist) { .Set("extension_types", std::move(ListBuilder().Append("extension"))) .Build()); simple_feature->Parse(rule.get()); - features->push_back(simple_feature.Pass()); + features->push_back(std::move(simple_feature)); // Rule: "legacy_packaged_app", whitelist "bar". simple_feature.reset(new SimpleFeature); @@ -38,9 +38,9 @@ TEST(ComplexFeatureTest, MultipleRulesWhitelist) { std::move(ListBuilder().Append("legacy_packaged_app"))) .Build(); simple_feature->Parse(rule.get()); - features->push_back(simple_feature.Pass()); + features->push_back(std::move(simple_feature)); - scoped_ptr<ComplexFeature> feature(new ComplexFeature(features.Pass())); + scoped_ptr<ComplexFeature> feature(new ComplexFeature(std::move(features))); // Test match 1st rule. EXPECT_EQ( @@ -90,7 +90,7 @@ TEST(ComplexFeatureTest, Dependencies) { "manifest:content_security_policy"))) .Build(); simple_feature->Parse(rule.get()); - features->push_back(simple_feature.Pass()); + features->push_back(std::move(simple_feature)); // Rule which depends on an platform-app-only feature (serial). simple_feature.reset(new SimpleFeature); @@ -99,9 +99,9 @@ TEST(ComplexFeatureTest, Dependencies) { std::move(ListBuilder().Append("permission:serial"))) .Build(); simple_feature->Parse(rule.get()); - features->push_back(simple_feature.Pass()); + features->push_back(std::move(simple_feature)); - scoped_ptr<ComplexFeature> feature(new ComplexFeature(features.Pass())); + scoped_ptr<ComplexFeature> feature(new ComplexFeature(std::move(features))); // Available to extensions because of the content_security_policy rule. EXPECT_EQ( diff --git a/extensions/common/features/json_feature_provider_source.cc b/extensions/common/features/json_feature_provider_source.cc index c41ecb7..4d2f834 100644 --- a/extensions/common/features/json_feature_provider_source.cc +++ b/extensions/common/features/json_feature_provider_source.cc @@ -4,6 +4,8 @@ #include "extensions/common/features/json_feature_provider_source.h" +#include <utility> + #include "base/json/json_reader.h" #include "base/logging.h" #include "ui/base/resource/resource_bundle.h" @@ -29,7 +31,7 @@ void JSONFeatureProviderSource::LoadJSON(int resource_id) { scoped_ptr<base::DictionaryValue> value_as_dict; if (value) { CHECK(value->IsType(base::Value::TYPE_DICTIONARY)) << name_; - value_as_dict = base::DictionaryValue::From(value.Pass()); + value_as_dict = base::DictionaryValue::From(std::move(value)); } else { // There was some error loading the features file. // http://crbug.com/176381 diff --git a/extensions/common/features/simple_feature.cc b/extensions/common/features/simple_feature.cc index 4ead463..68c8dfa 100644 --- a/extensions/common/features/simple_feature.cc +++ b/extensions/common/features/simple_feature.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <map> +#include <utility> #include <vector> #include "base/bind.h" @@ -293,7 +294,7 @@ bool SimpleFeature::HasDependencies() const { } void SimpleFeature::AddFilter(scoped_ptr<SimpleFeatureFilter> filter) { - filters_.push_back(filter.Pass()); + filters_.push_back(std::move(filter)); } std::string SimpleFeature::Parse(const base::DictionaryValue* dictionary) { diff --git a/extensions/common/file_util.cc b/extensions/common/file_util.cc index 763fa29..a187378 100644 --- a/extensions/common/file_util.cc +++ b/extensions/common/file_util.cc @@ -268,7 +268,7 @@ scoped_ptr<base::DictionaryValue> LoadManifest( return NULL; } - return base::DictionaryValue::From(root.Pass()); + return base::DictionaryValue::From(std::move(root)); } bool ValidateExtension(const Extension* extension, diff --git a/extensions/common/file_util_unittest.cc b/extensions/common/file_util_unittest.cc index 0814334..634b338 100644 --- a/extensions/common/file_util_unittest.cc +++ b/extensions/common/file_util_unittest.cc @@ -4,6 +4,8 @@ #include "extensions/common/file_util.h" +#include <utility> + #include "base/basictypes.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" @@ -49,8 +51,8 @@ scoped_refptr<Extension> LoadExtensionManifest( return NULL; CHECK_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); return LoadExtensionManifest( - *base::DictionaryValue::From(result.Pass()).get(), manifest_dir, location, - extra_flags, error); + *base::DictionaryValue::From(std::move(result)).get(), manifest_dir, + location, extra_flags, error); } } // namespace diff --git a/extensions/common/manifest.cc b/extensions/common/manifest.cc index c552de7..cf39887 100644 --- a/extensions/common/manifest.cc +++ b/extensions/common/manifest.cc @@ -4,6 +4,8 @@ #include "extensions/common/manifest.h" +#include <utility> + #include "base/basictypes.h" #include "base/lazy_instance.h" #include "base/logging.h" @@ -109,9 +111,7 @@ Manifest::Location Manifest::GetHigherPriorityLocation( } Manifest::Manifest(Location location, scoped_ptr<base::DictionaryValue> value) - : location_(location), - value_(value.Pass()), - type_(TYPE_UNKNOWN) { + : location_(location), value_(std::move(value)), type_(TYPE_UNKNOWN) { if (value_->HasKey(keys::kTheme)) { type_ = TYPE_THEME; } else if (value_->HasKey(keys::kExport)) { diff --git a/extensions/common/manifest_handlers/oauth2_manifest_unittest.cc b/extensions/common/manifest_handlers/oauth2_manifest_unittest.cc index e52a103..f09c971 100644 --- a/extensions/common/manifest_handlers/oauth2_manifest_unittest.cc +++ b/extensions/common/manifest_handlers/oauth2_manifest_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/test/values_test_util.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/oauth2_manifest_handler.h" @@ -156,7 +158,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) { TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionNotOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -166,7 +168,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionNotOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_FALSE, false, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_EQ(1U, extension->install_warnings().size()); @@ -179,7 +181,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionNotOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, false, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_EQ(1U, extension->install_warnings().size()); @@ -192,7 +194,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionNotOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_INVALID, false, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_EQ(1U, extension->install_warnings().size()); @@ -205,7 +207,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionNotOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, true, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -215,7 +217,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveNotSetExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_FALSE, true, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -225,7 +227,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveFalseExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest); EXPECT_TRUE(extension->install_warnings().empty()); @@ -235,7 +237,7 @@ TEST_F(OAuth2ManifestTest, AutoApproveTrueExtensionOnWhitelist) { TEST_F(OAuth2ManifestTest, AutoApproveInvalidExtensionOnWhitelist) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_INVALID, true, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); std::string error; scoped_refptr<extensions::Extension> extension = LoadExtension(manifest, &error); @@ -248,7 +250,7 @@ TEST_F(OAuth2ManifestTest, InvalidClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_NOT_SET); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId); } @@ -256,7 +258,7 @@ TEST_F(OAuth2ManifestTest, InvalidClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_EMPTY); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId); } @@ -267,7 +269,7 @@ TEST_F(OAuth2ManifestTest, ComponentInvalidClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_NOT_SET); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId, @@ -277,7 +279,7 @@ TEST_F(OAuth2ManifestTest, ComponentInvalidClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_NOT_SET, false, CLIENT_ID_EMPTY); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); std::string error; LoadAndExpectError(manifest, errors::kInvalidOAuth2ClientId, @@ -289,7 +291,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_NOT_SET); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension.get()).client_id.empty()); @@ -298,7 +300,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_EMPTY); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); EXPECT_TRUE(OAuth2Info::GetOAuth2Info(extension.get()).client_id.empty()); @@ -308,7 +310,7 @@ TEST_F(OAuth2ManifestTest, ComponentWithChromeClientId) { TEST_F(OAuth2ManifestTest, ComponentWithStandardClientId) { scoped_ptr<base::DictionaryValue> ext_manifest = CreateManifest(AUTO_APPROVE_TRUE, true, CLIENT_ID_DEFAULT); - ManifestData manifest(ext_manifest.Pass(), "test"); + ManifestData manifest(std::move(ext_manifest), "test"); scoped_refptr<extensions::Extension> extension = LoadAndExpectSuccess(manifest, extensions::Manifest::COMPONENT); EXPECT_EQ("client1", OAuth2Info::GetOAuth2Info(extension.get()).client_id); diff --git a/extensions/common/manifest_handlers/permissions_parser.cc b/extensions/common/manifest_handlers/permissions_parser.cc index a7c6db9..2afdf72 100644 --- a/extensions/common/manifest_handlers/permissions_parser.cc +++ b/extensions/common/manifest_handlers/permissions_parser.cc @@ -4,6 +4,8 @@ #include "extensions/common/manifest_handlers/permissions_parser.h" +#include <utility> + #include "base/command_line.h" #include "base/memory/ref_counted.h" #include "base/strings/utf_string_conversions.h" @@ -40,7 +42,7 @@ struct ManifestPermissions : public Extension::ManifestData { ManifestPermissions::ManifestPermissions( scoped_ptr<const PermissionSet> permissions) - : permissions(permissions.Pass()) {} + : permissions(std::move(permissions)) {} ManifestPermissions::~ManifestPermissions() { } @@ -272,7 +274,8 @@ void PermissionsParser::Finalize(Extension* extension) { initial_required_permissions_->host_permissions, initial_required_permissions_->scriptable_hosts)); extension->SetManifestData( - keys::kPermissions, new ManifestPermissions(required_permissions.Pass())); + keys::kPermissions, + new ManifestPermissions(std::move(required_permissions))); scoped_ptr<const PermissionSet> optional_permissions(new PermissionSet( initial_optional_permissions_->api_permissions, @@ -280,7 +283,7 @@ void PermissionsParser::Finalize(Extension* extension) { initial_optional_permissions_->host_permissions, URLPatternSet())); extension->SetManifestData( keys::kOptionalPermissions, - new ManifestPermissions(optional_permissions.Pass())); + new ManifestPermissions(std::move(optional_permissions))); } // static diff --git a/extensions/common/manifest_handlers/webview_info.cc b/extensions/common/manifest_handlers/webview_info.cc index 12bafcc..f66df27 100644 --- a/extensions/common/manifest_handlers/webview_info.cc +++ b/extensions/common/manifest_handlers/webview_info.cc @@ -4,6 +4,8 @@ #include "extensions/common/manifest_handlers/webview_info.h" +#include <utility> + #include "base/memory/scoped_ptr.h" #include "base/strings/pattern.h" #include "base/strings/string_number_conversions.h" @@ -83,7 +85,7 @@ bool WebviewInfo::IsResourceWebviewAccessible( } void WebviewInfo::AddPartitionItem(scoped_ptr<PartitionItem> item) { - partition_items_.push_back(item.Pass()); + partition_items_.push_back(std::move(item)); } WebviewHandler::WebviewHandler() { @@ -159,7 +161,7 @@ bool WebviewHandler::Parse(Extension* extension, base::string16* error) { relative_path).spec()); partition_item->AddPattern(pattern); } - info->AddPartitionItem(partition_item.Pass()); + info->AddPartitionItem(std::move(partition_item)); } extension->SetManifestData(keys::kWebviewAccessibleResources, info.release()); diff --git a/extensions/common/manifest_test.cc b/extensions/common/manifest_test.cc index ea32fc8..771d4b3 100644 --- a/extensions/common/manifest_test.cc +++ b/extensions/common/manifest_test.cc @@ -4,6 +4,8 @@ #include "extensions/common/manifest_test.h" +#include <utility> + #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/json/json_file_value_serializer.h" @@ -68,7 +70,7 @@ ManifestTest::ManifestData::ManifestData(base::DictionaryValue* manifest, ManifestTest::ManifestData::ManifestData( scoped_ptr<base::DictionaryValue> manifest) - : manifest_(manifest.get()), manifest_holder_(manifest.Pass()) { + : manifest_(manifest.get()), manifest_holder_(std::move(manifest)) { CHECK(manifest_) << "Manifest NULL"; } @@ -77,7 +79,7 @@ ManifestTest::ManifestData::ManifestData( const char* name) : name_(name), manifest_(manifest.get()), - manifest_holder_(manifest.Pass()) { + manifest_holder_(std::move(manifest)) { CHECK(manifest_) << "Manifest NULL"; } diff --git a/extensions/common/permissions/permissions_data.cc b/extensions/common/permissions/permissions_data.cc index 79271d7..5b28d85 100644 --- a/extensions/common/permissions/permissions_data.cc +++ b/extensions/common/permissions/permissions_data.cc @@ -4,6 +4,8 @@ #include "extensions/common/permissions/permissions_data.h" +#include <utility> + #include "base/command_line.h" #include "content/public/common/url_constants.h" #include "extensions/common/constants.h" @@ -132,14 +134,14 @@ void PermissionsData::SetPermissions( scoped_ptr<const PermissionSet> active, scoped_ptr<const PermissionSet> withheld) const { AutoLockOnValidThread lock(runtime_lock_, thread_checker_.get()); - active_permissions_unsafe_ = active.Pass(); - withheld_permissions_unsafe_ = withheld.Pass(); + active_permissions_unsafe_ = std::move(active); + withheld_permissions_unsafe_ = std::move(withheld); } void PermissionsData::SetActivePermissions( scoped_ptr<const PermissionSet> active) const { AutoLockOnValidThread lock(runtime_lock_, thread_checker_.get()); - active_permissions_unsafe_ = active.Pass(); + active_permissions_unsafe_ = std::move(active); } void PermissionsData::UpdateTabSpecificPermissions( @@ -154,7 +156,7 @@ void PermissionsData::UpdateTabSpecificPermissions( ? static_cast<const PermissionSet&>(PermissionSet()) : *iter->second, permissions); - tab_specific_permissions_[tab_id] = new_permissions.Pass(); + tab_specific_permissions_[tab_id] = std::move(new_permissions); } void PermissionsData::ClearTabSpecificPermissions(int tab_id) const { diff --git a/extensions/common/url_pattern_set.cc b/extensions/common/url_pattern_set.cc index bd489e1..52db387 100644 --- a/extensions/common/url_pattern_set.cc +++ b/extensions/common/url_pattern_set.cc @@ -231,7 +231,7 @@ scoped_ptr<base::ListValue> URLPatternSet::ToValue() const { for (URLPatternSet::const_iterator i = patterns_.begin(); i != patterns_.end(); ++i) value->AppendIfNotPresent(new base::StringValue(i->GetAsString())); - return value.Pass(); + return value; } bool URLPatternSet::Populate(const std::vector<std::string>& patterns, @@ -266,7 +266,7 @@ scoped_ptr<std::vector<std::string> > URLPatternSet::ToStringVector() const { ++i) { value->push_back(i->GetAsString()); } - return value.Pass(); + return value; } bool URLPatternSet::Populate(const base::ListValue& value, diff --git a/extensions/common/value_builder.cc b/extensions/common/value_builder.cc index b15bca8..89c3ec3 100644 --- a/extensions/common/value_builder.cc +++ b/extensions/common/value_builder.cc @@ -4,6 +4,8 @@ #include "extensions/common/value_builder.h" +#include <utility> + #include "base/json/json_writer.h" #include "base/values.h" @@ -51,19 +53,19 @@ DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, DictionaryBuilder& in_value) { - dict_->SetWithoutPathExpansion(path, in_value.Build().Pass()); + dict_->SetWithoutPathExpansion(path, in_value.Build()); return *this; } DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, ListBuilder in_value) { - dict_->SetWithoutPathExpansion(path, in_value.Build().Pass()); + dict_->SetWithoutPathExpansion(path, in_value.Build()); return *this; } DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, scoped_ptr<base::Value> in_value) { - dict_->SetWithoutPathExpansion(path, in_value.Pass()); + dict_->SetWithoutPathExpansion(path, std::move(in_value)); return *this; } diff --git a/extensions/common/value_builder.h b/extensions/common/value_builder.h index cc706fa..17020a8 100644 --- a/extensions/common/value_builder.h +++ b/extensions/common/value_builder.h @@ -30,6 +30,7 @@ #define EXTENSIONS_COMMON_VALUE_BUILDER_H_ #include <string> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_ptr.h" @@ -57,7 +58,7 @@ class DictionaryBuilder { DictionaryBuilder& Pass() { return *this; } // Can only be called once, after which it's invalid to use the builder. - scoped_ptr<base::DictionaryValue> Build() { return dict_.Pass(); } + scoped_ptr<base::DictionaryValue> Build() { return std::move(dict_); } // Immediately serializes the current state to JSON. Can be called as many // times as you like. diff --git a/extensions/common/value_counter.cc b/extensions/common/value_counter.cc index 3a5e662..a4e49e0 100644 --- a/extensions/common/value_counter.cc +++ b/extensions/common/value_counter.cc @@ -5,6 +5,7 @@ #include "extensions/common/value_counter.h" #include <algorithm> +#include <utility> #include "base/values.h" @@ -12,7 +13,7 @@ namespace extensions { struct ValueCounter::Entry { explicit Entry(scoped_ptr<base::Value> value) - : value(value.Pass()), count(1) {} + : value(std::move(value)), count(1) {} scoped_ptr<base::Value> value; int count; diff --git a/extensions/renderer/api/serial/data_receiver_unittest.cc b/extensions/renderer/api/serial/data_receiver_unittest.cc index 623fcbf..c650866 100644 --- a/extensions/renderer/api/serial/data_receiver_unittest.cc +++ b/extensions/renderer/api/serial/data_receiver_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <queue> +#include <utility> #include "device/serial/data_source_sender.h" #include "device/serial/data_stream.mojom.h" @@ -35,7 +36,7 @@ class DataReceiverFactory : public gin::Wrappable<DataReceiverFactory> { mojo::InterfacePtr<device::serial::DataSourceClient> client; mojo::InterfaceRequest<device::serial::DataSourceClient> client_request = mojo::GetProxy(&client); - callback_.Run(mojo::GetProxy(&sink), client.Pass()); + callback_.Run(mojo::GetProxy(&sink), std::move(client)); gin::Dictionary result = gin::Dictionary::CreateEmpty(isolate_); result.Set("source", sink.PassInterface().PassHandle().release()); @@ -89,7 +90,7 @@ class DataReceiverTest : public ApiTestBase { mojo::InterfaceRequest<device::serial::DataSource> request, mojo::InterfacePtr<device::serial::DataSourceClient> client) { sender_ = new device::DataSourceSender( - request.Pass(), client.Pass(), + std::move(request), std::move(client), base::Bind(&DataReceiverTest::ReadyToSend, base::Unretained(this)), base::Bind(base::DoNothing)); } diff --git a/extensions/renderer/api/serial/data_sender_unittest.cc b/extensions/renderer/api/serial/data_sender_unittest.cc index 461f012..dfda6cd 100644 --- a/extensions/renderer/api/serial/data_sender_unittest.cc +++ b/extensions/renderer/api/serial/data_sender_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <queue> +#include <utility> #include "device/serial/data_sink_receiver.h" #include "device/serial/data_stream.mojom.h" @@ -39,7 +40,7 @@ class DataSenderTest : public ApiTestBase { void CreateDataSink( mojo::InterfaceRequest<device::serial::DataSink> request) { receiver_ = new device::DataSinkReceiver( - request.Pass(), + std::move(request), base::Bind(&DataSenderTest::ReadyToReceive, base::Unretained(this)), base::Bind(&DataSenderTest::OnCancel, base::Unretained(this)), base::Bind(base::DoNothing)); @@ -48,7 +49,7 @@ class DataSenderTest : public ApiTestBase { void ReadyToReceive(scoped_ptr<device::ReadOnlyBuffer> buffer) { std::string data(buffer->GetData(), buffer->GetSize()); if (expected_data_.empty()) { - buffer_ = buffer.Pass(); + buffer_ = std::move(buffer); return; } diff --git a/extensions/renderer/api/serial/serial_api_unittest.cc b/extensions/renderer/api/serial/serial_api_unittest.cc index f90fe76..216ac5c 100644 --- a/extensions/renderer/api/serial/serial_api_unittest.cc +++ b/extensions/renderer/api/serial/serial_api_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/thread_task_runner_handle.h" #include "device/serial/serial_device_enumerator.h" #include "device/serial/serial_service_impl.h" @@ -38,7 +40,7 @@ class FakeSerialDeviceEnumerator : public device::SerialDeviceEnumerator { result[2] = device::serial::DeviceInfo::New(); result[2]->path = ""; result[2]->display_name = ""; - return result.Pass(); + return result; } }; @@ -166,7 +168,7 @@ class GetControlSignalsTestIoHandler : public TestIoHandlerBase { signals->ri = num_calls() & 4; signals->dsr = num_calls() & 8; record_call(); - return signals.Pass(); + return signals; } private: @@ -442,7 +444,7 @@ class SerialApiTest : public ApiTestBase { base::ThreadTaskRunnerHandle::Get()), scoped_ptr<device::SerialDeviceEnumerator>( new FakeSerialDeviceEnumerator), - request.Pass()); + std::move(request)); } DISALLOW_COPY_AND_ASSIGN(SerialApiTest); diff --git a/extensions/renderer/api_test_base.cc b/extensions/renderer/api_test_base.cc index 75c6d5d..3ce3d5d 100644 --- a/extensions/renderer/api_test_base.cc +++ b/extensions/renderer/api_test_base.cc @@ -4,6 +4,7 @@ #include "extensions/renderer/api_test_base.h" +#include <utility> #include <vector> #include "base/run_loop.h" @@ -89,7 +90,7 @@ mojo::Handle TestServiceProvider::ConnectToService( base::Callback<void(mojo::ScopedMessagePipeHandle)> >::iterator it = service_factories_.find(service_name); if (it != service_factories_.end()) - it->second.Run(pipe.handle0.Pass()); + it->second.Run(std::move(pipe.handle0)); return pipe.handle1.release(); } diff --git a/extensions/renderer/api_test_base.h b/extensions/renderer/api_test_base.h index ed53280..2bfc4cc 100644 --- a/extensions/renderer/api_test_base.h +++ b/extensions/renderer/api_test_base.h @@ -62,7 +62,7 @@ class TestServiceProvider : public gin::Wrappable<TestServiceProvider> { const base::Callback<void(mojo::InterfaceRequest<Interface>)> service_factory, mojo::ScopedMessagePipeHandle handle) { - service_factory.Run(mojo::MakeRequest<Interface>(handle.Pass())); + service_factory.Run(mojo::MakeRequest<Interface>(std::move(handle))); } static void IgnoreHandle(mojo::ScopedMessagePipeHandle handle); diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index b6e3a1e..a674504 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc @@ -4,6 +4,8 @@ #include "extensions/renderer/dispatcher.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" @@ -262,7 +264,7 @@ void Dispatcher::DidCreateScriptContext( { scoped_ptr<ModuleSystem> module_system( new ModuleSystem(context, &source_map_)); - context->set_module_system(module_system.Pass()); + context->set_module_system(std::move(module_system)); } ModuleSystem* module_system = context->module_system(); @@ -1170,7 +1172,8 @@ void Dispatcher::OnUpdatePermissions( active->effective_hosts()); } - extension->permissions_data()->SetPermissions(active.Pass(), withheld.Pass()); + extension->permissions_data()->SetPermissions(std::move(active), + std::move(withheld)); UpdateBindings(extension->id()); } diff --git a/extensions/renderer/dom_activity_logger.cc b/extensions/renderer/dom_activity_logger.cc index 53c5917..086f63e 100644 --- a/extensions/renderer/dom_activity_logger.cc +++ b/extensions/renderer/dom_activity_logger.cc @@ -4,6 +4,8 @@ #include "extensions/renderer/dom_activity_logger.h" +#include <utility> + #include "content/public/child/v8_value_converter.h" #include "content/public/renderer/render_thread.h" #include "extensions/common/dom_action_types.h" @@ -85,8 +87,8 @@ void DOMActivityLogger::logSetter(const WebString& api_name, AppendV8Value(api_name_utf8, new_value, args.get()); if (!old_value.IsEmpty()) AppendV8Value(api_name_utf8, old_value, args.get()); - SendDomActionMessage( - api_name_utf8, url, title, DomActionType::SETTER, args.Pass()); + SendDomActionMessage(api_name_utf8, url, title, DomActionType::SETTER, + std::move(args)); } void DOMActivityLogger::logMethod(const WebString& api_name, @@ -98,8 +100,8 @@ void DOMActivityLogger::logMethod(const WebString& api_name, std::string api_name_utf8 = api_name.utf8(); for (int i = 0; i < argc; ++i) AppendV8Value(api_name_utf8, argv[i], args.get()); - SendDomActionMessage( - api_name_utf8, url, title, DomActionType::METHOD, args.Pass()); + SendDomActionMessage(api_name_utf8, url, title, DomActionType::METHOD, + std::move(args)); } void DOMActivityLogger::logEvent(const WebString& event_name, @@ -111,8 +113,8 @@ void DOMActivityLogger::logEvent(const WebString& event_name, std::string event_name_utf8 = event_name.utf8(); for (int i = 0; i < argc; ++i) args->Append(new base::StringValue(argv[i])); - SendDomActionMessage( - event_name_utf8, url, title, DomActionType::METHOD, args.Pass()); + SendDomActionMessage(event_name_utf8, url, title, DomActionType::METHOD, + std::move(args)); } void DOMActivityLogger::SendDomActionMessage(const std::string& api_call, diff --git a/extensions/renderer/event_bindings.cc b/extensions/renderer/event_bindings.cc index 7544f74b..b92ed6c 100644 --- a/extensions/renderer/event_bindings.cc +++ b/extensions/renderer/event_bindings.cc @@ -266,14 +266,14 @@ void EventBindings::AttachFilteredEvent( args.GetReturnValue().Set(static_cast<int32_t>(-1)); return; } - filter = base::DictionaryValue::From(filter_value.Pass()); + filter = base::DictionaryValue::From(std::move(filter_value)); } // Hold onto a weak reference to |filter| so that it can be used after passing // ownership to |event_filter|. base::DictionaryValue* filter_weak = filter.get(); int id = g_event_filter.Get().AddEventMatcher( - event_name, ParseEventMatcher(filter.Pass())); + event_name, ParseEventMatcher(std::move(filter))); attached_matcher_ids_.insert(id); // Only send IPCs the first time a filter gets added. @@ -341,7 +341,7 @@ void EventBindings::MatchAgainstEventFilter( scoped_ptr<EventMatcher> EventBindings::ParseEventMatcher( scoped_ptr<base::DictionaryValue> filter) { return make_scoped_ptr(new EventMatcher( - filter.Pass(), context()->GetRenderFrame()->GetRoutingID())); + std::move(filter), context()->GetRenderFrame()->GetRoutingID())); } void EventBindings::OnInvalidated() { diff --git a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc index ee243bf..f54c878 100644 --- a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc +++ b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc @@ -152,7 +152,7 @@ void GuestViewInternalCustomBindings::AttachGuest( scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); scoped_ptr<base::Value> params_as_value( converter->FromV8Value(args[2], context()->v8_context())); - params = base::DictionaryValue::From(params_as_value.Pass()); + params = base::DictionaryValue::From(std::move(params_as_value)); CHECK(params); } @@ -162,7 +162,7 @@ void GuestViewInternalCustomBindings::AttachGuest( linked_ptr<guest_view::GuestViewRequest> request( new guest_view::GuestViewAttachRequest( - guest_view_container, guest_instance_id, params.Pass(), + guest_view_container, guest_instance_id, std::move(params), args.Length() == 4 ? args[3].As<v8::Function>() : v8::Local<v8::Function>(), args.GetIsolate())); @@ -226,7 +226,7 @@ void GuestViewInternalCustomBindings::AttachIframeGuest( scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); scoped_ptr<base::Value> params_as_value( converter->FromV8Value(args[2], context()->v8_context())); - params = base::DictionaryValue::From(params_as_value.Pass()); + params = base::DictionaryValue::From(std::move(params_as_value)); CHECK(params); } @@ -261,9 +261,9 @@ void GuestViewInternalCustomBindings::AttachIframeGuest( linked_ptr<guest_view::GuestViewRequest> request( new guest_view::GuestViewAttachIframeRequest( guest_view_container, render_frame->GetRoutingID(), guest_instance_id, - params.Pass(), args.Length() == (num_required_params + 1) - ? args[num_required_params].As<v8::Function>() - : v8::Local<v8::Function>(), + std::move(params), args.Length() == (num_required_params + 1) + ? args[num_required_params].As<v8::Function>() + : v8::Local<v8::Function>(), args.GetIsolate())); guest_view_container->IssueRequest(request); diff --git a/extensions/renderer/module_system.h b/extensions/renderer/module_system.h index e8c2601..45e9c44 100644 --- a/extensions/renderer/module_system.h +++ b/extensions/renderer/module_system.h @@ -8,6 +8,7 @@ #include <map> #include <set> #include <string> +#include <utility> #include <vector> #include "base/compiler_specific.h" @@ -141,7 +142,7 @@ class ModuleSystem : public ObjectBackedNativeHandler, // Passes exceptions to |handler| rather than console::Fatal. void SetExceptionHandlerForTest(scoped_ptr<ExceptionHandler> handler) { - exception_handler_ = handler.Pass(); + exception_handler_ = std::move(handler); } protected: diff --git a/extensions/renderer/module_system_test.cc b/extensions/renderer/module_system_test.cc index 7f697a2..0db5495 100644 --- a/extensions/renderer/module_system_test.cc +++ b/extensions/renderer/module_system_test.cc @@ -6,6 +6,7 @@ #include <map> #include <string> +#include <utility> #include "base/callback.h" #include "base/files/file_path.h" @@ -140,7 +141,7 @@ ModuleSystemTestEnvironment::ModuleSystemTestEnvironment(v8::Isolate* isolate) { scoped_ptr<ModuleSystem> module_system( new ModuleSystem(context_.get(), source_map_.get())); - context_->set_module_system(module_system.Pass()); + context_->set_module_system(std::move(module_system)); } ModuleSystem* module_system = context_->module_system(); module_system->RegisterNativeHandler( diff --git a/extensions/renderer/module_system_unittest.cc b/extensions/renderer/module_system_unittest.cc index d2cb5f8..d84e31e 100644 --- a/extensions/renderer/module_system_unittest.cc +++ b/extensions/renderer/module_system_unittest.cc @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/memory/scoped_ptr.h" #include "extensions/renderer/module_system.h" + +#include <utility> + +#include "base/memory/scoped_ptr.h" #include "extensions/renderer/module_system_test.h" #include "gin/modules/module_registry.h" @@ -53,7 +56,7 @@ TEST_F(ModuleSystemTest, TestExceptionHandling) { TestExceptionHandler* handler = new TestExceptionHandler; scoped_ptr<ModuleSystem::ExceptionHandler> scoped_handler(handler); ASSERT_FALSE(handler->handled_exception()); - env()->module_system()->SetExceptionHandlerForTest(scoped_handler.Pass()); + env()->module_system()->SetExceptionHandlerForTest(std::move(scoped_handler)); env()->RegisterModule("test", "throw 'hi';"); env()->module_system()->Require("test"); diff --git a/extensions/renderer/mojo/keep_alive_client_unittest.cc b/extensions/renderer/mojo/keep_alive_client_unittest.cc index 391d03b..2d9c63c 100644 --- a/extensions/renderer/mojo/keep_alive_client_unittest.cc +++ b/extensions/renderer/mojo/keep_alive_client_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "extensions/common/mojo/keep_alive.mojom.h" #include "extensions/renderer/api_test_base.h" #include "grit/extensions_renderer_resources.h" @@ -19,14 +21,15 @@ class TestKeepAlive : public KeepAlive { public: TestKeepAlive(const base::Closure& on_destruction, mojo::InterfaceRequest<KeepAlive> keep_alive) - : on_destruction_(on_destruction), binding_(this, keep_alive.Pass()) {} + : on_destruction_(on_destruction), + binding_(this, std::move(keep_alive)) {} ~TestKeepAlive() override { on_destruction_.Run(); } static void Create(const base::Closure& on_creation, const base::Closure& on_destruction, mojo::InterfaceRequest<KeepAlive> keep_alive) { - new TestKeepAlive(on_destruction, keep_alive.Pass()); + new TestKeepAlive(on_destruction, std::move(keep_alive)); on_creation.Run(); } diff --git a/extensions/renderer/programmatic_script_injector.cc b/extensions/renderer/programmatic_script_injector.cc index 8fea5aa..f576305 100644 --- a/extensions/renderer/programmatic_script_injector.cc +++ b/extensions/renderer/programmatic_script_injector.cc @@ -4,6 +4,7 @@ #include "extensions/renderer/programmatic_script_injector.h" +#include <utility> #include <vector> #include "base/values.h" @@ -118,7 +119,7 @@ void ProgrammaticScriptInjector::OnInjectionComplete( content::RenderFrame* render_frame) { DCHECK(results_.empty()); if (execution_result) - results_.Append(execution_result.Pass()); + results_.Append(std::move(execution_result)); Finish(std::string(), render_frame); } diff --git a/extensions/renderer/script_context.h b/extensions/renderer/script_context.h index a345d07..c803b7b 100644 --- a/extensions/renderer/script_context.h +++ b/extensions/renderer/script_context.h @@ -6,6 +6,7 @@ #define EXTENSIONS_RENDERER_SCRIPT_CONTEXT_H_ #include <string> +#include <utility> #include <vector> #include "base/basictypes.h" @@ -89,7 +90,7 @@ class ScriptContext : public RequestSender::Source { } void set_module_system(scoped_ptr<ModuleSystem> module_system) { - module_system_ = module_system.Pass(); + module_system_ = std::move(module_system); } ModuleSystem* module_system() { return module_system_.get(); } diff --git a/extensions/renderer/script_injection.cc b/extensions/renderer/script_injection.cc index f924a01..876c07a 100644 --- a/extensions/renderer/script_injection.cc +++ b/extensions/renderer/script_injection.cc @@ -5,6 +5,7 @@ #include "extensions/renderer/script_injection.h" #include <map> +#include <utility> #include "base/lazy_instance.h" #include "base/metrics/histogram.h" @@ -113,14 +114,13 @@ void ScriptInjection::RemoveIsolatedWorld(const std::string& host_id) { g_isolated_worlds.Get().erase(host_id); } -ScriptInjection::ScriptInjection( - scoped_ptr<ScriptInjector> injector, - content::RenderFrame* render_frame, - scoped_ptr<const InjectionHost> injection_host, - UserScript::RunLocation run_location) - : injector_(injector.Pass()), +ScriptInjection::ScriptInjection(scoped_ptr<ScriptInjector> injector, + content::RenderFrame* render_frame, + scoped_ptr<const InjectionHost> injection_host, + UserScript::RunLocation run_location) + : injector_(std::move(injector)), render_frame_(render_frame), - injection_host_(injection_host.Pass()), + injection_host_(std::move(injection_host)), run_location_(run_location), request_id_(kInvalidRequestId), complete_(false), @@ -226,7 +226,7 @@ ScriptInjection::InjectionResult ScriptInjection::Inject( injector_->GetRunInfo(scripts_run_info, run_location_); if (complete_) { - injector_->OnInjectionComplete(execution_result_.Pass(), run_location_, + injector_->OnInjectionComplete(std::move(execution_result_), run_location_, render_frame_); } else { ++scripts_run_info->num_blocking_js; @@ -302,7 +302,7 @@ void ScriptInjection::OnJsInjectionCompleted( // If |async_completion_callback_| is set, it means the script finished // asynchronously, and we should run it. if (!async_completion_callback_.is_null()) { - injector_->OnInjectionComplete(execution_result_.Pass(), run_location_, + injector_->OnInjectionComplete(std::move(execution_result_), run_location_, render_frame_); // Warning: this object can be destroyed after this line! async_completion_callback_.Run(this); diff --git a/extensions/renderer/script_injection_manager.cc b/extensions/renderer/script_injection_manager.cc index 90622c7..e2974af 100644 --- a/extensions/renderer/script_injection_manager.cc +++ b/extensions/renderer/script_injection_manager.cc @@ -414,8 +414,7 @@ void ScriptInjectionManager::HandleExecuteCode( scoped_ptr<ScriptInjection> injection(new ScriptInjection( scoped_ptr<ScriptInjector>( new ProgrammaticScriptInjector(params, render_frame)), - render_frame, - injection_host.Pass(), + render_frame, std::move(injection_host), static_cast<UserScript::RunLocation>(params.run_at))); FrameStatusMap::const_iterator iter = frame_statuses_.find(render_frame); @@ -423,7 +422,7 @@ void ScriptInjectionManager::HandleExecuteCode( iter == frame_statuses_.end() ? UserScript::UNDEFINED : iter->second; ScriptsRunInfo scripts_run_info(render_frame, run_location); - TryToInject(injection.Pass(), run_location, &scripts_run_info); + TryToInject(std::move(injection), run_location, &scripts_run_info); } void ScriptInjectionManager::HandleExecuteDeclarativeScript( @@ -442,8 +441,7 @@ void ScriptInjectionManager::HandleExecuteDeclarativeScript( if (injection.get()) { ScriptsRunInfo scripts_run_info(render_frame, UserScript::BROWSER_DRIVEN); // TODO(markdittmer): Use return value of TryToInject for error handling. - TryToInject(injection.Pass(), - UserScript::BROWSER_DRIVEN, + TryToInject(std::move(injection), UserScript::BROWSER_DRIVEN, &scripts_run_info); scripts_run_info.LogRun(); diff --git a/extensions/renderer/user_script_set.cc b/extensions/renderer/user_script_set.cc index 5667f2d..e4d5295 100644 --- a/extensions/renderer/user_script_set.cc +++ b/extensions/renderer/user_script_set.cc @@ -4,6 +4,8 @@ #include "extensions/renderer/user_script_set.h" +#include <utility> + #include "base/memory/ref_counted.h" #include "content/public/common/url_constants.h" #include "content/public/renderer/render_frame.h" @@ -146,7 +148,7 @@ bool UserScriptSet::UpdateUserScripts(base::SharedMemoryHandle shared_memory, continue; } - scripts_.push_back(script.Pass()); + scripts_.push_back(std::move(script)); } FOR_EACH_OBSERVER(Observer, @@ -189,20 +191,20 @@ scoped_ptr<ScriptInjection> UserScriptSet::GetInjectionForScript( if (host_id.type() == HostID::EXTENSIONS) { injection_host = ExtensionInjectionHost::Create(host_id.id()); if (!injection_host) - return injection.Pass(); + return injection; } else { DCHECK_EQ(host_id.type(), HostID::WEBUI); injection_host.reset(new WebUIInjectionHost(host_id)); } if (web_frame->parent() && !script->match_all_frames()) - return injection.Pass(); // Only match subframes if the script declared it. + return injection; // Only match subframes if the script declared it. GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL( web_frame, document_url, script->match_about_blank()); if (!script->MatchesURL(effective_document_url)) - return injection.Pass(); + return injection; scoped_ptr<ScriptInjector> injector(new UserScriptInjector(script, this, @@ -213,7 +215,7 @@ scoped_ptr<ScriptInjection> UserScriptSet::GetInjectionForScript( web_frame, tab_id) == PermissionsData::ACCESS_DENIED) { - return injection.Pass(); + return injection; } bool inject_css = !script->css_scripts().empty() && @@ -221,13 +223,11 @@ scoped_ptr<ScriptInjection> UserScriptSet::GetInjectionForScript( bool inject_js = !script->js_scripts().empty() && script->run_location() == run_location; if (inject_css || inject_js) { - injection.reset(new ScriptInjection( - injector.Pass(), - render_frame, - injection_host.Pass(), - run_location)); + injection.reset(new ScriptInjection(std::move(injector), render_frame, + std::move(injection_host), + run_location)); } - return injection.Pass(); + return injection; } } // namespace extensions diff --git a/extensions/renderer/v8_schema_registry.cc b/extensions/renderer/v8_schema_registry.cc index 65b1bed..e3dd34c 100644 --- a/extensions/renderer/v8_schema_registry.cc +++ b/extensions/renderer/v8_schema_registry.cc @@ -4,6 +4,8 @@ #include "extensions/renderer/v8_schema_registry.h" +#include <utility> + #include "base/logging.h" #include "base/values.h" #include "content/public/child/v8_value_converter.h" @@ -22,7 +24,7 @@ class SchemaRegistryNativeHandler : public ObjectBackedNativeHandler { SchemaRegistryNativeHandler(V8SchemaRegistry* registry, scoped_ptr<ScriptContext> context) : ObjectBackedNativeHandler(context.get()), - context_(context.Pass()), + context_(std::move(context)), registry_(registry) { RouteFunction("GetSchema", base::Bind(&SchemaRegistryNativeHandler::GetSchema, @@ -58,7 +60,7 @@ scoped_ptr<NativeHandler> V8SchemaRegistry::AsNativeHandler() { NULL, // no effective extension Feature::UNSPECIFIED_CONTEXT)); return scoped_ptr<NativeHandler>( - new SchemaRegistryNativeHandler(this, context.Pass())); + new SchemaRegistryNativeHandler(this, std::move(context))); } v8::Local<v8::Array> V8SchemaRegistry::GetSchemas( diff --git a/extensions/renderer/wake_event_page.cc b/extensions/renderer/wake_event_page.cc index ae98acc..6097075 100644 --- a/extensions/renderer/wake_event_page.cc +++ b/extensions/renderer/wake_event_page.cc @@ -4,6 +4,8 @@ #include "extensions/renderer/wake_event_page.h" +#include <utility> + #include "base/atomic_sequence_num.h" #include "base/bind.h" #include "base/bind_helpers.h" @@ -160,7 +162,7 @@ void WakeEventPage::MakeRequest(const std::string& extension_id, scoped_ptr<RequestData> request_data( new RequestData(content::WorkerThread::GetCurrentId(), on_response)); base::AutoLock lock(requests_lock_); - requests_.set(request_id, request_data.Pass()); + requests_.set(request_id, std::move(request_data)); } message_filter_->Send( new ExtensionHostMsg_WakeEventPage(request_id, extension_id)); diff --git a/extensions/renderer/worker_script_context_set.cc b/extensions/renderer/worker_script_context_set.cc index 242e5a0..a05fdbc 100644 --- a/extensions/renderer/worker_script_context_set.cc +++ b/extensions/renderer/worker_script_context_set.cc @@ -5,6 +5,7 @@ #include "extensions/renderer/worker_script_context_set.h" #include <algorithm> +#include <utility> #include "extensions/renderer/script_context.h" @@ -45,7 +46,7 @@ void WorkerScriptContextSet::Insert(scoped_ptr<ScriptContext> context) { } CHECK(FindContext(contexts, context->v8_context()) == contexts->end()) << "Worker for " << context->url() << " is already in this set"; - contexts->push_back(context.Pass()); + contexts->push_back(std::move(context)); } void WorkerScriptContextSet::Remove(v8::Local<v8::Context> v8_context, diff --git a/extensions/shell/browser/media_capture_util.cc b/extensions/shell/browser/media_capture_util.cc index d8a11a8..6f4660c 100644 --- a/extensions/shell/browser/media_capture_util.cc +++ b/extensions/shell/browser/media_capture_util.cc @@ -5,6 +5,7 @@ #include "extensions/shell/browser/media_capture_util.h" #include <string> +#include <utility> #include "base/callback.h" #include "base/logging.h" @@ -64,10 +65,9 @@ void GrantMediaStreamRequest(content::WebContents* web_contents, // TODO(jamescook): Should we show a recording icon somewhere? If so, where? scoped_ptr<MediaStreamUI> ui; - callback.Run(devices, - devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE - : content::MEDIA_DEVICE_OK, - ui.Pass()); + callback.Run(devices, devices.empty() ? content::MEDIA_DEVICE_INVALID_STATE + : content::MEDIA_DEVICE_OK, + std::move(ui)); } void VerifyMediaAccessPermission(content::MediaStreamType type, diff --git a/extensions/shell/browser/shell_browser_context.cc b/extensions/shell/browser/shell_browser_context.cc index 745770b..b38661b 100644 --- a/extensions/shell/browser/shell_browser_context.cc +++ b/extensions/shell/browser/shell_browser_context.cc @@ -4,6 +4,8 @@ #include "extensions/shell/browser/shell_browser_context.h" +#include <utility> + #include "base/command_line.h" #include "components/guest_view/browser/guest_view_manager.h" #include "content/public/browser/browser_thread.h" @@ -47,19 +49,14 @@ net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( content::URLRequestInterceptorScopedVector request_interceptors, InfoMap* extension_info_map) { DCHECK(!url_request_context_getter()); - set_url_request_context_getter( - new ShellURLRequestContextGetter( - this, - IgnoreCertificateErrors(), - GetPath(), - content::BrowserThread::UnsafeGetMessageLoopForThread( - content::BrowserThread::IO), - content::BrowserThread::UnsafeGetMessageLoopForThread( - content::BrowserThread::FILE), - protocol_handlers, - request_interceptors.Pass(), - nullptr /* net_log */, - extension_info_map)); + set_url_request_context_getter(new ShellURLRequestContextGetter( + this, IgnoreCertificateErrors(), GetPath(), + content::BrowserThread::UnsafeGetMessageLoopForThread( + content::BrowserThread::IO), + content::BrowserThread::UnsafeGetMessageLoopForThread( + content::BrowserThread::FILE), + protocol_handlers, std::move(request_interceptors), nullptr /* net_log */, + extension_info_map)); resource_context_->set_url_request_context_getter( url_request_context_getter()); content::BrowserThread::PostTask( diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc index 06cf81b..044f0461 100644 --- a/extensions/shell/browser/shell_content_browser_client.cc +++ b/extensions/shell/browser/shell_content_browser_client.cc @@ -4,6 +4,8 @@ #include "extensions/shell/browser/shell_content_browser_client.h" +#include <utility> + #include "base/command_line.h" #include "components/guest_view/browser/guest_view_message_filter.h" #include "content/public/browser/browser_thread.h" @@ -126,7 +128,7 @@ net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( extension_info_map) .release()); return browser_main_parts_->browser_context()->CreateRequestContext( - protocol_handlers, request_interceptors.Pass(), extension_info_map); + protocol_handlers, std::move(request_interceptors), extension_info_map); } bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { diff --git a/extensions/shell/browser/shell_extensions_browser_client.cc b/extensions/shell/browser/shell_extensions_browser_client.cc index a3ec44a..fc53b92 100644 --- a/extensions/shell/browser/shell_extensions_browser_client.cc +++ b/extensions/shell/browser/shell_extensions_browser_client.cc @@ -4,6 +4,8 @@ #include "extensions/shell/browser/shell_extensions_browser_client.h" +#include <utility> + #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_frame_host.h" @@ -213,8 +215,9 @@ void ShellExtensionsBrowserClient::BroadcastEventToRenderers( return; } - scoped_ptr<Event> event(new Event(histogram_value, event_name, args.Pass())); - EventRouter::Get(browser_context_)->BroadcastEvent(event.Pass()); + scoped_ptr<Event> event( + new Event(histogram_value, event_name, std::move(args))); + EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); } net::NetLog* ShellExtensionsBrowserClient::GetNetLog() { diff --git a/extensions/shell/browser/shell_url_request_context_getter.cc b/extensions/shell/browser/shell_url_request_context_getter.cc index 4216a3e..8ee74b2 100644 --- a/extensions/shell/browser/shell_url_request_context_getter.cc +++ b/extensions/shell/browser/shell_url_request_context_getter.cc @@ -4,6 +4,8 @@ #include "extensions/shell/browser/shell_url_request_context_getter.h" +#include <utility> + #include "base/memory/scoped_ptr.h" #include "content/public/browser/resource_request_info.h" #include "extensions/browser/info_map.h" @@ -26,11 +28,10 @@ ShellURLRequestContextGetter::ShellURLRequestContextGetter( io_loop, file_loop, protocol_handlers, - request_interceptors.Pass(), + std::move(request_interceptors), net_log), browser_context_(browser_context), - extension_info_map_(extension_info_map) { -} + extension_info_map_(extension_info_map) {} ShellURLRequestContextGetter::~ShellURLRequestContextGetter() { } diff --git a/extensions/shell/common/shell_extensions_client.cc b/extensions/shell/common/shell_extensions_client.cc index 4a37b09..5153eea 100644 --- a/extensions/shell/common/shell_extensions_client.cc +++ b/extensions/shell/common/shell_extensions_client.cc @@ -115,7 +115,7 @@ scoped_ptr<FeatureProvider> ShellExtensionsClient::CreateFeatureProvider( } else { NOTREACHED(); } - return provider.Pass(); + return provider; } scoped_ptr<JSONFeatureProviderSource> @@ -136,7 +136,7 @@ ShellExtensionsClient::CreateFeatureProviderSource( NOTREACHED(); source.reset(); } - return source.Pass(); + return source; } void ShellExtensionsClient::FilterHostPermissions( diff --git a/extensions/test/test_extensions_client.cc b/extensions/test/test_extensions_client.cc index b0b02f1..753c6b0 100644 --- a/extensions/test/test_extensions_client.cc +++ b/extensions/test/test_extensions_client.cc @@ -92,7 +92,7 @@ scoped_ptr<FeatureProvider> TestExtensionsClient::CreateFeatureProvider( } else { NOTREACHED(); } - return provider.Pass(); + return provider; } scoped_ptr<JSONFeatureProviderSource> @@ -112,7 +112,7 @@ TestExtensionsClient::CreateFeatureProviderSource( NOTREACHED(); source.reset(); } - return source.Pass(); + return source; } void TestExtensionsClient::FilterHostPermissions( diff --git a/extensions/utility/unpacker.cc b/extensions/utility/unpacker.cc index f499808..36c0eba 100644 --- a/extensions/utility/unpacker.cc +++ b/extensions/utility/unpacker.cc @@ -5,6 +5,7 @@ #include "extensions/utility/unpacker.h" #include <set> +#include <utility> #include "base/files/file_enumerator.h" #include "base/files/file_util.h" @@ -132,7 +133,7 @@ scoped_ptr<base::DictionaryValue> Unpacker::ReadManifest() { return NULL; } - return base::DictionaryValue::From(root.Pass()); + return base::DictionaryValue::From(std::move(root)); } bool Unpacker::ReadAllMessageCatalogs(const std::string& default_locale) { |