summaryrefslogtreecommitdiff
path: root/chromium/extensions/browser
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-07-14 17:41:05 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-08-04 12:37:36 +0000
commit399c965b6064c440ddcf4015f5f8e9d131c7a0a6 (patch)
tree6b06b60ff365abef0e13b3503d593a0df48d20e8 /chromium/extensions/browser
parent7366110654eec46f21b6824f302356426f48cd74 (diff)
downloadqtwebengine-chromium-399c965b6064c440ddcf4015f5f8e9d131c7a0a6.tar.gz
BASELINE: Update Chromium to 52.0.2743.76 and Ninja to 1.7.1
Change-Id: I382f51b959689505a60f8b707255ecb344f7d8b4 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/extensions/browser')
-rw-r--r--chromium/extensions/browser/BUILD.gn6
-rw-r--r--chromium/extensions/browser/DEPS1
-rw-r--r--chromium/extensions/browser/api/alarms/OWNERS1
-rw-r--r--chromium/extensions/browser/api/alarms/alarm_manager.cc16
-rw-r--r--chromium/extensions/browser/api/alarms/alarm_manager.h6
-rw-r--r--chromium/extensions/browser/api/alarms/alarms_api.cc9
-rw-r--r--chromium/extensions/browser/api/alarms/alarms_api_unittest.cc26
-rw-r--r--chromium/extensions/browser/api/api_resource_manager.h2
-rw-r--r--chromium/extensions/browser/api/api_resource_manager_unittest.cc2
-rw-r--r--chromium/extensions/browser/api/app_current_window_internal/app_current_window_internal_api.cc21
-rw-r--r--chromium/extensions/browser/api/app_runtime/app_runtime_api.cc44
-rw-r--r--chromium/extensions/browser/api/app_runtime/app_runtime_api.h4
-rw-r--r--chromium/extensions/browser/api/app_window/app_window_api.cc6
-rw-r--r--chromium/extensions/browser/api/app_window/app_window_apitest.cc2
-rw-r--r--chromium/extensions/browser/api/audio/audio_api.cc34
-rw-r--r--chromium/extensions/browser/api/bluetooth/bluetooth_api.cc2
-rw-r--r--chromium/extensions/browser/api/bluetooth/bluetooth_api.h4
-rw-r--r--chromium/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc10
-rw-r--r--chromium/extensions/browser/api/bluetooth/bluetooth_apitest.cc13
-rw-r--r--chromium/extensions/browser/api/bluetooth/bluetooth_event_router.cc14
-rw-r--r--chromium/extensions/browser/api/bluetooth/bluetooth_event_router.h4
-rw-r--r--chromium/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc8
-rw-r--r--chromium/extensions/browser/api/bluetooth/bluetooth_private_api.cc16
-rw-r--r--chromium/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc14
-rw-r--r--chromium/extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h2
-rw-r--r--chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc6
-rw-r--r--chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h28
-rw-r--r--chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc6
-rw-r--r--chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc32
-rw-r--r--chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h5
-rw-r--r--chromium/extensions/browser/api/cast_channel/DEPS1
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_auth_util.cc6
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_auth_util_unittest.cc113
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_channel_api.cc44
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_channel_api.h27
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_channel_api_unittest.cc5
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_channel_apitest.cc5
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_framer.cc20
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_framer.h7
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_framer_unittest.cc6
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_message_util.cc5
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_socket.cc25
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_socket.h28
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_socket_unittest.cc51
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_test_util.cc2
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_test_util.h11
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_transport.cc2
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_transport.h10
-rw-r--r--chromium/extensions/browser/api/cast_channel/cast_transport_unittest.cc8
-rw-r--r--chromium/extensions/browser/api/cast_channel/keep_alive_delegate.cc8
-rw-r--r--chromium/extensions/browser/api/cast_channel/keep_alive_delegate.h12
-rw-r--r--chromium/extensions/browser/api/cast_channel/keep_alive_delegate_unittest.cc13
-rw-r--r--chromium/extensions/browser/api/cast_channel/logger.cc10
-rw-r--r--chromium/extensions/browser/api/cast_channel/logger.h8
-rw-r--r--chromium/extensions/browser/api/cast_channel/logger_unittest.cc25
-rw-r--r--chromium/extensions/browser/api/declarative/declarative_api.cc16
-rw-r--r--chromium/extensions/browser/api/declarative/declarative_rule.h73
-rw-r--r--chromium/extensions/browser/api/declarative/declarative_rule_unittest.cc44
-rw-r--r--chromium/extensions/browser/api/declarative/deduping_factory_unittest.cc23
-rw-r--r--chromium/extensions/browser/api/declarative/rules_cache_delegate.cc4
-rw-r--r--chromium/extensions/browser/api/declarative/rules_cache_delegate.h6
-rw-r--r--chromium/extensions/browser/api/declarative/rules_registry.cc11
-rw-r--r--chromium/extensions/browser/api/declarative/rules_registry.h4
-rw-r--r--chromium/extensions/browser/api/declarative/rules_registry_service.cc8
-rw-r--r--chromium/extensions/browser/api/declarative/rules_registry_service.h2
-rw-r--r--chromium/extensions/browser/api/declarative/rules_registry_unittest.cc10
-rw-r--r--chromium/extensions/browser/api/declarative_webrequest/webrequest_action.cc16
-rw-r--r--chromium/extensions/browser/api/declarative_webrequest/webrequest_action.h7
-rw-r--r--chromium/extensions/browser/api/declarative_webrequest/webrequest_condition.cc19
-rw-r--r--chromium/extensions/browser/api/declarative_webrequest/webrequest_condition.h2
-rw-r--r--chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc80
-rw-r--r--chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.h12
-rw-r--r--chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc30
-rw-r--r--chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_unittest.cc90
-rw-r--r--chromium/extensions/browser/api/declarative_webrequest/webrequest_rules_registry.cc2
-rw-r--r--chromium/extensions/browser/api/declarative_webrequest/webrequest_rules_registry.h2
-rw-r--r--chromium/extensions/browser/api/device_permissions_manager.cc6
-rw-r--r--chromium/extensions/browser/api/device_permissions_manager.h4
-rw-r--r--chromium/extensions/browser/api/device_permissions_prompt.cc6
-rw-r--r--chromium/extensions/browser/api/device_permissions_prompt.h6
-rw-r--r--chromium/extensions/browser/api/diagnostics/diagnostics_api.h4
-rw-r--r--chromium/extensions/browser/api/diagnostics/diagnostics_api_chromeos.cc2
-rw-r--r--chromium/extensions/browser/api/display_source/display_source_api.cc6
-rw-r--r--chromium/extensions/browser/api/display_source/display_source_apitest.cc95
-rw-r--r--chromium/extensions/browser/api/display_source/display_source_apitestbase.cc533
-rw-r--r--chromium/extensions/browser/api/display_source/display_source_apitestbase.h26
-rw-r--r--chromium/extensions/browser/api/display_source/display_source_connection_delegate.h8
-rw-r--r--chromium/extensions/browser/api/display_source/display_source_connection_delegate_factory.h3
-rw-r--r--chromium/extensions/browser/api/display_source/display_source_event_router.cc4
-rw-r--r--chromium/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.cc134
-rw-r--r--chromium/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.h47
-rw-r--r--chromium/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.cc5
-rw-r--r--chromium/extensions/browser/api/dns/dns_api.cc4
-rw-r--r--chromium/extensions/browser/api/dns/dns_api.h4
-rw-r--r--chromium/extensions/browser/api/dns/dns_apitest.cc7
-rw-r--r--chromium/extensions/browser/api/document_scan/document_scan_api.h6
-rw-r--r--chromium/extensions/browser/api/document_scan/document_scan_api_unittest.cc2
-rw-r--r--chromium/extensions/browser/api/document_scan/document_scan_interface.h2
-rw-r--r--chromium/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc2
-rw-r--r--chromium/extensions/browser/api/execute_code_function.cc2
-rw-r--r--chromium/extensions/browser/api/execute_code_function.h2
-rw-r--r--chromium/extensions/browser/api/extensions_api_client.cc13
-rw-r--r--chromium/extensions/browser/api/extensions_api_client.h16
-rw-r--r--chromium/extensions/browser/api/guest_view/app_view/app_view_guest_internal_api.cc4
-rw-r--r--chromium/extensions/browser/api/guest_view/extension_view/extension_view_internal_api.cc6
-rw-r--r--chromium/extensions/browser/api/guest_view/guest_view_internal_api.cc7
-rw-r--r--chromium/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc38
-rw-r--r--chromium/extensions/browser/api/guest_view/web_view/web_view_internal_api.h2
-rw-r--r--chromium/extensions/browser/api/hid/hid_api.cc10
-rw-r--r--chromium/extensions/browser/api/hid/hid_api.h15
-rw-r--r--chromium/extensions/browser/api/hid/hid_apitest.cc9
-rw-r--r--chromium/extensions/browser/api/hid/hid_device_manager.cc33
-rw-r--r--chromium/extensions/browser/api/hid/hid_device_manager.h12
-rw-r--r--chromium/extensions/browser/api/idle/idle_api_unittest.cc36
-rw-r--r--chromium/extensions/browser/api/idle/idle_manager.cc12
-rw-r--r--chromium/extensions/browser/api/idle/idle_manager.h9
-rw-r--r--chromium/extensions/browser/api/management/management_api.cc28
-rw-r--r--chromium/extensions/browser/api/management/management_api.h16
-rw-r--r--chromium/extensions/browser/api/management/management_api_delegate.h10
-rw-r--r--chromium/extensions/browser/api/messaging/native_message_host.h4
-rw-r--r--chromium/extensions/browser/api/messaging/native_messaging_channel.h7
-rw-r--r--chromium/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc11
-rw-r--r--chromium/extensions/browser/api/networking_config/networking_config_api.h5
-rw-r--r--chromium/extensions/browser/api/networking_config/networking_config_service.cc23
-rw-r--r--chromium/extensions/browser/api/networking_config/networking_config_service.h10
-rw-r--r--chromium/extensions/browser/api/networking_config/networking_config_service_chromeos_unittest.cc17
-rw-r--r--chromium/extensions/browser/api/networking_config/networking_config_service_factory.cc3
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_api.cc64
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_api.h12
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_chromeos.cc26
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_chromeos.h23
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_delegate.cc2
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_delegate.h27
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_delegate_factory.cc11
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_delegate_factory.h15
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_event_router_chromeos.cc16
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_event_router_nonchromeos.cc8
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_linux.cc100
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_linux.h39
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_service_client.cc35
-rw-r--r--chromium/extensions/browser/api/networking_private/networking_private_service_client.h21
-rw-r--r--chromium/extensions/browser/api/power/power_api.cc4
-rw-r--r--chromium/extensions/browser/api/power/power_api.h9
-rw-r--r--chromium/extensions/browser/api/power/power_api_unittest.cc14
-rw-r--r--chromium/extensions/browser/api/printer_provider/printer_provider_api.cc23
-rw-r--r--chromium/extensions/browser/api/printer_provider/printer_provider_apitest.cc17
-rw-r--r--chromium/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.cc14
-rw-r--r--chromium/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.h2
-rw-r--r--chromium/extensions/browser/api/runtime/runtime_api.cc44
-rw-r--r--chromium/extensions/browser/api/runtime/runtime_api.h2
-rw-r--r--chromium/extensions/browser/api/runtime/runtime_apitest.cc2
-rw-r--r--chromium/extensions/browser/api/serial/serial_api.cc4
-rw-r--r--chromium/extensions/browser/api/serial/serial_api.h22
-rw-r--r--chromium/extensions/browser/api/serial/serial_apitest.cc2
-rw-r--r--chromium/extensions/browser/api/serial/serial_connection.cc5
-rw-r--r--chromium/extensions/browser/api/serial/serial_connection.h4
-rw-r--r--chromium/extensions/browser/api/serial/serial_event_dispatcher.cc21
-rw-r--r--chromium/extensions/browser/api/serial/serial_event_dispatcher.h4
-rw-r--r--chromium/extensions/browser/api/socket/app_firewall_hole_manager.cc6
-rw-r--r--chromium/extensions/browser/api/socket/app_firewall_hole_manager.h11
-rw-r--r--chromium/extensions/browser/api/socket/socket.h6
-rw-r--r--chromium/extensions/browser/api/socket/socket_api.cc19
-rw-r--r--chromium/extensions/browser/api/socket/socket_api.h40
-rw-r--r--chromium/extensions/browser/api/socket/socket_apitest.cc6
-rw-r--r--chromium/extensions/browser/api/socket/tcp_socket.cc15
-rw-r--r--chromium/extensions/browser/api/socket/tcp_socket.h16
-rw-r--r--chromium/extensions/browser/api/socket/tls_socket.cc16
-rw-r--r--chromium/extensions/browser/api/socket/tls_socket.h6
-rw-r--r--chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc14
-rw-r--r--chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api.h28
-rw-r--r--chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api_unittest.cc13
-rw-r--r--chromium/extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc14
-rw-r--r--chromium/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc20
-rw-r--r--chromium/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.h4
-rw-r--r--chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc4
-rw-r--r--chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h16
-rw-r--r--chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc4
-rw-r--r--chromium/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc18
-rw-r--r--chromium/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h7
-rw-r--r--chromium/extensions/browser/api/sockets_udp/sockets_udp_api.cc8
-rw-r--r--chromium/extensions/browser/api/sockets_udp/sockets_udp_api.h30
-rw-r--r--chromium/extensions/browser/api/sockets_udp/sockets_udp_api_unittest.cc13
-rw-r--r--chromium/extensions/browser/api/sockets_udp/sockets_udp_apitest.cc10
-rw-r--r--chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc20
-rw-r--r--chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h5
-rw-r--r--chromium/extensions/browser/api/storage/local_value_store_cache.cc2
-rw-r--r--chromium/extensions/browser/api/storage/local_value_store_cache.h3
-rw-r--r--chromium/extensions/browser/api/storage/settings_quota_unittest.cc8
-rw-r--r--chromium/extensions/browser/api/storage/settings_storage_quota_enforcer.cc5
-rw-r--r--chromium/extensions/browser/api/storage/settings_storage_quota_enforcer.h6
-rw-r--r--chromium/extensions/browser/api/storage/settings_test_util.cc10
-rw-r--r--chromium/extensions/browser/api/storage/settings_test_util.h6
-rw-r--r--chromium/extensions/browser/api/storage/storage_api.cc3
-rw-r--r--chromium/extensions/browser/api/storage/storage_api_unittest.cc16
-rw-r--r--chromium/extensions/browser/api/storage/storage_frontend.cc13
-rw-r--r--chromium/extensions/browser/api/storage/storage_frontend.h6
-rw-r--r--chromium/extensions/browser/api/storage/storage_frontend_unittest.cc12
-rw-r--r--chromium/extensions/browser/api/system_cpu/cpu_info_provider_win.cc5
-rw-r--r--chromium/extensions/browser/api/system_display/display_info_provider.cc26
-rw-r--r--chromium/extensions/browser/api/system_display/display_info_provider.h12
-rw-r--r--chromium/extensions/browser/api/system_display/system_display_api.cc17
-rw-r--r--chromium/extensions/browser/api/system_display/system_display_apitest.cc109
-rw-r--r--chromium/extensions/browser/api/system_info/system_info_api.cc41
-rw-r--r--chromium/extensions/browser/api/system_memory/system_memory_apitest.cc2
-rw-r--r--chromium/extensions/browser/api/system_network/system_network_api.cc2
-rw-r--r--chromium/extensions/browser/api/system_network/system_network_apitest.cc2
-rw-r--r--chromium/extensions/browser/api/system_storage/system_storage_api.cc5
-rw-r--r--chromium/extensions/browser/api/system_storage/system_storage_apitest.cc2
-rw-r--r--chromium/extensions/browser/api/usb/usb_api.cc77
-rw-r--r--chromium/extensions/browser/api/usb/usb_api.h8
-rw-r--r--chromium/extensions/browser/api/usb/usb_apitest.cc16
-rw-r--r--chromium/extensions/browser/api/usb/usb_event_router.cc2
-rw-r--r--chromium/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.cc4
-rw-r--r--chromium/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h2
-rw-r--r--chromium/extensions/browser/api/vpn_provider/vpn_provider_api.cc12
-rw-r--r--chromium/extensions/browser/api/vpn_provider/vpn_service.cc20
-rw-r--r--chromium/extensions/browser/api/vpn_provider/vpn_service.h13
-rw-r--r--chromium/extensions/browser/api/web_contents_capture_client.cc6
-rw-r--r--chromium/extensions/browser/api/web_request/form_data_parser.cc15
-rw-r--r--chromium/extensions/browser/api/web_request/form_data_parser.h6
-rw-r--r--chromium/extensions/browser/api/web_request/form_data_parser_unittest.cc11
-rw-r--r--chromium/extensions/browser/api/web_request/upload_data_presenter.cc9
-rw-r--r--chromium/extensions/browser/api/web_request/upload_data_presenter.h16
-rw-r--r--chromium/extensions/browser/api/web_request/upload_data_presenter_unittest.cc14
-rw-r--r--chromium/extensions/browser/api/web_request/web_request_api.cc78
-rw-r--r--chromium/extensions/browser/api/web_request/web_request_api.h33
-rw-r--r--chromium/extensions/browser/api/web_request/web_request_api_helpers.cc6
-rw-r--r--chromium/extensions/browser/api/web_request/web_request_api_helpers.h45
-rw-r--r--chromium/extensions/browser/api/web_request/web_request_event_details.cc15
-rw-r--r--chromium/extensions/browser/api/web_request/web_request_event_details.h17
-rw-r--r--chromium/extensions/browser/api/web_request/web_request_event_router_delegate.h16
-rw-r--r--chromium/extensions/browser/api/web_request/web_request_time_tracker.h4
-rw-r--r--chromium/extensions/browser/api/webcam_private/visca_webcam.cc2
-rw-r--r--chromium/extensions/browser/api/webcam_private/visca_webcam.h4
-rw-r--r--chromium/extensions/browser/api/webcam_private/visca_webcam_unittest.cc6
-rw-r--r--chromium/extensions/browser/api/webcam_private/webcam_private_api.h4
-rw-r--r--chromium/extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc19
-rw-r--r--chromium/extensions/browser/api_activity_monitor.h11
-rw-r--r--chromium/extensions/browser/api_test_utils.cc75
-rw-r--r--chromium/extensions/browser/api_test_utils.h16
-rw-r--r--chromium/extensions/browser/api_unittest.cc22
-rw-r--r--chromium/extensions/browser/api_unittest.h15
-rw-r--r--chromium/extensions/browser/app_window/app_window.cc24
-rw-r--r--chromium/extensions/browser/app_window/app_window.h17
-rw-r--r--chromium/extensions/browser/app_window/app_window_contents.h5
-rw-r--r--chromium/extensions/browser/app_window/app_window_geometry_cache.cc2
-rw-r--r--chromium/extensions/browser/app_window/app_window_geometry_cache.h2
-rw-r--r--chromium/extensions/browser/app_window/app_window_geometry_cache_unittest.cc12
-rw-r--r--chromium/extensions/browser/app_window/native_app_window.h4
-rw-r--r--chromium/extensions/browser/app_window/test_app_window_contents.h2
-rw-r--r--chromium/extensions/browser/blob_holder.cc2
-rw-r--r--chromium/extensions/browser/blob_holder.h4
-rw-r--r--chromium/extensions/browser/computed_hashes.cc4
-rw-r--r--chromium/extensions/browser/computed_hashes.h4
-rw-r--r--chromium/extensions/browser/content_hash_fetcher.cc15
-rw-r--r--chromium/extensions/browser/content_hash_reader.h4
-rw-r--r--chromium/extensions/browser/content_hash_tree.cc5
-rw-r--r--chromium/extensions/browser/content_hash_tree_unittest.cc8
-rw-r--r--chromium/extensions/browser/content_verifier.cc6
-rw-r--r--chromium/extensions/browser/content_verifier.h6
-rw-r--r--chromium/extensions/browser/content_verifier_io_data.cc4
-rw-r--r--chromium/extensions/browser/content_verifier_io_data.h9
-rw-r--r--chromium/extensions/browser/content_verify_job.h4
-rw-r--r--chromium/extensions/browser/declarative_user_script_master.h4
-rw-r--r--chromium/extensions/browser/error_map.cc7
-rw-r--r--chromium/extensions/browser/error_map.h4
-rw-r--r--chromium/extensions/browser/error_map_unittest.cc4
-rw-r--r--chromium/extensions/browser/event_listener_map.cc44
-rw-r--r--chromium/extensions/browser/event_listener_map.h20
-rw-r--r--chromium/extensions/browser/event_listener_map_unittest.cc116
-rw-r--r--chromium/extensions/browser/event_router.cc67
-rw-r--r--chromium/extensions/browser/event_router.h20
-rw-r--r--chromium/extensions/browser/event_router_unittest.cc30
-rw-r--r--chromium/extensions/browser/extension_error_test_util.cc24
-rw-r--r--chromium/extensions/browser/extension_error_test_util.h11
-rw-r--r--chromium/extensions/browser/extension_event_histogram_value.h7
-rw-r--r--chromium/extensions/browser/extension_function.cc37
-rw-r--r--chromium/extensions/browser/extension_function.h28
-rw-r--r--chromium/extensions/browser/extension_function_dispatcher.cc29
-rw-r--r--chromium/extensions/browser/extension_function_histogram_value.h15
-rw-r--r--chromium/extensions/browser/extension_host.h8
-rw-r--r--chromium/extensions/browser/extension_icon_image_unittest.cc27
-rw-r--r--chromium/extensions/browser/extension_message_filter.h3
-rw-r--r--chromium/extensions/browser/extension_pref_value_map.cc5
-rw-r--r--chromium/extensions/browser/extension_pref_value_map.h5
-rw-r--r--chromium/extensions/browser/extension_pref_value_map_unittest.cc6
-rw-r--r--chromium/extensions/browser/extension_prefs.cc82
-rw-r--r--chromium/extensions/browser/extension_prefs.h29
-rw-r--r--chromium/extensions/browser/extension_prefs_factory.cc2
-rw-r--r--chromium/extensions/browser/extension_prefs_factory.h5
-rw-r--r--chromium/extensions/browser/extension_protocols.cc7
-rw-r--r--chromium/extensions/browser/extension_protocols.h4
-rw-r--r--chromium/extensions/browser/extension_registry.cc8
-rw-r--r--chromium/extensions/browser/extension_registry.h4
-rw-r--r--chromium/extensions/browser/extension_system.h2
-rw-r--r--chromium/extensions/browser/extension_throttle_entry.cc4
-rw-r--r--chromium/extensions/browser/extension_throttle_manager.cc7
-rw-r--r--chromium/extensions/browser/extension_throttle_manager.h9
-rw-r--r--chromium/extensions/browser/extension_throttle_simulation_unittest.cc15
-rw-r--r--chromium/extensions/browser/extension_throttle_unittest.cc7
-rw-r--r--chromium/extensions/browser/extension_user_script_loader.cc8
-rw-r--r--chromium/extensions/browser/extension_user_script_loader.h2
-rw-r--r--chromium/extensions/browser/extension_web_contents_observer.h18
-rw-r--r--chromium/extensions/browser/extension_zoom_request_client.cc8
-rw-r--r--chromium/extensions/browser/extension_zoom_request_client.h3
-rw-r--r--chromium/extensions/browser/extensions_browser_client.cc5
-rw-r--r--chromium/extensions/browser/extensions_browser_client.h15
-rw-r--r--chromium/extensions/browser/extensions_test.cc2
-rw-r--r--chromium/extensions/browser/extensions_test.h13
-rw-r--r--chromium/extensions/browser/external_install_info.cc4
-rw-r--r--chromium/extensions/browser/external_install_info.h8
-rw-r--r--chromium/extensions/browser/external_provider_interface.h2
-rw-r--r--chromium/extensions/browser/guest_view/app_view/app_view_apitest.cc25
-rw-r--r--chromium/extensions/browser/guest_view/app_view/app_view_guest.cc20
-rw-r--r--chromium/extensions/browser/guest_view/app_view/app_view_guest.h6
-rw-r--r--chromium/extensions/browser/guest_view/extension_options/extension_options_guest.cc11
-rw-r--r--chromium/extensions/browser/guest_view/extension_options/extension_options_guest.h2
-rw-r--r--chromium/extensions/browser/guest_view/extension_view/extension_view_guest.cc5
-rw-r--r--chromium/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc7
-rw-r--r--chromium/extensions/browser/guest_view/extensions_guest_view_manager_delegate.h2
-rw-r--r--chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc16
-rw-r--r--chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.h4
-rw-r--r--chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc2
-rw-r--r--chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h8
-rw-r--r--chromium/extensions/browser/guest_view/mime_handler_view/test_mime_handler_view_guest.cc4
-rw-r--r--chromium/extensions/browser/guest_view/mime_handler_view/test_mime_handler_view_guest.h2
-rw-r--r--chromium/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.cc5
-rw-r--r--chromium/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h5
-rw-r--r--chromium/extensions/browser/guest_view/web_view/web_view_apitest.cc24
-rw-r--r--chromium/extensions/browser/guest_view/web_view/web_view_find_helper.cc9
-rw-r--r--chromium/extensions/browser/guest_view/web_view/web_view_find_helper.h4
-rw-r--r--chromium/extensions/browser/guest_view/web_view/web_view_guest.cc69
-rw-r--r--chromium/extensions/browser/guest_view/web_view/web_view_guest.h8
-rw-r--r--chromium/extensions/browser/guest_view/web_view/web_view_media_access_apitest.cc10
-rw-r--r--chromium/extensions/browser/guest_view/web_view/web_view_permission_helper.cc13
-rw-r--r--chromium/extensions/browser/guest_view/web_view/web_view_permission_helper.h2
-rw-r--r--chromium/extensions/browser/image_loader_unittest.cc7
-rw-r--r--chromium/extensions/browser/info_map.h4
-rw-r--r--chromium/extensions/browser/lazy_background_task_queue_unittest.cc11
-rw-r--r--chromium/extensions/browser/load_monitoring_extension_host_queue.cc4
-rw-r--r--chromium/extensions/browser/load_monitoring_extension_host_queue.h8
-rw-r--r--chromium/extensions/browser/load_monitoring_extension_host_queue_unittest.cc12
-rw-r--r--chromium/extensions/browser/mock_extension_system.cc4
-rw-r--r--chromium/extensions/browser/mock_extension_system.h2
-rw-r--r--chromium/extensions/browser/mojo/DEPS3
-rw-r--r--chromium/extensions/browser/mojo/keep_alive_impl_unittest.cc4
-rw-r--r--chromium/extensions/browser/mojo/service_registration.cc3
-rw-r--r--chromium/extensions/browser/mojo/stash_backend.cc12
-rw-r--r--chromium/extensions/browser/mojo/stash_backend.h2
-rw-r--r--chromium/extensions/browser/mojo/stash_backend_unittest.cc6
-rw-r--r--chromium/extensions/browser/process_manager_unittest.cc23
-rw-r--r--chromium/extensions/browser/quota_service.h4
-rw-r--r--chromium/extensions/browser/quota_service_unittest.cc3
-rw-r--r--chromium/extensions/browser/sandboxed_unpacker.cc4
-rw-r--r--chromium/extensions/browser/sandboxed_unpacker_unittest.cc6
-rw-r--r--chromium/extensions/browser/state_store.cc2
-rw-r--r--chromium/extensions/browser/state_store.h9
-rw-r--r--chromium/extensions/browser/test_extension_registry_observer.cc2
-rw-r--r--chromium/extensions/browser/test_extension_registry_observer.h12
-rw-r--r--chromium/extensions/browser/test_extensions_browser_client.cc10
-rw-r--r--chromium/extensions/browser/test_extensions_browser_client.h15
-rw-r--r--chromium/extensions/browser/updater/extension_downloader.cc112
-rw-r--r--chromium/extensions/browser/updater/extension_downloader.h44
-rw-r--r--chromium/extensions/browser/updater/extension_downloader_test_delegate.h32
-rw-r--r--chromium/extensions/browser/updater/request_queue.h14
-rw-r--r--chromium/extensions/browser/updater/request_queue_impl.h11
-rw-r--r--chromium/extensions/browser/updater/safe_manifest_parser.h2
-rw-r--r--chromium/extensions/browser/updater/update_service.h2
-rw-r--r--chromium/extensions/browser/updater/update_service_unittest.cc4
-rw-r--r--chromium/extensions/browser/user_script_loader.cc17
-rw-r--r--chromium/extensions/browser/user_script_loader.h18
-rw-r--r--chromium/extensions/browser/value_store/lazy_leveldb.cc10
-rw-r--r--chromium/extensions/browser/value_store/lazy_leveldb.h11
-rw-r--r--chromium/extensions/browser/value_store/legacy_value_store_factory.cc13
-rw-r--r--chromium/extensions/browser/value_store/legacy_value_store_factory.h12
-rw-r--r--chromium/extensions/browser/value_store/leveldb_scoped_database.cc13
-rw-r--r--chromium/extensions/browser/value_store/leveldb_scoped_database.h2
-rw-r--r--chromium/extensions/browser/value_store/leveldb_scoped_database_unittest.cc6
-rw-r--r--chromium/extensions/browser/value_store/leveldb_value_store.cc33
-rw-r--r--chromium/extensions/browser/value_store/leveldb_value_store.h2
-rw-r--r--chromium/extensions/browser/value_store/leveldb_value_store_unittest.cc8
-rw-r--r--chromium/extensions/browser/value_store/test_value_store_factory.cc11
-rw-r--r--chromium/extensions/browser/value_store/test_value_store_factory.h8
-rw-r--r--chromium/extensions/browser/value_store/testing_value_store.cc27
-rw-r--r--chromium/extensions/browser/value_store/value_store.cc4
-rw-r--r--chromium/extensions/browser/value_store/value_store.h24
-rw-r--r--chromium/extensions/browser/value_store/value_store_change.cc19
-rw-r--r--chromium/extensions/browser/value_store/value_store_change.h17
-rw-r--r--chromium/extensions/browser/value_store/value_store_change_unittest.cc41
-rw-r--r--chromium/extensions/browser/value_store/value_store_factory.h8
-rw-r--r--chromium/extensions/browser/value_store/value_store_factory_impl.cc6
-rw-r--r--chromium/extensions/browser/value_store/value_store_factory_impl.h8
-rw-r--r--chromium/extensions/browser/value_store/value_store_frontend.cc10
-rw-r--r--chromium/extensions/browser/value_store/value_store_frontend.h6
-rw-r--r--chromium/extensions/browser/value_store/value_store_frontend_unittest.cc20
-rw-r--r--chromium/extensions/browser/value_store/value_store_unittest.cc121
-rw-r--r--chromium/extensions/browser/value_store/value_store_unittest.h21
-rw-r--r--chromium/extensions/browser/verified_contents.cc4
-rw-r--r--chromium/extensions/browser/web_ui_user_script_loader.cc8
-rw-r--r--chromium/extensions/browser/web_ui_user_script_loader.h8
400 files changed, 3735 insertions, 2800 deletions
diff --git a/chromium/extensions/browser/BUILD.gn b/chromium/extensions/browser/BUILD.gn
index e044a7a8912..f145569871f 100644
--- a/chromium/extensions/browser/BUILD.gn
+++ b/chromium/extensions/browser/BUILD.gn
@@ -11,6 +11,7 @@ source_set("browser") {
deps = [
"//base:i18n",
+ "//components/cast_certificate",
"//components/guest_view/browser",
"//components/keyed_service/content",
"//components/keyed_service/core",
@@ -31,6 +32,7 @@ source_set("browser") {
"//skia",
"//third_party/leveldatabase",
"//third_party/re2",
+ "//ui/display",
]
configs += [
@@ -83,7 +85,7 @@ source_set("browser") {
sources += nonchromeos_sources
if (is_linux) {
- configs += [ "//build/config/linux:dbus" ]
+ configs += [ "//build/config/linux/dbus" ]
deps += [ "//dbus" ]
linux_sources = rebase_path(
extensions_gypi_values.extensions_browser_sources_linux_nonchromeos,
@@ -101,7 +103,7 @@ source_set("browser") {
sources += win_or_mac_sources
}
}
- if (enable_wifi_display) {
+ if (proprietary_codecs && enable_wifi_display) {
wifi_display_sources = rebase_path(
extensions_gypi_values.extensions_browser_sources_wifi_display,
".",
diff --git a/chromium/extensions/browser/DEPS b/chromium/extensions/browser/DEPS
index abf85d9d797..b29c812fbb6 100644
--- a/chromium/extensions/browser/DEPS
+++ b/chromium/extensions/browser/DEPS
@@ -25,6 +25,7 @@ include_rules = [
"+third_party/re2",
"+third_party/WebKit/public/web",
"+third_party/zlib/google",
+ "+ui/display",
]
specific_include_rules = {
diff --git a/chromium/extensions/browser/api/alarms/OWNERS b/chromium/extensions/browser/api/alarms/OWNERS
deleted file mode 100644
index 39cb68cb187..00000000000
--- a/chromium/extensions/browser/api/alarms/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-mpcomplete@chromium.org
diff --git a/chromium/extensions/browser/api/alarms/alarm_manager.cc b/chromium/extensions/browser/api/alarms/alarm_manager.cc
index 0616481fc75..b382dff81f0 100644
--- a/chromium/extensions/browser/api/alarms/alarm_manager.cc
+++ b/chromium/extensions/browser/api/alarms/alarm_manager.cc
@@ -45,9 +45,9 @@ class DefaultAlarmDelegate : public AlarmManager::Delegate {
~DefaultAlarmDelegate() override {}
void OnAlarm(const std::string& extension_id, const Alarm& alarm) override {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(alarm.js_alarm->ToValue().release());
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::ALARMS_ON_ALARM, alarms::OnAlarm::kEventName, std::move(args)));
EventRouter::Get(browser_context_)
->DispatchEventToExtension(extension_id, std::move(event));
@@ -79,10 +79,12 @@ std::vector<Alarm> AlarmsFromValue(const base::ListValue* list) {
return alarms;
}
-scoped_ptr<base::ListValue> AlarmsToValue(const std::vector<Alarm>& alarms) {
- scoped_ptr<base::ListValue> list(new base::ListValue());
+std::unique_ptr<base::ListValue> AlarmsToValue(
+ const std::vector<Alarm>& alarms) {
+ std::unique_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();
+ std::unique_ptr<base::DictionaryValue> alarm =
+ alarms[i].js_alarm->ToValue();
alarm->Set(kAlarmGranularity,
base::CreateTimeDeltaValue(alarms[i].granularity));
list->Append(alarm.release());
@@ -290,7 +292,7 @@ void AlarmManager::WriteToStorage(const std::string& extension_id) {
if (!storage)
return;
- scoped_ptr<base::Value> alarms;
+ std::unique_ptr<base::Value> alarms;
AlarmMap::iterator list = alarms_.find(extension_id);
if (list != alarms_.end())
alarms.reset(AlarmsToValue(list->second).release());
@@ -301,7 +303,7 @@ void AlarmManager::WriteToStorage(const std::string& extension_id) {
}
void AlarmManager::ReadFromStorage(const std::string& extension_id,
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
base::ListValue* list = NULL;
if (value.get() && value->GetAsList(&list)) {
std::vector<Alarm> alarm_states = AlarmsFromValue(list);
diff --git a/chromium/extensions/browser/api/alarms/alarm_manager.h b/chromium/extensions/browser/api/alarms/alarm_manager.h
index 66e5fb105d5..f534ea923f1 100644
--- a/chromium/extensions/browser/api/alarms/alarm_manager.h
+++ b/chromium/extensions/browser/api/alarms/alarm_manager.h
@@ -184,7 +184,7 @@ class AlarmManager : public BrowserContextKeyedAPI,
// Syncs our alarm data for the given extension to/from the state storage.
void WriteToStorage(const std::string& extension_id);
void ReadFromStorage(const std::string& extension_id,
- scoped_ptr<base::Value> value);
+ std::unique_ptr<base::Value> value);
// Set the timer to go off at the specified |time|, and set |next_poll_time|
// appropriately.
@@ -214,8 +214,8 @@ class AlarmManager : public BrowserContextKeyedAPI,
static const bool kServiceHasOwnInstanceInIncognito = true;
content::BrowserContext* const browser_context_;
- scoped_ptr<base::Clock> clock_;
- scoped_ptr<Delegate> delegate_;
+ std::unique_ptr<base::Clock> clock_;
+ std::unique_ptr<Delegate> delegate_;
// Listen to extension load notifications.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
diff --git a/chromium/extensions/browser/api/alarms/alarms_api.cc b/chromium/extensions/browser/api/alarms/alarms_api.cc
index 102bce4f863..fa27a54d0c4 100644
--- a/chromium/extensions/browser/api/alarms/alarms_api.cc
+++ b/chromium/extensions/browser/api/alarms/alarms_api.cc
@@ -103,7 +103,7 @@ AlarmsCreateFunction::~AlarmsCreateFunction() {
}
bool AlarmsCreateFunction::RunAsync() {
- scoped_ptr<alarms::Create::Params> params(
+ std::unique_ptr<alarms::Create::Params> params(
alarms::Create::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
const std::string& alarm_name =
@@ -135,7 +135,8 @@ void AlarmsCreateFunction::Callback() {
}
bool AlarmsGetFunction::RunAsync() {
- scoped_ptr<alarms::Get::Params> params(alarms::Get::Params::Create(*args_));
+ std::unique_ptr<alarms::Get::Params> params(
+ alarms::Get::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
std::string name = params->name.get() ? *params->name : kDefaultAlarmName;
@@ -162,7 +163,7 @@ bool AlarmsGetAllFunction::RunAsync() {
}
void AlarmsGetAllFunction::Callback(const AlarmList* alarms) {
- scoped_ptr<base::ListValue> alarms_value(new base::ListValue());
+ std::unique_ptr<base::ListValue> alarms_value(new base::ListValue());
if (alarms) {
for (const Alarm& alarm : *alarms)
alarms_value->Append(alarm.js_alarm->ToValue());
@@ -172,7 +173,7 @@ void AlarmsGetAllFunction::Callback(const AlarmList* alarms) {
}
bool AlarmsClearFunction::RunAsync() {
- scoped_ptr<alarms::Clear::Params> params(
+ std::unique_ptr<alarms::Clear::Params> params(
alarms::Clear::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chromium/extensions/browser/api/alarms/alarms_api_unittest.cc b/chromium/extensions/browser/api/alarms/alarms_api_unittest.cc
index b0626f2641c..67f04b40d54 100644
--- a/chromium/extensions/browser/api/alarms/alarms_api_unittest.cc
+++ b/chromium/extensions/browser/api/alarms/alarms_api_unittest.cc
@@ -97,8 +97,9 @@ class ExtensionAlarmsTest : public ApiUnitTest {
"[\"0\", {\"delayInMinutes\": 0}]",
};
for (size_t i = 0; i < num_alarms; ++i) {
- scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
- new AlarmsCreateFunction(test_clock_), kCreateArgs[i]));
+ std::unique_ptr<base::DictionaryValue> result(
+ RunFunctionAndReturnDictionary(new AlarmsCreateFunction(test_clock_),
+ kCreateArgs[i]));
EXPECT_FALSE(result.get());
}
}
@@ -326,7 +327,7 @@ TEST_F(ExtensionAlarmsTest, Get) {
// Get the default one.
{
JsAlarm alarm;
- scoped_ptr<base::DictionaryValue> result(
+ std::unique_ptr<base::DictionaryValue> result(
RunFunctionAndReturnDictionary(new AlarmsGetFunction(), "[null]"));
ASSERT_TRUE(result.get());
EXPECT_TRUE(JsAlarm::Populate(*result, &alarm));
@@ -339,7 +340,7 @@ TEST_F(ExtensionAlarmsTest, Get) {
// Get "7".
{
JsAlarm alarm;
- scoped_ptr<base::DictionaryValue> result(
+ std::unique_ptr<base::DictionaryValue> result(
RunFunctionAndReturnDictionary(new AlarmsGetFunction(), "[\"7\"]"));
ASSERT_TRUE(result.get());
EXPECT_TRUE(JsAlarm::Populate(*result, &alarm));
@@ -350,8 +351,9 @@ TEST_F(ExtensionAlarmsTest, Get) {
// Get a non-existent one.
{
- scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
- new AlarmsGetFunction(), "[\"nobody\"]"));
+ std::unique_ptr<base::DictionaryValue> result(
+ RunFunctionAndReturnDictionary(new AlarmsGetFunction(),
+ "[\"nobody\"]"));
ASSERT_FALSE(result.get());
}
}
@@ -359,7 +361,7 @@ TEST_F(ExtensionAlarmsTest, Get) {
TEST_F(ExtensionAlarmsTest, GetAll) {
// Test getAll with 0 alarms.
{
- scoped_ptr<base::ListValue> result(
+ std::unique_ptr<base::ListValue> result(
RunFunctionAndReturnList(new AlarmsGetAllFunction(), "[]"));
std::vector<linked_ptr<JsAlarm>> alarms = ToAlarmList(result.get());
EXPECT_EQ(0u, alarms.size());
@@ -369,7 +371,7 @@ TEST_F(ExtensionAlarmsTest, GetAll) {
CreateAlarms(2);
{
- scoped_ptr<base::ListValue> result(
+ std::unique_ptr<base::ListValue> result(
RunFunctionAndReturnList(new AlarmsGetAllFunction(), "[null]"));
std::vector<linked_ptr<JsAlarm>> alarms = ToAlarmList(result.get());
EXPECT_EQ(2u, alarms.size());
@@ -418,7 +420,7 @@ void ExtensionAlarmsTestClearGetAllAlarms1Callback(
TEST_F(ExtensionAlarmsTest, Clear) {
// Clear a non-existent one.
{
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"nobody\"]"));
bool copy_bool_result = false;
ASSERT_TRUE(result->GetAsBoolean(&copy_bool_result));
@@ -430,14 +432,14 @@ TEST_F(ExtensionAlarmsTest, Clear) {
// Clear all but the 0.001-minute alarm.
{
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"7\"]"));
bool copy_bool_result = false;
ASSERT_TRUE(result->GetAsBoolean(&copy_bool_result));
EXPECT_TRUE(copy_bool_result);
}
{
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new AlarmsClearFunction(), "[\"0\"]"));
bool copy_bool_result = false;
ASSERT_TRUE(result->GetAsBoolean(&copy_bool_result));
@@ -470,7 +472,7 @@ void ExtensionAlarmsTestClearAllGetAllAlarms1Callback(
TEST_F(ExtensionAlarmsTest, ClearAll) {
// ClearAll with no alarms set.
{
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new AlarmsClearAllFunction(), "[]"));
bool copy_bool_result = false;
ASSERT_TRUE(result->GetAsBoolean(&copy_bool_result));
diff --git a/chromium/extensions/browser/api/api_resource_manager.h b/chromium/extensions/browser/api/api_resource_manager.h
index 79ef86209dd..89e5bb330d4 100644
--- a/chromium/extensions/browser/api/api_resource_manager.h
+++ b/chromium/extensions/browser/api/api_resource_manager.h
@@ -6,11 +6,11 @@
#define EXTENSIONS_BROWSER_API_API_RESOURCE_MANAGER_H_
#include <map>
+#include <memory>
#include "base/containers/hash_tables.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "base/threading/non_thread_safe.h"
#include "components/keyed_service/core/keyed_service.h"
diff --git a/chromium/extensions/browser/api/api_resource_manager_unittest.cc b/chromium/extensions/browser/api/api_resource_manager_unittest.cc
index d398b3075ec..7ab19c578b3 100644
--- a/chromium/extensions/browser/api/api_resource_manager_unittest.cc
+++ b/chromium/extensions/browser/api/api_resource_manager_unittest.cc
@@ -28,7 +28,7 @@ class FakeApiResource : public ApiResource {
};
TEST_F(ApiResourceManagerUnitTest, TwoAppsCannotShareResources) {
- scoped_ptr<ApiResourceManager<FakeApiResource>> manager(
+ std::unique_ptr<ApiResourceManager<FakeApiResource>> manager(
new ApiResourceManager<FakeApiResource>(browser_context()));
scoped_refptr<extensions::Extension> extension_one =
test_util::CreateEmptyExtension("one");
diff --git a/chromium/extensions/browser/api/app_current_window_internal/app_current_window_internal_api.cc b/chromium/extensions/browser/api/app_current_window_internal/app_current_window_internal_api.cc
index 661edcd8faa..4033699b539 100644
--- a/chromium/extensions/browser/api/app_current_window_internal/app_current_window_internal_api.cc
+++ b/chromium/extensions/browser/api/app_current_window_internal/app_current_window_internal_api.cc
@@ -72,7 +72,7 @@ void GetBoundsFields(const Bounds& bounds_spec, gfx::Rect* bounds) {
// Copy the constraint value from the API to our internal representation of
// content size constraints. A value of zero resets the constraints. The insets
// are used to transform window constraints to content constraints.
-void GetConstraintWidth(const scoped_ptr<int>& width,
+void GetConstraintWidth(const std::unique_ptr<int>& width,
const gfx::Insets& insets,
gfx::Size* size) {
if (!width.get())
@@ -82,7 +82,7 @@ void GetConstraintWidth(const scoped_ptr<int>& width,
: kUnboundedSize);
}
-void GetConstraintHeight(const scoped_ptr<int>& height,
+void GetConstraintHeight(const std::unique_ptr<int>& height,
const gfx::Insets& insets,
gfx::Size* size) {
if (!height.get())
@@ -177,7 +177,7 @@ bool AppCurrentWindowInternalClearAttentionFunction::RunWithWindow(
}
bool AppCurrentWindowInternalShowFunction::RunWithWindow(AppWindow* window) {
- scoped_ptr<Show::Params> params(Show::Params::Create(*args_));
+ std::unique_ptr<Show::Params> params(Show::Params::Create(*args_));
CHECK(params.get());
if (params->focused && !*params->focused)
window->Show(AppWindow::SHOW_INACTIVE);
@@ -193,7 +193,7 @@ bool AppCurrentWindowInternalHideFunction::RunWithWindow(AppWindow* window) {
bool AppCurrentWindowInternalSetBoundsFunction::RunWithWindow(
AppWindow* window) {
- scoped_ptr<SetBounds::Params> params(SetBounds::Params::Create(*args_));
+ std::unique_ptr<SetBounds::Params> params(SetBounds::Params::Create(*args_));
CHECK(params.get());
bounds::BoundsType bounds_type = bounds::GetBoundsType(params->bounds_type);
@@ -258,7 +258,7 @@ bool AppCurrentWindowInternalSetBoundsFunction::RunWithWindow(
bool AppCurrentWindowInternalSetSizeConstraintsFunction::RunWithWindow(
AppWindow* window) {
- scoped_ptr<SetSizeConstraints::Params> params(
+ std::unique_ptr<SetSizeConstraints::Params> params(
SetSizeConstraints::Params::Create(*args_));
CHECK(params.get());
@@ -303,7 +303,7 @@ bool AppCurrentWindowInternalSetIconFunction::RunWithWindow(AppWindow* window) {
return false;
}
- scoped_ptr<SetIcon::Params> params(SetIcon::Params::Create(*args_));
+ std::unique_ptr<SetIcon::Params> params(SetIcon::Params::Create(*args_));
CHECK(params.get());
// The |icon_url| parameter may be a blob url (e.g. an image fetched with an
// XMLHttpRequest) or a resource url.
@@ -323,8 +323,7 @@ bool AppCurrentWindowInternalSetShapeFunction::RunWithWindow(
return false;
}
- scoped_ptr<SetShape::Params> params(
- SetShape::Params::Create(*args_));
+ std::unique_ptr<SetShape::Params> params(SetShape::Params::Create(*args_));
const Region& shape = params->region;
// Build a region from the supplied list of rects.
@@ -332,7 +331,7 @@ bool AppCurrentWindowInternalSetShapeFunction::RunWithWindow(
// input region so that the entire window accepts input events.
// To specify an empty input region (so the window ignores all input),
// |rects| should be an empty list.
- scoped_ptr<SkRegion> region(new SkRegion);
+ std::unique_ptr<SkRegion> region(new SkRegion);
if (shape.rects) {
for (const RegionRect& input_rect : *shape.rects) {
int32_t x = input_rect.left;
@@ -360,7 +359,7 @@ bool AppCurrentWindowInternalSetAlwaysOnTopFunction::RunWithWindow(
return false;
}
- scoped_ptr<SetAlwaysOnTop::Params> params(
+ std::unique_ptr<SetAlwaysOnTop::Params> params(
SetAlwaysOnTop::Params::Create(*args_));
CHECK(params.get());
window->SetAlwaysOnTop(params->always_on_top);
@@ -369,7 +368,7 @@ bool AppCurrentWindowInternalSetAlwaysOnTopFunction::RunWithWindow(
bool AppCurrentWindowInternalSetVisibleOnAllWorkspacesFunction::RunWithWindow(
AppWindow* window) {
- scoped_ptr<SetVisibleOnAllWorkspaces::Params> params(
+ std::unique_ptr<SetVisibleOnAllWorkspaces::Params> params(
SetVisibleOnAllWorkspaces::Params::Create(*args_));
CHECK(params.get());
window->GetBaseWindow()->SetVisibleOnAllWorkspaces(params->always_visible);
diff --git a/chromium/extensions/browser/api/app_runtime/app_runtime_api.cc b/chromium/extensions/browser/api/app_runtime/app_runtime_api.cc
index fca709bd009..f24d52cb19b 100644
--- a/chromium/extensions/browser/api/app_runtime/app_runtime_api.cc
+++ b/chromium/extensions/browser/api/app_runtime/app_runtime_api.cc
@@ -31,13 +31,13 @@ namespace {
void DispatchOnEmbedRequestedEventImpl(
const std::string& extension_id,
- scoped_ptr<base::DictionaryValue> app_embedding_request_data,
+ std::unique_ptr<base::DictionaryValue> app_embedding_request_data,
content::BrowserContext* context) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(app_embedding_request_data.release());
- scoped_ptr<Event> event(new Event(events::APP_RUNTIME_ON_EMBED_REQUESTED,
- app_runtime::OnEmbedRequested::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(
+ new Event(events::APP_RUNTIME_ON_EMBED_REQUESTED,
+ app_runtime::OnEmbedRequested::kEventName, std::move(args)));
event->restrict_to_browser_context = context;
EventRouter::Get(context)
->DispatchEventWithLazyListener(extension_id, std::move(event));
@@ -46,10 +46,11 @@ void DispatchOnEmbedRequestedEventImpl(
->SetLastLaunchTime(extension_id, base::Time::Now());
}
-void DispatchOnLaunchedEventImpl(const std::string& extension_id,
- app_runtime::LaunchSource source,
- scoped_ptr<base::DictionaryValue> launch_data,
- BrowserContext* context) {
+void DispatchOnLaunchedEventImpl(
+ const std::string& extension_id,
+ app_runtime::LaunchSource source,
+ std::unique_ptr<base::DictionaryValue> launch_data,
+ BrowserContext* context) {
UMA_HISTOGRAM_ENUMERATION(
"Extensions.AppLaunchSource", source, NUM_APP_LAUNCH_SOURCES);
@@ -62,11 +63,11 @@ void DispatchOnLaunchedEventImpl(const std::string& extension_id,
"isPublicSession",
ExtensionsBrowserClient::Get()->IsLoggedInAsPublicAccount());
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(launch_data.release());
- scoped_ptr<Event> event(new Event(events::APP_RUNTIME_ON_LAUNCHED,
- app_runtime::OnLaunched::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::APP_RUNTIME_ON_LAUNCHED,
+ app_runtime::OnLaunched::kEventName,
+ std::move(args)));
event->restrict_to_browser_context = context;
EventRouter::Get(context)
->DispatchEventWithLazyListener(extension_id, std::move(event));
@@ -124,7 +125,7 @@ app_runtime::LaunchSource getLaunchSourceEnum(
// static
void AppRuntimeEventRouter::DispatchOnEmbedRequestedEvent(
content::BrowserContext* context,
- scoped_ptr<base::DictionaryValue> embed_app_data,
+ std::unique_ptr<base::DictionaryValue> embed_app_data,
const Extension* extension) {
DispatchOnEmbedRequestedEventImpl(extension->id(), std::move(embed_app_data),
context);
@@ -149,10 +150,10 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEvent(
void AppRuntimeEventRouter::DispatchOnRestartedEvent(
BrowserContext* context,
const Extension* extension) {
- scoped_ptr<base::ListValue> arguments(new base::ListValue());
- scoped_ptr<Event> event(new Event(events::APP_RUNTIME_ON_RESTARTED,
- app_runtime::OnRestarted::kEventName,
- std::move(arguments)));
+ std::unique_ptr<base::ListValue> arguments(new base::ListValue());
+ std::unique_ptr<Event> event(new Event(events::APP_RUNTIME_ON_RESTARTED,
+ app_runtime::OnRestarted::kEventName,
+ std::move(arguments)));
event->restrict_to_browser_context = context;
EventRouter::Get(context)
->DispatchEventToExtension(extension->id(), std::move(event));
@@ -167,7 +168,7 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEventWithFileEntries(
const std::vector<GrantedFileEntry>& file_entries) {
// TODO(sergeygs): Use the same way of creating an event (using the generated
// boilerplate) as below in DispatchOnLaunchedEventWithUrl.
- scoped_ptr<base::DictionaryValue> launch_data(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> launch_data(new base::DictionaryValue);
launch_data->SetString("id", handler_id);
app_runtime::LaunchSource source_enum =
@@ -176,10 +177,11 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEventWithFileEntries(
launch_data->SetString("source", app_runtime::ToString(source_enum));
}
- scoped_ptr<base::ListValue> items(new base::ListValue);
+ std::unique_ptr<base::ListValue> items(new base::ListValue);
DCHECK(file_entries.size() == entries.size());
for (size_t i = 0; i < file_entries.size(); ++i) {
- scoped_ptr<base::DictionaryValue> launch_item(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> launch_item(
+ new base::DictionaryValue);
launch_item->SetString("fileSystemId", file_entries[i].filesystem_id);
launch_item->SetString("baseName", file_entries[i].registered_name);
diff --git a/chromium/extensions/browser/api/app_runtime/app_runtime_api.h b/chromium/extensions/browser/api/app_runtime/app_runtime_api.h
index 35a28d22f60..1548387b2e5 100644
--- a/chromium/extensions/browser/api/app_runtime/app_runtime_api.h
+++ b/chromium/extensions/browser/api/app_runtime/app_runtime_api.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_
#define EXTENSIONS_BROWSER_API_APP_RUNTIME_APP_RUNTIME_API_H_
+#include <memory>
#include <string>
#include <vector>
-#include "base/memory/scoped_ptr.h"
#include "extensions/common/constants.h"
class GURL;
@@ -33,7 +33,7 @@ class AppRuntimeEventRouter {
// Dispatches the onEmbedRequested event to the given app.
static void DispatchOnEmbedRequestedEvent(
content::BrowserContext* context,
- scoped_ptr<base::DictionaryValue> app_embedding_request_data,
+ std::unique_ptr<base::DictionaryValue> app_embedding_request_data,
const extensions::Extension* extension);
// Dispatches the onLaunched event to the given app.
diff --git a/chromium/extensions/browser/api/app_window/app_window_api.cc b/chromium/extensions/browser/api/app_window/app_window_api.cc
index 4f5ffa551fe..e5dd7139724 100644
--- a/chromium/extensions/browser/api/app_window/app_window_api.cc
+++ b/chromium/extensions/browser/api/app_window/app_window_api.cc
@@ -80,8 +80,8 @@ namespace {
// If the same property is specified for the inner and outer bounds, raise an
// error.
-bool CheckBoundsConflict(const scoped_ptr<int>& inner_property,
- const scoped_ptr<int>& outer_property,
+bool CheckBoundsConflict(const std::unique_ptr<int>& inner_property,
+ const std::unique_ptr<int>& outer_property,
const std::string& property_name,
std::string* error) {
if (inner_property.get() && outer_property.get()) {
@@ -129,7 +129,7 @@ bool AppWindowCreateFunction::RunAsync() {
if (ExtensionsBrowserClient::Get()->IsShuttingDown())
return false;
- scoped_ptr<Create::Params> params(Create::Params::Create(*args_));
+ std::unique_ptr<Create::Params> params(Create::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
GURL url = extension()->GetResourceURL(params->url);
diff --git a/chromium/extensions/browser/api/app_window/app_window_apitest.cc b/chromium/extensions/browser/api/app_window/app_window_apitest.cc
index b03fde448bf..d8215a85ae8 100644
--- a/chromium/extensions/browser/api/app_window/app_window_apitest.cc
+++ b/chromium/extensions/browser/api/app_window/app_window_apitest.cc
@@ -55,7 +55,7 @@ class TestAppWindowRegistryObserver : public AppWindowRegistry::Observer {
// Tests chrome.app.window.setIcon.
IN_PROC_BROWSER_TEST_F(ExperimentalPlatformAppBrowserTest, WindowsApiSetIcon) {
- scoped_ptr<TestAppWindowRegistryObserver> test_observer(
+ std::unique_ptr<TestAppWindowRegistryObserver> test_observer(
new TestAppWindowRegistryObserver(browser()->profile()));
ExtensionTestMessageListener listener("ready", true);
diff --git a/chromium/extensions/browser/api/audio/audio_api.cc b/chromium/extensions/browser/api/audio/audio_api.cc
index ad1f22d85e9..2c84fda51b1 100644
--- a/chromium/extensions/browser/api/audio/audio_api.cc
+++ b/chromium/extensions/browser/api/audio/audio_api.cc
@@ -40,40 +40,42 @@ AudioService* AudioAPI::GetService() const {
void AudioAPI::OnDeviceChanged() {
if (EventRouter::Get(browser_context_)) {
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::AUDIO_ON_DEVICE_CHANGED, audio::OnDeviceChanged::kEventName,
- scoped_ptr<base::ListValue>(new base::ListValue())));
+ std::unique_ptr<base::ListValue>(new base::ListValue())));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
}
}
void AudioAPI::OnLevelChanged(const std::string& id, int level) {
if (EventRouter::Get(browser_context_)) {
- scoped_ptr<base::ListValue> args = audio::OnLevelChanged::Create(id, level);
- scoped_ptr<Event> event(new Event(events::AUDIO_ON_LEVEL_CHANGED,
- audio::OnLevelChanged::kEventName,
- std::move(args)));
+ std::unique_ptr<base::ListValue> args =
+ audio::OnLevelChanged::Create(id, level);
+ std::unique_ptr<Event> event(new Event(events::AUDIO_ON_LEVEL_CHANGED,
+ audio::OnLevelChanged::kEventName,
+ std::move(args)));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
}
}
void AudioAPI::OnMuteChanged(bool is_input, bool is_muted) {
if (EventRouter::Get(browser_context_)) {
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
audio::OnMuteChanged::Create(is_input, is_muted);
- scoped_ptr<Event> event(new Event(events::AUDIO_ON_MUTE_CHANGED,
- audio::OnMuteChanged::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::AUDIO_ON_MUTE_CHANGED,
+ audio::OnMuteChanged::kEventName,
+ std::move(args)));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
}
}
void AudioAPI::OnDevicesChanged(const DeviceInfoList& devices) {
if (EventRouter::Get(browser_context_)) {
- scoped_ptr<base::ListValue> args = audio::OnDevicesChanged::Create(devices);
- scoped_ptr<Event> event(new Event(events::AUDIO_ON_DEVICES_CHANGED,
- audio::OnDevicesChanged::kEventName,
- std::move(args)));
+ std::unique_ptr<base::ListValue> args =
+ audio::OnDevicesChanged::Create(devices);
+ std::unique_ptr<Event> event(new Event(events::AUDIO_ON_DEVICES_CHANGED,
+ audio::OnDevicesChanged::kEventName,
+ std::move(args)));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
}
}
@@ -98,7 +100,7 @@ bool AudioGetInfoFunction::RunSync() {
///////////////////////////////////////////////////////////////////////////////
bool AudioSetActiveDevicesFunction::RunSync() {
- scoped_ptr<audio::SetActiveDevices::Params> params(
+ std::unique_ptr<audio::SetActiveDevices::Params> params(
audio::SetActiveDevices::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -113,7 +115,7 @@ bool AudioSetActiveDevicesFunction::RunSync() {
///////////////////////////////////////////////////////////////////////////////
bool AudioSetPropertiesFunction::RunSync() {
- scoped_ptr<audio::SetProperties::Params> params(
+ std::unique_ptr<audio::SetProperties::Params> params(
audio::SetProperties::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chromium/extensions/browser/api/bluetooth/bluetooth_api.cc b/chromium/extensions/browser/api/bluetooth/bluetooth_api.cc
index ff9780bb6e0..9c5fc508dd7 100644
--- a/chromium/extensions/browser/api/bluetooth/bluetooth_api.cc
+++ b/chromium/extensions/browser/api/bluetooth/bluetooth_api.cc
@@ -142,7 +142,7 @@ bool BluetoothGetDeviceFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- scoped_ptr<GetDevice::Params> params(GetDevice::Params::Create(*args_));
+ std::unique_ptr<GetDevice::Params> params(GetDevice::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get() != NULL);
BluetoothDevice* device = adapter->GetDevice(params->device_address);
diff --git a/chromium/extensions/browser/api/bluetooth/bluetooth_api.h b/chromium/extensions/browser/api/bluetooth/bluetooth_api.h
index d4f4f1fbb50..838bd4f4c43 100644
--- a/chromium/extensions/browser/api/bluetooth/bluetooth_api.h
+++ b/chromium/extensions/browser/api/bluetooth/bluetooth_api.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_H_
#define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_H_
+#include <memory>
#include <string>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "device/bluetooth/bluetooth_device.h"
#include "extensions/browser/api/bluetooth/bluetooth_extension_function.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
@@ -61,7 +61,7 @@ class BluetoothAPI : public BrowserContextKeyedAPI,
content::BrowserContext* browser_context_;
// Created lazily on first access.
- scoped_ptr<BluetoothEventRouter> event_router_;
+ std::unique_ptr<BluetoothEventRouter> event_router_;
};
namespace api {
diff --git a/chromium/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc b/chromium/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc
index 22cb6f74ffe..4a5210fa818 100644
--- a/chromium/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc
+++ b/chromium/extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.cc
@@ -4,9 +4,9 @@
#include "extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.h"
+#include <memory>
#include <utility>
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "content/public/browser/browser_context.h"
#include "device/bluetooth/bluetooth_device.h"
@@ -101,11 +101,11 @@ void BluetoothApiPairingDelegate::AuthorizePairing(
void BluetoothApiPairingDelegate::DispatchPairingEvent(
const bt_private::PairingEvent& pairing_event) {
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
bt_private::OnPairing::Create(pairing_event);
- scoped_ptr<Event> event(new Event(events::BLUETOOTH_PRIVATE_ON_PAIRING,
- bt_private::OnPairing::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::BLUETOOTH_PRIVATE_ON_PAIRING,
+ bt_private::OnPairing::kEventName,
+ std::move(args)));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
}
diff --git a/chromium/extensions/browser/api/bluetooth/bluetooth_apitest.cc b/chromium/extensions/browser/api/bluetooth/bluetooth_apitest.cc
index 184c4c8225c..e586d4a063f 100644
--- a/chromium/extensions/browser/api/bluetooth/bluetooth_apitest.cc
+++ b/chromium/extensions/browser/api/bluetooth/bluetooth_apitest.cc
@@ -76,7 +76,7 @@ class BluetoothApiTest : public ExtensionApiTest {
const BluetoothAdapter::ErrorCallback& error_callback) {
if (mock_session_.get()) {
callback.Run(
- scoped_ptr<BluetoothDiscoverySession>(mock_session_.release()));
+ std::unique_ptr<BluetoothDiscoverySession>(mock_session_.release()));
return;
}
error_callback.Run();
@@ -91,10 +91,11 @@ class BluetoothApiTest : public ExtensionApiTest {
protected:
testing::StrictMock<MockBluetoothAdapter>* mock_adapter_;
- scoped_ptr<testing::NiceMock<MockBluetoothDiscoverySession> > mock_session_;
- scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device1_;
- scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device2_;
- scoped_ptr<testing::NiceMock<MockBluetoothDevice> > device3_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothDiscoverySession>>
+ mock_session_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothDevice>> device1_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothDevice>> device2_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothDevice>> device3_;
extensions::BluetoothEventRouter* event_router() {
return bluetooth_api()->event_router();
@@ -130,7 +131,7 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetAdapterState) {
scoped_refptr<api::BluetoothGetAdapterStateFunction> get_adapter_state;
get_adapter_state = setupFunction(new api::BluetoothGetAdapterStateFunction);
- scoped_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result(utils::RunFunctionAndReturnSingleResult(
get_adapter_state.get(), "[]", browser()));
ASSERT_TRUE(result.get() != NULL);
api::bluetooth::AdapterState state;
diff --git a/chromium/extensions/browser/api/bluetooth/bluetooth_event_router.cc b/chromium/extensions/browser/api/bluetooth/bluetooth_event_router.cc
index 0f9345b4d0b..bd73e7983c5 100644
--- a/chromium/extensions/browser/api/bluetooth/bluetooth_event_router.cc
+++ b/chromium/extensions/browser/api/bluetooth/bluetooth_event_router.cc
@@ -137,7 +137,7 @@ void BluetoothEventRouter::StartDiscoverySessionImpl(
pre_set_filter_map_.find(extension_id);
if (pre_set_iter != pre_set_filter_map_.end()) {
adapter->StartDiscoverySessionWithFilter(
- scoped_ptr<device::BluetoothDiscoveryFilter>(pre_set_iter->second),
+ std::unique_ptr<device::BluetoothDiscoveryFilter>(pre_set_iter->second),
base::Bind(&BluetoothEventRouter::OnStartDiscoverySession,
weak_ptr_factory_.GetWeakPtr(), extension_id, callback),
error_callback);
@@ -171,7 +171,7 @@ void BluetoothEventRouter::StopDiscoverySession(
}
void BluetoothEventRouter::SetDiscoveryFilter(
- scoped_ptr<device::BluetoothDiscoveryFilter> discovery_filter,
+ std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter,
device::BluetoothAdapter* adapter,
const std::string& extension_id,
const base::Closure& callback,
@@ -377,9 +377,9 @@ void BluetoothEventRouter::DispatchAdapterStateEvent() {
CHECK(adapter_.get());
PopulateAdapterState(*adapter_.get(), &state);
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
bluetooth::OnAdapterStateChanged::Create(state);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::BLUETOOTH_ON_ADAPTER_STATE_CHANGED,
bluetooth::OnAdapterStateChanged::kEventName, std::move(args)));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
@@ -393,9 +393,9 @@ void BluetoothEventRouter::DispatchDeviceEvent(
CHECK(device);
bluetooth::BluetoothDeviceToApiDevice(*device, &extension_device);
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
bluetooth::OnDeviceAdded::Create(extension_device);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(args)));
EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event));
}
@@ -440,7 +440,7 @@ void BluetoothEventRouter::CleanUpAllExtensions() {
void BluetoothEventRouter::OnStartDiscoverySession(
const std::string& extension_id,
const base::Closure& callback,
- scoped_ptr<device::BluetoothDiscoverySession> discovery_session) {
+ std::unique_ptr<device::BluetoothDiscoverySession> discovery_session) {
// Clean up any existing session instance for the extension.
DiscoverySessionMap::iterator iter =
discovery_session_map_.find(extension_id);
diff --git a/chromium/extensions/browser/api/bluetooth/bluetooth_event_router.h b/chromium/extensions/browser/api/bluetooth/bluetooth_event_router.h
index 6afaac0d8d5..4d2fb55fdfa 100644
--- a/chromium/extensions/browser/api/bluetooth/bluetooth_event_router.h
+++ b/chromium/extensions/browser/api/bluetooth/bluetooth_event_router.h
@@ -74,7 +74,7 @@ class BluetoothEventRouter : public device::BluetoothAdapter::Observer,
// Callback is called, if the filter was successfully updated.
// |error_callback| is called, if filter update failed.
void SetDiscoveryFilter(
- scoped_ptr<device::BluetoothDiscoveryFilter> discovery_filter,
+ std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter,
device::BluetoothAdapter* adapter,
const std::string& extension_id,
const base::Closure& callback,
@@ -151,7 +151,7 @@ class BluetoothEventRouter : public device::BluetoothAdapter::Observer,
void OnStartDiscoverySession(
const std::string& extension_id,
const base::Closure& callback,
- scoped_ptr<device::BluetoothDiscoverySession> discovery_session);
+ std::unique_ptr<device::BluetoothDiscoverySession> discovery_session);
void OnSetDiscoveryFilter(const std::string& extension_id,
const base::Closure& callback);
diff --git a/chromium/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc b/chromium/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
index 597d73838b7..5de97568f2f 100644
--- a/chromium/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
+++ b/chromium/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
@@ -4,11 +4,11 @@
#include "extensions/browser/api/bluetooth/bluetooth_event_router.h"
+#include <memory>
#include <string>
#include <utility>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "content/public/browser/notification_service.h"
@@ -60,8 +60,8 @@ class BluetoothEventRouterTest : public ExtensionsTest {
// Note: |ui_thread_| must be declared before |router_|.
content::TestBrowserThread ui_thread_;
testing::StrictMock<device::MockBluetoothAdapter>* mock_adapter_;
- scoped_ptr<content::NotificationService> notification_service_;
- scoped_ptr<BluetoothEventRouter> router_;
+ std::unique_ptr<content::NotificationService> notification_service_;
+ std::unique_ptr<BluetoothEventRouter> router_;
};
TEST_F(BluetoothEventRouterTest, BluetoothEventListener) {
@@ -100,7 +100,7 @@ TEST_F(BluetoothEventRouterTest, UnloadExtension) {
// This test check that calling SetDiscoveryFilter before StartDiscoverySession
// for given extension will start session with proper filter.
TEST_F(BluetoothEventRouterTest, SetDiscoveryFilter) {
- scoped_ptr<device::BluetoothDiscoveryFilter> discovery_filter(
+ std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter(
new device::BluetoothDiscoveryFilter(
device::BluetoothDiscoveryFilter::Transport::TRANSPORT_LE));
diff --git a/chromium/extensions/browser/api/bluetooth/bluetooth_private_api.cc b/chromium/extensions/browser/api/bluetooth/bluetooth_private_api.cc
index 79deb70543d..f4f176ab43b 100644
--- a/chromium/extensions/browser/api/bluetooth/bluetooth_private_api.cc
+++ b/chromium/extensions/browser/api/bluetooth/bluetooth_private_api.cc
@@ -142,7 +142,7 @@ BluetoothPrivateSetAdapterStateFunction::
bool BluetoothPrivateSetAdapterStateFunction::DoWork(
scoped_refptr<device::BluetoothAdapter> adapter) {
- scoped_ptr<bt_private::SetAdapterState::Params> params(
+ std::unique_ptr<bt_private::SetAdapterState::Params> params(
bt_private::SetAdapterState::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -250,7 +250,7 @@ BluetoothPrivateSetPairingResponseFunction::
bool BluetoothPrivateSetPairingResponseFunction::DoWork(
scoped_refptr<device::BluetoothAdapter> adapter) {
- scoped_ptr<bt_private::SetPairingResponse::Params> params(
+ std::unique_ptr<bt_private::SetPairingResponse::Params> params(
bt_private::SetPairingResponse::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
const bt_private::SetPairingResponseOptions& options = params->options;
@@ -311,7 +311,7 @@ BluetoothPrivateDisconnectAllFunction::
bool BluetoothPrivateDisconnectAllFunction::DoWork(
scoped_refptr<device::BluetoothAdapter> adapter) {
- scoped_ptr<bt_private::DisconnectAll::Params> params(
+ std::unique_ptr<bt_private::DisconnectAll::Params> params(
bt_private::DisconnectAll::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -364,7 +364,7 @@ BluetoothPrivateForgetDeviceFunction::~BluetoothPrivateForgetDeviceFunction() {}
bool BluetoothPrivateForgetDeviceFunction::DoWork(
scoped_refptr<device::BluetoothAdapter> adapter) {
- scoped_ptr<bt_private::ForgetDevice::Params> params(
+ std::unique_ptr<bt_private::ForgetDevice::Params> params(
bt_private::ForgetDevice::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -399,11 +399,11 @@ void BluetoothPrivateForgetDeviceFunction::OnErrorCallback(
bool BluetoothPrivateSetDiscoveryFilterFunction::DoWork(
scoped_refptr<device::BluetoothAdapter> adapter) {
- scoped_ptr<SetDiscoveryFilter::Params> params(
+ std::unique_ptr<SetDiscoveryFilter::Params> params(
SetDiscoveryFilter::Params::Create(*args_));
auto& df_param = params->discovery_filter;
- scoped_ptr<device::BluetoothDiscoveryFilter> discovery_filter;
+ std::unique_ptr<device::BluetoothDiscoveryFilter> discovery_filter;
// If all filter fields are empty, we are clearing filter. If any field is
// set, then create proper filter.
@@ -475,7 +475,7 @@ BluetoothPrivateConnectFunction::~BluetoothPrivateConnectFunction() {}
bool BluetoothPrivateConnectFunction::DoWork(
scoped_refptr<device::BluetoothAdapter> adapter) {
- scoped_ptr<bt_private::Connect::Params> params(
+ std::unique_ptr<bt_private::Connect::Params> params(
bt_private::Connect::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -577,7 +577,7 @@ BluetoothPrivatePairFunction::~BluetoothPrivatePairFunction() {}
bool BluetoothPrivatePairFunction::DoWork(
scoped_refptr<device::BluetoothAdapter> adapter) {
- scoped_ptr<bt_private::Pair::Params> params(
+ std::unique_ptr<bt_private::Pair::Params> params(
bt_private::Pair::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chromium/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc b/chromium/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc
index 65adb8a379e..8307eb0b4f1 100644
--- a/chromium/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc
+++ b/chromium/extensions/browser/api/bluetooth/bluetooth_private_apitest.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <utility>
#include "base/command_line.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "device/bluetooth/test/mock_bluetooth_adapter.h"
@@ -106,11 +106,11 @@ class BluetoothPrivateApiTest : public ExtensionApiTest {
pairing_event.device.vendor_id_source = bt::VENDOR_ID_SOURCE_USB;
pairing_event.device.type = bt::DEVICE_TYPE_PHONE;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
bt_private::OnPairing::Create(pairing_event);
- scoped_ptr<Event> event(new Event(events::BLUETOOTH_PRIVATE_ON_PAIRING,
- bt_private::OnPairing::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::BLUETOOTH_PRIVATE_ON_PAIRING,
+ bt_private::OnPairing::kEventName,
+ std::move(args)));
EventRouter::Get(browser()->profile())
->DispatchEventToExtension(kTestExtensionId, std::move(event));
}
@@ -133,7 +133,7 @@ class BluetoothPrivateApiTest : public ExtensionApiTest {
void CallSetDiscoveryFilterCallback(
device::BluetoothAdapter::DiscoverySessionCallback callback) {
- auto session_ptr = scoped_ptr<NiceMock<MockBluetoothDiscoverySession>>(
+ auto session_ptr = std::unique_ptr<NiceMock<MockBluetoothDiscoverySession>>(
mock_discovery_session_);
callback.Run(std::move(session_ptr));
@@ -145,7 +145,7 @@ class BluetoothPrivateApiTest : public ExtensionApiTest {
bool adapter_discoverable_;
scoped_refptr<NiceMock<MockBluetoothAdapter> > mock_adapter_;
- scoped_ptr<NiceMock<MockBluetoothDevice> > mock_device_;
+ std::unique_ptr<NiceMock<MockBluetoothDevice>> mock_device_;
// This discovery session will be owned by EventRouter, we'll only keep
// pointer to it.
diff --git a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h
index 40304fb0b0d..dcc87b2dc21 100644
--- a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h
+++ b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h
@@ -138,7 +138,7 @@ class BluetoothApiSocket : public ApiResource {
device::BluetoothUUID uuid_;
// Application-defined string - see bluetooth.idl.
- scoped_ptr<std::string> name_;
+ std::unique_ptr<std::string> name_;
// Flag indicating whether the socket is left open when the application is
// suspended - see bluetooth.idl.
diff --git a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc
index 0357ed9b951..ac1f41f76d5 100644
--- a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc
+++ b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.cc
@@ -301,7 +301,7 @@ void BluetoothSocketListenFunction::OnGetAdapter(
return;
}
- scoped_ptr<std::string> name;
+ std::unique_ptr<std::string> name;
if (socket->name())
name.reset(new std::string(*socket->name()));
@@ -364,7 +364,7 @@ bool BluetoothSocketListenUsingRfcommFunction::CreateParams() {
void BluetoothSocketListenUsingRfcommFunction::CreateService(
scoped_refptr<device::BluetoothAdapter> adapter,
const device::BluetoothUUID& uuid,
- scoped_ptr<std::string> name,
+ std::unique_ptr<std::string> name,
const device::BluetoothAdapter::CreateServiceCallback& callback,
const device::BluetoothAdapter::CreateServiceErrorCallback&
error_callback) {
@@ -407,7 +407,7 @@ bool BluetoothSocketListenUsingL2capFunction::CreateParams() {
void BluetoothSocketListenUsingL2capFunction::CreateService(
scoped_refptr<device::BluetoothAdapter> adapter,
const device::BluetoothUUID& uuid,
- scoped_ptr<std::string> name,
+ std::unique_ptr<std::string> name,
const device::BluetoothAdapter::CreateServiceCallback& callback,
const device::BluetoothAdapter::CreateServiceErrorCallback&
error_callback) {
diff --git a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h
index 31de3b77da6..5203fc1c176 100644
--- a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h
+++ b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h
@@ -7,11 +7,11 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include "base/containers/hash_tables.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/browser/api/async_api_function.h"
@@ -81,7 +81,7 @@ class BluetoothSocketCreateFunction : public BluetoothSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<bluetooth_socket::Create::Params> params_;
+ std::unique_ptr<bluetooth_socket::Create::Params> params_;
};
class BluetoothSocketUpdateFunction : public BluetoothSocketAsyncApiFunction {
@@ -98,7 +98,7 @@ class BluetoothSocketUpdateFunction : public BluetoothSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<bluetooth_socket::Update::Params> params_;
+ std::unique_ptr<bluetooth_socket::Update::Params> params_;
};
class BluetoothSocketSetPausedFunction
@@ -117,7 +117,7 @@ class BluetoothSocketSetPausedFunction
void Work() override;
private:
- scoped_ptr<bluetooth_socket::SetPaused::Params> params_;
+ std::unique_ptr<bluetooth_socket::SetPaused::Params> params_;
BluetoothSocketEventDispatcher* socket_event_dispatcher_;
};
@@ -129,7 +129,7 @@ class BluetoothSocketListenFunction : public BluetoothSocketAsyncApiFunction {
virtual void CreateService(
scoped_refptr<device::BluetoothAdapter> adapter,
const device::BluetoothUUID& uuid,
- scoped_ptr<std::string> name,
+ std::unique_ptr<std::string> name,
const device::BluetoothAdapter::CreateServiceCallback& callback,
const device::BluetoothAdapter::CreateServiceErrorCallback&
error_callback) = 0;
@@ -168,7 +168,7 @@ class BluetoothSocketListenUsingRfcommFunction
void CreateService(
scoped_refptr<device::BluetoothAdapter> adapter,
const device::BluetoothUUID& uuid,
- scoped_ptr<std::string> name,
+ std::unique_ptr<std::string> name,
const device::BluetoothAdapter::CreateServiceCallback& callback,
const device::BluetoothAdapter::CreateServiceErrorCallback&
error_callback) override;
@@ -178,7 +178,7 @@ class BluetoothSocketListenUsingRfcommFunction
~BluetoothSocketListenUsingRfcommFunction() override;
private:
- scoped_ptr<bluetooth_socket::ListenUsingRfcomm::Params> params_;
+ std::unique_ptr<bluetooth_socket::ListenUsingRfcomm::Params> params_;
};
class BluetoothSocketListenUsingL2capFunction
@@ -197,7 +197,7 @@ class BluetoothSocketListenUsingL2capFunction
void CreateService(
scoped_refptr<device::BluetoothAdapter> adapter,
const device::BluetoothUUID& uuid,
- scoped_ptr<std::string> name,
+ std::unique_ptr<std::string> name,
const device::BluetoothAdapter::CreateServiceCallback& callback,
const device::BluetoothAdapter::CreateServiceErrorCallback&
error_callback) override;
@@ -207,7 +207,7 @@ class BluetoothSocketListenUsingL2capFunction
~BluetoothSocketListenUsingL2capFunction() override;
private:
- scoped_ptr<bluetooth_socket::ListenUsingL2cap::Params> params_;
+ std::unique_ptr<bluetooth_socket::ListenUsingL2cap::Params> params_;
};
class BluetoothSocketAbstractConnectFunction :
@@ -233,7 +233,7 @@ class BluetoothSocketAbstractConnectFunction :
private:
virtual void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
- scoped_ptr<bluetooth_socket::Connect::Params> params_;
+ std::unique_ptr<bluetooth_socket::Connect::Params> params_;
BluetoothSocketEventDispatcher* socket_event_dispatcher_;
};
@@ -271,7 +271,7 @@ class BluetoothSocketDisconnectFunction
private:
virtual void OnSuccess();
- scoped_ptr<bluetooth_socket::Disconnect::Params> params_;
+ std::unique_ptr<bluetooth_socket::Disconnect::Params> params_;
};
class BluetoothSocketCloseFunction : public BluetoothSocketAsyncApiFunction {
@@ -288,7 +288,7 @@ class BluetoothSocketCloseFunction : public BluetoothSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<bluetooth_socket::Close::Params> params_;
+ std::unique_ptr<bluetooth_socket::Close::Params> params_;
};
class BluetoothSocketSendFunction : public BluetoothSocketAsyncApiFunction {
@@ -309,7 +309,7 @@ class BluetoothSocketSendFunction : public BluetoothSocketAsyncApiFunction {
void OnError(BluetoothApiSocket::ErrorReason reason,
const std::string& message);
- scoped_ptr<bluetooth_socket::Send::Params> params_;
+ std::unique_ptr<bluetooth_socket::Send::Params> params_;
scoped_refptr<net::IOBuffer> io_buffer_;
size_t io_buffer_size_;
};
@@ -329,7 +329,7 @@ class BluetoothSocketGetInfoFunction : public BluetoothSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<bluetooth_socket::GetInfo::Params> params_;
+ std::unique_ptr<bluetooth_socket::GetInfo::Params> params_;
};
class BluetoothSocketGetSocketsFunction
diff --git a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc
index 74c0842485a..1462ed49274 100644
--- a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc
+++ b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_apitest.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
#include <string>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/bluetooth/bluetooth_uuid.h"
@@ -67,8 +67,8 @@ class BluetoothSocketApiTest : public extensions::ShellApiTest {
protected:
scoped_refptr<testing::StrictMock<MockBluetoothAdapter> > mock_adapter_;
- scoped_ptr<testing::NiceMock<MockBluetoothDevice> > mock_device1_;
- scoped_ptr<testing::NiceMock<MockBluetoothDevice> > mock_device2_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothDevice>> mock_device1_;
+ std::unique_ptr<testing::NiceMock<MockBluetoothDevice>> mock_device2_;
private:
scoped_refptr<Extension> empty_extension_;
diff --git a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc
index d6185dbba1f..145a288825d 100644
--- a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc
+++ b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.cc
@@ -197,11 +197,11 @@ void BluetoothSocketEventDispatcher::ReceiveCallback(
bluetooth_socket::ReceiveInfo receive_info;
receive_info.socket_id = params.socket_id;
receive_info.data.assign(io_buffer->data(), io_buffer->data() + bytes_read);
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
bluetooth_socket::OnReceive::Create(receive_info);
- scoped_ptr<Event> event(new Event(events::BLUETOOTH_SOCKET_ON_RECEIVE,
- bluetooth_socket::OnReceive::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(
+ new Event(events::BLUETOOTH_SOCKET_ON_RECEIVE,
+ bluetooth_socket::OnReceive::kEventName, std::move(args)));
PostEvent(params, std::move(event));
// Post a task to delay the read until the socket is available, as
@@ -232,9 +232,9 @@ void BluetoothSocketEventDispatcher::ReceiveErrorCallback(
receive_error_info.socket_id = params.socket_id;
receive_error_info.error_message = error;
receive_error_info.error = MapReceiveErrorReason(error_reason);
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
bluetooth_socket::OnReceiveError::Create(receive_error_info);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::BLUETOOTH_SOCKET_ON_RECEIVE_ERROR,
bluetooth_socket::OnReceiveError::kEventName, std::move(args)));
PostEvent(params, std::move(event));
@@ -294,11 +294,11 @@ void BluetoothSocketEventDispatcher::AcceptCallback(
bluetooth_socket::AcceptInfo accept_info;
accept_info.socket_id = params.socket_id;
accept_info.client_socket_id = client_socket_id;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
bluetooth_socket::OnAccept::Create(accept_info);
- scoped_ptr<Event> event(new Event(events::BLUETOOTH_SOCKET_ON_ACCEPT,
- bluetooth_socket::OnAccept::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::BLUETOOTH_SOCKET_ON_ACCEPT,
+ bluetooth_socket::OnAccept::kEventName,
+ std::move(args)));
PostEvent(params, std::move(event));
// Post a task to delay the accept until the socket is available, as
@@ -329,11 +329,11 @@ void BluetoothSocketEventDispatcher::AcceptErrorCallback(
accept_error_info.socket_id = params.socket_id;
accept_error_info.error_message = error;
accept_error_info.error = MapAcceptErrorReason(error_reason);
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
bluetooth_socket::OnAcceptError::Create(accept_error_info);
- scoped_ptr<Event> event(new Event(events::BLUETOOTH_SOCKET_ON_ACCEPT_ERROR,
- bluetooth_socket::OnAcceptError::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(
+ new Event(events::BLUETOOTH_SOCKET_ON_ACCEPT_ERROR,
+ bluetooth_socket::OnAcceptError::kEventName, std::move(args)));
PostEvent(params, std::move(event));
// Since we got an error, the socket is now "paused" until the application
@@ -347,7 +347,7 @@ void BluetoothSocketEventDispatcher::AcceptErrorCallback(
// static
void BluetoothSocketEventDispatcher::PostEvent(const SocketParams& params,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK_CURRENTLY_ON(params.thread_id);
BrowserThread::PostTask(
@@ -360,7 +360,7 @@ void BluetoothSocketEventDispatcher::PostEvent(const SocketParams& params,
void BluetoothSocketEventDispatcher::DispatchEvent(
void* browser_context_id,
const std::string& extension_id,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::BrowserContext* context =
diff --git a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h
index 5e45fc0c055..72a78b82253 100644
--- a/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h
+++ b/chromium/extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatcher.h
@@ -101,12 +101,13 @@ class BluetoothSocketEventDispatcher
const std::string& error);
// Post an extension event from IO to UI thread
- static void PostEvent(const SocketParams& params, scoped_ptr<Event> event);
+ static void PostEvent(const SocketParams& params,
+ std::unique_ptr<Event> event);
// Dispatch an extension event on to EventRouter instance on UI thread.
static void DispatchEvent(void* browser_context_id,
const std::string& extension_id,
- scoped_ptr<Event> event);
+ std::unique_ptr<Event> event);
// Usually FILE thread (except for unit testing).
content::BrowserThread::ID thread_id_;
diff --git a/chromium/extensions/browser/api/cast_channel/DEPS b/chromium/extensions/browser/api/cast_channel/DEPS
index c6e9550543b..23ace86e7c7 100644
--- a/chromium/extensions/browser/api/cast_channel/DEPS
+++ b/chromium/extensions/browser/api/cast_channel/DEPS
@@ -1,3 +1,4 @@
include_rules = [
+ "+components/cast_certificate",
"+third_party/zlib",
]
diff --git a/chromium/extensions/browser/api/cast_channel/cast_auth_util.cc b/chromium/extensions/browser/api/cast_channel/cast_auth_util.cc
index afc433ea71b..451058b0358 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_auth_util.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_auth_util.cc
@@ -10,9 +10,9 @@
#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
+#include "components/cast_certificate/cast_cert_validator.h"
#include "extensions/browser/api/cast_channel/cast_message_util.h"
#include "extensions/common/api/cast_channel/cast_channel.pb.h"
-#include "extensions/common/cast/cast_cert_validator.h"
#include "net/cert/x509_certificate.h"
#include "net/der/parse_values.h"
@@ -26,7 +26,7 @@ const char* const kParseErrorPrefix = "Failed to parse auth message: ";
// The maximum number of days a cert can live for.
const int kMaxSelfSignedCertLifetimeInDays = 4;
-namespace cast_crypto = ::extensions::api::cast_crypto;
+namespace cast_crypto = ::cast_certificate;
// Extracts an embedded DeviceAuthMessage payload from an auth challenge reply
// message.
@@ -138,7 +138,7 @@ AuthResult AuthenticateChallengeReply(const CastMessage& challenge_reply,
AuthResult VerifyCredentials(const AuthResponse& response,
const std::string& signature_input) {
// Verify the certificate
- scoped_ptr<cast_crypto::CertVerificationContext> verification_context;
+ std::unique_ptr<cast_crypto::CertVerificationContext> verification_context;
// Build a single vector containing the certificate chain.
std::vector<std::string> cert_chain;
diff --git a/chromium/extensions/browser/api/cast_channel/cast_auth_util_unittest.cc b/chromium/extensions/browser/api/cast_channel/cast_auth_util_unittest.cc
index c474613c945..9393eac7532 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_auth_util_unittest.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_auth_util_unittest.cc
@@ -6,12 +6,9 @@
#include <string>
-#include "base/files/file_util.h"
#include "base/macros.h"
-#include "base/path_service.h"
+#include "components/cast_certificate/cast_cert_validator_test_helpers.h"
#include "extensions/common/api/cast_channel/cast_channel.pb.h"
-#include "extensions/common/extension_paths.h"
-#include "net/cert/pem_tokenizer.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
@@ -19,99 +16,6 @@ namespace api {
namespace cast_channel {
namespace {
-// Creates an std::string given a uint8_t array.
-template <size_t N>
-std::string CreateString(const uint8_t (&data)[N]) {
- return std::string(reinterpret_cast<const char*>(data), N);
-}
-
-// Reads a file from the cast certificates test data directory:
-// src/extensions/test/data/cast_certificates/
-std::string ReadTestFileToString(const std::string& file_name) {
- base::FilePath filepath;
- if (!PathService::Get(DIR_TEST_DATA, &filepath)) {
- ADD_FAILURE() << "Couldn't retrieve test data root";
- return std::string();
- }
- filepath = filepath.AppendASCII("cast_certificates/" + file_name);
-
- // Read the full contents of the file.
- std::string file_data;
- if (!base::ReadFileToString(filepath, &file_data)) {
- ADD_FAILURE() << "Couldn't read file: " << filepath.value();
- return std::string();
- }
-
- return file_data;
-}
-
-// Reads a PEM file containing "CERTIFICATE" blocks to a vector of certificate
-// data.
-std::vector<std::string> ReadCertificateChainFromFile(
- const std::string& file_name) {
- std::string file_data = ReadTestFileToString(file_name);
-
- // Read the certificate chain from the test file, which is comprised of PEM
- // blocks titled "CERTIFICATE".
- std::vector<std::string> pem_headers;
- pem_headers.push_back("CERTIFICATE");
-
- std::vector<std::string> certs;
- net::PEMTokenizer pem_tokenizer(file_data, pem_headers);
- while (pem_tokenizer.GetNext())
- certs.push_back(pem_tokenizer.data());
-
- return certs;
-}
-
-static const unsigned char kSignedData[] = {
- 0x5f, 0x76, 0x0d, 0xc8, 0x4b, 0xe7, 0x6e, 0xcb, 0x31, 0x58, 0xca, 0xd3,
- 0x7d, 0x23, 0x55, 0xbe, 0x8d, 0x52, 0x87, 0x83, 0x27, 0x52, 0x78, 0xfa,
- 0xa6, 0xdd, 0xdf, 0x13, 0x00, 0x51, 0x57, 0x6a, 0x83, 0x15, 0xcc, 0xc5,
- 0xb2, 0x5c, 0xdf, 0xe6, 0x81, 0xdc, 0x13, 0x58, 0x7b, 0x94, 0x0f, 0x69,
- 0xcc, 0xdf, 0x68, 0x41, 0x8a, 0x95, 0xe2, 0xcd, 0xf8, 0xde, 0x0f, 0x2f,
- 0x30, 0xcf, 0x73, 0xbf, 0x37, 0x52, 0x87, 0x23, 0xd7, 0xbe, 0xba, 0x7c,
- 0xde, 0x50, 0xd3, 0x77, 0x9c, 0x06, 0x82, 0x28, 0x67, 0xc1, 0x1a, 0xf5,
- 0x8a, 0xa0, 0xf2, 0x32, 0x09, 0x95, 0x41, 0x41, 0x93, 0x8e, 0x62, 0xaa,
- 0xf3, 0xe3, 0x22, 0x17, 0x43, 0x94, 0x9b, 0x63, 0xfa, 0x68, 0x20, 0x69,
- 0x38, 0xf6, 0x75, 0x6c, 0xe0, 0x3b, 0xe0, 0x8d, 0x63, 0xac, 0x7f, 0xe3,
- 0x09, 0xd8, 0xde, 0x91, 0xc8, 0x1e, 0x07, 0x4a, 0xb2, 0x1e, 0xe1, 0xe3,
- 0xf4, 0x4d, 0x3e, 0x8a, 0xf4, 0xf8, 0x83, 0x39, 0x2b, 0x50, 0x98, 0x61,
- 0x91, 0x50, 0x00, 0x34, 0x57, 0xd2, 0x0d, 0xf7, 0xfa, 0xc9, 0xcc, 0xd9,
- 0x7a, 0x3d, 0x39, 0x7a, 0x1a, 0xbd, 0xf8, 0xbe, 0x65, 0xb6, 0xea, 0x4e,
- 0x86, 0x74, 0xdd, 0x51, 0x74, 0x6e, 0xa6, 0x7f, 0x14, 0x6c, 0x6a, 0x46,
- 0xb8, 0xaf, 0xcd, 0x6c, 0x78, 0x43, 0x76, 0x47, 0x5b, 0xdc, 0xb6, 0xf6,
- 0x4d, 0x1b, 0xe0, 0xb5, 0xf9, 0xa2, 0xb8, 0x26, 0x3f, 0x3f, 0xb8, 0x80,
- 0xed, 0xce, 0xfd, 0x0e, 0xcb, 0x48, 0x7a, 0x3b, 0xdf, 0x92, 0x44, 0x04,
- 0x81, 0xe4, 0xd3, 0x1e, 0x07, 0x9b, 0x02, 0xae, 0x05, 0x5a, 0x11, 0xf2,
- 0xc2, 0x75, 0x85, 0xd5, 0xf1, 0x53, 0x4c, 0x09, 0xd0, 0x99, 0xf8, 0x3e,
- 0xf6, 0x24, 0x46, 0xae, 0x83, 0x35, 0x3e, 0x6c, 0x8c, 0x2a, 0x9f, 0x1c,
- 0x5b, 0xfb, 0x89, 0x56};
-
-static const unsigned char kSha1Signature[] = {
- 0x52, 0x56, 0xcd, 0x53, 0xfa, 0xd9, 0x44, 0x31, 0x00, 0x2e, 0x85, 0x18,
- 0x56, 0xae, 0xf9, 0xf2, 0x70, 0x16, 0xc9, 0x59, 0x53, 0xc0, 0x17, 0xd9,
- 0x09, 0x65, 0x75, 0xee, 0xba, 0xc8, 0x0d, 0x06, 0x2e, 0xb7, 0x1b, 0xd0,
- 0x6a, 0x4d, 0x58, 0xde, 0x8e, 0xbe, 0x92, 0x22, 0x53, 0x19, 0xbf, 0x74,
- 0x8f, 0xb8, 0xfc, 0x3c, 0x9b, 0x42, 0x14, 0x7d, 0xe1, 0xfc, 0xa3, 0x71,
- 0x91, 0x6c, 0x5d, 0x28, 0x69, 0x8d, 0xd2, 0xde, 0xd1, 0x8f, 0xac, 0x6d,
- 0xf6, 0x48, 0xd8, 0x6f, 0x0e, 0xc9, 0x0a, 0xfa, 0xde, 0x20, 0xe0, 0x9d,
- 0x7a, 0xf8, 0x30, 0xa8, 0xd4, 0x79, 0x15, 0x63, 0xfb, 0x97, 0xa9, 0xef,
- 0x9f, 0x9c, 0xac, 0x16, 0xba, 0x1b, 0x2c, 0x14, 0xb4, 0xa4, 0x54, 0x5e,
- 0xec, 0x04, 0x10, 0x84, 0xc2, 0xa0, 0xd9, 0x6f, 0x05, 0xd4, 0x09, 0x8c,
- 0x85, 0xe9, 0x7a, 0xd1, 0x5a, 0xa3, 0x70, 0x00, 0x30, 0x9b, 0x19, 0x44,
- 0x2a, 0x90, 0x7a, 0xcd, 0x91, 0x94, 0x90, 0x66, 0xf9, 0x2e, 0x5e, 0x43,
- 0x27, 0x33, 0x2c, 0x45, 0xa7, 0xe2, 0x3a, 0x6d, 0xc9, 0x44, 0x58, 0x39,
- 0x45, 0xcb, 0xbd, 0x2f, 0xc5, 0xb4, 0x08, 0x41, 0x4d, 0x45, 0x67, 0x55,
- 0x0d, 0x43, 0x3c, 0xb6, 0x81, 0xbb, 0xb4, 0x34, 0x07, 0x10, 0x28, 0x17,
- 0xc2, 0xad, 0x40, 0x3b, 0xaf, 0xcb, 0xc0, 0xf6, 0x9d, 0x0e, 0x9b, 0xca,
- 0x2b, 0x20, 0xdf, 0xd0, 0xa3, 0xbe, 0xea, 0x3e, 0xe0, 0x82, 0x7b, 0x93,
- 0xfd, 0x9c, 0xaf, 0x97, 0x00, 0x05, 0x44, 0x91, 0x73, 0x68, 0x92, 0x3a,
- 0x8b, 0xbc, 0x0e, 0x96, 0x5e, 0x92, 0x98, 0x70, 0xab, 0xaa, 0x6e, 0x9a,
- 0x8e, 0xb0, 0xf4, 0x92, 0xc5, 0xa0, 0xa0, 0x4b, 0xb3, 0xd5, 0x44, 0x99,
- 0x8e, 0xa1, 0xd1, 0x8f, 0xe3, 0xac, 0x71, 0x1e, 0x3f, 0xc2, 0xfd, 0x0a,
- 0x57, 0xed, 0xea, 0x04};
-
class CastAuthUtilTest : public testing::Test {
public:
CastAuthUtilTest() {}
@@ -121,17 +25,21 @@ class CastAuthUtilTest : public testing::Test {
protected:
static AuthResponse CreateAuthResponse(std::string* signed_data) {
- auto chain = ReadCertificateChainFromFile("audio_ref_dev_test_chain_3.pem");
+ auto chain = cast_certificate::testing::ReadCertificateChainFromFile(
+ "certificates/chromecast_gen1.pem");
CHECK(!chain.empty());
+ auto signature_data = cast_certificate::testing::ReadSignatureTestData(
+ "signeddata/2ZZBG9_FA8FCA3EF91A.pem");
+
AuthResponse response;
response.set_client_auth_certificate(chain[0]);
for (size_t i = 1; i < chain.size(); ++i)
response.add_intermediate_certificate(chain[i]);
- response.set_signature(CreateString(kSha1Signature));
- *signed_data = CreateString(kSignedData);
+ response.set_signature(signature_data.signature_sha1);
+ *signed_data = signature_data.message;
return response;
}
@@ -140,12 +48,15 @@ class CastAuthUtilTest : public testing::Test {
static void MangleString(std::string* str) { (*str)[0] = ~(*str)[0]; }
};
+// Note on expiration: VerifyCredentials() depends on the system clock. In
+// practice this shouldn't be a problem though since the certificate chain
+// being verified doesn't expire until 2032!
TEST_F(CastAuthUtilTest, VerifySuccess) {
std::string signed_data;
AuthResponse auth_response = CreateAuthResponse(&signed_data);
AuthResult result = VerifyCredentials(auth_response, signed_data);
EXPECT_TRUE(result.success());
- EXPECT_EQ(AuthResult::POLICY_AUDIO_ONLY, result.channel_policies);
+ EXPECT_EQ(AuthResult::POLICY_NONE, result.channel_policies);
}
TEST_F(CastAuthUtilTest, VerifyBadCA) {
diff --git a/chromium/extensions/browser/api/cast_channel/cast_channel_api.cc b/chromium/extensions/browser/api/cast_channel/cast_channel_api.cc
index 2c57b392cd2..7856cbd27dd 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_channel_api.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_channel_api.cc
@@ -8,12 +8,13 @@
#include <stdint.h>
#include <limits>
+#include <memory>
#include <string>
#include <utility>
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/default_clock.h"
#include "base/values.h"
@@ -59,7 +60,7 @@ namespace {
// T is an extension dictionary (MessageInfo or ChannelInfo)
template <class T>
std::string ParamToString(const T& info) {
- scoped_ptr<base::DictionaryValue> dict = info.ToValue();
+ std::unique_ptr<base::DictionaryValue> dict = info.ToValue();
std::string out;
base::JSONWriter::Write(*dict, &out);
return out;
@@ -109,7 +110,7 @@ bool IsValidConnectInfoIpAddress(const ConnectInfo& connect_info) {
CastChannelAPI::CastChannelAPI(content::BrowserContext* context)
: browser_context_(context),
- logger_(new Logger(make_scoped_ptr<base::Clock>(new base::DefaultClock),
+ logger_(new Logger(base::WrapUnique<base::Clock>(new base::DefaultClock),
base::Time::UnixEpoch())) {
DCHECK(browser_context_);
}
@@ -124,7 +125,7 @@ scoped_refptr<Logger> CastChannelAPI::GetLogger() {
}
void CastChannelAPI::SendEvent(const std::string& extension_id,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
EventRouter* event_router = EventRouter::Get(GetBrowserContext());
if (event_router) {
@@ -141,11 +142,12 @@ CastChannelAPI::GetFactoryInstance() {
return g_factory.Pointer();
}
-void CastChannelAPI::SetSocketForTest(scoped_ptr<CastSocket> socket_for_test) {
+void CastChannelAPI::SetSocketForTest(
+ std::unique_ptr<CastSocket> socket_for_test) {
socket_for_test_ = std::move(socket_for_test);
}
-scoped_ptr<CastSocket> CastChannelAPI::GetSocketForTest() {
+std::unique_ptr<CastSocket> CastChannelAPI::GetSocketForTest() {
return std::move(socket_for_test_);
}
@@ -153,11 +155,12 @@ content::BrowserContext* CastChannelAPI::GetBrowserContext() const {
return browser_context_;
}
-void CastChannelAPI::SetPingTimeoutTimerForTest(scoped_ptr<base::Timer> timer) {
+void CastChannelAPI::SetPingTimeoutTimerForTest(
+ std::unique_ptr<base::Timer> timer) {
injected_timeout_timer_ = std::move(timer);
}
-scoped_ptr<base::Timer> CastChannelAPI::GetInjectedTimeoutTimerForTest() {
+std::unique_ptr<base::Timer> CastChannelAPI::GetInjectedTimeoutTimerForTest() {
return std::move(injected_timeout_timer_);
}
@@ -302,7 +305,7 @@ void CastChannelOpenFunction::AsyncWorkStart() {
DCHECK(ip_endpoint_.get());
const ConnectInfo& connect_info = params_->connect_info;
CastSocket* socket;
- scoped_ptr<CastSocket> test_socket = api_->GetSocketForTest();
+ std::unique_ptr<CastSocket> test_socket = api_->GetSocketForTest();
if (test_socket.get()) {
socket = test_socket.release();
} else {
@@ -320,8 +323,8 @@ void CastChannelOpenFunction::AsyncWorkStart() {
api_->GetLogger()->LogNewSocketEvent(*socket);
// Construct read delegates.
- scoped_ptr<api::cast_channel::CastTransport::Delegate> delegate(
- make_scoped_ptr(new CastMessageHandler(
+ std::unique_ptr<api::cast_channel::CastTransport::Delegate> delegate(
+ base::WrapUnique(new CastMessageHandler(
base::Bind(&CastChannelAPI::SendEvent, api_->AsWeakPtr()), socket,
api_->GetLogger())));
if (socket->keep_alive()) {
@@ -330,11 +333,11 @@ void CastChannelOpenFunction::AsyncWorkStart() {
new api::cast_channel::KeepAliveDelegate(
socket, api_->GetLogger(), std::move(delegate), ping_interval_,
liveness_timeout_);
- scoped_ptr<base::Timer> injected_timer =
+ std::unique_ptr<base::Timer> injected_timer =
api_->GetInjectedTimeoutTimerForTest();
if (injected_timer) {
keep_alive->SetTimersForTest(
- make_scoped_ptr(new base::Timer(false, false)),
+ base::WrapUnique(new base::Timer(false, false)),
std::move(injected_timer));
}
delegate.reset(keep_alive);
@@ -475,7 +478,7 @@ void CastChannelGetLogsFunction::AsyncWorkStart() {
DCHECK(api_);
size_t length = 0;
- scoped_ptr<char[]> out = api_->GetLogger()->GetLogs(&length);
+ std::unique_ptr<char[]> out = api_->GetLogger()->GetLogs(&length);
if (out.get()) {
SetResult(new base::BinaryValue(std::move(out), length));
} else {
@@ -510,10 +513,10 @@ void CastChannelOpenFunction::CastMessageHandler::OnError(
FillErrorInfo(error_state, logger_->GetLastErrors(socket_->id()),
&error_info);
- scoped_ptr<base::ListValue> results =
+ std::unique_ptr<base::ListValue> results =
OnError::Create(channel_info, error_info);
- scoped_ptr<Event> event(new Event(events::CAST_CHANNEL_ON_ERROR,
- OnError::kEventName, std::move(results)));
+ std::unique_ptr<Event> event(new Event(
+ events::CAST_CHANNEL_ON_ERROR, OnError::kEventName, std::move(results)));
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(ui_dispatch_cb_, socket_->owner_extension_id(),
@@ -531,10 +534,11 @@ void CastChannelOpenFunction::CastMessageHandler::OnMessage(
VLOG(1) << "Received message " << ParamToString(message_info)
<< " on channel " << ParamToString(channel_info);
- scoped_ptr<base::ListValue> results =
+ std::unique_ptr<base::ListValue> results =
OnMessage::Create(channel_info, message_info);
- scoped_ptr<Event> event(new Event(events::CAST_CHANNEL_ON_MESSAGE,
- OnMessage::kEventName, std::move(results)));
+ std::unique_ptr<Event> event(new Event(events::CAST_CHANNEL_ON_MESSAGE,
+ OnMessage::kEventName,
+ std::move(results)));
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(ui_dispatch_cb_, socket_->owner_extension_id(),
diff --git a/chromium/extensions/browser/api/cast_channel/cast_channel_api.h b/chromium/extensions/browser/api/cast_channel/cast_channel_api.h
index b4cbba602e1..b526e73e691 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_channel_api.h
+++ b/chromium/extensions/browser/api/cast_channel/cast_channel_api.h
@@ -5,12 +5,12 @@
#ifndef EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
#define EXTENSIONS_BROWSER_API_CAST_CHANNEL_CAST_CHANNEL_API_H_
+#include <memory>
#include <string>
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/browser/api/async_api_function.h"
@@ -59,24 +59,25 @@ class CastChannelAPI : public BrowserContextKeyedAPI,
scoped_refptr<cast_channel::Logger> GetLogger();
// Sets the CastSocket instance to be used for testing.
- void SetSocketForTest(scoped_ptr<cast_channel::CastSocket> socket_for_test);
+ void SetSocketForTest(
+ std::unique_ptr<cast_channel::CastSocket> socket_for_test);
// Returns a test CastSocket instance, if it is defined.
// Otherwise returns a scoped_ptr with a nullptr value.
- scoped_ptr<cast_channel::CastSocket> GetSocketForTest();
+ std::unique_ptr<cast_channel::CastSocket> GetSocketForTest();
// Returns the API browser context.
content::BrowserContext* GetBrowserContext() const;
// Sets injected ping timeout timer for testing.
- void SetPingTimeoutTimerForTest(scoped_ptr<base::Timer> timer);
+ void SetPingTimeoutTimerForTest(std::unique_ptr<base::Timer> timer);
// Gets the injected ping timeout timer, if set.
// Returns a null scoped ptr if there is no injected timer.
- scoped_ptr<base::Timer> GetInjectedTimeoutTimerForTest();
+ std::unique_ptr<base::Timer> GetInjectedTimeoutTimerForTest();
// Sends an event to the extension's EventRouter, if it exists.
- void SendEvent(const std::string& extension_id, scoped_ptr<Event> event);
+ void SendEvent(const std::string& extension_id, std::unique_ptr<Event> event);
private:
friend class BrowserContextKeyedAPIFactory<CastChannelAPI>;
@@ -90,8 +91,8 @@ class CastChannelAPI : public BrowserContextKeyedAPI,
content::BrowserContext* const browser_context_;
scoped_refptr<cast_channel::Logger> logger_;
- scoped_ptr<cast_channel::CastSocket> socket_for_test_;
- scoped_ptr<base::Timer> injected_timeout_timer_;
+ std::unique_ptr<cast_channel::CastSocket> socket_for_test_;
+ std::unique_ptr<base::Timer> injected_timeout_timer_;
DISALLOW_COPY_AND_ASSIGN(CastChannelAPI);
};
@@ -163,7 +164,7 @@ class CastChannelOpenFunction : public CastChannelAsyncApiFunction {
// Parameter #0 is the extension's ID.
// Parameter #1 is a scoped pointer to the event payload.
using EventDispatchCallback =
- base::Callback<void(const std::string&, scoped_ptr<Event>)>;
+ base::Callback<void(const std::string&, std::unique_ptr<Event>)>;
// Receives incoming messages and errors and provides additional API and
// origin socket context.
@@ -198,11 +199,11 @@ class CastChannelOpenFunction : public CastChannelAsyncApiFunction {
void OnOpen(cast_channel::ChannelError result);
- scoped_ptr<cast_channel::Open::Params> params_;
+ std::unique_ptr<cast_channel::Open::Params> params_;
// The id of the newly opened socket.
int new_channel_id_;
CastChannelAPI* api_;
- scoped_ptr<net::IPEndPoint> ip_endpoint_;
+ std::unique_ptr<net::IPEndPoint> ip_endpoint_;
cast_channel::ChannelAuthType channel_auth_;
base::TimeDelta liveness_timeout_;
base::TimeDelta ping_interval_;
@@ -227,7 +228,7 @@ class CastChannelSendFunction : public CastChannelAsyncApiFunction {
void OnSend(int result);
- scoped_ptr<cast_channel::Send::Params> params_;
+ std::unique_ptr<cast_channel::Send::Params> params_;
DISALLOW_COPY_AND_ASSIGN(CastChannelSendFunction);
};
@@ -248,7 +249,7 @@ class CastChannelCloseFunction : public CastChannelAsyncApiFunction {
void OnClose(int result);
- scoped_ptr<cast_channel::Close::Params> params_;
+ std::unique_ptr<cast_channel::Close::Params> params_;
DISALLOW_COPY_AND_ASSIGN(CastChannelCloseFunction);
};
diff --git a/chromium/extensions/browser/api/cast_channel/cast_channel_api_unittest.cc b/chromium/extensions/browser/api/cast_channel/cast_channel_api_unittest.cc
index 5587194d45e..6cc9124e2ae 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_channel_api_unittest.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_channel_api_unittest.cc
@@ -4,7 +4,8 @@
#include "extensions/browser/api/cast_channel/cast_channel_api.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "net/base/ip_endpoint.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -15,7 +16,7 @@ namespace cast_channel {
// Tests parsing of ConnectInfo.
TEST(CastChannelOpenFunctionTest, TestParseConnectInfo) {
typedef CastChannelOpenFunction ccof;
- scoped_ptr<net::IPEndPoint> ip_endpoint;
+ std::unique_ptr<net::IPEndPoint> ip_endpoint;
// Valid ConnectInfo
ConnectInfo connect_info;
diff --git a/chromium/extensions/browser/api/cast_channel/cast_channel_apitest.cc b/chromium/extensions/browser/api/cast_channel/cast_channel_apitest.cc
index 84958b263da..e578b5deca7 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_channel_apitest.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_channel_apitest.cc
@@ -5,6 +5,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
#include "base/timer/mock_timer.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_apitest.h"
@@ -94,12 +95,12 @@ class CastChannelAPITest : public ExtensionApiTest {
void SetUpMockCastSocket() {
extensions::CastChannelAPI* api = GetApi();
timeout_timer_ = new base::MockTimer(true, false);
- api->SetPingTimeoutTimerForTest(make_scoped_ptr(timeout_timer_));
+ api->SetPingTimeoutTimerForTest(base::WrapUnique(timeout_timer_));
net::IPEndPoint ip_endpoint(net::IPAddress(192, 168, 1, 1), 8009);
mock_cast_socket_ = new MockCastSocket;
// Transfers ownership of the socket.
- api->SetSocketForTest(make_scoped_ptr<CastSocket>(mock_cast_socket_));
+ api->SetSocketForTest(base::WrapUnique<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/chromium/extensions/browser/api/cast_channel/cast_framer.cc b/chromium/extensions/browser/api/cast_channel/cast_framer.cc
index a5dcf3e816c..c0dec4957b6 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_framer.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_framer.cc
@@ -40,7 +40,7 @@ void MessageFramer::MessageHeader::PrependToString(std::string* str) {
MessageHeader output = *this;
output.message_size = base::HostToNet32(message_size);
size_t header_size = MessageHeader::header_size();
- scoped_ptr<char, base::FreeDeleter> char_array(
+ std::unique_ptr<char, base::FreeDeleter> char_array(
static_cast<char*>(malloc(header_size)));
memcpy(char_array.get(), &output, header_size);
str->insert(0, char_array.get(), header_size);
@@ -113,14 +113,14 @@ size_t MessageFramer::BytesRequested() {
}
}
-scoped_ptr<CastMessage> MessageFramer::Ingest(size_t num_bytes,
- size_t* message_length,
- ChannelError* error) {
+std::unique_ptr<CastMessage> MessageFramer::Ingest(size_t num_bytes,
+ size_t* message_length,
+ ChannelError* error) {
DCHECK(error);
DCHECK(message_length);
if (error_) {
*error = CHANNEL_ERROR_INVALID_MESSAGE;
- return scoped_ptr<CastMessage>();
+ return nullptr;
}
DCHECK_EQ(base::checked_cast<int32_t>(message_bytes_received_),
@@ -139,7 +139,7 @@ scoped_ptr<CastMessage> MessageFramer::Ingest(size_t num_bytes,
VLOG(1) << "Error parsing header (message size too large).";
*error = CHANNEL_ERROR_INVALID_MESSAGE;
error_ = true;
- return scoped_ptr<CastMessage>();
+ return nullptr;
}
current_element_ = BODY;
body_size_ = header.message_size;
@@ -147,14 +147,14 @@ scoped_ptr<CastMessage> MessageFramer::Ingest(size_t num_bytes,
break;
case BODY:
if (BytesRequested() == 0) {
- scoped_ptr<CastMessage> parsed_message(new CastMessage);
+ std::unique_ptr<CastMessage> parsed_message(new CastMessage);
if (!parsed_message->ParseFromArray(
input_buffer_->StartOfBuffer() + MessageHeader::header_size(),
body_size_)) {
VLOG(1) << "Error parsing packet body.";
*error = CHANNEL_ERROR_INVALID_MESSAGE;
error_ = true;
- return scoped_ptr<CastMessage>();
+ return nullptr;
}
*message_length = body_size_;
Reset();
@@ -163,11 +163,11 @@ scoped_ptr<CastMessage> MessageFramer::Ingest(size_t num_bytes,
break;
default:
NOTREACHED() << "Unhandled packet element type.";
- return scoped_ptr<CastMessage>();
+ return nullptr;
}
input_buffer_->set_offset(message_bytes_received_);
- return scoped_ptr<CastMessage>();
+ return nullptr;
}
void MessageFramer::Reset() {
diff --git a/chromium/extensions/browser/api/cast_channel/cast_framer.h b/chromium/extensions/browser/api/cast_channel/cast_framer.h
index 093d6e56526..ec8fcfe6088 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_framer.h
+++ b/chromium/extensions/browser/api/cast_channel/cast_framer.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
#include <string>
#include "base/macros.h"
@@ -48,9 +49,9 @@ class MessageFramer {
// if no error occurred.
// Returns A pointer to a parsed CastMessage if a message was received
// in its entirety, nullptr otherwise.
- scoped_ptr<CastMessage> Ingest(size_t num_bytes,
- size_t* message_length,
- ChannelError* error);
+ std::unique_ptr<CastMessage> Ingest(size_t num_bytes,
+ size_t* message_length,
+ ChannelError* error);
// Message header struct. If fields are added, be sure to update
// header_size(). Public to allow use of *_size() methods in unit tests.
diff --git a/chromium/extensions/browser/api/cast_channel/cast_framer_unittest.cc b/chromium/extensions/browser/api/cast_channel/cast_framer_unittest.cc
index 0ff96831973..4000e1a7ab6 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_framer_unittest.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_framer_unittest.cc
@@ -42,7 +42,7 @@ class CastFramerTest : public testing::Test {
CastMessage cast_message_;
std::string cast_message_str_;
scoped_refptr<net::GrowableIOBuffer> buffer_;
- scoped_ptr<MessageFramer> framer_;
+ std::unique_ptr<MessageFramer> framer_;
};
TEST_F(CastFramerTest, TestMessageFramerCompleteMessage) {
@@ -66,7 +66,7 @@ TEST_F(CastFramerTest, TestMessageFramerCompleteMessage) {
framer_->BytesRequested());
// Remainder of packet sent over the wire.
- scoped_ptr<CastMessage> message;
+ std::unique_ptr<CastMessage> message;
message = framer_->Ingest(framer_->BytesRequested(), &message_length, &error);
EXPECT_NE(static_cast<CastMessage*>(nullptr), message.get());
EXPECT_EQ(cast_channel::CHANNEL_ERROR_NONE, error);
@@ -130,7 +130,7 @@ TEST_F(CastFramerTest, TestUnparsableBodyProto) {
EXPECT_EQ(cast_message_str_.size() - 4, framer_->BytesRequested());
// Send body, expect an error.
- scoped_ptr<CastMessage> message;
+ std::unique_ptr<CastMessage> message;
EXPECT_EQ(nullptr, framer_->Ingest(framer_->BytesRequested(), &message_length,
&error).get());
EXPECT_EQ(cast_channel::CHANNEL_ERROR_INVALID_MESSAGE, error);
diff --git a/chromium/extensions/browser/api/cast_channel/cast_message_util.cc b/chromium/extensions/browser/api/cast_channel/cast_message_util.cc
index 76fa2d0218a..f81b20aa17c 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_message_util.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_message_util.cc
@@ -4,8 +4,9 @@
#include "extensions/browser/api/cast_channel/cast_message_util.h"
+#include <memory>
+
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "extensions/common/api/cast_channel.h"
@@ -80,7 +81,7 @@ bool CastMessageToMessageInfo(const CastMessage& message_proto,
message->destination_id = message_proto.destination_id();
message->namespace_ = message_proto.namespace_();
// Determine the type of the payload and fill base::Value appropriately.
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
switch (message_proto.payload_type()) {
case CastMessage_PayloadType_STRING:
if (message_proto.has_payload_utf8())
diff --git a/chromium/extensions/browser/api/cast_channel/cast_socket.cc b/chromium/extensions/browser/api/cast_channel/cast_socket.cc
index 12df2bf382e..038bdceaf7c 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_socket.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_socket.cc
@@ -6,12 +6,14 @@
#include <stdlib.h>
#include <string.h>
+
#include <utility>
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/format_macros.h"
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_number_conversions.h"
@@ -83,7 +85,7 @@ class FakeCertVerifier : public net::CertVerifier {
net::CRLSet*,
net::CertVerifyResult* verify_result,
const net::CompletionCallback&,
- scoped_ptr<net::CertVerifier::Request>*,
+ std::unique_ptr<net::CertVerifier::Request>*,
const net::BoundNetLog&) override {
verify_result->Reset();
verify_result->verified_cert = cert;
@@ -171,19 +173,19 @@ bool CastSocketImpl::audio_only() const {
return audio_only_;
}
-scoped_ptr<net::TCPClientSocket> CastSocketImpl::CreateTcpSocket() {
+std::unique_ptr<net::TCPClientSocket> CastSocketImpl::CreateTcpSocket() {
net::AddressList addresses(ip_endpoint_);
- return scoped_ptr<net::TCPClientSocket>(
- new net::TCPClientSocket(addresses, net_log_, net_log_source_));
+ return std::unique_ptr<net::TCPClientSocket>(
+ new net::TCPClientSocket(addresses, nullptr, net_log_, net_log_source_));
// Options cannot be set on the TCPClientSocket yet, because the
// underlying platform socket will not be created until Bind()
// or Connect() is called.
}
-scoped_ptr<net::SSLClientSocket> CastSocketImpl::CreateSslSocket(
- scoped_ptr<net::StreamSocket> socket) {
+std::unique_ptr<net::SSLClientSocket> CastSocketImpl::CreateSslSocket(
+ std::unique_ptr<net::StreamSocket> socket) {
net::SSLConfig ssl_config;
- cert_verifier_ = make_scoped_ptr(new FakeCertVerifier);
+ cert_verifier_ = base::WrapUnique(new FakeCertVerifier);
transport_security_state_.reset(new net::TransportSecurityState);
net::SSLClientSocketContext context;
// CertVerifier and TransportSecurityState are owned by us, not the
@@ -191,7 +193,8 @@ scoped_ptr<net::SSLClientSocket> CastSocketImpl::CreateSslSocket(
context.cert_verifier = cert_verifier_.get();
context.transport_security_state = transport_security_state_.get();
- scoped_ptr<net::ClientSocketHandle> connection(new net::ClientSocketHandle);
+ std::unique_ptr<net::ClientSocketHandle> connection(
+ new net::ClientSocketHandle);
connection->SetSocket(std::move(socket));
net::HostPortPair host_and_port = net::HostPortPair::FromIPEndPoint(
ip_endpoint_);
@@ -239,11 +242,11 @@ bool CastSocketImpl::VerifyChallengeReply() {
}
void CastSocketImpl::SetTransportForTesting(
- scoped_ptr<CastTransport> transport) {
+ std::unique_ptr<CastTransport> transport) {
transport_ = std::move(transport);
}
-void CastSocketImpl::Connect(scoped_ptr<CastTransport::Delegate> delegate,
+void CastSocketImpl::Connect(std::unique_ptr<CastTransport::Delegate> delegate,
base::Callback<void(ChannelError)> callback) {
DCHECK(CalledOnValidThread());
VLOG_WITH_CONNECTION(1) << "Connect readyState = " << ready_state_;
@@ -425,7 +428,7 @@ int CastSocketImpl::DoSslConnectComplete(int result) {
logger_));
}
auth_delegate_ = new AuthTransportDelegate(this);
- transport_->SetReadDelegate(make_scoped_ptr(auth_delegate_));
+ transport_->SetReadDelegate(base::WrapUnique(auth_delegate_));
if (channel_auth_ == CHANNEL_AUTH_TYPE_SSL_VERIFIED) {
// Additionally verify the connection with a handshake.
SetConnectState(proto::CONN_STATE_AUTH_CHALLENGE_SEND);
diff --git a/chromium/extensions/browser/api/cast_channel/cast_socket.h b/chromium/extensions/browser/api/cast_channel/cast_socket.h
index 35edd4d84f6..3f04b207ddb 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_socket.h
+++ b/chromium/extensions/browser/api/cast_channel/cast_socket.h
@@ -72,7 +72,7 @@ class CastSocket : public ApiResource {
// CHANNEL_ERROR_NONE if successful.
// |delegate| receives message receipt and error events.
// Ownership of |delegate| is transferred to this CastSocket.
- virtual void Connect(scoped_ptr<CastTransport::Delegate> delegate,
+ virtual void Connect(std::unique_ptr<CastTransport::Delegate> delegate,
base::Callback<void(ChannelError)> callback) = 0;
// Closes the channel if not already closed. On completion, the channel will
@@ -157,7 +157,7 @@ class CastSocketImpl : public CastSocket {
~CastSocketImpl() override;
// CastSocket interface.
- void Connect(scoped_ptr<CastTransport::Delegate> delegate,
+ void Connect(std::unique_ptr<CastTransport::Delegate> delegate,
base::Callback<void(ChannelError)> callback) override;
CastTransport* transport() const override;
void Close(const net::CompletionCallback& callback) override;
@@ -199,7 +199,7 @@ class CastSocketImpl : public CastSocket {
// Replaces the internally-constructed transport object with one provided
// by the caller (e.g. a mock).
- void SetTransportForTesting(scoped_ptr<CastTransport> transport);
+ void SetTransportForTesting(std::unique_ptr<CastTransport> transport);
// Verifies whether the socket complies with cast channel policy.
// Audio only channel policy mandates that a device declaring a video out
@@ -225,10 +225,10 @@ class CastSocketImpl : public CastSocket {
void CloseInternal();
// Creates an instance of TCPClientSocket.
- virtual scoped_ptr<net::TCPClientSocket> CreateTcpSocket();
+ virtual std::unique_ptr<net::TCPClientSocket> CreateTcpSocket();
// Creates an instance of SSLClientSocket with the given underlying |socket|.
- virtual scoped_ptr<net::SSLClientSocket> CreateSslSocket(
- scoped_ptr<net::StreamSocket> socket);
+ virtual std::unique_ptr<net::SSLClientSocket> CreateSslSocket(
+ std::unique_ptr<net::StreamSocket> socket);
// Extracts peer certificate from SSLClientSocket instance when the socket
// is in cert error state.
// Returns null if the certificate could not be extracted.
@@ -304,21 +304,21 @@ class CastSocketImpl : public CastSocket {
// CertVerifier is owned by us but should be deleted AFTER SSLClientSocket
// since in some cases the destructor of SSLClientSocket may call a method
// to cancel a cert verification request.
- scoped_ptr<net::CertVerifier> cert_verifier_;
- scoped_ptr<net::TransportSecurityState> transport_security_state_;
+ std::unique_ptr<net::CertVerifier> cert_verifier_;
+ std::unique_ptr<net::TransportSecurityState> transport_security_state_;
// Owned ptr to the underlying TCP socket.
- scoped_ptr<net::TCPClientSocket> tcp_socket_;
+ std::unique_ptr<net::TCPClientSocket> tcp_socket_;
// Owned ptr to the underlying SSL socket.
- scoped_ptr<net::SSLClientSocket> socket_;
+ std::unique_ptr<net::SSLClientSocket> socket_;
// Certificate of the peer. This field may be empty if the peer
// certificate is not yet fetched.
scoped_refptr<net::X509Certificate> peer_cert_;
// Reply received from the receiver to a challenge request.
- scoped_ptr<CastMessage> challenge_reply_;
+ std::unique_ptr<CastMessage> challenge_reply_;
// Callback invoked when the socket is connected or fails to connect.
base::Callback<void(ChannelError)> connect_callback_;
@@ -330,7 +330,7 @@ class CastSocketImpl : public CastSocket {
base::TimeDelta connect_timeout_;
// Timer invoked when the connection has timed out.
- scoped_ptr<base::Timer> connect_timeout_timer_;
+ std::unique_ptr<base::Timer> connect_timeout_timer_;
// Set when a timeout is triggered and the connection process has
// canceled.
@@ -367,10 +367,10 @@ class CastSocketImpl : public CastSocket {
base::CancelableClosure send_auth_challenge_callback_;
// Cast message formatting and parsing layer.
- scoped_ptr<CastTransport> transport_;
+ std::unique_ptr<CastTransport> transport_;
// Caller's message read and error handling delegate.
- scoped_ptr<CastTransport::Delegate> delegate_;
+ std::unique_ptr<CastTransport::Delegate> delegate_;
// Raw pointer to the auth handshake delegate. Used to get detailed error
// information.
diff --git a/chromium/extensions/browser/api/cast_channel/cast_socket_unittest.cc b/chromium/extensions/browser/api/cast_channel/cast_socket_unittest.cc
index dbc46dcef32..4db753a1775 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_socket_unittest.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_socket_unittest.cc
@@ -10,6 +10,7 @@
#include <vector>
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
@@ -83,12 +84,18 @@ CastMessage CreateTestMessage() {
class MockTCPSocket : public net::TCPClientSocket {
public:
explicit MockTCPSocket(const net::MockConnect& connect_data)
- : TCPClientSocket(net::AddressList(), nullptr, net::NetLog::Source()),
+ : TCPClientSocket(net::AddressList(),
+ nullptr,
+ nullptr,
+ net::NetLog::Source()),
connect_data_(connect_data),
do_nothing_(false) {}
explicit MockTCPSocket(bool do_nothing)
- : TCPClientSocket(net::AddressList(), nullptr, net::NetLog::Source()) {
+ : TCPClientSocket(net::AddressList(),
+ nullptr,
+ nullptr,
+ net::NetLog::Source()) {
CHECK(do_nothing);
do_nothing_ = do_nothing;
}
@@ -162,18 +169,18 @@ class CompleteHandler {
class TestCastSocket : public CastSocketImpl {
public:
- static scoped_ptr<TestCastSocket> Create(
+ static std::unique_ptr<TestCastSocket> Create(
Logger* logger,
uint64_t device_capabilities = cast_channel::CastDeviceCapability::NONE) {
- return scoped_ptr<TestCastSocket>(
+ return std::unique_ptr<TestCastSocket>(
new TestCastSocket(CreateIPEndPointForTest(), CHANNEL_AUTH_TYPE_SSL,
kDistantTimeoutMillis, logger, device_capabilities));
}
- static scoped_ptr<TestCastSocket> CreateSecure(
+ static std::unique_ptr<TestCastSocket> CreateSecure(
Logger* logger,
uint64_t device_capabilities = cast_channel::CastDeviceCapability::NONE) {
- return scoped_ptr<TestCastSocket>(new TestCastSocket(
+ return std::unique_ptr<TestCastSocket>(new TestCastSocket(
CreateIPEndPointForTest(), CHANNEL_AUTH_TYPE_SSL_VERIFIED,
kDistantTimeoutMillis, logger, device_capabilities));
}
@@ -203,7 +210,7 @@ class TestCastSocket : public CastSocketImpl {
void SetupMockTransport() {
mock_transport_ = new MockCastTransport;
- SetTransportForTesting(make_scoped_ptr(mock_transport_));
+ SetTransportForTesting(base::WrapUnique(mock_transport_));
}
// Socket connection helpers.
@@ -268,18 +275,19 @@ class TestCastSocket : public CastSocketImpl {
}
private:
- scoped_ptr<net::TCPClientSocket> CreateTcpSocket() override {
+ std::unique_ptr<net::TCPClientSocket> CreateTcpSocket() override {
if (tcp_unresponsive_) {
- return scoped_ptr<net::TCPClientSocket>(new MockTCPSocket(true));
+ return std::unique_ptr<net::TCPClientSocket>(new MockTCPSocket(true));
} else {
net::MockConnect* connect_data = tcp_connect_data_.get();
connect_data->peer_addr = ip_;
- return scoped_ptr<net::TCPClientSocket>(new MockTCPSocket(*connect_data));
+ return std::unique_ptr<net::TCPClientSocket>(
+ new MockTCPSocket(*connect_data));
}
}
- scoped_ptr<net::SSLClientSocket> CreateSslSocket(
- scoped_ptr<net::StreamSocket> socket) override {
+ std::unique_ptr<net::SSLClientSocket> CreateSslSocket(
+ std::unique_ptr<net::StreamSocket> socket) override {
net::MockConnect* connect_data = ssl_connect_data_.get();
connect_data->peer_addr = ip_;
@@ -287,9 +295,8 @@ class TestCastSocket : public CastSocketImpl {
reads_.data(), reads_.size(), writes_.data(), writes_.size()));
ssl_data_->set_connect_data(*connect_data);
// NOTE: net::MockTCPClientSocket inherits from net::SSLClientSocket !!
- return scoped_ptr<net::SSLClientSocket>(
- new net::MockTCPClientSocket(
- net::AddressList(), &capturing_net_log_, ssl_data_.get()));
+ return std::unique_ptr<net::SSLClientSocket>(new net::MockTCPClientSocket(
+ net::AddressList(), &capturing_net_log_, ssl_data_.get()));
}
scoped_refptr<net::X509Certificate> ExtractPeerCert() override {
@@ -309,12 +316,12 @@ class TestCastSocket : public CastSocketImpl {
net::TestNetLog capturing_net_log_;
net::IPEndPoint ip_;
// Simulated connect data
- scoped_ptr<net::MockConnect> tcp_connect_data_;
- scoped_ptr<net::MockConnect> ssl_connect_data_;
+ std::unique_ptr<net::MockConnect> tcp_connect_data_;
+ std::unique_ptr<net::MockConnect> ssl_connect_data_;
// Simulated read / write data
std::vector<net::MockWrite> writes_;
std::vector<net::MockRead> reads_;
- scoped_ptr<net::SocketDataProvider> ssl_data_;
+ std::unique_ptr<net::SocketDataProvider> ssl_data_;
// Simulated result of peer cert extraction.
bool extract_cert_result_;
// Simulated result of verifying challenge reply.
@@ -322,7 +329,7 @@ class TestCastSocket : public CastSocketImpl {
bool verify_challenge_disallow_;
// If true, makes TCP connection process stall. For timeout testing.
bool tcp_unresponsive_;
- scoped_ptr<base::MockTimer> mock_timer_;
+ std::unique_ptr<base::MockTimer> mock_timer_;
MockCastTransport* mock_transport_;
DISALLOW_COPY_AND_ASSIGN(TestCastSocket);
@@ -332,7 +339,7 @@ class CastSocketTest : public testing::Test {
public:
CastSocketTest()
: logger_(
- new Logger(make_scoped_ptr<base::Clock>(new base::SimpleTestClock),
+ new Logger(base::WrapUnique<base::Clock>(new base::SimpleTestClock),
base::Time())),
delegate_(new MockDelegate) {}
~CastSocketTest() override {}
@@ -379,9 +386,9 @@ class CastSocketTest : public testing::Test {
base::MessageLoop message_loop_;
Logger* logger_;
- scoped_ptr<TestCastSocket> socket_;
+ std::unique_ptr<TestCastSocket> socket_;
CompleteHandler handler_;
- scoped_ptr<MockDelegate> delegate_;
+ std::unique_ptr<MockDelegate> delegate_;
private:
DISALLOW_COPY_AND_ASSIGN(CastSocketTest);
diff --git a/chromium/extensions/browser/api/cast_channel/cast_test_util.cc b/chromium/extensions/browser/api/cast_channel/cast_test_util.cc
index 13a19641f2e..7a115f2bf6d 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_test_util.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_test_util.cc
@@ -25,7 +25,7 @@ CastTransport::Delegate* MockCastTransport::current_delegate() const {
}
void MockCastTransport::SetReadDelegate(
- scoped_ptr<CastTransport::Delegate> delegate) {
+ std::unique_ptr<CastTransport::Delegate> delegate) {
delegate_ = std::move(delegate);
}
diff --git a/chromium/extensions/browser/api/cast_channel/cast_test_util.h b/chromium/extensions/browser/api/cast_channel/cast_test_util.h
index 550a460a66a..0c8d75551e0 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_test_util.h
+++ b/chromium/extensions/browser/api/cast_channel/cast_test_util.h
@@ -27,7 +27,8 @@ class MockCastTransport : public extensions::api::cast_channel::CastTransport {
MockCastTransport();
~MockCastTransport() override;
- void SetReadDelegate(scoped_ptr<CastTransport::Delegate> delegate) override;
+ void SetReadDelegate(
+ std::unique_ptr<CastTransport::Delegate> delegate) override;
MOCK_METHOD2(SendMessage,
void(const extensions::api::cast_channel::CastMessage& message,
@@ -39,7 +40,7 @@ class MockCastTransport : public extensions::api::cast_channel::CastTransport {
CastTransport::Delegate* current_delegate() const;
private:
- scoped_ptr<CastTransport::Delegate> delegate_;
+ std::unique_ptr<CastTransport::Delegate> delegate_;
DISALLOW_COPY_AND_ASSIGN(MockCastTransport);
};
@@ -70,7 +71,7 @@ class MockCastSocket : public CastSocket {
// Proxy for ConnectRawPtr. Unpacks scoped_ptr into a GMock-friendly bare
// ptr.
- void Connect(scoped_ptr<CastTransport::Delegate> delegate,
+ void Connect(std::unique_ptr<CastTransport::Delegate> delegate,
base::Callback<void(ChannelError)> callback) override {
delegate_ = std::move(delegate);
ConnectRawPtr(delegate_.get(), callback);
@@ -92,8 +93,8 @@ class MockCastSocket : public CastSocket {
MockCastTransport* mock_transport() const { return mock_transport_.get(); }
private:
- scoped_ptr<MockCastTransport> mock_transport_;
- scoped_ptr<CastTransport::Delegate> delegate_;
+ std::unique_ptr<MockCastTransport> mock_transport_;
+ std::unique_ptr<CastTransport::Delegate> delegate_;
DISALLOW_COPY_AND_ASSIGN(MockCastSocket);
};
diff --git a/chromium/extensions/browser/api/cast_channel/cast_transport.cc b/chromium/extensions/browser/api/cast_channel/cast_transport.cc
index 8a22af65a2b..a11cc6ffbc4 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_transport.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_transport.cc
@@ -144,7 +144,7 @@ proto::ErrorState CastTransportImpl::ErrorStateToProto(ChannelError state) {
}
}
-void CastTransportImpl::SetReadDelegate(scoped_ptr<Delegate> delegate) {
+void CastTransportImpl::SetReadDelegate(std::unique_ptr<Delegate> delegate) {
DCHECK(CalledOnValidThread());
DCHECK(delegate);
delegate_ = std::move(delegate);
diff --git a/chromium/extensions/browser/api/cast_channel/cast_transport.h b/chromium/extensions/browser/api/cast_channel/cast_transport.h
index 740bd5f1d3b..5d52968f0fe 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_transport.h
+++ b/chromium/extensions/browser/api/cast_channel/cast_transport.h
@@ -71,7 +71,7 @@ class CastTransport {
// in-flight.
// Ownership of the pointee of |delegate| is assumed by the transport.
// Prior delegates are deleted automatically.
- virtual void SetReadDelegate(scoped_ptr<Delegate> delegate) = 0;
+ virtual void SetReadDelegate(std::unique_ptr<Delegate> delegate) = 0;
};
// Manager class for reading and writing messages to/from a socket.
@@ -95,7 +95,7 @@ class CastTransportImpl : public CastTransport, public base::NonThreadSafe {
void SendMessage(const CastMessage& message,
const net::CompletionCallback& callback) override;
void Start() override;
- void SetReadDelegate(scoped_ptr<Delegate> delegate) override;
+ void SetReadDelegate(std::unique_ptr<Delegate> delegate) override;
private:
// Internal write states.
@@ -185,16 +185,16 @@ class CastTransportImpl : public CastTransport, public base::NonThreadSafe {
scoped_refptr<net::GrowableIOBuffer> read_buffer_;
// Constructs and parses the wire representation of message frames.
- scoped_ptr<MessageFramer> framer_;
+ std::unique_ptr<MessageFramer> framer_;
// Last message received on the socket.
- scoped_ptr<CastMessage> current_message_;
+ std::unique_ptr<CastMessage> current_message_;
// Socket used for I/O operations.
net::Socket* const socket_;
// Methods for communicating message receipt and error status to client code.
- scoped_ptr<Delegate> delegate_;
+ std::unique_ptr<Delegate> delegate_;
// Write flow state machine state.
WriteState write_state_;
diff --git a/chromium/extensions/browser/api/cast_channel/cast_transport_unittest.cc b/chromium/extensions/browser/api/cast_channel/cast_transport_unittest.cc
index d8cc6f42ba8..3884d61c62b 100644
--- a/chromium/extensions/browser/api/cast_channel/cast_transport_unittest.cc
+++ b/chromium/extensions/browser/api/cast_channel/cast_transport_unittest.cc
@@ -6,9 +6,11 @@
#include <stddef.h>
#include <stdint.h>
+
#include <queue>
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/simple_test_clock.h"
@@ -147,13 +149,13 @@ class CastTransportTest : public testing::Test {
public:
CastTransportTest()
: logger_(
- new Logger(make_scoped_ptr<base::Clock>(new base::SimpleTestClock),
+ new Logger(base::WrapUnique<base::Clock>(new base::SimpleTestClock),
base::Time())) {
delegate_ = new MockCastTransportDelegate;
transport_.reset(new CastTransportImpl(&mock_socket_, kChannelId,
CreateIPEndPointForTest(),
auth_type_, logger_));
- transport_->SetReadDelegate(make_scoped_ptr(delegate_));
+ transport_->SetReadDelegate(base::WrapUnique(delegate_));
}
~CastTransportTest() override {}
@@ -169,7 +171,7 @@ class CastTransportTest : public testing::Test {
MockSocket mock_socket_;
ChannelAuthType auth_type_;
Logger* logger_;
- scoped_ptr<CastTransport> transport_;
+ std::unique_ptr<CastTransport> transport_;
};
// ----------------------------------------------------------------------------
diff --git a/chromium/extensions/browser/api/cast_channel/keep_alive_delegate.cc b/chromium/extensions/browser/api/cast_channel/keep_alive_delegate.cc
index fe1bd9167fc..f77c9b0beb0 100644
--- a/chromium/extensions/browser/api/cast_channel/keep_alive_delegate.cc
+++ b/chromium/extensions/browser/api/cast_channel/keep_alive_delegate.cc
@@ -36,7 +36,7 @@ bool NestedPayloadTypeEquals(const std::string& chk_type,
if (!message_info.data->GetAsString(&type_json)) {
return false;
}
- scoped_ptr<base::Value> type_value(base::JSONReader::Read(type_json));
+ std::unique_ptr<base::Value> type_value(base::JSONReader::Read(type_json));
if (!type_value.get()) {
return false;
}
@@ -82,7 +82,7 @@ CastMessage KeepAliveDelegate::CreateKeepAliveMessage(
KeepAliveDelegate::KeepAliveDelegate(
CastSocket* socket,
scoped_refptr<Logger> logger,
- scoped_ptr<CastTransport::Delegate> inner_delegate,
+ std::unique_ptr<CastTransport::Delegate> inner_delegate,
base::TimeDelta ping_interval,
base::TimeDelta liveness_timeout)
: started_(false),
@@ -102,8 +102,8 @@ KeepAliveDelegate::~KeepAliveDelegate() {
}
void KeepAliveDelegate::SetTimersForTest(
- scoped_ptr<base::Timer> injected_ping_timer,
- scoped_ptr<base::Timer> injected_liveness_timer) {
+ std::unique_ptr<base::Timer> injected_ping_timer,
+ std::unique_ptr<base::Timer> injected_liveness_timer) {
ping_timer_ = std::move(injected_ping_timer);
liveness_timer_ = std::move(injected_liveness_timer);
}
diff --git a/chromium/extensions/browser/api/cast_channel/keep_alive_delegate.h b/chromium/extensions/browser/api/cast_channel/keep_alive_delegate.h
index 27b3738eab3..0ecdf83edd3 100644
--- a/chromium/extensions/browser/api/cast_channel/keep_alive_delegate.h
+++ b/chromium/extensions/browser/api/cast_channel/keep_alive_delegate.h
@@ -35,7 +35,7 @@ class KeepAliveDelegate : public CastTransport::Delegate {
// connection.
KeepAliveDelegate(CastSocket* socket,
scoped_refptr<Logger> logger,
- scoped_ptr<CastTransport::Delegate> inner_delegate,
+ std::unique_ptr<CastTransport::Delegate> inner_delegate,
base::TimeDelta ping_interval,
base::TimeDelta liveness_timeout);
@@ -44,8 +44,8 @@ class KeepAliveDelegate : public CastTransport::Delegate {
// Creates a keep-alive message (e.g. PING or PONG).
static CastMessage CreateKeepAliveMessage(const char* message_type);
- void SetTimersForTest(scoped_ptr<base::Timer> injected_ping_timer,
- scoped_ptr<base::Timer> injected_liveness_timer);
+ void SetTimersForTest(std::unique_ptr<base::Timer> injected_ping_timer,
+ std::unique_ptr<base::Timer> injected_liveness_timer);
// CastTransport::Delegate implementation.
void Start() override;
@@ -85,7 +85,7 @@ class KeepAliveDelegate : public CastTransport::Delegate {
scoped_refptr<Logger> logger_;
// Delegate object which receives all non-keep alive messages.
- scoped_ptr<CastTransport::Delegate> inner_delegate_;
+ std::unique_ptr<CastTransport::Delegate> inner_delegate_;
// Amount of idle time to wait before disconnecting.
base::TimeDelta liveness_timeout_;
@@ -94,10 +94,10 @@ class KeepAliveDelegate : public CastTransport::Delegate {
base::TimeDelta ping_interval_;
// Fired when |ping_interval_| is exceeded or when triggered by test code.
- scoped_ptr<base::Timer> ping_timer_;
+ std::unique_ptr<base::Timer> ping_timer_;
// Fired when |liveness_timer_| is exceeded.
- scoped_ptr<base::Timer> liveness_timer_;
+ std::unique_ptr<base::Timer> liveness_timer_;
// The PING message to send over the wire.
CastMessage ping_message_;
diff --git a/chromium/extensions/browser/api/cast_channel/keep_alive_delegate_unittest.cc b/chromium/extensions/browser/api/cast_channel/keep_alive_delegate_unittest.cc
index 645d1657f75..f6f0b43da3b 100644
--- a/chromium/extensions/browser/api/cast_channel/keep_alive_delegate_unittest.cc
+++ b/chromium/extensions/browser/api/cast_channel/keep_alive_delegate_unittest.cc
@@ -7,6 +7,7 @@
#include <stdint.h>
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/test/simple_test_clock.h"
@@ -54,18 +55,18 @@ class KeepAliveDelegateTest : public testing::Test {
protected:
void SetUp() override {
inner_delegate_ = new MockCastTransportDelegate;
- logger_ = new Logger(scoped_ptr<base::Clock>(new base::SimpleTestClock),
- base::Time());
+ logger_ = new Logger(
+ std::unique_ptr<base::Clock>(new base::SimpleTestClock), base::Time());
keep_alive_.reset(new KeepAliveDelegate(
- &socket_, logger_, make_scoped_ptr(inner_delegate_),
+ &socket_, logger_, base::WrapUnique(inner_delegate_),
base::TimeDelta::FromMilliseconds(kTestPingTimeoutMillis),
base::TimeDelta::FromMilliseconds(kTestLivenessTimeoutMillis)));
liveness_timer_ = new MockTimerWithMonitoredReset(true, false);
ping_timer_ = new MockTimerWithMonitoredReset(true, false);
EXPECT_CALL(*liveness_timer_, Stop()).Times(0);
EXPECT_CALL(*ping_timer_, Stop()).Times(0);
- keep_alive_->SetTimersForTest(make_scoped_ptr(ping_timer_),
- make_scoped_ptr(liveness_timer_));
+ keep_alive_->SetTimersForTest(base::WrapUnique(ping_timer_),
+ base::WrapUnique(liveness_timer_));
}
// Runs all pending tasks in the message loop.
@@ -76,7 +77,7 @@ class KeepAliveDelegateTest : public testing::Test {
base::MessageLoop message_loop_;
MockCastSocket socket_;
- scoped_ptr<KeepAliveDelegate> keep_alive_;
+ std::unique_ptr<KeepAliveDelegate> keep_alive_;
scoped_refptr<Logger> logger_;
MockCastTransportDelegate* inner_delegate_;
MockTimerWithMonitoredReset* liveness_timer_;
diff --git a/chromium/extensions/browser/api/cast_channel/logger.cc b/chromium/extensions/browser/api/cast_channel/logger.cc
index 1ea0e24f10c..9a420d8f1c5 100644
--- a/chromium/extensions/browser/api/cast_channel/logger.cc
+++ b/chromium/extensions/browser/api/cast_channel/logger.cc
@@ -64,7 +64,7 @@ proto::ChallengeReplyErrorType ChallegeReplyErrorToProto(
}
}
-scoped_ptr<char[]> Compress(const std::string& input, size_t* length) {
+std::unique_ptr<char[]> Compress(const std::string& input, size_t* length) {
*length = 0;
z_stream stream = {0};
int result = deflateInit2(&stream,
@@ -77,7 +77,7 @@ scoped_ptr<char[]> Compress(const std::string& input, size_t* length) {
DCHECK_EQ(Z_OK, result);
size_t out_size = deflateBound(&stream, input.size());
- scoped_ptr<char[]> out(new char[out_size]);
+ std::unique_ptr<char[]> out(new char[out_size]);
stream.next_in = reinterpret_cast<uint8_t*>(const_cast<char*>(input.data()));
stream.avail_in = input.size();
@@ -125,7 +125,7 @@ Logger::AggregatedSocketEventLog::AggregatedSocketEventLog() {
Logger::AggregatedSocketEventLog::~AggregatedSocketEventLog() {
}
-Logger::Logger(scoped_ptr<base::Clock> clock, base::Time unix_epoch_time)
+Logger::Logger(std::unique_ptr<base::Clock> clock, base::Time unix_epoch_time)
: clock_(std::move(clock)), unix_epoch_time_(unix_epoch_time) {
DCHECK(clock_);
@@ -311,7 +311,7 @@ AggregatedSocketEvent& Logger::LogSocketEvent(int channel_id,
return it->second->aggregated_socket_event;
}
-scoped_ptr<char[]> Logger::GetLogs(size_t* length) const {
+std::unique_ptr<char[]> Logger::GetLogs(size_t* length) const {
*length = 0;
Log log;
@@ -341,7 +341,7 @@ scoped_ptr<char[]> Logger::GetLogs(size_t* length) const {
std::string serialized;
if (!log.SerializeToString(&serialized)) {
VLOG(2) << "Failed to serialized proto to string.";
- return scoped_ptr<char[]>();
+ return std::unique_ptr<char[]>();
}
return Compress(serialized, length);
diff --git a/chromium/extensions/browser/api/cast_channel/logger.h b/chromium/extensions/browser/api/cast_channel/logger.h
index 90c32ebf955..c9c696aa3a4 100644
--- a/chromium/extensions/browser/api/cast_channel/logger.h
+++ b/chromium/extensions/browser/api/cast_channel/logger.h
@@ -9,12 +9,12 @@
#include <deque>
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
#include "extensions/browser/api/cast_channel/logger_util.h"
#include "extensions/common/api/cast_channel/logging.pb.h"
@@ -45,7 +45,7 @@ class Logger : public base::RefCounted<Logger> {
//
// See crbug.com/518951 for information on why base::Clock
// is used instead of base::TickClock.
- Logger(scoped_ptr<base::Clock> clock, base::Time unix_epoch_time);
+ Logger(std::unique_ptr<base::Clock> clock, base::Time unix_epoch_time);
// For newly created sockets. Will create an event and log a
// CAST_SOCKET_CREATED event.
@@ -81,7 +81,7 @@ class Logger : public base::RefCounted<Logger> {
// compressed in gzip format.
// If serialization or compression failed, returns nullptr.
// |length|: If successful, assigned with size of compressed content.
- scoped_ptr<char[]> GetLogs(size_t* length) const;
+ std::unique_ptr<char[]> GetLogs(size_t* length) const;
// Clears the internal map.
void Reset();
@@ -129,7 +129,7 @@ class Logger : public base::RefCounted<Logger> {
int channel_id,
const proto::SocketEvent& socket_event);
- scoped_ptr<base::Clock> clock_;
+ std::unique_ptr<base::Clock> clock_;
AggregatedSocketEventLogMap aggregated_socket_events_;
base::Time unix_epoch_time_;
diff --git a/chromium/extensions/browser/api/cast_channel/logger_unittest.cc b/chromium/extensions/browser/api/cast_channel/logger_unittest.cc
index a9daf7bb33e..6909644da12 100644
--- a/chromium/extensions/browser/api/cast_channel/logger_unittest.cc
+++ b/chromium/extensions/browser/api/cast_channel/logger_unittest.cc
@@ -29,7 +29,8 @@ class CastChannelLoggerTest : public testing::Test {
// |logger_| will take ownership of |clock_|.
CastChannelLoggerTest()
: clock_(new base::SimpleTestClock),
- logger_(new Logger(scoped_ptr<base::Clock>(clock_), base::Time())) {}
+ logger_(
+ new Logger(std::unique_ptr<base::Clock>(clock_), base::Time())) {}
~CastChannelLoggerTest() override {}
bool Uncompress(const char* input, int length, std::string* output) {
@@ -64,20 +65,20 @@ class CastChannelLoggerTest : public testing::Test {
return success;
}
- scoped_ptr<Log> GetLog() {
+ std::unique_ptr<Log> GetLog() {
size_t length = 0;
- scoped_ptr<char[]> output = logger_->GetLogs(&length);
+ std::unique_ptr<char[]> output = logger_->GetLogs(&length);
if (!output.get())
- return scoped_ptr<Log>();
+ return std::unique_ptr<Log>();
// 20kb should be enough for test purposes.
std::string uncompressed(20000, 0);
if (!Uncompress(output.get(), length, &uncompressed))
- return scoped_ptr<Log>();
+ return std::unique_ptr<Log>();
- scoped_ptr<Log> log(new Log);
+ std::unique_ptr<Log> log(new Log);
if (!log->ParseFromString(uncompressed))
- return scoped_ptr<Log>();
+ return std::unique_ptr<Log>();
return log;
}
@@ -117,7 +118,7 @@ TEST_F(CastChannelLoggerTest, BasicLogging) {
EXPECT_EQ(last_errors.challenge_reply_error_type,
proto::CHALLENGE_REPLY_ERROR_CERT_PARSING_FAILED);
- scoped_ptr<Log> log = GetLog();
+ std::unique_ptr<Log> log = GetLog();
ASSERT_TRUE(log);
ASSERT_EQ(2, log->aggregated_socket_event_size());
@@ -247,7 +248,7 @@ TEST_F(CastChannelLoggerTest, LogSocketReadWrite) {
logger_->LogSocketEventWithRv(2, EventType::SOCKET_WRITE, -5);
clock_->Advance(base::TimeDelta::FromMicroseconds(1));
- scoped_ptr<Log> log = GetLog();
+ std::unique_ptr<Log> log = GetLog();
ASSERT_TRUE(log);
ASSERT_EQ(2, log->aggregated_socket_event_size());
@@ -274,7 +275,7 @@ TEST_F(CastChannelLoggerTest, TooManySockets) {
logger_->LogSocketEvent(i, EventType::CAST_SOCKET_CREATED);
}
- scoped_ptr<Log> log = GetLog();
+ std::unique_ptr<Log> log = GetLog();
ASSERT_TRUE(log);
ASSERT_EQ(kMaxSocketsToLog, log->aggregated_socket_event_size());
@@ -292,7 +293,7 @@ TEST_F(CastChannelLoggerTest, TooManyEvents) {
clock_->Advance(base::TimeDelta::FromMicroseconds(1));
}
- scoped_ptr<Log> log = GetLog();
+ std::unique_ptr<Log> log = GetLog();
ASSERT_TRUE(log);
ASSERT_EQ(1, log->aggregated_socket_event_size());
@@ -308,7 +309,7 @@ TEST_F(CastChannelLoggerTest, TooManyEvents) {
TEST_F(CastChannelLoggerTest, Reset) {
logger_->LogSocketEvent(1, EventType::CAST_SOCKET_CREATED);
- scoped_ptr<Log> log = GetLog();
+ std::unique_ptr<Log> log = GetLog();
ASSERT_TRUE(log);
EXPECT_EQ(1, log->aggregated_socket_event_size());
diff --git a/chromium/extensions/browser/api/declarative/declarative_api.cc b/chromium/extensions/browser/api/declarative/declarative_api.cc
index 183ca3e9cd8..5ac56a4da0b 100644
--- a/chromium/extensions/browser/api/declarative/declarative_api.cc
+++ b/chromium/extensions/browser/api/declarative/declarative_api.cc
@@ -41,11 +41,12 @@ void ConvertBinaryDictionaryValuesToBase64(base::DictionaryValue* dict);
// Encodes |binary| as base64 and returns a new StringValue populated with the
// encoded string.
-scoped_ptr<base::StringValue> ConvertBinaryToBase64(base::BinaryValue* binary) {
+std::unique_ptr<base::StringValue> ConvertBinaryToBase64(
+ base::BinaryValue* binary) {
std::string binary_data = std::string(binary->GetBuffer(), binary->GetSize());
std::string data64;
base::Base64Encode(binary_data, &data64);
- return scoped_ptr<base::StringValue>(new base::StringValue(data64));
+ return std::unique_ptr<base::StringValue>(new base::StringValue(data64));
}
// Parses through |args| replacing any BinaryValues with base64 encoded
@@ -168,7 +169,7 @@ bool RulesFunction::RunAsync() {
bool EventsEventAddRulesFunction::RunAsyncOnCorrectThread() {
ConvertBinaryListElementsToBase64(args_.get());
- scoped_ptr<AddRules::Params> params(AddRules::Params::Create(*args_));
+ std::unique_ptr<AddRules::Params> params(AddRules::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
// TODO(devlin): Remove the dependency on linked_ptr here.
@@ -180,7 +181,7 @@ bool EventsEventAddRulesFunction::RunAsyncOnCorrectThread() {
error_ = rules_registry_->AddRules(extension_id(), linked_rules);
if (error_.empty()) {
- scoped_ptr<base::ListValue> rules_value(new base::ListValue());
+ std::unique_ptr<base::ListValue> rules_value(new base::ListValue());
for (const auto& rule : linked_rules)
rules_value->Append(rule->ToValue());
SetResult(std::move(rules_value));
@@ -190,7 +191,8 @@ bool EventsEventAddRulesFunction::RunAsyncOnCorrectThread() {
}
bool EventsEventRemoveRulesFunction::RunAsyncOnCorrectThread() {
- scoped_ptr<RemoveRules::Params> params(RemoveRules::Params::Create(*args_));
+ std::unique_ptr<RemoveRules::Params> params(
+ RemoveRules::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->rule_identifiers.get()) {
@@ -204,7 +206,7 @@ bool EventsEventRemoveRulesFunction::RunAsyncOnCorrectThread() {
}
bool EventsEventGetRulesFunction::RunAsyncOnCorrectThread() {
- scoped_ptr<GetRules::Params> params(GetRules::Params::Create(*args_));
+ std::unique_ptr<GetRules::Params> params(GetRules::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
std::vector<linked_ptr<Rule> > rules;
@@ -215,7 +217,7 @@ bool EventsEventGetRulesFunction::RunAsyncOnCorrectThread() {
rules_registry_->GetAllRules(extension_id(), &rules);
}
- scoped_ptr<base::ListValue> rules_value(new base::ListValue());
+ std::unique_ptr<base::ListValue> rules_value(new base::ListValue());
for (const auto& rule : rules)
rules_value->Append(rule->ToValue());
SetResult(std::move(rules_value));
diff --git a/chromium/extensions/browser/api/declarative/declarative_rule.h b/chromium/extensions/browser/api/declarative/declarative_rule.h
index 6e8e9098097..e18f2bbde58 100644
--- a/chromium/extensions/browser/api/declarative/declarative_rule.h
+++ b/chromium/extensions/browser/api/declarative/declarative_rule.h
@@ -19,6 +19,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
#include "base/time/time.h"
#include "components/url_matcher/url_matcher.h"
@@ -44,7 +45,7 @@ namespace extensions {
// members:
//
// // Arguments passed through from DeclarativeConditionSet::Create.
-// static scoped_ptr<ConditionT> Create(
+// static std::unique_ptr<ConditionT> Create(
// const Extension* extension,
// URLMatcherConditionFactory* url_matcher_condition_factory,
// // Except this argument gets elements of the Values array.
@@ -60,14 +61,14 @@ namespace extensions {
template<typename ConditionT>
class DeclarativeConditionSet {
public:
- typedef std::vector<scoped_ptr<base::Value>> Values;
+ typedef std::vector<std::unique_ptr<base::Value>> Values;
typedef std::vector<linked_ptr<const ConditionT> > Conditions;
typedef typename Conditions::const_iterator const_iterator;
// Factory method that creates a DeclarativeConditionSet for |extension|
// according to the JSON array |conditions| passed by the extension API. Sets
// |error| and returns NULL in case of an error.
- static scoped_ptr<DeclarativeConditionSet> Create(
+ static std::unique_ptr<DeclarativeConditionSet> Create(
const Extension* extension,
url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory,
const Values& condition_values,
@@ -119,7 +120,7 @@ class DeclarativeConditionSet {
// members:
//
// // Arguments passed through from ActionSet::Create.
-// static scoped_ptr<ActionT> Create(
+// static std::unique_ptr<ActionT> Create(
// const Extension* extension,
// // Except this argument gets elements of the Values array.
// const base::Value& definition,
@@ -143,7 +144,7 @@ class DeclarativeConditionSet {
template<typename ActionT>
class DeclarativeActionSet {
public:
- typedef std::vector<scoped_ptr<base::Value>> Values;
+ typedef std::vector<std::unique_ptr<base::Value>> Values;
typedef std::vector<scoped_refptr<const ActionT> > Actions;
explicit DeclarativeActionSet(const Actions& actions);
@@ -151,7 +152,7 @@ class DeclarativeActionSet {
// Factory method that instantiates a DeclarativeActionSet for |extension|
// according to |actions| which represents the array of actions received from
// the extension API.
- static scoped_ptr<DeclarativeActionSet> Create(
+ static std::unique_ptr<DeclarativeActionSet> Create(
content::BrowserContext* browser_context,
const Extension* extension,
const Values& action_values,
@@ -216,8 +217,8 @@ class DeclarativeRule {
DeclarativeRule(const GlobalRuleId& id,
const Tags& tags,
base::Time extension_installation_time,
- scoped_ptr<ConditionSet> conditions,
- scoped_ptr<ActionSet> actions,
+ std::unique_ptr<ConditionSet> conditions,
+ std::unique_ptr<ActionSet> actions,
Priority priority);
// Creates a DeclarativeRule for |extension| given a json definition. The
@@ -228,7 +229,7 @@ class DeclarativeRule {
// actions, error) and returns NULL if it fails. Pass NULL if no consistency
// check is needed. If |error| is empty, the translation was successful and
// the returned rule is internally consistent.
- static scoped_ptr<DeclarativeRule> Create(
+ static std::unique_ptr<DeclarativeRule> Create(
url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory,
content::BrowserContext* browser_context,
const Extension* extension,
@@ -259,8 +260,8 @@ class DeclarativeRule {
GlobalRuleId id_;
Tags tags_;
base::Time extension_installation_time_; // For precedences of rules.
- scoped_ptr<ConditionSet> conditions_;
- scoped_ptr<ActionSet> actions_;
+ std::unique_ptr<ConditionSet> conditions_;
+ std::unique_ptr<ActionSet> actions_;
Priority priority_;
DISALLOW_COPY_AND_ASSIGN(DeclarativeRule);
@@ -301,7 +302,7 @@ void DeclarativeConditionSet<ConditionT>::GetURLMatcherConditionSets(
// static
template <typename ConditionT>
-scoped_ptr<DeclarativeConditionSet<ConditionT>>
+std::unique_ptr<DeclarativeConditionSet<ConditionT>>
DeclarativeConditionSet<ConditionT>::Create(
const Extension* extension,
url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory,
@@ -309,12 +310,12 @@ DeclarativeConditionSet<ConditionT>::Create(
std::string* error) {
Conditions result;
- for (const scoped_ptr<base::Value>& value : condition_values) {
+ for (const std::unique_ptr<base::Value>& value : condition_values) {
CHECK(value.get());
- scoped_ptr<ConditionT> condition = ConditionT::Create(
+ std::unique_ptr<ConditionT> condition = ConditionT::Create(
extension, url_matcher_condition_factory, *value, error);
if (!error->empty())
- return scoped_ptr<DeclarativeConditionSet>();
+ return std::unique_ptr<DeclarativeConditionSet>();
result.push_back(make_linked_ptr(condition.release()));
}
@@ -334,7 +335,7 @@ DeclarativeConditionSet<ConditionT>::Create(
}
}
- return make_scoped_ptr(new DeclarativeConditionSet(
+ return base::WrapUnique(new DeclarativeConditionSet(
result, match_id_to_condition, conditions_without_urls));
}
@@ -357,26 +358,27 @@ DeclarativeActionSet<ActionT>::DeclarativeActionSet(const Actions& actions)
// static
template <typename ActionT>
-scoped_ptr<DeclarativeActionSet<ActionT>> DeclarativeActionSet<ActionT>::Create(
- content::BrowserContext* browser_context,
- const Extension* extension,
- const Values& action_values,
- std::string* error,
- bool* bad_message) {
+std::unique_ptr<DeclarativeActionSet<ActionT>>
+DeclarativeActionSet<ActionT>::Create(content::BrowserContext* browser_context,
+ const Extension* extension,
+ const Values& action_values,
+ std::string* error,
+ bool* bad_message) {
*error = "";
*bad_message = false;
Actions result;
- for (const scoped_ptr<base::Value>& value : action_values) {
+ for (const std::unique_ptr<base::Value>& value : action_values) {
CHECK(value.get());
scoped_refptr<const ActionT> action =
ActionT::Create(browser_context, extension, *value, error, bad_message);
if (!error->empty() || *bad_message)
- return scoped_ptr<DeclarativeActionSet>();
+ return std::unique_ptr<DeclarativeActionSet>();
result.push_back(action);
}
- return scoped_ptr<DeclarativeActionSet>(new DeclarativeActionSet(result));
+ return std::unique_ptr<DeclarativeActionSet>(
+ new DeclarativeActionSet(result));
}
template<typename ActionT>
@@ -420,13 +422,13 @@ int DeclarativeActionSet<ActionT>::GetMinimumPriority() const {
// DeclarativeRule
//
-template<typename ConditionT, typename ActionT>
+template <typename ConditionT, typename ActionT>
DeclarativeRule<ConditionT, ActionT>::DeclarativeRule(
const GlobalRuleId& id,
const Tags& tags,
base::Time extension_installation_time,
- scoped_ptr<ConditionSet> conditions,
- scoped_ptr<ActionSet> actions,
+ std::unique_ptr<ConditionSet> conditions,
+ std::unique_ptr<ActionSet> actions,
Priority priority)
: id_(id),
tags_(tags),
@@ -439,8 +441,8 @@ DeclarativeRule<ConditionT, ActionT>::DeclarativeRule(
}
// static
-template<typename ConditionT, typename ActionT>
-scoped_ptr<DeclarativeRule<ConditionT, ActionT> >
+template <typename ConditionT, typename ActionT>
+std::unique_ptr<DeclarativeRule<ConditionT, ActionT>>
DeclarativeRule<ConditionT, ActionT>::Create(
url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory,
content::BrowserContext* browser_context,
@@ -449,18 +451,17 @@ DeclarativeRule<ConditionT, ActionT>::Create(
linked_ptr<JsonRule> rule,
ConsistencyChecker check_consistency,
std::string* error) {
- scoped_ptr<DeclarativeRule> error_result;
+ std::unique_ptr<DeclarativeRule> error_result;
- scoped_ptr<ConditionSet> conditions = ConditionSet::Create(
+ std::unique_ptr<ConditionSet> conditions = ConditionSet::Create(
extension, url_matcher_condition_factory, rule->conditions, error);
if (!error->empty())
return std::move(error_result);
CHECK(conditions.get());
bool bad_message = false;
- scoped_ptr<ActionSet> actions =
- ActionSet::Create(
- browser_context, extension, rule->actions, error, &bad_message);
+ std::unique_ptr<ActionSet> actions = ActionSet::Create(
+ browser_context, extension, rule->actions, error, &bad_message);
if (bad_message) {
// TODO(battre) Export concept of bad_message to caller, the extension
// should be killed in case it is true.
@@ -483,7 +484,7 @@ DeclarativeRule<ConditionT, ActionT>::Create(
GlobalRuleId rule_id(extension->id(), *(rule->id));
Tags tags = rule->tags ? *rule->tags : Tags();
- return scoped_ptr<DeclarativeRule>(
+ return std::unique_ptr<DeclarativeRule>(
new DeclarativeRule(rule_id, tags, extension_installation_time,
std::move(conditions), std::move(actions), priority));
}
diff --git a/chromium/extensions/browser/api/declarative/declarative_rule_unittest.cc b/chromium/extensions/browser/api/declarative/declarative_rule_unittest.cc
index 93ec58b4026..fae5a6ebf5a 100644
--- a/chromium/extensions/browser/api/declarative/declarative_rule_unittest.cc
+++ b/chromium/extensions/browser/api/declarative/declarative_rule_unittest.cc
@@ -22,7 +22,7 @@ namespace extensions {
namespace {
-scoped_ptr<base::DictionaryValue> SimpleManifest() {
+std::unique_ptr<base::DictionaryValue> SimpleManifest() {
return DictionaryBuilder()
.Set("name", "extension")
.Set("manifest_version", 2)
@@ -36,14 +36,14 @@ struct RecordingCondition {
typedef int MatchData;
URLMatcherConditionFactory* factory;
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
void GetURLMatcherConditionSets(
URLMatcherConditionSet::Vector* condition_sets) const {
// No condition sets.
}
- static scoped_ptr<RecordingCondition> Create(
+ static std::unique_ptr<RecordingCondition> Create(
const Extension* extension,
URLMatcherConditionFactory* url_matcher_condition_factory,
const base::Value& condition,
@@ -51,10 +51,10 @@ struct RecordingCondition {
const base::DictionaryValue* dict = NULL;
if (condition.GetAsDictionary(&dict) && dict->HasKey("bad_key")) {
*error = "Found error key";
- return scoped_ptr<RecordingCondition>();
+ return std::unique_ptr<RecordingCondition>();
}
- scoped_ptr<RecordingCondition> result(new RecordingCondition());
+ std::unique_ptr<RecordingCondition> result(new RecordingCondition());
result->factory = url_matcher_condition_factory;
result->value.reset(condition.DeepCopy());
return result;
@@ -69,7 +69,7 @@ TEST(DeclarativeConditionTest, ErrorConditionSet) {
conditions.push_back(ParseJson("{\"bad_key\": 2}"));
std::string error;
- scoped_ptr<RecordingConditionSet> result = RecordingConditionSet::Create(
+ std::unique_ptr<RecordingConditionSet> result = RecordingConditionSet::Create(
NULL, matcher.condition_factory(), conditions, &error);
EXPECT_EQ("Found error key", error);
ASSERT_FALSE(result);
@@ -83,7 +83,7 @@ TEST(DeclarativeConditionTest, CreateConditionSet) {
// Test insertion
std::string error;
- scoped_ptr<RecordingConditionSet> result = RecordingConditionSet::Create(
+ std::unique_ptr<RecordingConditionSet> result = RecordingConditionSet::Create(
NULL, matcher.condition_factory(), conditions, &error);
EXPECT_EQ("", error);
ASSERT_TRUE(result);
@@ -125,12 +125,12 @@ struct FulfillableCondition {
return match_data.value <= max_value;
}
- static scoped_ptr<FulfillableCondition> Create(
+ static std::unique_ptr<FulfillableCondition> Create(
const Extension* extension,
URLMatcherConditionFactory* url_matcher_condition_factory,
const base::Value& condition,
std::string* error) {
- scoped_ptr<FulfillableCondition> result(new FulfillableCondition());
+ std::unique_ptr<FulfillableCondition> result(new FulfillableCondition());
const base::DictionaryValue* dict;
if (!condition.GetAsDictionary(&dict)) {
*error = "Expected dict";
@@ -159,7 +159,7 @@ TEST(DeclarativeConditionTest, FulfillConditionSet) {
// Test insertion
std::string error;
- scoped_ptr<FulfillableConditionSet> result =
+ std::unique_ptr<FulfillableConditionSet> result =
FulfillableConditionSet::Create(NULL, NULL, conditions, &error);
ASSERT_EQ("", error);
ASSERT_TRUE(result);
@@ -260,7 +260,7 @@ TEST(DeclarativeActionTest, ErrorActionSet) {
std::string error;
bool bad = false;
- scoped_ptr<SummingActionSet> result =
+ std::unique_ptr<SummingActionSet> result =
SummingActionSet::Create(NULL, NULL, actions, &error, &bad);
EXPECT_EQ("the error", error);
EXPECT_FALSE(bad);
@@ -285,7 +285,7 @@ TEST(DeclarativeActionTest, ApplyActionSet) {
// Test insertion
std::string error;
bool bad = false;
- scoped_ptr<SummingActionSet> result =
+ std::unique_ptr<SummingActionSet> result =
SummingActionSet::Create(NULL, NULL, actions, &error, &bad);
EXPECT_EQ("", error);
EXPECT_FALSE(bad);
@@ -327,13 +327,9 @@ TEST(DeclarativeRuleTest, Create) {
URLMatcher matcher;
std::string error;
- scoped_ptr<Rule> rule(Rule::Create(matcher.condition_factory(),
- NULL,
- extension.get(),
- install_time,
- json_rule,
- Rule::ConsistencyChecker(),
- &error));
+ std::unique_ptr<Rule> rule(Rule::Create(
+ matcher.condition_factory(), NULL, extension.get(), install_time,
+ json_rule, Rule::ConsistencyChecker(), &error));
EXPECT_EQ("", error);
ASSERT_TRUE(rule.get());
@@ -396,13 +392,9 @@ TEST(DeclarativeRuleTest, CheckConsistency) {
" \"priority\": 200 \n"
"}"),
json_rule.get()));
- scoped_ptr<Rule> rule(Rule::Create(matcher.condition_factory(),
- NULL,
- extension.get(),
- base::Time(),
- json_rule,
- base::Bind(AtLeastOneCondition),
- &error));
+ std::unique_ptr<Rule> rule(Rule::Create(
+ matcher.condition_factory(), NULL, extension.get(), base::Time(),
+ json_rule, base::Bind(AtLeastOneCondition), &error));
EXPECT_TRUE(rule);
EXPECT_EQ("", error);
diff --git a/chromium/extensions/browser/api/declarative/deduping_factory_unittest.cc b/chromium/extensions/browser/api/declarative/deduping_factory_unittest.cc
index f4c335b7040..ea494c6d51a 100644
--- a/chromium/extensions/browser/api/declarative/deduping_factory_unittest.cc
+++ b/chromium/extensions/browser/api/declarative/deduping_factory_unittest.cc
@@ -4,8 +4,9 @@
#include "extensions/browser/api/declarative/deduping_factory.h"
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -72,8 +73,8 @@ scoped_refptr<const BaseClass> CreateFoo(const std::string& /*instance_type*/,
return scoped_refptr<const BaseClass>(new Foo(parameter));
}
-scoped_ptr<base::DictionaryValue> CreateDictWithParameter(int parameter) {
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+std::unique_ptr<base::DictionaryValue> CreateDictWithParameter(int parameter) {
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
dict->SetInteger("parameter", parameter);
return dict;
}
@@ -87,10 +88,10 @@ TEST(DedupingFactoryTest, InstantiationParameterized) {
factory.RegisterFactoryMethod(
kTypeName, DedupingFactory<BaseClass>::IS_PARAMETERIZED, &CreateFoo);
- scoped_ptr<base::DictionaryValue> d1(CreateDictWithParameter(1));
- scoped_ptr<base::DictionaryValue> d2(CreateDictWithParameter(2));
- scoped_ptr<base::DictionaryValue> d3(CreateDictWithParameter(3));
- scoped_ptr<base::DictionaryValue> d4(CreateDictWithParameter(4));
+ std::unique_ptr<base::DictionaryValue> d1(CreateDictWithParameter(1));
+ std::unique_ptr<base::DictionaryValue> d2(CreateDictWithParameter(2));
+ std::unique_ptr<base::DictionaryValue> d3(CreateDictWithParameter(3));
+ std::unique_ptr<base::DictionaryValue> d4(CreateDictWithParameter(4));
std::string error;
bool bad_message = false;
@@ -134,8 +135,8 @@ TEST(DedupingFactoryTest, InstantiationNonParameterized) {
factory.RegisterFactoryMethod(
kTypeName, DedupingFactory<BaseClass>::IS_NOT_PARAMETERIZED, &CreateFoo);
- scoped_ptr<base::DictionaryValue> d1(CreateDictWithParameter(1));
- scoped_ptr<base::DictionaryValue> d2(CreateDictWithParameter(2));
+ std::unique_ptr<base::DictionaryValue> d1(CreateDictWithParameter(1));
+ std::unique_ptr<base::DictionaryValue> d2(CreateDictWithParameter(2));
std::string error;
bool bad_message = false;
@@ -160,7 +161,7 @@ TEST(DedupingFactoryTest, TypeNames) {
factory.RegisterFactoryMethod(
kTypeName2, DedupingFactory<BaseClass>::IS_PARAMETERIZED, &CreateFoo);
- scoped_ptr<base::DictionaryValue> d1(CreateDictWithParameter(1));
+ std::unique_ptr<base::DictionaryValue> d1(CreateDictWithParameter(1));
std::string error;
bool bad_message = false;
@@ -180,7 +181,7 @@ TEST(DedupingFactoryTest, Clear) {
factory.RegisterFactoryMethod(
kTypeName, DedupingFactory<BaseClass>::IS_PARAMETERIZED, &CreateFoo);
- scoped_ptr<base::DictionaryValue> d1(CreateDictWithParameter(1));
+ std::unique_ptr<base::DictionaryValue> d1(CreateDictWithParameter(1));
std::string error;
bool bad_message = false;
diff --git a/chromium/extensions/browser/api/declarative/rules_cache_delegate.cc b/chromium/extensions/browser/api/declarative/rules_cache_delegate.cc
index 0603d6c4db7..8da41b56ba5 100644
--- a/chromium/extensions/browser/api/declarative/rules_cache_delegate.cc
+++ b/chromium/extensions/browser/api/declarative/rules_cache_delegate.cc
@@ -94,7 +94,7 @@ void RulesCacheDelegate::Init(RulesRegistry* registry) {
}
void RulesCacheDelegate::WriteToStorage(const std::string& extension_id,
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!browser_context_)
return;
@@ -181,7 +181,7 @@ void RulesCacheDelegate::ReadFromStorage(const std::string& extension_id) {
void RulesCacheDelegate::ReadFromStorageCallback(
const std::string& extension_id,
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
content::BrowserThread::PostTask(
rules_registry_thread_,
diff --git a/chromium/extensions/browser/api/declarative/rules_cache_delegate.h b/chromium/extensions/browser/api/declarative/rules_cache_delegate.h
index 15553dab75c..f9cca0b8af4 100644
--- a/chromium/extensions/browser/api/declarative/rules_cache_delegate.h
+++ b/chromium/extensions/browser/api/declarative/rules_cache_delegate.h
@@ -5,11 +5,11 @@
#ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_CACHE_DELEGATE_H__
#define EXTENSIONS_BROWSER_API_DECLARATIVE_RULES_CACHE_DELEGATE_H__
+#include <memory>
#include <set>
#include <string>
#include "base/gtest_prod_util.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "content/public/browser/browser_thread.h"
@@ -42,7 +42,7 @@ class RulesCacheDelegate {
void Init(RulesRegistry* registry);
void WriteToStorage(const std::string& extension_id,
- scoped_ptr<base::Value> value);
+ std::unique_ptr<base::Value> value);
base::WeakPtr<RulesCacheDelegate> GetWeakPtr() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -69,7 +69,7 @@ class RulesCacheDelegate {
// Read/write a list of rules serialized to Values.
void ReadFromStorage(const std::string& extension_id);
void ReadFromStorageCallback(const std::string& extension_id,
- scoped_ptr<base::Value> value);
+ std::unique_ptr<base::Value> value);
// Check the preferences whether the extension with |extension_id| has some
// rules stored on disk. If this information is not in the preferences, true
diff --git a/chromium/extensions/browser/api/declarative/rules_registry.cc b/chromium/extensions/browser/api/declarative/rules_registry.cc
index ffbcb7f896b..fd77d4646ff 100644
--- a/chromium/extensions/browser/api/declarative/rules_registry.cc
+++ b/chromium/extensions/browser/api/declarative/rules_registry.cc
@@ -38,9 +38,9 @@ const char kDuplicateRuleId[] = "Duplicate rule ID: %s";
const char kErrorCannotRemoveManifestRules[] =
"Rules declared in the 'event_rules' manifest field cannot be removed";
-scoped_ptr<base::Value> RulesToValue(
+std::unique_ptr<base::Value> RulesToValue(
const std::vector<linked_ptr<api::events::Rule>>& rules) {
- scoped_ptr<base::ListValue> list(new base::ListValue());
+ std::unique_ptr<base::ListValue> list(new base::ListValue());
for (size_t i = 0; i < rules.size(); ++i)
list->Append(rules[i]->ToValue().release());
return std::move(list);
@@ -297,9 +297,8 @@ size_t RulesRegistry::GetNumberOfUsedRuleIdentifiersForTesting() const {
return entry_count;
}
-void RulesRegistry::DeserializeAndAddRules(
- const std::string& extension_id,
- scoped_ptr<base::Value> rules) {
+void RulesRegistry::DeserializeAndAddRules(const std::string& extension_id,
+ std::unique_ptr<base::Value> rules) {
DCHECK_CURRENTLY_ON(owner_thread());
std::string error =
@@ -310,7 +309,7 @@ void RulesRegistry::DeserializeAndAddRules(
void RulesRegistry::ReportInternalError(const std::string& extension_id,
const std::string& error) {
- scoped_ptr<ExtensionError> error_instance(new InternalError(
+ std::unique_ptr<ExtensionError> error_instance(new InternalError(
extension_id, base::ASCIIToUTF16(error), logging::LOG_ERROR));
ExtensionsBrowserClient::Get()->ReportError(browser_context_,
std::move(error_instance));
diff --git a/chromium/extensions/browser/api/declarative/rules_registry.h b/chromium/extensions/browser/api/declarative/rules_registry.h
index 91f34f1cfd9..a1d4a982891 100644
--- a/chromium/extensions/browser/api/declarative/rules_registry.h
+++ b/chromium/extensions/browser/api/declarative/rules_registry.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -16,7 +17,6 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_observer.h"
@@ -224,7 +224,7 @@ class RulesRegistry : public base::RefCountedThreadSafe<RulesRegistry> {
// Deserialize the rules from the given Value object and add them to the
// RulesRegistry.
void DeserializeAndAddRules(const std::string& extension_id,
- scoped_ptr<base::Value> rules);
+ std::unique_ptr<base::Value> rules);
// Reports an internal error with the specified params to the extensions
// client.
diff --git a/chromium/extensions/browser/api/declarative/rules_registry_service.cc b/chromium/extensions/browser/api/declarative/rules_registry_service.cc
index d5c3b2f276b..8fac46194b6 100644
--- a/chromium/extensions/browser/api/declarative/rules_registry_service.cc
+++ b/chromium/extensions/browser/api/declarative/rules_registry_service.cc
@@ -4,10 +4,12 @@
#include "extensions/browser/api/declarative/rules_registry_service.h"
+#include <memory>
+
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/api/declarative/rules_cache_delegate.h"
@@ -78,7 +80,7 @@ void RulesRegistryService::EnsureDefaultRulesRegistriesRegistered(
// Create a RulesCacheDelegate.
web_request_cache_delegate =
new RulesCacheDelegate(true /*log_storage_init_delay*/);
- cache_delegates_.push_back(make_scoped_ptr(web_request_cache_delegate));
+ cache_delegates_.push_back(base::WrapUnique(web_request_cache_delegate));
}
scoped_refptr<WebRequestRulesRegistry> web_request_rules_registry(
new WebRequestRulesRegistry(browser_context_, web_request_cache_delegate,
@@ -95,7 +97,7 @@ void RulesRegistryService::EnsureDefaultRulesRegistriesRegistered(
if (rules_registry_id == kDefaultRulesRegistryID) {
RulesCacheDelegate* content_rules_cache_delegate =
new RulesCacheDelegate(false /*log_storage_init_delay*/);
- cache_delegates_.push_back(make_scoped_ptr(content_rules_cache_delegate));
+ cache_delegates_.push_back(base::WrapUnique(content_rules_cache_delegate));
scoped_refptr<ContentRulesRegistry> content_rules_registry =
ExtensionsAPIClient::Get()->CreateContentRulesRegistry(
browser_context_, content_rules_cache_delegate);
diff --git a/chromium/extensions/browser/api/declarative/rules_registry_service.h b/chromium/extensions/browser/api/declarative/rules_registry_service.h
index c79f1dfd31b..b36d2ad7368 100644
--- a/chromium/extensions/browser/api/declarative/rules_registry_service.h
+++ b/chromium/extensions/browser/api/declarative/rules_registry_service.h
@@ -133,7 +133,7 @@ class RulesRegistryService : public BrowserContextKeyedAPI,
RulesRegistryMap rule_registries_;
// We own the parts of the registries which need to run on the UI thread.
- std::vector<scoped_ptr<RulesCacheDelegate>> cache_delegates_;
+ std::vector<std::unique_ptr<RulesCacheDelegate>> cache_delegates_;
// Weak pointer into rule_registries_ to make it easier to handle content rule
// conditions.
diff --git a/chromium/extensions/browser/api/declarative/rules_registry_unittest.cc b/chromium/extensions/browser/api/declarative/rules_registry_unittest.cc
index 4e76b2b8559..edf91514f5d 100644
--- a/chromium/extensions/browser/api/declarative/rules_registry_unittest.cc
+++ b/chromium/extensions/browser/api/declarative/rules_registry_unittest.cc
@@ -128,7 +128,7 @@ TEST(RulesRegistryTest, FillOptionalIdentifiers) {
EXPECT_EQ(kRuleId, *get_rules_4b[0]->id);
// Create extension
- scoped_ptr<base::DictionaryValue> manifest = ParseDictionary(
+ std::unique_ptr<base::DictionaryValue> manifest = ParseDictionary(
"{"
" \"name\": \"Test\","
" \"version\": \"1\""
@@ -188,7 +188,7 @@ TEST(RulesRegistryTest, TwoRulesInManifest) {
content::TestBrowserThread thread(content::BrowserThread::UI, &message_loop);
// Create extension
- scoped_ptr<base::DictionaryValue> manifest = ParseDictionary(
+ std::unique_ptr<base::DictionaryValue> manifest = ParseDictionary(
"{"
" \"name\": \"Test\","
" \"version\": \"1\","
@@ -232,7 +232,7 @@ TEST(RulesRegistryTest, TwoRulesInManifest) {
registry->GetAllRules(kExtensionId, &get_rules);
ASSERT_EQ(2u, get_rules.size());
- scoped_ptr<base::DictionaryValue> expected_rule_0 = ParseDictionary(
+ std::unique_ptr<base::DictionaryValue> expected_rule_0 = ParseDictionary(
"{"
" \"id\": \"000\","
" \"priority\": 200,"
@@ -247,7 +247,7 @@ TEST(RulesRegistryTest, TwoRulesInManifest) {
"}");
EXPECT_TRUE(expected_rule_0->Equals(get_rules[0]->ToValue().get()));
- scoped_ptr<base::DictionaryValue> expected_rule_1 = ParseDictionary(
+ std::unique_ptr<base::DictionaryValue> expected_rule_1 = ParseDictionary(
"{"
" \"id\": \"_0_\","
" \"priority\": 100,"
@@ -269,7 +269,7 @@ TEST(RulesRegistryTest, DeleteRuleInManifest) {
content::TestBrowserThread thread(content::BrowserThread::UI, &message_loop);
// Create extension
- scoped_ptr<base::DictionaryValue> manifest = ParseDictionary(
+ std::unique_ptr<base::DictionaryValue> manifest = ParseDictionary(
"{"
" \"name\": \"Test\","
" \"version\": \"1\","
diff --git a/chromium/extensions/browser/api/declarative_webrequest/webrequest_action.cc b/chromium/extensions/browser/api/declarative_webrequest/webrequest_action.cc
index 6cf0dbb7410..3092113cf52 100644
--- a/chromium/extensions/browser/api/declarative_webrequest/webrequest_action.cc
+++ b/chromium/extensions/browser/api/declarative_webrequest/webrequest_action.cc
@@ -53,9 +53,9 @@ const char kEmptyDocumentUrl[] = "data:text/html,";
} \
} while (0)
-scoped_ptr<helpers::RequestCookie> ParseRequestCookie(
+std::unique_ptr<helpers::RequestCookie> ParseRequestCookie(
const base::DictionaryValue* dict) {
- scoped_ptr<helpers::RequestCookie> result(new helpers::RequestCookie);
+ std::unique_ptr<helpers::RequestCookie> result(new helpers::RequestCookie);
std::string tmp;
if (dict->GetString(keys::kNameKey, &tmp))
result->name.reset(new std::string(tmp));
@@ -87,16 +87,16 @@ void ParseResponseCookieImpl(const base::DictionaryValue* dict,
cookie->http_only.reset(new bool(bool_tmp));
}
-scoped_ptr<helpers::ResponseCookie> ParseResponseCookie(
+std::unique_ptr<helpers::ResponseCookie> ParseResponseCookie(
const base::DictionaryValue* dict) {
- scoped_ptr<helpers::ResponseCookie> result(new helpers::ResponseCookie);
+ std::unique_ptr<helpers::ResponseCookie> result(new helpers::ResponseCookie);
ParseResponseCookieImpl(dict, result.get());
return result;
}
-scoped_ptr<helpers::FilterResponseCookie> ParseFilterResponseCookie(
+std::unique_ptr<helpers::FilterResponseCookie> ParseFilterResponseCookie(
const base::DictionaryValue* dict) {
- scoped_ptr<helpers::FilterResponseCookie> result(
+ std::unique_ptr<helpers::FilterResponseCookie> result(
new helpers::FilterResponseCookie);
ParseResponseCookieImpl(dict, result.get());
@@ -153,7 +153,7 @@ scoped_refptr<const WebRequestAction> CreateRedirectRequestByRegExAction(
RE2::Options options;
options.set_case_sensitive(false);
- scoped_ptr<RE2> from_pattern(new RE2(from, options));
+ std::unique_ptr<RE2> from_pattern(new RE2(from, options));
if (!from_pattern->ok()) {
*error = "Invalid pattern '" + from + "' -> '" + to + "'";
@@ -695,7 +695,7 @@ WebRequestRedirectToEmptyDocumentAction::CreateDelta(
//
WebRequestRedirectByRegExAction::WebRequestRedirectByRegExAction(
- scoped_ptr<RE2> from_pattern,
+ std::unique_ptr<RE2> from_pattern,
const std::string& to_pattern)
: WebRequestAction(ON_BEFORE_REQUEST | ON_HEADERS_RECEIVED,
ACTION_REDIRECT_BY_REGEX_DOCUMENT,
diff --git a/chromium/extensions/browser/api/declarative_webrequest/webrequest_action.h b/chromium/extensions/browser/api/declarative_webrequest/webrequest_action.h
index be7ae9d7944..2644af05f4d 100644
--- a/chromium/extensions/browser/api/declarative_webrequest/webrequest_action.h
+++ b/chromium/extensions/browser/api/declarative_webrequest/webrequest_action.h
@@ -261,8 +261,9 @@ class WebRequestRedirectByRegExAction : public WebRequestAction {
public:
// The |to_pattern| has to be passed in RE2 syntax with the exception that
// capture groups are referenced in Perl style ($1, $2, ...).
- explicit WebRequestRedirectByRegExAction(scoped_ptr<re2::RE2> from_pattern,
- const std::string& to_pattern);
+ explicit WebRequestRedirectByRegExAction(
+ std::unique_ptr<re2::RE2> from_pattern,
+ const std::string& to_pattern);
// Conversion of capture group styles between Perl style ($1, $2, ...) and
// RE2 (\1, \2, ...).
@@ -279,7 +280,7 @@ class WebRequestRedirectByRegExAction : public WebRequestAction {
private:
~WebRequestRedirectByRegExAction() override;
- scoped_ptr<re2::RE2> from_pattern_;
+ std::unique_ptr<re2::RE2> from_pattern_;
std::string to_pattern_;
DISALLOW_COPY_AND_ASSIGN(WebRequestRedirectByRegExAction);
diff --git a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition.cc b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition.cc
index ef72ea4496c..7e41f1228ec 100644
--- a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition.cc
+++ b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition.cc
@@ -125,7 +125,7 @@ void WebRequestCondition::GetURLMatcherConditionSets(
}
// static
-scoped_ptr<WebRequestCondition> WebRequestCondition::Create(
+std::unique_ptr<WebRequestCondition> WebRequestCondition::Create(
const Extension* extension,
URLMatcherConditionFactory* url_matcher_condition_factory,
const base::Value& condition,
@@ -133,18 +133,18 @@ scoped_ptr<WebRequestCondition> WebRequestCondition::Create(
const base::DictionaryValue* condition_dict = NULL;
if (!condition.GetAsDictionary(&condition_dict)) {
*error = kExpectedDictionary;
- return scoped_ptr<WebRequestCondition>();
+ return std::unique_ptr<WebRequestCondition>();
}
// Verify that we are dealing with a Condition whose type we understand.
std::string instance_type;
if (!condition_dict->GetString(keys::kInstanceTypeKey, &instance_type)) {
*error = kConditionWithoutInstanceType;
- return scoped_ptr<WebRequestCondition>();
+ return std::unique_ptr<WebRequestCondition>();
}
if (instance_type != keys::kRequestMatcherType) {
*error = kExpectedOtherConditionType;
- return scoped_ptr<WebRequestCondition>();
+ return std::unique_ptr<WebRequestCondition>();
}
WebRequestConditionAttributes attributes;
@@ -185,17 +185,16 @@ scoped_ptr<WebRequestCondition> WebRequestCondition::Create(
attributes.push_back(attribute);
}
if (!error->empty())
- return scoped_ptr<WebRequestCondition>();
+ return std::unique_ptr<WebRequestCondition>();
}
- scoped_ptr<WebRequestCondition> result(
- new WebRequestCondition(url_matcher_condition_set,
- first_party_url_matcher_condition_set,
- attributes));
+ std::unique_ptr<WebRequestCondition> result(new WebRequestCondition(
+ url_matcher_condition_set, first_party_url_matcher_condition_set,
+ attributes));
if (!result->stages()) {
*error = kConditionCannotBeFulfilled;
- return scoped_ptr<WebRequestCondition>();
+ return std::unique_ptr<WebRequestCondition>();
}
return result;
diff --git a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition.h b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition.h
index 0d43f46be78..2380dfe6fb8 100644
--- a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition.h
+++ b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition.h
@@ -78,7 +78,7 @@ class WebRequestCondition {
// Factory method that instantiates a WebRequestCondition according to
// the description |condition| passed by the extension API.
- static scoped_ptr<WebRequestCondition> Create(
+ static std::unique_ptr<WebRequestCondition> Create(
const Extension* extension,
url_matcher::URLMatcherConditionFactory* url_matcher_condition_factory,
const base::Value& condition,
diff --git a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
index c9c51f17acd..4b1ee0e5d63 100644
--- a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
+++ b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc
@@ -13,6 +13,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
@@ -305,7 +306,8 @@ class HeaderMatcher {
// Creates an instance based on a list |tests| of test groups, encoded as
// dictionaries of the type declarativeWebRequest.HeaderFilter (see
// declarative_web_request.json).
- static scoped_ptr<const HeaderMatcher> Create(const base::ListValue* tests);
+ static std::unique_ptr<const HeaderMatcher> Create(
+ const base::ListValue* tests);
// Does |this| match the header "|name|: |value|"?
bool TestNameValue(const std::string& name, const std::string& value) const;
@@ -318,9 +320,9 @@ class HeaderMatcher {
// |data| is the pattern to be matched in the position given by |type|.
// Note that |data| must point to a StringValue object.
- static scoped_ptr<StringMatchTest> Create(const base::Value* data,
- MatchType type,
- bool case_sensitive);
+ static std::unique_ptr<StringMatchTest> Create(const base::Value* data,
+ MatchType type,
+ bool case_sensitive);
~StringMatchTest();
// Does |str| pass |this| StringMatchTest?
@@ -345,7 +347,7 @@ class HeaderMatcher {
// Gets the test group description in |tests| and creates the corresponding
// HeaderMatchTest. On failure returns NULL.
- static scoped_ptr<const HeaderMatchTest> Create(
+ static std::unique_ptr<const HeaderMatchTest> Create(
const base::DictionaryValue* tests);
// Does the header "|name|: |value|" match all tests in |this|?
@@ -353,20 +355,22 @@ class HeaderMatcher {
private:
// Takes ownership of the content of both |name_match| and |value_match|.
- HeaderMatchTest(std::vector<scoped_ptr<const StringMatchTest>> name_match,
- std::vector<scoped_ptr<const StringMatchTest>> value_match);
+ HeaderMatchTest(
+ std::vector<std::unique_ptr<const StringMatchTest>> name_match,
+ std::vector<std::unique_ptr<const StringMatchTest>> value_match);
// Tests to be passed by a header's name.
- const std::vector<scoped_ptr<const StringMatchTest>> name_match_;
+ const std::vector<std::unique_ptr<const StringMatchTest>> name_match_;
// Tests to be passed by a header's value.
- const std::vector<scoped_ptr<const StringMatchTest>> value_match_;
+ const std::vector<std::unique_ptr<const StringMatchTest>> value_match_;
DISALLOW_COPY_AND_ASSIGN(HeaderMatchTest);
};
- explicit HeaderMatcher(std::vector<scoped_ptr<const HeaderMatchTest>> tests);
+ explicit HeaderMatcher(
+ std::vector<std::unique_ptr<const HeaderMatchTest>> tests);
- const std::vector<scoped_ptr<const HeaderMatchTest>> tests_;
+ const std::vector<std::unique_ptr<const HeaderMatchTest>> tests_;
DISALLOW_COPY_AND_ASSIGN(HeaderMatcher);
};
@@ -376,23 +380,23 @@ class HeaderMatcher {
HeaderMatcher::~HeaderMatcher() {}
// static
-scoped_ptr<const HeaderMatcher> HeaderMatcher::Create(
+std::unique_ptr<const HeaderMatcher> HeaderMatcher::Create(
const base::ListValue* tests) {
- std::vector<scoped_ptr<const HeaderMatchTest>> header_tests;
+ std::vector<std::unique_ptr<const HeaderMatchTest>> header_tests;
for (base::ListValue::const_iterator it = tests->begin();
it != tests->end(); ++it) {
const base::DictionaryValue* tests = NULL;
if (!(*it)->GetAsDictionary(&tests))
- return scoped_ptr<const HeaderMatcher>();
+ return std::unique_ptr<const HeaderMatcher>();
- scoped_ptr<const HeaderMatchTest> header_test(
+ std::unique_ptr<const HeaderMatchTest> header_test(
HeaderMatchTest::Create(tests));
if (header_test.get() == NULL)
- return scoped_ptr<const HeaderMatcher>();
+ return std::unique_ptr<const HeaderMatcher>();
header_tests.push_back(std::move(header_test));
}
- return scoped_ptr<const HeaderMatcher>(
+ return std::unique_ptr<const HeaderMatcher>(
new HeaderMatcher(std::move(header_tests)));
}
@@ -406,19 +410,19 @@ bool HeaderMatcher::TestNameValue(const std::string& name,
}
HeaderMatcher::HeaderMatcher(
- std::vector<scoped_ptr<const HeaderMatchTest>> tests)
+ std::vector<std::unique_ptr<const HeaderMatchTest>> tests)
: tests_(std::move(tests)) {}
// HeaderMatcher::StringMatchTest implementation.
// static
-scoped_ptr<HeaderMatcher::StringMatchTest>
+std::unique_ptr<HeaderMatcher::StringMatchTest>
HeaderMatcher::StringMatchTest::Create(const base::Value* data,
MatchType type,
bool case_sensitive) {
std::string str;
CHECK(data->GetAsString(&str));
- return scoped_ptr<StringMatchTest>(
+ return std::unique_ptr<StringMatchTest>(
new StringMatchTest(str, type, case_sensitive));
}
@@ -458,18 +462,18 @@ HeaderMatcher::StringMatchTest::StringMatchTest(const std::string& data,
// HeaderMatcher::HeaderMatchTest implementation.
HeaderMatcher::HeaderMatchTest::HeaderMatchTest(
- std::vector<scoped_ptr<const StringMatchTest>> name_match,
- std::vector<scoped_ptr<const StringMatchTest>> value_match)
+ std::vector<std::unique_ptr<const StringMatchTest>> name_match,
+ std::vector<std::unique_ptr<const StringMatchTest>> value_match)
: name_match_(std::move(name_match)),
value_match_(std::move(value_match)) {}
HeaderMatcher::HeaderMatchTest::~HeaderMatchTest() {}
// static
-scoped_ptr<const HeaderMatcher::HeaderMatchTest>
+std::unique_ptr<const HeaderMatcher::HeaderMatchTest>
HeaderMatcher::HeaderMatchTest::Create(const base::DictionaryValue* tests) {
- std::vector<scoped_ptr<const StringMatchTest>> name_match;
- std::vector<scoped_ptr<const StringMatchTest>> value_match;
+ std::vector<std::unique_ptr<const StringMatchTest>> name_match;
+ std::vector<std::unique_ptr<const StringMatchTest>> value_match;
for (base::DictionaryValue::Iterator it(*tests);
!it.IsAtEnd(); it.Advance()) {
@@ -497,11 +501,11 @@ HeaderMatcher::HeaderMatchTest::Create(const base::DictionaryValue* tests) {
match_type = StringMatchTest::kEquals;
} else {
NOTREACHED(); // JSON schema type checking should prevent this.
- return scoped_ptr<const HeaderMatchTest>();
+ return std::unique_ptr<const HeaderMatchTest>();
}
const base::Value* content = &it.value();
- std::vector<scoped_ptr<const StringMatchTest>>* tests =
+ std::vector<std::unique_ptr<const StringMatchTest>>* tests =
is_name ? &name_match : &value_match;
switch (content->GetType()) {
case base::Value::TYPE_LIST: {
@@ -509,24 +513,24 @@ HeaderMatcher::HeaderMatchTest::Create(const base::DictionaryValue* tests) {
CHECK(content->GetAsList(&list));
for (base::ListValue::const_iterator it = list->begin();
it != list->end(); ++it) {
- tests->push_back(make_scoped_ptr(
+ tests->push_back(base::WrapUnique(
StringMatchTest::Create(*it, match_type, !is_name).release()));
}
break;
}
case base::Value::TYPE_STRING: {
- tests->push_back(make_scoped_ptr(
+ tests->push_back(base::WrapUnique(
StringMatchTest::Create(content, match_type, !is_name).release()));
break;
}
default: {
NOTREACHED(); // JSON schema type checking should prevent this.
- return scoped_ptr<const HeaderMatchTest>();
+ return std::unique_ptr<const HeaderMatchTest>();
}
}
}
- return scoped_ptr<const HeaderMatchTest>(
+ return std::unique_ptr<const HeaderMatchTest>(
new HeaderMatchTest(std::move(name_match), std::move(value_match)));
}
@@ -551,7 +555,7 @@ bool HeaderMatcher::HeaderMatchTest::Matches(const std::string& name,
WebRequestConditionAttributeRequestHeaders::
WebRequestConditionAttributeRequestHeaders(
- scoped_ptr<const HeaderMatcher> header_matcher,
+ std::unique_ptr<const HeaderMatcher> header_matcher,
bool positive)
: header_matcher_(std::move(header_matcher)), positive_(positive) {}
@@ -560,17 +564,17 @@ WebRequestConditionAttributeRequestHeaders::
namespace {
-scoped_ptr<const HeaderMatcher> PrepareHeaderMatcher(
+std::unique_ptr<const HeaderMatcher> PrepareHeaderMatcher(
const std::string& name,
const base::Value* value,
std::string* error) {
const base::ListValue* value_as_list = NULL;
if (!value->GetAsList(&value_as_list)) {
*error = ErrorUtils::FormatErrorMessage(kInvalidValue, name);
- return scoped_ptr<const HeaderMatcher>();
+ return std::unique_ptr<const HeaderMatcher>();
}
- scoped_ptr<const HeaderMatcher> header_matcher(
+ std::unique_ptr<const HeaderMatcher> header_matcher(
HeaderMatcher::Create(value_as_list));
if (header_matcher.get() == NULL)
*error = ErrorUtils::FormatErrorMessage(kInvalidValue, name);
@@ -589,7 +593,7 @@ WebRequestConditionAttributeRequestHeaders::Create(
DCHECK(name == keys::kRequestHeadersKey ||
name == keys::kExcludeRequestHeadersKey);
- scoped_ptr<const HeaderMatcher> header_matcher(
+ std::unique_ptr<const HeaderMatcher> header_matcher(
PrepareHeaderMatcher(name, value, error));
if (header_matcher.get() == NULL)
return scoped_refptr<const WebRequestConditionAttribute>(NULL);
@@ -645,7 +649,7 @@ bool WebRequestConditionAttributeRequestHeaders::Equals(
WebRequestConditionAttributeResponseHeaders::
WebRequestConditionAttributeResponseHeaders(
- scoped_ptr<const HeaderMatcher> header_matcher,
+ std::unique_ptr<const HeaderMatcher> header_matcher,
bool positive)
: header_matcher_(std::move(header_matcher)), positive_(positive) {}
@@ -662,7 +666,7 @@ WebRequestConditionAttributeResponseHeaders::Create(
DCHECK(name == keys::kResponseHeadersKey ||
name == keys::kExcludeResponseHeadersKey);
- scoped_ptr<const HeaderMatcher> header_matcher(
+ std::unique_ptr<const HeaderMatcher> header_matcher(
PrepareHeaderMatcher(name, value, error));
if (header_matcher.get() == NULL)
return scoped_refptr<const WebRequestConditionAttribute>(NULL);
diff --git a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.h b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.h
index b39a68db61d..d7afeee8447 100644
--- a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.h
+++ b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.h
@@ -5,12 +5,12 @@
#ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_ATTRIBUTE_H_
#define EXTENSIONS_BROWSER_API_DECLARATIVE_WEBREQUEST_WEBREQUEST_CONDITION_ATTRIBUTE_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "content/public/common/resource_type.h"
#include "extensions/browser/api/declarative_webrequest/request_stage.h"
#include "extensions/common/api/events.h"
@@ -167,10 +167,11 @@ class WebRequestConditionAttributeRequestHeaders
private:
WebRequestConditionAttributeRequestHeaders(
- scoped_ptr<const HeaderMatcher> header_matcher, bool positive);
+ std::unique_ptr<const HeaderMatcher> header_matcher,
+ bool positive);
~WebRequestConditionAttributeRequestHeaders() override;
- const scoped_ptr<const HeaderMatcher> header_matcher_;
+ const std::unique_ptr<const HeaderMatcher> header_matcher_;
const bool positive_;
DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeRequestHeaders);
@@ -200,10 +201,11 @@ class WebRequestConditionAttributeResponseHeaders
private:
WebRequestConditionAttributeResponseHeaders(
- scoped_ptr<const HeaderMatcher> header_matcher, bool positive);
+ std::unique_ptr<const HeaderMatcher> header_matcher,
+ bool positive);
~WebRequestConditionAttributeResponseHeaders() override;
- const scoped_ptr<const HeaderMatcher> header_matcher_;
+ const std::unique_ptr<const HeaderMatcher> header_matcher_;
const bool positive_;
DISALLOW_COPY_AND_ASSIGN(WebRequestConditionAttributeResponseHeaders);
diff --git a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc
index 7960af4b860..07f5071f5ff 100644
--- a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc
+++ b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc
@@ -6,9 +6,10 @@
#include <stddef.h>
+#include <memory>
+
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/values.h"
#include "content/public/browser/resource_request_info.h"
@@ -99,7 +100,7 @@ TEST(WebRequestConditionAttributeTest, ResourceType) {
EXPECT_EQ(std::string(keys::kResourceTypeKey), attribute->GetName());
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> url_request_ok(context.CreateRequest(
+ std::unique_ptr<net::URLRequest> url_request_ok(context.CreateRequest(
GURL("http://www.example.com"), net::DEFAULT_PRIORITY, NULL));
content::ResourceRequestInfo::AllocateForTesting(
url_request_ok.get(), content::RESOURCE_TYPE_SUB_FRAME,
@@ -115,7 +116,7 @@ TEST(WebRequestConditionAttributeTest, ResourceType) {
EXPECT_TRUE(attribute->IsFulfilled(WebRequestData(url_request_ok.get(),
ON_BEFORE_REQUEST)));
- scoped_ptr<net::URLRequest> url_request_fail(context.CreateRequest(
+ std::unique_ptr<net::URLRequest> url_request_fail(context.CreateRequest(
GURL("http://www.example.com"), net::DEFAULT_PRIORITY, NULL));
content::ResourceRequestInfo::AllocateForTesting(
url_request_fail.get(), content::RESOURCE_TYPE_MAIN_FRAME,
@@ -146,7 +147,7 @@ TEST(WebRequestConditionAttributeTest, ContentType) {
net::TestURLRequestContext context;
net::TestDelegate delegate;
- scoped_ptr<net::URLRequest> url_request(context.CreateRequest(
+ std::unique_ptr<net::URLRequest> url_request(context.CreateRequest(
test_server.GetURL("/headers.html"), net::DEFAULT_PRIORITY, &delegate));
url_request->Start();
base::MessageLoop::current()->Run();
@@ -230,7 +231,7 @@ TEST(WebRequestConditionAttributeTest, ThirdParty) {
const GURL url_b("http://b.com");
net::TestURLRequestContext context;
net::TestDelegate delegate;
- scoped_ptr<net::URLRequest> url_request(
+ std::unique_ptr<net::URLRequest> url_request(
context.CreateRequest(url_a, net::DEFAULT_PRIORITY, &delegate));
for (unsigned int i = 1; i <= kLastActiveStage; i <<= 1) {
@@ -321,7 +322,7 @@ TEST(WebRequestConditionAttributeTest, Stages) {
const GURL url_empty;
net::TestURLRequestContext context;
net::TestDelegate delegate;
- scoped_ptr<net::URLRequest> url_request(
+ std::unique_ptr<net::URLRequest> url_request(
context.CreateRequest(url_empty, net::DEFAULT_PRIORITY, &delegate));
for (size_t i = 0; i < arraysize(active_stages); ++i) {
@@ -366,21 +367,21 @@ void GetArrayAsVector(const std::string array[],
// Builds a DictionaryValue from an array of the form {name1, value1, name2,
// value2, ...}. Values for the same key are grouped in a ListValue.
-scoped_ptr<base::DictionaryValue> GetDictionaryFromArray(
+std::unique_ptr<base::DictionaryValue> GetDictionaryFromArray(
const std::vector<const std::string*>& array) {
const size_t length = array.size();
CHECK(length % 2 == 0);
- scoped_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue);
for (size_t i = 0; i < length; i += 2) {
const std::string* name = array[i];
const std::string* value = array[i+1];
if (dictionary->HasKey(*name)) {
base::Value* entry = NULL;
- scoped_ptr<base::Value> entry_owned;
+ std::unique_ptr<base::Value> entry_owned;
base::ListValue* list = NULL;
if (!dictionary->GetWithoutPathExpansion(*name, &entry))
- return scoped_ptr<base::DictionaryValue>();
+ return std::unique_ptr<base::DictionaryValue>();
switch (entry->GetType()) {
case base::Value::TYPE_STRING:
// Replace the present string with a list.
@@ -397,7 +398,7 @@ scoped_ptr<base::DictionaryValue> GetDictionaryFromArray(
break;
default:
NOTREACHED(); // We never put other Values here.
- return scoped_ptr<base::DictionaryValue>();
+ return std::unique_ptr<base::DictionaryValue>();
}
} else {
dictionary->SetString(*name, *value);
@@ -418,7 +419,8 @@ void MatchAndCheck(const std::vector< std::vector<const std::string*> >& tests,
bool* result) {
base::ListValue contains_headers;
for (size_t i = 0; i < tests.size(); ++i) {
- scoped_ptr<base::DictionaryValue> temp(GetDictionaryFromArray(tests[i]));
+ std::unique_ptr<base::DictionaryValue> temp(
+ GetDictionaryFromArray(tests[i]));
ASSERT_TRUE(temp.get());
contains_headers.Append(temp.release());
}
@@ -446,7 +448,7 @@ TEST(WebRequestConditionAttributeTest, RequestHeaders) {
net::TestURLRequestContext context;
net::TestDelegate delegate;
- scoped_ptr<net::URLRequest> url_request(
+ std::unique_ptr<net::URLRequest> url_request(
context.CreateRequest(GURL("http://example.com"), // Dummy URL.
net::DEFAULT_PRIORITY, &delegate));
url_request->SetExtraRequestHeaderByName(
@@ -534,7 +536,7 @@ TEST(WebRequestConditionAttributeTest, ResponseHeaders) {
net::TestURLRequestContext context;
net::TestDelegate delegate;
- scoped_ptr<net::URLRequest> url_request(context.CreateRequest(
+ std::unique_ptr<net::URLRequest> url_request(context.CreateRequest(
test_server.GetURL("/headers.html"), net::DEFAULT_PRIORITY, &delegate));
url_request->Start();
base::MessageLoop::current()->Run();
diff --git a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_unittest.cc b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_unittest.cc
index 0de50310766..fd955270c3b 100644
--- a/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_unittest.cc
+++ b/chromium/extensions/browser/api/declarative_webrequest/webrequest_condition_unittest.cc
@@ -4,9 +4,9 @@
#include "extensions/browser/api/declarative_webrequest/webrequest_condition.h"
+#include <memory>
#include <set>
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/test/values_test_util.h"
#include "base/values.h"
@@ -30,7 +30,7 @@ TEST(WebRequestConditionTest, CreateCondition) {
URLMatcher matcher;
std::string error;
- scoped_ptr<WebRequestCondition> result;
+ std::unique_ptr<WebRequestCondition> result;
// Test wrong condition name passed.
error.clear();
@@ -80,7 +80,7 @@ TEST(WebRequestConditionTest, CreateCondition) {
net::TestURLRequestContext context;
const GURL http_url("http://www.example.com");
- scoped_ptr<net::URLRequest> match_request(
+ std::unique_ptr<net::URLRequest> match_request(
context.CreateRequest(http_url, net::DEFAULT_PRIORITY, NULL));
WebRequestData data(match_request.get(), ON_BEFORE_REQUEST);
WebRequestDataWithMatchIds request_data(&data);
@@ -100,7 +100,7 @@ TEST(WebRequestConditionTest, CreateCondition) {
EXPECT_TRUE(result->IsFulfilled(request_data));
const GURL https_url("https://www.example.com");
- scoped_ptr<net::URLRequest> wrong_resource_type(
+ std::unique_ptr<net::URLRequest> wrong_resource_type(
context.CreateRequest(https_url, net::DEFAULT_PRIORITY, NULL));
data.request = wrong_resource_type.get();
request_data.url_match_ids = matcher.MatchURL(http_url);
@@ -126,7 +126,7 @@ TEST(WebRequestConditionTest, CreateConditionFirstPartyForCookies) {
URLMatcher matcher;
std::string error;
- scoped_ptr<WebRequestCondition> result;
+ std::unique_ptr<WebRequestCondition> result;
result = WebRequestCondition::Create(
NULL,
@@ -147,7 +147,7 @@ TEST(WebRequestConditionTest, CreateConditionFirstPartyForCookies) {
net::TestURLRequestContext context;
const GURL http_url("http://www.example.com");
const GURL first_party_url("http://fpfc.example.com");
- scoped_ptr<net::URLRequest> match_request(
+ std::unique_ptr<net::URLRequest> match_request(
context.CreateRequest(http_url, net::DEFAULT_PRIORITY, NULL));
WebRequestData data(match_request.get(), ON_BEFORE_REQUEST);
WebRequestDataWithMatchIds request_data(&data);
@@ -183,53 +183,51 @@ TEST(WebRequestConditionTest, NoUrlAttributes) {
// The empty condition.
error.clear();
- scoped_ptr<WebRequestCondition> condition_empty = WebRequestCondition::Create(
- NULL,
- matcher.condition_factory(),
- *base::test::ParseJson(
- "{ \n"
- " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
- "}"),
- &error);
+ std::unique_ptr<WebRequestCondition> condition_empty =
+ WebRequestCondition::Create(
+ NULL, matcher.condition_factory(),
+ *base::test::ParseJson(
+ "{ \n"
+ " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"
+ "}"),
+ &error);
EXPECT_EQ("", error);
ASSERT_TRUE(condition_empty.get());
// A condition without a UrlFilter attribute, which is always true.
error.clear();
- scoped_ptr<WebRequestCondition> condition_no_url_true =
+ std::unique_ptr<WebRequestCondition> condition_no_url_true =
WebRequestCondition::Create(
- NULL,
- matcher.condition_factory(),
+ NULL, matcher.condition_factory(),
*base::test::ParseJson(
- "{ \n"
- " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", "
- "\n"
- // There is no "1st party for cookies" URL in the requests below,
- // therefore all requests are considered first party for cookies.
- " \"thirdPartyForCookies\": false, \n"
- "}"),
+ "{ \n"
+ " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", "
+ "\n"
+ // There is no "1st party for cookies" URL in the requests below,
+ // therefore all requests are considered first party for cookies.
+ " \"thirdPartyForCookies\": false, \n"
+ "}"),
&error);
EXPECT_EQ("", error);
ASSERT_TRUE(condition_no_url_true.get());
// A condition without a UrlFilter attribute, which is always false.
error.clear();
- scoped_ptr<WebRequestCondition> condition_no_url_false =
+ std::unique_ptr<WebRequestCondition> condition_no_url_false =
WebRequestCondition::Create(
- NULL,
- matcher.condition_factory(),
+ NULL, matcher.condition_factory(),
*base::test::ParseJson(
- "{ \n"
- " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", "
- "\n"
- " \"thirdPartyForCookies\": true, \n"
- "}"),
+ "{ \n"
+ " \"instanceType\": \"declarativeWebRequest.RequestMatcher\", "
+ "\n"
+ " \"thirdPartyForCookies\": true, \n"
+ "}"),
&error);
EXPECT_EQ("", error);
ASSERT_TRUE(condition_no_url_false.get());
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> https_request(context.CreateRequest(
+ std::unique_ptr<net::URLRequest> https_request(context.CreateRequest(
GURL("https://www.example.com"), net::DEFAULT_PRIORITY, NULL));
// 1. A non-empty condition without UrlFilter attributes is fulfilled iff its
@@ -274,8 +272,9 @@ TEST(WebRequestConditionTest, CreateConditionSet) {
// Test insertion
std::string error;
- scoped_ptr<WebRequestConditionSet> result = WebRequestConditionSet::Create(
- NULL, matcher.condition_factory(), conditions, &error);
+ std::unique_ptr<WebRequestConditionSet> result =
+ WebRequestConditionSet::Create(NULL, matcher.condition_factory(),
+ conditions, &error);
EXPECT_EQ("", error);
ASSERT_TRUE(result.get());
EXPECT_EQ(2u, result->conditions().size());
@@ -289,7 +288,7 @@ TEST(WebRequestConditionTest, CreateConditionSet) {
// https://www.example.com
GURL http_url("http://www.example.com");
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> http_request(
+ std::unique_ptr<net::URLRequest> http_request(
context.CreateRequest(http_url, net::DEFAULT_PRIORITY, NULL));
WebRequestData data(http_request.get(), ON_BEFORE_REQUEST);
WebRequestDataWithMatchIds request_data(&data);
@@ -301,7 +300,7 @@ TEST(WebRequestConditionTest, CreateConditionSet) {
GURL https_url("https://www.example.com");
request_data.url_match_ids = matcher.MatchURL(https_url);
EXPECT_EQ(1u, request_data.url_match_ids.size());
- scoped_ptr<net::URLRequest> https_request(
+ std::unique_ptr<net::URLRequest> https_request(
context.CreateRequest(https_url, net::DEFAULT_PRIORITY, NULL));
data.request = https_request.get();
EXPECT_TRUE(result->IsFulfilled(*(request_data.url_match_ids.begin()),
@@ -311,7 +310,7 @@ TEST(WebRequestConditionTest, CreateConditionSet) {
GURL https_foo_url("https://foo.example.com");
request_data.url_match_ids = matcher.MatchURL(https_foo_url);
EXPECT_EQ(0u, request_data.url_match_ids.size());
- scoped_ptr<net::URLRequest> https_foo_request(
+ std::unique_ptr<net::URLRequest> https_foo_request(
context.CreateRequest(https_foo_url, net::DEFAULT_PRIORITY, NULL));
data.request = https_foo_request.get();
EXPECT_FALSE(result->IsFulfilled(-1, request_data));
@@ -334,8 +333,9 @@ TEST(WebRequestConditionTest, TestPortFilter) {
// Test insertion
std::string error;
- scoped_ptr<WebRequestConditionSet> result = WebRequestConditionSet::Create(
- NULL, matcher.condition_factory(), conditions, &error);
+ std::unique_ptr<WebRequestConditionSet> result =
+ WebRequestConditionSet::Create(NULL, matcher.condition_factory(),
+ conditions, &error);
EXPECT_EQ("", error);
ASSERT_TRUE(result.get());
EXPECT_EQ(1u, result->conditions().size());
@@ -350,25 +350,25 @@ TEST(WebRequestConditionTest, TestPortFilter) {
// Test various URLs.
GURL http_url("http://www.example.com");
net::TestURLRequestContext context;
- scoped_ptr<net::URLRequest> http_request(
+ std::unique_ptr<net::URLRequest> http_request(
context.CreateRequest(http_url, net::DEFAULT_PRIORITY, NULL));
url_match_ids = matcher.MatchURL(http_url);
ASSERT_EQ(1u, url_match_ids.size());
GURL http_url_80("http://www.example.com:80");
- scoped_ptr<net::URLRequest> http_request_80(
+ std::unique_ptr<net::URLRequest> http_request_80(
context.CreateRequest(http_url_80, net::DEFAULT_PRIORITY, NULL));
url_match_ids = matcher.MatchURL(http_url_80);
ASSERT_EQ(1u, url_match_ids.size());
GURL http_url_1000("http://www.example.com:1000");
- scoped_ptr<net::URLRequest> http_request_1000(
+ std::unique_ptr<net::URLRequest> http_request_1000(
context.CreateRequest(http_url_1000, net::DEFAULT_PRIORITY, NULL));
url_match_ids = matcher.MatchURL(http_url_1000);
ASSERT_EQ(1u, url_match_ids.size());
GURL http_url_2000("http://www.example.com:2000");
- scoped_ptr<net::URLRequest> http_request_2000(
+ std::unique_ptr<net::URLRequest> http_request_2000(
context.CreateRequest(http_url_2000, net::DEFAULT_PRIORITY, NULL));
url_match_ids = matcher.MatchURL(http_url_2000);
ASSERT_EQ(0u, url_match_ids.size());
@@ -383,7 +383,7 @@ TEST(WebRequestConditionTest, ConditionsWithConflictingStages) {
URLMatcher matcher;
std::string error;
- scoped_ptr<WebRequestCondition> result;
+ std::unique_ptr<WebRequestCondition> result;
// Test error on incompatible application stages for involved attributes.
error.clear();
diff --git a/chromium/extensions/browser/api/declarative_webrequest/webrequest_rules_registry.cc b/chromium/extensions/browser/api/declarative_webrequest/webrequest_rules_registry.cc
index ef709b28aa2..62bf3cc3d37 100644
--- a/chromium/extensions/browser/api/declarative_webrequest/webrequest_rules_registry.cc
+++ b/chromium/extensions/browser/api/declarative_webrequest/webrequest_rules_registry.cc
@@ -170,7 +170,7 @@ std::string WebRequestRulesRegistry::AddRulesImpl(
const WebRequestRule::RuleId& rule_id(*rule->id);
DCHECK(registered_rules.find(rule_id) == registered_rules.end());
- scoped_ptr<WebRequestRule> webrequest_rule(WebRequestRule::Create(
+ std::unique_ptr<WebRequestRule> webrequest_rule(WebRequestRule::Create(
url_matcher_.condition_factory(), browser_context(), extension,
extension_installation_time, rule,
base::Bind(&Checker, base::Unretained(extension)), &error));
diff --git a/chromium/extensions/browser/api/declarative_webrequest/webrequest_rules_registry.h b/chromium/extensions/browser/api/declarative_webrequest/webrequest_rules_registry.h
index 1bdad0cc64e..9af31c719c4 100644
--- a/chromium/extensions/browser/api/declarative_webrequest/webrequest_rules_registry.h
+++ b/chromium/extensions/browser/api/declarative_webrequest/webrequest_rules_registry.h
@@ -7,6 +7,7 @@
#include <list>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
@@ -15,7 +16,6 @@
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "components/url_matcher/url_matcher.h"
#include "extensions/browser/api/declarative/declarative_rule.h"
diff --git a/chromium/extensions/browser/api/device_permissions_manager.cc b/chromium/extensions/browser/api/device_permissions_manager.cc
index 0bf8db4f696..fd9d0edbd1d 100644
--- a/chromium/extensions/browser/api/device_permissions_manager.cc
+++ b/chromium/extensions/browser/api/device_permissions_manager.cc
@@ -100,7 +100,7 @@ void SaveDevicePermissionEntry(BrowserContext* context,
devices = update.Create();
}
- scoped_ptr<base::Value> device_entry(entry->ToValue());
+ std::unique_ptr<base::Value> device_entry(entry->ToValue());
DCHECK(devices->Find(*device_entry.get()) == devices->end());
devices->Append(device_entry.release());
}
@@ -311,13 +311,13 @@ bool DevicePermissionEntry::IsPersistent() const {
return !serial_number_.empty();
}
-scoped_ptr<base::Value> DevicePermissionEntry::ToValue() const {
+std::unique_ptr<base::Value> DevicePermissionEntry::ToValue() const {
if (!IsPersistent()) {
return nullptr;
}
DCHECK(!serial_number_.empty());
- scoped_ptr<base::DictionaryValue> entry_dict(
+ std::unique_ptr<base::DictionaryValue> entry_dict(
DictionaryBuilder()
.Set(kDeviceType, TypeToString(type_))
.Set(kDeviceVendorId, vendor_id_)
diff --git a/chromium/extensions/browser/api/device_permissions_manager.h b/chromium/extensions/browser/api/device_permissions_manager.h
index 534abca2b4a..299109b5f5e 100644
--- a/chromium/extensions/browser/api/device_permissions_manager.h
+++ b/chromium/extensions/browser/api/device_permissions_manager.h
@@ -8,13 +8,13 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <set>
#include <vector>
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "base/strings/string16.h"
#include "base/threading/thread_checker.h"
@@ -60,7 +60,7 @@ class DevicePermissionEntry : public base::RefCounted<DevicePermissionEntry> {
// Convert the device to a serializable value, returns a null pointer if the
// entry is not persistent.
- scoped_ptr<base::Value> ToValue() const;
+ std::unique_ptr<base::Value> ToValue() const;
base::string16 GetPermissionMessageString() const;
diff --git a/chromium/extensions/browser/api/device_permissions_prompt.cc b/chromium/extensions/browser/api/device_permissions_prompt.cc
index e29ae85d97e..4a6c0e61864 100644
--- a/chromium/extensions/browser/api/device_permissions_prompt.cc
+++ b/chromium/extensions/browser/api/device_permissions_prompt.cc
@@ -130,7 +130,7 @@ class UsbDevicePermissionsPrompt : public DevicePermissionsPrompt::Prompt,
return;
}
- scoped_ptr<DeviceInfo> device_info(new UsbDeviceInfo(device));
+ std::unique_ptr<DeviceInfo> device_info(new UsbDeviceInfo(device));
device->CheckUsbAccess(
base::Bind(&UsbDevicePermissionsPrompt::AddCheckedDevice, this,
base::Passed(&device_info)));
@@ -243,7 +243,7 @@ class HidDevicePermissionsPrompt : public DevicePermissionsPrompt::Prompt,
void OnDeviceAdded(scoped_refptr<device::HidDeviceInfo> device) override {
if (HasUnprotectedCollections(device) &&
(filters_.empty() || HidDeviceFilter::MatchesAny(device, filters_))) {
- scoped_ptr<DeviceInfo> device_info(new HidDeviceInfo(device));
+ std::unique_ptr<DeviceInfo> device_info(new HidDeviceInfo(device));
#if defined(OS_CHROMEOS)
chromeos::PermissionBrokerClient* client =
chromeos::DBusThreadManager::Get()->GetPermissionBrokerClient();
@@ -343,7 +343,7 @@ DevicePermissionsPrompt::Prompt::~Prompt() {
}
void DevicePermissionsPrompt::Prompt::AddCheckedDevice(
- scoped_ptr<DeviceInfo> device,
+ std::unique_ptr<DeviceInfo> device,
bool allowed) {
if (allowed) {
devices_.push_back(std::move(device));
diff --git a/chromium/extensions/browser/api/device_permissions_prompt.h b/chromium/extensions/browser/api/device_permissions_prompt.h
index 469ff594d71..cbe5e8ff6e6 100644
--- a/chromium/extensions/browser/api/device_permissions_prompt.h
+++ b/chromium/extensions/browser/api/device_permissions_prompt.h
@@ -7,13 +7,13 @@
#include <stddef.h>
+#include <memory>
#include <vector>
#include "base/callback_forward.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
namespace content {
@@ -99,7 +99,7 @@ class DevicePermissionsPrompt {
protected:
virtual ~Prompt();
- void AddCheckedDevice(scoped_ptr<DeviceInfo> device, bool allowed);
+ void AddCheckedDevice(std::unique_ptr<DeviceInfo> device, bool allowed);
const Extension* extension() const { return extension_; }
Observer* observer() const { return observer_; }
@@ -109,7 +109,7 @@ class DevicePermissionsPrompt {
// Subclasses may fill this with a particular subclass of DeviceInfo and may
// assume that only that instances of that type are stored here.
- std::vector<scoped_ptr<DeviceInfo>> devices_;
+ std::vector<std::unique_ptr<DeviceInfo>> devices_;
private:
friend class base::RefCounted<Prompt>;
diff --git a/chromium/extensions/browser/api/diagnostics/diagnostics_api.h b/chromium/extensions/browser/api/diagnostics/diagnostics_api.h
index cf7ce6c13c2..356c686eb95 100644
--- a/chromium/extensions/browser/api/diagnostics/diagnostics_api.h
+++ b/chromium/extensions/browser/api/diagnostics/diagnostics_api.h
@@ -5,9 +5,9 @@
#ifndef EXTENSIONS_BROWSER_API_DIAGNOSTICS_DIAGNOSTICS_API_H_
#define EXTENSIONS_BROWSER_API_DIAGNOSTICS_DIAGNOSTICS_API_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/async_api_function.h"
#include "extensions/common/api/diagnostics.h"
@@ -47,7 +47,7 @@ class DiagnosticsSendPacketFunction : public AsyncApiFunction {
const std::string& ip,
double latency);
- scoped_ptr<api::diagnostics::SendPacket::Params> parameters_;
+ std::unique_ptr<api::diagnostics::SendPacket::Params> parameters_;
};
} // namespace extensions
diff --git a/chromium/extensions/browser/api/diagnostics/diagnostics_api_chromeos.cc b/chromium/extensions/browser/api/diagnostics/diagnostics_api_chromeos.cc
index f14b8fb0cbe..6186bc77830 100644
--- a/chromium/extensions/browser/api/diagnostics/diagnostics_api_chromeos.cc
+++ b/chromium/extensions/browser/api/diagnostics/diagnostics_api_chromeos.cc
@@ -29,7 +29,7 @@ typedef base::Callback<void(
bool ParseResult(const std::string& status, std::string* ip, double* latency) {
// Parses the result and returns IP and latency.
- scoped_ptr<base::Value> parsed_value(base::JSONReader::Read(status));
+ std::unique_ptr<base::Value> parsed_value(base::JSONReader::Read(status));
if (!parsed_value)
return false;
diff --git a/chromium/extensions/browser/api/display_source/display_source_api.cc b/chromium/extensions/browser/api/display_source/display_source_api.cc
index 9b57e6b6e3b..fb944130748 100644
--- a/chromium/extensions/browser/api/display_source/display_source_api.cc
+++ b/chromium/extensions/browser/api/display_source/display_source_api.cc
@@ -44,7 +44,7 @@ DisplaySourceGetAvailableSinksFunction::Run() {
void DisplaySourceGetAvailableSinksFunction::OnGetSinksCompleted(
const DisplaySourceSinkInfoList& sinks) {
- scoped_ptr<base::ListValue> result =
+ std::unique_ptr<base::ListValue> result =
api::display_source::GetAvailableSinks::Results::Create(sinks);
Respond(ArgumentList(std::move(result)));
}
@@ -62,7 +62,7 @@ DisplaySourceRequestAuthenticationFunction::
ExtensionFunction::ResponseAction
DisplaySourceRequestAuthenticationFunction::Run() {
- scoped_ptr<api::display_source::RequestAuthentication::Params> params(
+ std::unique_ptr<api::display_source::RequestAuthentication::Params> params(
api::display_source::RequestAuthentication::Params::Create(*args_));
if (!params) {
return RespondNow(Error(kErrorInvalidArguments));
@@ -87,7 +87,7 @@ DisplaySourceRequestAuthenticationFunction::Run() {
void DisplaySourceRequestAuthenticationFunction::OnRequestAuthCompleted(
const DisplaySourceAuthInfo& auth_info) {
- scoped_ptr<base::ListValue> result =
+ std::unique_ptr<base::ListValue> result =
api::display_source::RequestAuthentication::Results::Create(auth_info);
Respond(ArgumentList(std::move(result)));
}
diff --git a/chromium/extensions/browser/api/display_source/display_source_apitest.cc b/chromium/extensions/browser/api/display_source/display_source_apitest.cc
index 01419f3dec4..5dc2c666281 100644
--- a/chromium/extensions/browser/api/display_source/display_source_apitest.cc
+++ b/chromium/extensions/browser/api/display_source/display_source_apitest.cc
@@ -1,95 +1,22 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// 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 "content/public/test/test_utils.h"
-#include "extensions/browser/api/display_source/display_source_connection_delegate.h"
-#include "extensions/browser/api/display_source/display_source_connection_delegate_factory.h"
+#include "extensions/browser/api/display_source/display_source_apitestbase.h"
#include "extensions/shell/test/shell_apitest.h"
namespace extensions {
-using api::display_source::SinkInfo;
-using api::display_source::SinkState;
-using api::display_source::SINK_STATE_DISCONNECTED;
-using api::display_source::AUTHENTICATION_METHOD_PBC;
-
-namespace {
-
-DisplaySourceSinkInfo CreateSinkInfoPtr(int id,
- const std::string& name,
- SinkState state) {
- DisplaySourceSinkInfo info;
- info.id = id;
- info.name = name;
- info.state = state;
-
- return info;
-}
-
-} // namespace
-
-class MockDisplaySourceConnectionDelegate
- : public DisplaySourceConnectionDelegate {
- public:
- const DisplaySourceSinkInfoList& last_found_sinks() const override {
- return sinks_;
- }
- const Connection* connection() const override { return nullptr; }
- void GetAvailableSinks(const SinkInfoListCallback& sinks_callback,
- const StringCallback& failure_callback) override {
- AddSink(CreateSinkInfoPtr(1, "sink 1", SINK_STATE_DISCONNECTED));
- sinks_callback.Run(sinks_);
- }
-
- void RequestAuthentication(int sink_id,
- const AuthInfoCallback& auth_info_callback,
- const StringCallback& failure_callback) override {
- DisplaySourceAuthInfo info;
- info.method = AUTHENTICATION_METHOD_PBC;
- auth_info_callback.Run(info);
- }
-
- void Connect(int sink_id,
- const DisplaySourceAuthInfo& auth_info,
- const StringCallback& failure_callback) override {}
-
- void Disconnect(const StringCallback& failure_callback) override {}
-
- void StartWatchingAvailableSinks() override {
- AddSink(CreateSinkInfoPtr(2, "sink 2", SINK_STATE_DISCONNECTED));
- }
-
- void StopWatchingAvailableSinks() override {}
-
- private:
- void AddSink(DisplaySourceSinkInfo sink) {
- sinks_.push_back(std::move(sink));
- FOR_EACH_OBSERVER(DisplaySourceConnectionDelegate::Observer, observers_,
- OnSinksUpdated(sinks_));
- }
-
- DisplaySourceSinkInfoList sinks_;
-};
-
class DisplaySourceApiTest : public ShellApiTest {
- public:
- DisplaySourceApiTest() = default;
-
- private:
- static scoped_ptr<KeyedService> CreateMockDelegate(
- content::BrowserContext* profile) {
- return make_scoped_ptr<KeyedService>(
- new MockDisplaySourceConnectionDelegate());
- }
-
- void SetUpOnMainThread() override {
- ShellApiTest::SetUpOnMainThread();
- DisplaySourceConnectionDelegateFactory::GetInstance()->SetTestingFactory(
- browser_context(), &CreateMockDelegate);
- content::RunAllPendingInMessageLoop();
- }
+ public:
+ DisplaySourceApiTest() = default;
+
+ private:
+ void SetUpOnMainThread() override {
+ ShellApiTest::SetUpOnMainThread();
+ InitMockDisplaySourceConnectionDelegate(browser_context());
+ content::RunAllPendingInMessageLoop();
+ }
};
IN_PROC_BROWSER_TEST_F(DisplaySourceApiTest, DisplaySourceExtension) {
diff --git a/chromium/extensions/browser/api/display_source/display_source_apitestbase.cc b/chromium/extensions/browser/api/display_source/display_source_apitestbase.cc
new file mode 100644
index 00000000000..ee7ae1fd86b
--- /dev/null
+++ b/chromium/extensions/browser/api/display_source/display_source_apitestbase.cc
@@ -0,0 +1,533 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/api/display_source/display_source_apitestbase.h"
+
+#include <map>
+#include <utility>
+
+#include "base/memory/ptr_util.h"
+#include "net/base/net_errors.h"
+#include "net/udp/udp_socket.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace extensions {
+
+using api::display_source::SinkInfo;
+using api::display_source::SinkState;
+using api::display_source::AuthenticationMethod;
+using api::display_source::SINK_STATE_DISCONNECTED;
+using api::display_source::SINK_STATE_CONNECTING;
+using api::display_source::SINK_STATE_CONNECTED;
+using api::display_source::AUTHENTICATION_METHOD_PBC;
+using api::display_source::AUTHENTICATION_METHOD_PIN;
+using content::BrowserThread;
+
+class MockDisplaySourceConnectionDelegate
+ : public DisplaySourceConnectionDelegate,
+ public DisplaySourceConnectionDelegate::Connection {
+ public:
+ MockDisplaySourceConnectionDelegate();
+
+ const DisplaySourceSinkInfoList& last_found_sinks() const override;
+
+ DisplaySourceConnectionDelegate::Connection* connection()
+ override {
+ return (active_sink_ && active_sink_->state == SINK_STATE_CONNECTED)
+ ? this
+ : nullptr;
+ }
+
+ void GetAvailableSinks(const SinkInfoListCallback& sinks_callback,
+ const StringCallback& failure_callback) override;
+
+ void RequestAuthentication(int sink_id,
+ const AuthInfoCallback& auth_info_callback,
+ const StringCallback& failure_callback) override;
+
+ void Connect(int sink_id,
+ const DisplaySourceAuthInfo& auth_info,
+ const StringCallback& failure_callback) override;
+
+ void Disconnect(const StringCallback& failure_callback) override;
+
+ void StartWatchingAvailableSinks() override;
+
+ // DisplaySourceConnectionDelegate::Connection overrides
+ const DisplaySourceSinkInfo& GetConnectedSink() const override;
+
+ void StopWatchingAvailableSinks() override;
+
+ std::string GetLocalAddress() const override;
+
+ std::string GetSinkAddress() const override;
+
+ void SendMessage(const std::string& message) override;
+
+ void SetMessageReceivedCallback(
+ const StringCallback& callback) override;
+
+ private:
+ void AddSink(DisplaySourceSinkInfo sink,
+ AuthenticationMethod auth_method,
+ const std::string& pin_value);
+
+ void OnSinkConnected();
+
+ void NotifySinksUpdated();
+
+ void EnqueueSinkMessage(std::string message);
+
+ void CheckSourceMessageContent(std::string pattern,
+ const std::string& message);
+
+ void BindToUdpSocket();
+
+ void ReceiveMediaPacket();
+
+ void OnMediaPacketReceived(int net_result);
+
+ DisplaySourceSinkInfoList sinks_;
+ DisplaySourceSinkInfo* active_sink_;
+ std::map<int, std::pair<AuthenticationMethod, std::string>> auth_infos_;
+ StringCallback message_received_cb_;
+
+ struct Message {
+ enum Direction {
+ SourceToSink,
+ SinkToSource
+ };
+ std::string data;
+ Direction direction;
+
+ bool is_from_sink() const { return direction == SinkToSource; }
+ Message(const std::string& message_data, Direction direction)
+ : data(message_data), direction(direction) {}
+ };
+
+ std::list<Message> messages_list_;
+ std::string session_id_;
+
+ std::unique_ptr<net::UDPSocket,
+ content::BrowserThread::DeleteOnIOThread> socket_;
+ scoped_refptr<net::IOBuffer> recvfrom_buffer_;
+ net::IPEndPoint end_point_;
+ std::string udp_port_;
+};
+
+namespace {
+
+const size_t kSessionIdLength = 8;
+const size_t kUdpPortLength = 5;
+const char kClientPortKey[] = "client_port=";
+const char kLocalHost[] = "127.0.0.1";
+const char kSessionKey[] = "Session: ";
+const char kUnicastKey[] = "unicast ";
+const int kPortStart = 10000;
+const int kPortEnd = 65535;
+
+DisplaySourceSinkInfo CreateSinkInfo(int id, const std::string& name) {
+ DisplaySourceSinkInfo ptr;
+ ptr.id = id;
+ ptr.name = name;
+ ptr.state = SINK_STATE_DISCONNECTED;
+
+ return ptr;
+}
+
+std::unique_ptr<KeyedService> CreateMockDelegate(
+ content::BrowserContext* profile) {
+ return base::WrapUnique<KeyedService>(
+ new MockDisplaySourceConnectionDelegate());
+}
+
+void AdaptMessagePattern(std::size_t key_pos,
+ const char *key,
+ std::size_t substr_len,
+ const std::string& replace_with,
+ std::string& pattern) {
+ const std::size_t position = key_pos +
+ std::char_traits<char>::length(key);
+ pattern.replace(position, substr_len, replace_with);
+}
+
+} // namespace
+
+void InitMockDisplaySourceConnectionDelegate(content::BrowserContext* profile) {
+ DisplaySourceConnectionDelegateFactory::GetInstance()->SetTestingFactory(
+ profile, &CreateMockDelegate);
+}
+namespace {
+
+// WiFi Display session RTSP messages patterns.
+
+const char kM1Message[] = "OPTIONS * RTSP/1.0\r\n"
+ "CSeq: 1\r\n"
+ "Require: org.wfa.wfd1.0\r\n\r\n";
+
+const char kM1MessageReply[] = "RTSP/1.0 200 OK\r\n"
+ "CSeq:1\r\n"
+ "Public: org.wfa.wfd1.0, "
+ "GET_PARAMETER, SET_PARAMETER\r\n\r\n";
+
+const char kM2Message[] = "OPTIONS * RTSP/1.0\r\n"
+ "CSeq: 2\r\n"
+ "Require: org.wfa.wfd1.0\r\n\r\n";
+
+const char kM2MessageReply[] = "RTSP/1.0 200 OK\r\n"
+ "CSeq: 2\r\n"
+ "Public: org.wfa.wfd1.0, "
+ "GET_PARAMETER, SET_PARAMETER, PLAY, PAUSE, "
+ "SETUP, TEARDOWN\r\n\r\n";
+
+const char kM3Message[] = "GET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0\r\n"
+ "CSeq: 2\r\n"
+ "Content-Type: text/parameters\r\n"
+ "Content-Length: 41\r\n\r\n"
+ "wfd_video_formats\r\n"
+ "wfd_client_rtp_ports\r\n";
+
+const char kM3MessageReply[] = "RTSP/1.0 200 OK\r\n"
+ "CSeq: 2\r\n"
+ "Content-Type: text/parameters\r\n"
+ "Content-Length: 145\r\n\r\n"
+ "wfd_video_formats: "
+ "00 00 01 01 0001FFFF 1FFFFFFF 00000FFF 00 0000 "
+ "0000 00 none none\r\n"
+ "wfd_client_rtp_ports: RTP/AVP/UDP;"
+ "unicast 00000 0 mode=play\r\n";
+
+const char kM4Message[] = "SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0\r\n"
+ "CSeq: 3\r\n"
+ "Content-Type: text/parameters\r\n"
+ "Content-Length: 209\r\n\r\n"
+ "wfd_client_rtp_ports: "
+ "RTP/AVP/UDP;unicast 00000 0 mode=play\r\n"
+ "wfd_presentation_URL: "
+ "rtsp://127.0.0.1/wfd1.0/streamid=0 none\r\n"
+ "wfd_video_formats: "
+ "00 00 01 01 00000001 00000000 00000000 00 0000 0000 "
+ "00 none none\r\n";
+
+const char kM4MessageReply[] = "RTSP/1.0 200 OK\r\n"
+ "CSeq: 3\r\n\r\n";
+
+const char kM5Message[] = "SET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0\r\n"
+ "CSeq: 4\r\n"
+ "Content-Type: text/parameters\r\n"
+ "Content-Length: 27\r\n\r\n"
+ "wfd_trigger_method: SETUP\r\n";
+
+const char kM5MessageReply[] = "RTSP/1.0 200 OK\r\n"
+ "CSeq: 4\r\n\r\n";
+
+const char kM6Message[] = "SETUP rtsp://localhost/wfd1.0/streamid=0 "
+ "RTSP/1.0\r\n"
+ "CSeq: 3\r\n"
+ "Transport: RTP/AVP/UDP;unicast;"
+ "client_port=00000\r\n\r\n";
+
+const char kM6MessageReply[] = "RTSP/1.0 200 OK\r\n"
+ "CSeq: 3\r\n"
+ "Session: 00000000;timeout=60\r\n"
+ "Transport: RTP/AVP/UDP;unicast;"
+ "client_port=00000\r\n\r\n";
+
+const char kM7Message[] = "PLAY rtsp://localhost/wfd1.0/streamid=0 RTSP/1.0\r\n"
+ "CSeq: 4\r\n"
+ "Session: 00000000\r\n\r\n";
+
+const char kM7MessageReply[] = "RTSP/1.0 200 OK\r\n"
+ "CSeq: 4\r\n\r\n";
+
+const char kM8Message[] = "GET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0\r\n"
+ "CSeq: 5\r\n\r\n";
+
+const char kM8MessageReply[] = "RTSP/1.0 200 OK\r\n"
+ "CSeq: 5\r\n\r\n";
+
+const char kM9Message[] = "GET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0\r\n"
+ "CSeq: 6\r\n\r\n";
+
+const char kM9MessageReply[] = "RTSP/1.0 200 OK\r\n"
+ "CSeq: 6\r\n\r\n";
+
+const char kM10Message[] = "GET_PARAMETER rtsp://localhost/wfd1.0 RTSP/1.0\r\n"
+ "CSeq: 7\r\n\r\n";
+
+const char kM10MessageReply[] = "RTSP/1.0 200 OK\r\n"
+ "CSeq: 7\r\n\r\n";
+
+} // namespace
+MockDisplaySourceConnectionDelegate::MockDisplaySourceConnectionDelegate()
+ : active_sink_(nullptr) {
+ messages_list_.push_back(Message(kM1Message, Message::SourceToSink));
+ messages_list_.push_back(Message(kM1MessageReply, Message::SinkToSource));
+ messages_list_.push_back(Message(kM2Message, Message::SinkToSource));
+ messages_list_.push_back(Message(kM2MessageReply, Message::SourceToSink));
+ messages_list_.push_back(Message(kM3Message, Message::SourceToSink));
+ messages_list_.push_back(Message(kM3MessageReply, Message::SinkToSource));
+ messages_list_.push_back(Message(kM4Message, Message::SourceToSink));
+ messages_list_.push_back(Message(kM4MessageReply, Message::SinkToSource));
+ messages_list_.push_back(Message(kM5Message, Message::SourceToSink));
+ messages_list_.push_back(Message(kM5MessageReply, Message::SinkToSource));
+ messages_list_.push_back(Message(kM6Message, Message::SinkToSource));
+ messages_list_.push_back(Message(kM6MessageReply, Message::SourceToSink));
+ messages_list_.push_back(Message(kM7Message, Message::SinkToSource));
+ messages_list_.push_back(Message(kM7MessageReply, Message::SourceToSink));
+ messages_list_.push_back(Message(kM8Message, Message::SourceToSink));
+ messages_list_.push_back(Message(kM8MessageReply, Message::SinkToSource));
+ messages_list_.push_back(Message(kM9Message, Message::SourceToSink));
+ messages_list_.push_back(Message(kM9MessageReply, Message::SinkToSource));
+ messages_list_.push_back(Message(kM10Message, Message::SourceToSink));
+ messages_list_.push_back(Message(kM10MessageReply, Message::SinkToSource));
+
+ AddSink(CreateSinkInfo(1, "sink 1"), AUTHENTICATION_METHOD_PIN, "1234");
+}
+
+const DisplaySourceSinkInfoList&
+MockDisplaySourceConnectionDelegate::last_found_sinks() const {
+ return sinks_;
+}
+
+void MockDisplaySourceConnectionDelegate::GetAvailableSinks(
+ const SinkInfoListCallback& sinks_callback,
+ const StringCallback& failure_callback) {
+ sinks_callback.Run(sinks_);
+}
+
+void MockDisplaySourceConnectionDelegate::RequestAuthentication(
+ int sink_id,
+ const AuthInfoCallback& auth_info_callback,
+ const StringCallback& failure_callback) {
+ DisplaySourceAuthInfo info;
+ auto it = auth_infos_.find(sink_id);
+ ASSERT_NE(it, auth_infos_.end());
+
+ info.method = it->second.first;
+ auth_info_callback.Run(info);
+}
+
+void MockDisplaySourceConnectionDelegate::Connect(
+ int sink_id,
+ const DisplaySourceAuthInfo& auth_info,
+ const StringCallback& failure_callback) {
+ auto it = auth_infos_.find(sink_id);
+ ASSERT_NE(it, auth_infos_.end());
+ ASSERT_EQ(it->second.first, auth_info.method);
+ ASSERT_STREQ(it->second.second.c_str(), auth_info.data->c_str());
+
+ auto found = std::find_if(sinks_.begin(), sinks_.end(),
+ [sink_id](const DisplaySourceSinkInfo& sink) {
+ return sink.id == sink_id;
+ });
+
+ ASSERT_NE(found, sinks_.end());
+ active_sink_ = sinks_.data() + (found - sinks_.begin());
+ active_sink_->state = SINK_STATE_CONNECTING;
+ NotifySinksUpdated();
+
+ // Bind sink to udp socket at this stage
+ // And store udp port to udp_port_ string in order to be used
+ // In a message exchange. Then make a BrowserThread::PostTask
+ // on UI thread and call OnSinkConnected() to proceed with the test
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&MockDisplaySourceConnectionDelegate::BindToUdpSocket,
+ base::Unretained(this)));
+}
+
+void MockDisplaySourceConnectionDelegate::Disconnect(
+ const StringCallback& failure_callback) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ CHECK(active_sink_);
+ ASSERT_EQ(active_sink_->state, SINK_STATE_CONNECTED);
+ active_sink_->state = SINK_STATE_DISCONNECTED;
+ active_sink_ = nullptr;
+ NotifySinksUpdated();
+}
+
+void MockDisplaySourceConnectionDelegate::StartWatchingAvailableSinks() {
+ AddSink(CreateSinkInfo(2, "sink 2"), AUTHENTICATION_METHOD_PBC, "");
+}
+
+const DisplaySourceSinkInfo&
+MockDisplaySourceConnectionDelegate::GetConnectedSink() const {
+ CHECK(active_sink_);
+ return *active_sink_;
+}
+
+void MockDisplaySourceConnectionDelegate::StopWatchingAvailableSinks() {}
+
+std::string MockDisplaySourceConnectionDelegate::GetLocalAddress() const {
+ return "127.0.0.1";
+}
+
+std::string MockDisplaySourceConnectionDelegate::GetSinkAddress() const {
+ return "127.0.0.1";
+}
+
+void MockDisplaySourceConnectionDelegate::SendMessage(
+ const std::string& message) {
+ ASSERT_FALSE(messages_list_.empty());
+ ASSERT_FALSE(messages_list_.front().is_from_sink());
+
+ CheckSourceMessageContent(messages_list_.front().data, message);
+ messages_list_.pop_front();
+
+ while (!messages_list_.empty() && messages_list_.front().is_from_sink()) {
+ EnqueueSinkMessage(messages_list_.front().data);
+ messages_list_.pop_front();
+ }
+}
+
+void MockDisplaySourceConnectionDelegate::SetMessageReceivedCallback(
+ const StringCallback& callback) {
+ message_received_cb_ = callback;
+}
+
+void MockDisplaySourceConnectionDelegate::AddSink(
+ DisplaySourceSinkInfo sink,
+ AuthenticationMethod auth_method,
+ const std::string& pin_value) {
+ auth_infos_[sink.id] = {auth_method, pin_value};
+ sinks_.push_back(std::move(sink));
+ NotifySinksUpdated();
+}
+
+void MockDisplaySourceConnectionDelegate::OnSinkConnected() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ CHECK(active_sink_);
+ active_sink_->state = SINK_STATE_CONNECTED;
+ NotifySinksUpdated();
+}
+
+void MockDisplaySourceConnectionDelegate::NotifySinksUpdated() {
+ FOR_EACH_OBSERVER(DisplaySourceConnectionDelegate::Observer, observers_,
+ OnSinksUpdated(sinks_));
+}
+
+void MockDisplaySourceConnectionDelegate::
+EnqueueSinkMessage(std::string message) {
+ const std::size_t found_session_key = message.find(kSessionKey);
+ if (found_session_key != std::string::npos)
+ AdaptMessagePattern(found_session_key, kSessionKey, kSessionIdLength,
+ session_id_, message);
+
+ const std::size_t found_unicast_key = message.find(kUnicastKey);
+ if (found_unicast_key != std::string::npos)
+ AdaptMessagePattern(found_unicast_key, kUnicastKey, kUdpPortLength,
+ udp_port_, message);
+
+ const std::size_t found_clientport_key = message.find(kClientPortKey);
+ if (found_clientport_key != std::string::npos)
+ AdaptMessagePattern(found_clientport_key, kClientPortKey, kUdpPortLength,
+ udp_port_, message);
+
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ base::Bind(message_received_cb_, message));
+}
+
+void MockDisplaySourceConnectionDelegate::
+CheckSourceMessageContent(std::string pattern,
+ const std::string& message) {
+ // Message M6_reply from Source to Sink has a unique and random session id
+ // generated by Source. The id cannot be predicted and the session id should
+ // be extracted and added to the message pattern for assertion.
+ // The following code checks if messages include "Session" string.
+ // If not, assert the message normally.
+ // If yes, find the session id, add it to the pattern and to the sink message
+ // that has Session: substring inside.
+ const std::size_t found_session_key = message.find(kSessionKey);
+ if (found_session_key != std::string::npos) {
+ const std::size_t session_id_pos = found_session_key +
+ std::char_traits<char>::length(kSessionKey);
+ session_id_ = message.substr(session_id_pos, kSessionIdLength);
+ AdaptMessagePattern(found_session_key, kSessionKey, kSessionIdLength,
+ session_id_, pattern);
+ }
+
+ const std::size_t found_unicast_key = message.find(kUnicastKey);
+ if (found_unicast_key != std::string::npos)
+ AdaptMessagePattern(found_unicast_key, kUnicastKey, kUdpPortLength,
+ udp_port_, pattern);
+
+ const std::size_t found_clientport_key = message.find(kClientPortKey);
+ if (found_clientport_key != std::string::npos)
+ AdaptMessagePattern(found_clientport_key, kClientPortKey, kUdpPortLength,
+ udp_port_, pattern);
+
+ ASSERT_EQ(pattern, message);
+}
+
+void MockDisplaySourceConnectionDelegate::BindToUdpSocket() {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ socket_.reset(new net::UDPSocket(
+ net::DatagramSocket::DEFAULT_BIND, net::RandIntCallback(), nullptr,
+ net::NetLog::Source()));
+
+ net::IPAddress address;
+ ASSERT_TRUE(address.AssignFromIPLiteral(kLocalHost));
+
+ int net_result;
+ net_result = socket_->Open(net::ADDRESS_FAMILY_IPV4);
+ ASSERT_EQ(net_result, net::OK);
+
+ for (uint16_t port = kPortStart; port < kPortEnd; ++port) {
+ net::IPEndPoint local_point(address, port);
+ net_result = socket_->Bind(local_point);
+ if (net_result == net::OK) {
+ udp_port_ = std::to_string(port);
+ // When we got an udp socket established and udp port is known
+ // Change sink's status to connected and proceed with the test.
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&MockDisplaySourceConnectionDelegate::OnSinkConnected,
+ base::Unretained(this)));
+ break;
+ }
+ }
+
+ ReceiveMediaPacket();
+}
+
+void MockDisplaySourceConnectionDelegate::ReceiveMediaPacket() {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(socket_.get());
+ const int kBufferSize = 512;
+
+ recvfrom_buffer_ = new net::IOBuffer(kBufferSize);
+
+ int net_result = socket_->RecvFrom(
+ recvfrom_buffer_.get(), kBufferSize, &end_point_,
+ base::Bind(&MockDisplaySourceConnectionDelegate::OnMediaPacketReceived,
+ base::Unretained(this)));
+
+ if (net_result != net::ERR_IO_PENDING)
+ OnMediaPacketReceived(net_result);
+}
+
+void MockDisplaySourceConnectionDelegate::OnMediaPacketReceived(
+ int net_result) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(recvfrom_buffer_.get());
+ recvfrom_buffer_ = NULL;
+
+ if (net_result > 0) {
+ // We received at least one media packet.
+ // Test is completed.
+ socket_->Close();
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&MockDisplaySourceConnectionDelegate::Disconnect,
+ base::Unretained(this), StringCallback()));
+ return;
+ }
+
+ DCHECK(socket_.get());
+ ReceiveMediaPacket();
+}
+
+} // namespace extensions
diff --git a/chromium/extensions/browser/api/display_source/display_source_apitestbase.h b/chromium/extensions/browser/api/display_source/display_source_apitestbase.h
new file mode 100644
index 00000000000..e5dd3e5ebd7
--- /dev/null
+++ b/chromium/extensions/browser/api/display_source/display_source_apitestbase.h
@@ -0,0 +1,26 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_APITESTBASE_H_
+#define EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_APITESTBASE_H_
+
+#include <memory>
+#include <string>
+
+#include "content/public/test/test_utils.h"
+#include "extensions/browser/api/display_source/display_source_connection_delegate.h"
+#include "extensions/browser/api/display_source/display_source_connection_delegate_factory.h"
+
+namespace extensions {
+
+// This functions sets up a mock connection delegate which
+// simulates having of one sink device from the beginning with the properties:
+// name is "sink 1", id is '1', auth.method is 'PIN', PIN value is '1234'.
+// Calling of "StartWatchingAvailableSinks" will add one more sink device,
+// its properties are: name is "sink 2", id is '2', auth.method is 'PBC'.
+void InitMockDisplaySourceConnectionDelegate(content::BrowserContext* profile);
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_APITESTBASE_H_
diff --git a/chromium/extensions/browser/api/display_source/display_source_connection_delegate.h b/chromium/extensions/browser/api/display_source/display_source_connection_delegate.h
index a1a3106beb8..a589e7040e0 100644
--- a/chromium/extensions/browser/api/display_source/display_source_connection_delegate.h
+++ b/chromium/extensions/browser/api/display_source/display_source_connection_delegate.h
@@ -31,7 +31,7 @@ class DisplaySourceConnectionDelegate : public KeyedService {
class Connection {
public:
// Returns the connected sink object.
- virtual DisplaySourceSinkInfo GetConnectedSink() const = 0;
+ virtual const DisplaySourceSinkInfo& GetConnectedSink() const = 0;
// Returns the local address of the source.
virtual std::string GetLocalAddress() const = 0;
@@ -41,14 +41,14 @@ class DisplaySourceConnectionDelegate : public KeyedService {
// Sends a control message to the connected sink.
// If an error occurs 'Observer::OnConnectionError' is invoked.
- virtual void SendMessage(const std::string& message) const = 0;
+ virtual void SendMessage(const std::string& message) = 0;
// Sets a callback to receive control messages from the connected sink.
// This method should only be called once in the lifetime of each
// Connection object.
// If an error occurs 'Observer::OnConnectionError' is invoked.
virtual void SetMessageReceivedCallback(
- const StringCallback& callback) const = 0;
+ const StringCallback& callback) = 0;
protected:
Connection();
@@ -90,7 +90,7 @@ class DisplaySourceConnectionDelegate : public KeyedService {
// Returns the Connection object representing the current
// connection to the sink or NULL if there is no current connection.
- virtual const Connection* connection() const = 0;
+ virtual Connection* connection() = 0;
// Queries the list of currently available sinks.
virtual void GetAvailableSinks(const SinkInfoListCallback& sinks_callback,
diff --git a/chromium/extensions/browser/api/display_source/display_source_connection_delegate_factory.h b/chromium/extensions/browser/api/display_source/display_source_connection_delegate_factory.h
index ec412a9884d..d11b55afbb2 100644
--- a/chromium/extensions/browser/api/display_source/display_source_connection_delegate_factory.h
+++ b/chromium/extensions/browser/api/display_source/display_source_connection_delegate_factory.h
@@ -5,8 +5,9 @@
#ifndef EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_CONNECTION_DELEGATE_FACTORY_H_
#define EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_DISPLAY_SOURCE_CONNECTION_DELEGATE_FACTORY_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "extensions/browser/api/display_source/display_source_connection_delegate.h"
diff --git a/chromium/extensions/browser/api/display_source/display_source_event_router.cc b/chromium/extensions/browser/api/display_source/display_source_event_router.cc
index d621e94cd37..202d7f99185 100644
--- a/chromium/extensions/browser/api/display_source/display_source_event_router.cc
+++ b/chromium/extensions/browser/api/display_source/display_source_event_router.cc
@@ -86,9 +86,9 @@ void DisplaySourceEventRouter::OnSinksUpdated(
EventRouter* event_router = EventRouter::Get(browser_context_);
if (!event_router)
return;
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
api::display_source::OnSinksUpdated::Create(sinks));
- scoped_ptr<Event> sinks_updated_event(new Event(
+ std::unique_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));
diff --git a/chromium/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.cc b/chromium/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.cc
new file mode 100644
index 00000000000..203caa93b12
--- /dev/null
+++ b/chromium/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.cc
@@ -0,0 +1,134 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.h"
+
+#include <string>
+#include <vector>
+
+#include "base/big_endian.h"
+#include "content/public/browser/browser_thread.h"
+#include "net/base/net_errors.h"
+
+using content::BrowserThread;
+
+namespace extensions {
+
+class WiFiDisplayMediaServiceImpl::PacketIOBuffer : public net::IOBuffer {
+ public:
+ explicit PacketIOBuffer(mojo::Array<uint8_t> array);
+
+ int size() const { return packet_data_.size(); }
+
+ private:
+ ~PacketIOBuffer() override;
+
+ std::vector<uint8_t> packet_data_;
+};
+
+WiFiDisplayMediaServiceImpl::PacketIOBuffer::PacketIOBuffer(
+ mojo::Array<uint8_t> array) {
+ array.Swap(&packet_data_);
+ data_ = reinterpret_cast<char*>(packet_data_.data());
+}
+
+WiFiDisplayMediaServiceImpl::PacketIOBuffer::~PacketIOBuffer() {
+ data_ = nullptr;
+}
+
+// static
+void WiFiDisplayMediaServiceImpl::Create(
+ WiFiDisplayMediaServiceRequest request) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ new WiFiDisplayMediaServiceImpl(std::move(request));
+}
+
+// static
+void WiFiDisplayMediaServiceImpl::BindToRequest(
+ WiFiDisplayMediaServiceRequest request) {
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ base::Bind(WiFiDisplayMediaServiceImpl::Create,
+ base::Passed(std::move(request))));
+}
+
+WiFiDisplayMediaServiceImpl::WiFiDisplayMediaServiceImpl(
+ WiFiDisplayMediaServiceRequest request)
+ : binding_(this, std::move(request)),
+ last_send_code_(net::OK),
+ weak_factory_(this) {}
+
+WiFiDisplayMediaServiceImpl::~WiFiDisplayMediaServiceImpl() {}
+
+void WiFiDisplayMediaServiceImpl::SetDesinationPoint(
+ const mojo::String& ip_address,
+ int32_t port,
+ const SetDesinationPointCallback& callback) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ net::IPAddress address;
+ if (!address.AssignFromIPLiteral(std::string(ip_address))) {
+ DVLOG(1) << "Failed to parse IP address from " << ip_address;
+ callback.Run(false);
+ return;
+ }
+ net::IPEndPoint end_point(address, static_cast<uint16_t>(port));
+
+ rtp_socket_.reset(new net::UDPSocket(net::DatagramSocket::DEFAULT_BIND,
+ net::RandIntCallback(), nullptr,
+ net::NetLog::Source()));
+ if (rtp_socket_->Open(end_point.GetFamily()) != net::OK ||
+ rtp_socket_->Connect(end_point) != net::OK) {
+ DVLOG(1) << "Could not connect to " << end_point.ToString();
+ callback.Run(false);
+ rtp_socket_.reset();
+ return;
+ }
+ callback.Run(true);
+}
+
+void WiFiDisplayMediaServiceImpl::SendMediaPacket(mojo::Array<uint8_t> packet) {
+ DCHECK(rtp_socket_);
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+
+ if (packet.size() >> 15) {
+ DVLOG(1) << "Packet size limit is exceeded, skipping.";
+ return;
+ }
+
+ if (last_send_code_ == net::ERR_IO_PENDING) {
+ VLOG(1) << "Cannot send because of pending IO, skipping";
+ return;
+ }
+
+ // Create, queue and send a write buffer.
+ scoped_refptr<PacketIOBuffer> write_buffer =
+ new PacketIOBuffer(std::move(packet));
+ write_buffers_.push(std::move(write_buffer));
+
+ Send();
+}
+
+void WiFiDisplayMediaServiceImpl::Send() {
+ DCHECK(!write_buffers_.empty());
+ last_send_code_ = rtp_socket_->Write(
+ write_buffers_.front().get(), write_buffers_.front()->size(),
+ base::Bind(&WiFiDisplayMediaServiceImpl::OnSent,
+ weak_factory_.GetWeakPtr()));
+ if (last_send_code_ != net::ERR_IO_PENDING)
+ OnSent(last_send_code_);
+}
+
+void WiFiDisplayMediaServiceImpl::OnSent(int code) {
+ last_send_code_ = code;
+ if (code < 0) {
+ VLOG(1) << "Unrepairable UDP socket error.";
+ delete this;
+ return;
+ }
+ DCHECK(!write_buffers_.empty());
+ write_buffers_.pop();
+ if (!write_buffers_.empty())
+ Send();
+}
+
+} // namespace extensions
diff --git a/chromium/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.h b/chromium/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.h
new file mode 100644
index 00000000000..c44f93e2f52
--- /dev/null
+++ b/chromium/extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.h
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_MEDIA_SERVICE_IMPL_H_
+#define EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_MEDIA_SERVICE_IMPL_H_
+
+#include <memory>
+#include <queue>
+
+#include "extensions/common/mojo/wifi_display_session_service.mojom.h"
+#include "mojo/public/cpp/bindings/array.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "net/base/io_buffer.h"
+#include "net/base/ip_endpoint.h"
+#include "net/udp/udp_socket.h"
+
+namespace extensions {
+
+class WiFiDisplayMediaServiceImpl : public WiFiDisplayMediaService {
+ public:
+ ~WiFiDisplayMediaServiceImpl() override;
+ static void BindToRequest(WiFiDisplayMediaServiceRequest request);
+
+ void SetDesinationPoint(const mojo::String& ip_address,
+ int32_t port,
+ const SetDesinationPointCallback& callback) override;
+ void SendMediaPacket(mojo::Array<uint8_t> packet) override;
+
+ private:
+ static void Create(WiFiDisplayMediaServiceRequest request);
+ explicit WiFiDisplayMediaServiceImpl(WiFiDisplayMediaServiceRequest request);
+ void Send();
+ void OnSent(int code);
+ mojo::StrongBinding<WiFiDisplayMediaService> binding_;
+ std::unique_ptr<net::UDPSocket> rtp_socket_;
+ class PacketIOBuffer;
+ std::queue<scoped_refptr<PacketIOBuffer>> write_buffers_;
+ int last_send_code_;
+ base::WeakPtrFactory<WiFiDisplayMediaServiceImpl> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(WiFiDisplayMediaServiceImpl);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_API_DISPLAY_SOURCE_WIFI_DISPLAY_WIFI_DISPLAY_MEDIA_SERVICE_IMPL_H_
diff --git a/chromium/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.cc b/chromium/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.cc
index 8143512f325..7a402b97b4f 100644
--- a/chromium/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.cc
+++ b/chromium/extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.cc
@@ -79,7 +79,7 @@ void WiFiDisplaySessionServiceImpl::Connect(int32_t sink_id,
if (auth_method != AUTHENTICATION_METHOD_NONE) {
DCHECK(auth_method <= AUTHENTICATION_METHOD_LAST);
auth_info.method = static_cast<AuthenticationMethod>(auth_method);
- auth_info.data = scoped_ptr<std::string>(new std::string(auth_data));
+ auth_info.data = std::unique_ptr<std::string>(new std::string(auth_data));
}
auto on_error = base::Bind(&WiFiDisplaySessionServiceImpl::OnConnectFailed,
weak_factory_.GetWeakPtr(), sink_id);
@@ -157,7 +157,8 @@ void WiFiDisplaySessionServiceImpl::OnSinksUpdated(
auto on_message = base::Bind(&WiFiDisplaySessionServiceImpl::OnSinkMessage,
weak_factory_.GetWeakPtr());
connection->SetMessageReceivedCallback(on_message);
- client_->OnConnected(connection->GetLocalAddress());
+ client_->OnConnected(connection->GetLocalAddress(),
+ connection->GetSinkAddress());
}
if (actual_state == SINK_STATE_DISCONNECTED) {
diff --git a/chromium/extensions/browser/api/dns/dns_api.cc b/chromium/extensions/browser/api/dns/dns_api.cc
index 5513e3a081e..671254ba402 100644
--- a/chromium/extensions/browser/api/dns/dns_api.cc
+++ b/chromium/extensions/browser/api/dns/dns_api.cc
@@ -31,7 +31,7 @@ DnsResolveFunction::DnsResolveFunction()
DnsResolveFunction::~DnsResolveFunction() {}
bool DnsResolveFunction::RunAsync() {
- scoped_ptr<Resolve::Params> params(Resolve::Params::Create(*args_));
+ std::unique_ptr<Resolve::Params> params(Resolve::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
hostname_ = params->hostname;
@@ -80,7 +80,7 @@ void DnsResolveFunction::RespondOnUIThread() {
}
void DnsResolveFunction::OnLookupFinished(int resolve_result) {
- scoped_ptr<ResolveCallbackResolveInfo> resolve_info(
+ std::unique_ptr<ResolveCallbackResolveInfo> resolve_info(
new ResolveCallbackResolveInfo());
resolve_info->result_code = resolve_result;
if (resolve_result == net::OK) {
diff --git a/chromium/extensions/browser/api/dns/dns_api.h b/chromium/extensions/browser/api/dns/dns_api.h
index a8947ead2dd..ca82c86b076 100644
--- a/chromium/extensions/browser/api/dns/dns_api.h
+++ b/chromium/extensions/browser/api/dns/dns_api.h
@@ -43,8 +43,8 @@ class DnsResolveFunction : public AsyncExtensionFunction {
bool response_; // The value sent in SendResponse().
- scoped_ptr<net::HostResolver::RequestHandle> request_handle_;
- scoped_ptr<net::AddressList> addresses_;
+ std::unique_ptr<net::HostResolver::RequestHandle> request_handle_;
+ std::unique_ptr<net::AddressList> addresses_;
};
} // namespace extensions
diff --git a/chromium/extensions/browser/api/dns/dns_apitest.cc b/chromium/extensions/browser/api/dns/dns_apitest.cc
index 24586f9dafb..8cb1015f6d7 100644
--- a/chromium/extensions/browser/api/dns/dns_apitest.cc
+++ b/chromium/extensions/browser/api/dns/dns_apitest.cc
@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
+
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/test_utils.h"
@@ -51,7 +52,7 @@ IN_PROC_BROWSER_TEST_F(DnsApiTest, DnsResolveIPLiteral) {
resolve_function->set_extension(empty_extension.get());
resolve_function->set_has_callback(true);
- scoped_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
resolve_function.get(), "[\"127.0.0.1\"]", browser_context()));
base::DictionaryValue* dict = NULL;
ASSERT_TRUE(result->GetAsDictionary(&dict));
@@ -75,7 +76,7 @@ IN_PROC_BROWSER_TEST_F(DnsApiTest, DnsResolveHostname) {
std::string function_arguments("[\"");
function_arguments += MockHostResolverCreator::kHostname;
function_arguments += "\"]";
- scoped_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
resolve_function.get(), function_arguments, browser_context()));
base::DictionaryValue* dict = NULL;
ASSERT_TRUE(result->GetAsDictionary(&dict));
diff --git a/chromium/extensions/browser/api/document_scan/document_scan_api.h b/chromium/extensions/browser/api/document_scan/document_scan_api.h
index efd0443ceff..f08aa99ac87 100644
--- a/chromium/extensions/browser/api/document_scan/document_scan_api.h
+++ b/chromium/extensions/browser/api/document_scan/document_scan_api.h
@@ -5,11 +5,11 @@
#ifndef EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
#define EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_API_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/async_api_function.h"
#include "extensions/browser/api/document_scan/document_scan_interface.h"
#include "extensions/common/api/document_scan.h"
@@ -42,8 +42,8 @@ class DocumentScanScanFunction : public AsyncApiFunction {
const std::string& mime_type,
const std::string& error);
- scoped_ptr<document_scan::Scan::Params> params_;
- scoped_ptr<DocumentScanInterface> document_scan_interface_;
+ std::unique_ptr<document_scan::Scan::Params> params_;
+ std::unique_ptr<DocumentScanInterface> document_scan_interface_;
DISALLOW_COPY_AND_ASSIGN(DocumentScanScanFunction);
};
diff --git a/chromium/extensions/browser/api/document_scan/document_scan_api_unittest.cc b/chromium/extensions/browser/api/document_scan/document_scan_api_unittest.cc
index ddc4e4dd53f..9a092366f2b 100644
--- a/chromium/extensions/browser/api/document_scan/document_scan_api_unittest.cc
+++ b/chromium/extensions/browser/api/document_scan/document_scan_api_unittest.cc
@@ -106,7 +106,7 @@ TEST_F(DocumentScanScanFunctionTest, Success) {
EXPECT_CALL(*document_scan_interface_, Scan(_, _, _, _))
.WillOnce(InvokeScanCallback(kScanData, kMimeType, ""));
function_->set_user_gesture(true);
- scoped_ptr<base::DictionaryValue> result(
+ std::unique_ptr<base::DictionaryValue> result(
RunFunctionAndReturnDictionary(function_, "[{}]"));
ASSERT_NE(nullptr, result.get());
document_scan::ScanResults scan_results;
diff --git a/chromium/extensions/browser/api/document_scan/document_scan_interface.h b/chromium/extensions/browser/api/document_scan/document_scan_interface.h
index dbcee196b23..2fb9d4f8785 100644
--- a/chromium/extensions/browser/api/document_scan/document_scan_interface.h
+++ b/chromium/extensions/browser/api/document_scan/document_scan_interface.h
@@ -5,11 +5,11 @@
#ifndef EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_
#define EXTENSIONS_BROWSER_API_DOCUMENT_SCAN_DOCUMENT_SCAN_INTERFACE_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
namespace extensions {
diff --git a/chromium/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc b/chromium/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc
index 4de0597ddc8..3ca4499b158 100644
--- a/chromium/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc
+++ b/chromium/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc
@@ -41,7 +41,7 @@ class DocumentScanInterfaceChromeosTest : public testing::Test {
protected:
DocumentScanInterfaceChromeos scan_interface_;
- scoped_ptr<chromeos::MockLorgnetteManagerClient> client_;
+ std::unique_ptr<chromeos::MockLorgnetteManagerClient> client_;
};
ACTION_P2(InvokeListScannersCallback, scanner_list, error) {
diff --git a/chromium/extensions/browser/api/execute_code_function.cc b/chromium/extensions/browser/api/execute_code_function.cc
index 53fcb44a47e..9571a0dcb7b 100644
--- a/chromium/extensions/browser/api/execute_code_function.cc
+++ b/chromium/extensions/browser/api/execute_code_function.cc
@@ -84,7 +84,7 @@ void ExecuteCodeFunction::GetFileURLAndLocalizeCSS(
// Check if the file is CSS and needs localization.
if ((script_type == ScriptExecutor::CSS) && !extension_id.empty() &&
(data.find(MessageBundle::kMessageBegin) != std::string::npos)) {
- scoped_ptr<SubstitutionMap> localization_messages(
+ std::unique_ptr<SubstitutionMap> localization_messages(
file_util::LoadMessageBundleSubstitutionMap(
extension_path, extension_id, extension_default_locale));
diff --git a/chromium/extensions/browser/api/execute_code_function.h b/chromium/extensions/browser/api/execute_code_function.h
index bf984f48dd8..d7d965f9e9c 100644
--- a/chromium/extensions/browser/api/execute_code_function.h
+++ b/chromium/extensions/browser/api/execute_code_function.h
@@ -50,7 +50,7 @@ class ExecuteCodeFunction : public AsyncExtensionFunction {
}
// The injection details.
- scoped_ptr<api::extension_types::InjectDetails> details_;
+ std::unique_ptr<api::extension_types::InjectDetails> details_;
private:
// Called when contents from the file whose path is specified in JSON
diff --git a/chromium/extensions/browser/api/extensions_api_client.cc b/chromium/extensions/browser/api/extensions_api_client.cc
index bfc08d3dae3..18ee9d63db0 100644
--- a/chromium/extensions/browser/api/extensions_api_client.cc
+++ b/chromium/extensions/browser/api/extensions_api_client.cc
@@ -5,6 +5,7 @@
#include "extensions/browser/api/extensions_api_client.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "extensions/browser/api/device_permissions_prompt.h"
#include "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_delegate.h"
#include "extensions/browser/api/web_request/web_request_event_router_delegate.h"
@@ -47,16 +48,16 @@ ExtensionsAPIClient::CreateExtensionOptionsGuestDelegate(
return NULL;
}
-scoped_ptr<guest_view::GuestViewManagerDelegate>
+std::unique_ptr<guest_view::GuestViewManagerDelegate>
ExtensionsAPIClient::CreateGuestViewManagerDelegate(
content::BrowserContext* context) const {
- return make_scoped_ptr(new ExtensionsGuestViewManagerDelegate(context));
+ return base::WrapUnique(new ExtensionsGuestViewManagerDelegate(context));
}
-scoped_ptr<MimeHandlerViewGuestDelegate>
+std::unique_ptr<MimeHandlerViewGuestDelegate>
ExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
MimeHandlerViewGuest* guest) const {
- return scoped_ptr<MimeHandlerViewGuestDelegate>();
+ return std::unique_ptr<MimeHandlerViewGuestDelegate>();
}
WebViewGuestDelegate* ExtensionsAPIClient::CreateWebViewGuestDelegate(
@@ -82,13 +83,13 @@ ExtensionsAPIClient::CreateContentRulesRegistry(
return scoped_refptr<ContentRulesRegistry>();
}
-scoped_ptr<DevicePermissionsPrompt>
+std::unique_ptr<DevicePermissionsPrompt>
ExtensionsAPIClient::CreateDevicePermissionsPrompt(
content::WebContents* web_contents) const {
return nullptr;
}
-scoped_ptr<VirtualKeyboardDelegate>
+std::unique_ptr<VirtualKeyboardDelegate>
ExtensionsAPIClient::CreateVirtualKeyboardDelegate() const {
return nullptr;
}
diff --git a/chromium/extensions/browser/api/extensions_api_client.h b/chromium/extensions/browser/api/extensions_api_client.h
index d68174d935d..af805402111 100644
--- a/chromium/extensions/browser/api/extensions_api_client.h
+++ b/chromium/extensions/browser/api/extensions_api_client.h
@@ -6,9 +6,9 @@
#define EXTENSIONS_BROWSER_API_EXTENSIONS_API_CLIENT_H_
#include <map>
+#include <memory>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/declarative_content/content_rules_registry.h"
#include "extensions/browser/api/storage/settings_namespace.h"
@@ -88,12 +88,12 @@ class ExtensionsAPIClient {
ExtensionOptionsGuest* guest) const;
// Returns a delegate for GuestViewManagerDelegate.
- virtual scoped_ptr<guest_view::GuestViewManagerDelegate>
+ virtual std::unique_ptr<guest_view::GuestViewManagerDelegate>
CreateGuestViewManagerDelegate(content::BrowserContext* context) const;
// Creates a delegate for MimeHandlerViewGuest.
- virtual scoped_ptr<MimeHandlerViewGuestDelegate>
- CreateMimeHandlerViewGuestDelegate(MimeHandlerViewGuest* guest) const;
+ virtual std::unique_ptr<MimeHandlerViewGuestDelegate>
+ CreateMimeHandlerViewGuestDelegate(MimeHandlerViewGuest* guest) const;
// Returns a delegate for some of WebViewGuest's behavior. The caller owns the
// returned WebViewGuestDelegate.
@@ -117,12 +117,12 @@ class ExtensionsAPIClient {
RulesCacheDelegate* cache_delegate) const;
// Creates a DevicePermissionsPrompt appropriate for the embedder.
- virtual scoped_ptr<DevicePermissionsPrompt> CreateDevicePermissionsPrompt(
- content::WebContents* web_contents) const;
+ virtual std::unique_ptr<DevicePermissionsPrompt>
+ CreateDevicePermissionsPrompt(content::WebContents* web_contents) const;
// Returns a delegate for some of VirtualKeyboardAPI's behavior.
- virtual scoped_ptr<VirtualKeyboardDelegate> CreateVirtualKeyboardDelegate()
- const;
+ virtual std::unique_ptr<VirtualKeyboardDelegate>
+ CreateVirtualKeyboardDelegate() const;
// Creates a delegate for handling the management extension api.
virtual ManagementAPIDelegate* CreateManagementAPIDelegate() const;
diff --git a/chromium/extensions/browser/api/guest_view/app_view/app_view_guest_internal_api.cc b/chromium/extensions/browser/api/guest_view/app_view/app_view_guest_internal_api.cc
index bacf7cd1c8f..0f15d9accea 100644
--- a/chromium/extensions/browser/api/guest_view/app_view/app_view_guest_internal_api.cc
+++ b/chromium/extensions/browser/api/guest_view/app_view/app_view_guest_internal_api.cc
@@ -17,7 +17,7 @@ AppViewGuestInternalAttachFrameFunction::
}
bool AppViewGuestInternalAttachFrameFunction::RunAsync() {
- scoped_ptr<appview::AttachFrame::Params> params(
+ std::unique_ptr<appview::AttachFrame::Params> params(
appview::AttachFrame::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -34,7 +34,7 @@ AppViewGuestInternalDenyRequestFunction::
}
bool AppViewGuestInternalDenyRequestFunction::RunAsync() {
- scoped_ptr<appview::DenyRequest::Params> params(
+ std::unique_ptr<appview::DenyRequest::Params> params(
appview::DenyRequest::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chromium/extensions/browser/api/guest_view/extension_view/extension_view_internal_api.cc b/chromium/extensions/browser/api/guest_view/extension_view/extension_view_internal_api.cc
index 878c4b583b1..53e31849d11 100644
--- a/chromium/extensions/browser/api/guest_view/extension_view/extension_view_internal_api.cc
+++ b/chromium/extensions/browser/api/guest_view/extension_view/extension_view_internal_api.cc
@@ -51,7 +51,7 @@ bool IsSrcValid(GURL src) {
bool ExtensionViewInternalLoadSrcFunction::RunAsyncSafe(
ExtensionViewGuest* guest) {
- scoped_ptr<extensionview::LoadSrc::Params> params(
+ std::unique_ptr<extensionview::LoadSrc::Params> params(
extensionview::LoadSrc::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
std::string src = params->src;
@@ -69,7 +69,7 @@ bool ExtensionViewInternalLoadSrcFunction::RunAsyncSafe(
}
bool ExtensionViewInternalParseSrcFunction::RunAsync() {
- scoped_ptr<extensionview::ParseSrc::Params> params(
+ std::unique_ptr<extensionview::ParseSrc::Params> params(
extensionview::ParseSrc::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
GURL url(params->src);
@@ -77,7 +77,7 @@ bool ExtensionViewInternalParseSrcFunction::RunAsync() {
// Return whether the src is valid and the current extension ID to
// the callback.
- scoped_ptr<base::ListValue> result_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> result_list(new base::ListValue());
result_list->AppendBoolean(is_src_valid);
result_list->AppendString(url.host());
SetResultList(std::move(result_list));
diff --git a/chromium/extensions/browser/api/guest_view/guest_view_internal_api.cc b/chromium/extensions/browser/api/guest_view/guest_view_internal_api.cc
index 6a60f566b7d..cfd2d0ea65e 100644
--- a/chromium/extensions/browser/api/guest_view/guest_view_internal_api.cc
+++ b/chromium/extensions/browser/api/guest_view/guest_view_internal_api.cc
@@ -73,7 +73,8 @@ void GuestViewInternalCreateGuestFunction::CreateGuestCallback(
guest_instance_id = guest->guest_instance_id();
content_window_id = guest->proxy_routing_id();
}
- scoped_ptr<base::DictionaryValue> return_params(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> return_params(
+ new base::DictionaryValue());
return_params->SetInteger(guest_view::kID, guest_instance_id);
return_params->SetInteger(guest_view::kContentWindowID, content_window_id);
SetResult(return_params.release());
@@ -89,7 +90,7 @@ GuestViewInternalDestroyGuestFunction::
}
bool GuestViewInternalDestroyGuestFunction::RunAsync() {
- scoped_ptr<guest_view_internal::DestroyGuest::Params> params(
+ std::unique_ptr<guest_view_internal::DestroyGuest::Params> params(
guest_view_internal::DestroyGuest::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
GuestViewBase* guest = GuestViewBase::From(
@@ -108,7 +109,7 @@ GuestViewInternalSetSizeFunction::~GuestViewInternalSetSizeFunction() {
}
bool GuestViewInternalSetSizeFunction::RunAsync() {
- scoped_ptr<guest_view_internal::SetSize::Params> params(
+ std::unique_ptr<guest_view_internal::SetSize::Params> params(
guest_view_internal::SetSize::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
GuestViewBase* guest = GuestViewBase::From(
diff --git a/chromium/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc b/chromium/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
index e33962dbe2e..f1ffb063ee9 100644
--- a/chromium/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
+++ b/chromium/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
@@ -266,11 +266,11 @@ bool WebViewInternalCaptureVisibleRegionFunction::RunAsyncSafe(
WebViewGuest* guest) {
using api::extension_types::ImageDetails;
- scoped_ptr<web_view_internal::CaptureVisibleRegion::Params> params(
+ std::unique_ptr<web_view_internal::CaptureVisibleRegion::Params> params(
web_view_internal::CaptureVisibleRegion::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
- scoped_ptr<ImageDetails> image_details;
+ std::unique_ptr<ImageDetails> image_details;
if (args_->GetSize() > 1) {
base::Value* spec = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &spec) && spec);
@@ -324,7 +324,7 @@ void WebViewInternalCaptureVisibleRegionFunction::OnCaptureFailure(
}
bool WebViewInternalNavigateFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::Navigate::Params> params(
+ std::unique_ptr<web_view_internal::Navigate::Params> params(
web_view_internal::Navigate::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
std::string src = params->src;
@@ -362,7 +362,7 @@ bool WebViewInternalExecuteCodeFunction::Init() {
base::DictionaryValue* details_value = NULL;
if (!args_->GetDictionary(2, &details_value))
return false;
- scoped_ptr<InjectDetails> details(new InjectDetails());
+ std::unique_ptr<InjectDetails> details(new InjectDetails());
if (!InjectDetails::Populate(*details_value, details.get()))
return false;
@@ -476,7 +476,7 @@ WebViewInternalAddContentScriptsFunction::
ExecuteCodeFunction::ResponseAction
WebViewInternalAddContentScriptsFunction::Run() {
- scoped_ptr<web_view_internal::AddContentScripts::Params> params(
+ std::unique_ptr<web_view_internal::AddContentScripts::Params> params(
web_view_internal::AddContentScripts::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -516,7 +516,7 @@ WebViewInternalRemoveContentScriptsFunction::
ExecuteCodeFunction::ResponseAction
WebViewInternalRemoveContentScriptsFunction::Run() {
- scoped_ptr<web_view_internal::RemoveContentScripts::Params> params(
+ std::unique_ptr<web_view_internal::RemoveContentScripts::Params> params(
web_view_internal::RemoveContentScripts::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -546,7 +546,7 @@ WebViewInternalSetNameFunction::~WebViewInternalSetNameFunction() {
}
bool WebViewInternalSetNameFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::SetName::Params> params(
+ std::unique_ptr<web_view_internal::SetName::Params> params(
web_view_internal::SetName::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
guest->SetName(params->frame_name);
@@ -564,7 +564,7 @@ WebViewInternalSetAllowTransparencyFunction::
bool WebViewInternalSetAllowTransparencyFunction::RunAsyncSafe(
WebViewGuest* guest) {
- scoped_ptr<web_view_internal::SetAllowTransparency::Params> params(
+ std::unique_ptr<web_view_internal::SetAllowTransparency::Params> params(
web_view_internal::SetAllowTransparency::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
guest->SetAllowTransparency(params->allow);
@@ -581,7 +581,7 @@ WebViewInternalSetAllowScalingFunction::
}
bool WebViewInternalSetAllowScalingFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::SetAllowScaling::Params> params(
+ std::unique_ptr<web_view_internal::SetAllowScaling::Params> params(
web_view_internal::SetAllowScaling::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
guest->SetAllowScaling(params->allow);
@@ -596,7 +596,7 @@ WebViewInternalSetZoomFunction::~WebViewInternalSetZoomFunction() {
}
bool WebViewInternalSetZoomFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::SetZoom::Params> params(
+ std::unique_ptr<web_view_internal::SetZoom::Params> params(
web_view_internal::SetZoom::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
guest->SetZoom(params->zoom_factor);
@@ -612,7 +612,7 @@ WebViewInternalGetZoomFunction::~WebViewInternalGetZoomFunction() {
}
bool WebViewInternalGetZoomFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::GetZoom::Params> params(
+ std::unique_ptr<web_view_internal::GetZoom::Params> params(
web_view_internal::GetZoom::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -629,7 +629,7 @@ WebViewInternalSetZoomModeFunction::~WebViewInternalSetZoomModeFunction() {
}
bool WebViewInternalSetZoomModeFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::SetZoomMode::Params> params(
+ std::unique_ptr<web_view_internal::SetZoomMode::Params> params(
web_view_internal::SetZoomMode::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -661,7 +661,7 @@ WebViewInternalGetZoomModeFunction::~WebViewInternalGetZoomModeFunction() {
}
bool WebViewInternalGetZoomModeFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::GetZoomMode::Params> params(
+ std::unique_ptr<web_view_internal::GetZoomMode::Params> params(
web_view_internal::GetZoomMode::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -692,7 +692,7 @@ WebViewInternalFindFunction::~WebViewInternalFindFunction() {
}
bool WebViewInternalFindFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::Find::Params> params(
+ std::unique_ptr<web_view_internal::Find::Params> params(
web_view_internal::Find::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -721,7 +721,7 @@ WebViewInternalStopFindingFunction::~WebViewInternalStopFindingFunction() {
}
bool WebViewInternalStopFindingFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::StopFinding::Params> params(
+ std::unique_ptr<web_view_internal::StopFinding::Params> params(
web_view_internal::StopFinding::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -755,7 +755,7 @@ WebViewInternalLoadDataWithBaseUrlFunction::
bool WebViewInternalLoadDataWithBaseUrlFunction::RunAsyncSafe(
WebViewGuest* guest) {
- scoped_ptr<web_view_internal::LoadDataWithBaseUrl::Params> params(
+ std::unique_ptr<web_view_internal::LoadDataWithBaseUrl::Params> params(
web_view_internal::LoadDataWithBaseUrl::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -777,7 +777,7 @@ WebViewInternalGoFunction::~WebViewInternalGoFunction() {
}
bool WebViewInternalGoFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::Go::Params> params(
+ std::unique_ptr<web_view_internal::Go::Params> params(
web_view_internal::Go::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -805,7 +805,7 @@ WebViewInternalSetPermissionFunction::~WebViewInternalSetPermissionFunction() {
}
bool WebViewInternalSetPermissionFunction::RunAsyncSafe(WebViewGuest* guest) {
- scoped_ptr<web_view_internal::SetPermission::Params> params(
+ std::unique_ptr<web_view_internal::SetPermission::Params> params(
web_view_internal::SetPermission::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -854,7 +854,7 @@ WebViewInternalOverrideUserAgentFunction::
bool WebViewInternalOverrideUserAgentFunction::RunAsyncSafe(
WebViewGuest* guest) {
- scoped_ptr<web_view_internal::OverrideUserAgent::Params> params(
+ std::unique_ptr<web_view_internal::OverrideUserAgent::Params> params(
web_view_internal::OverrideUserAgent::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chromium/extensions/browser/api/guest_view/web_view/web_view_internal_api.h b/chromium/extensions/browser/api/guest_view/web_view/web_view_internal_api.h
index 9f646e69721..54156f16f32 100644
--- a/chromium/extensions/browser/api/guest_view/web_view/web_view_internal_api.h
+++ b/chromium/extensions/browser/api/guest_view/web_view/web_view_internal_api.h
@@ -111,7 +111,7 @@ class WebViewInternalExecuteCodeFunction
GURL guest_src_;
- scoped_ptr<WebUIURLFetcher> url_fetcher_;
+ std::unique_ptr<WebUIURLFetcher> url_fetcher_;
DISALLOW_COPY_AND_ASSIGN(WebViewInternalExecuteCodeFunction);
};
diff --git a/chromium/extensions/browser/api/hid/hid_api.cc b/chromium/extensions/browser/api/hid/hid_api.cc
index 841795db2c4..bbf59b8746d 100644
--- a/chromium/extensions/browser/api/hid/hid_api.cc
+++ b/chromium/extensions/browser/api/hid/hid_api.cc
@@ -88,7 +88,7 @@ HidGetDevicesFunction::HidGetDevicesFunction() {}
HidGetDevicesFunction::~HidGetDevicesFunction() {}
ExtensionFunction::ResponseAction HidGetDevicesFunction::Run() {
- scoped_ptr<api::hid::GetDevices::Params> parameters =
+ std::unique_ptr<api::hid::GetDevices::Params> parameters =
hid::GetDevices::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters);
@@ -118,7 +118,7 @@ ExtensionFunction::ResponseAction HidGetDevicesFunction::Run() {
}
void HidGetDevicesFunction::OnEnumerationComplete(
- scoped_ptr<base::ListValue> devices) {
+ std::unique_ptr<base::ListValue> devices) {
Respond(OneArgument(devices.release()));
}
@@ -129,7 +129,7 @@ HidGetUserSelectedDevicesFunction::~HidGetUserSelectedDevicesFunction() {
}
ExtensionFunction::ResponseAction HidGetUserSelectedDevicesFunction::Run() {
- scoped_ptr<api::hid::GetUserSelectedDevices::Params> parameters =
+ std::unique_ptr<api::hid::GetUserSelectedDevices::Params> parameters =
hid::GetUserSelectedDevices::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters);
@@ -173,7 +173,7 @@ HidConnectFunction::HidConnectFunction() : connection_manager_(nullptr) {
HidConnectFunction::~HidConnectFunction() {}
ExtensionFunction::ResponseAction HidConnectFunction::Run() {
- scoped_ptr<api::hid::Connect::Params> parameters =
+ std::unique_ptr<api::hid::Connect::Params> parameters =
hid::Connect::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters);
@@ -221,7 +221,7 @@ HidDisconnectFunction::HidDisconnectFunction() {}
HidDisconnectFunction::~HidDisconnectFunction() {}
ExtensionFunction::ResponseAction HidDisconnectFunction::Run() {
- scoped_ptr<api::hid::Disconnect::Params> parameters =
+ std::unique_ptr<api::hid::Disconnect::Params> parameters =
hid::Disconnect::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters);
diff --git a/chromium/extensions/browser/api/hid/hid_api.h b/chromium/extensions/browser/api/hid/hid_api.h
index 99824696f9b..095a05b77b4 100644
--- a/chromium/extensions/browser/api/hid/hid_api.h
+++ b/chromium/extensions/browser/api/hid/hid_api.h
@@ -7,11 +7,11 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/browser/api/hid/hid_connection_resource.h"
#include "extensions/browser/api/hid/hid_device_manager.h"
@@ -44,7 +44,7 @@ class HidGetDevicesFunction : public UIThreadExtensionFunction {
// ExtensionFunction:
ResponseAction Run() override;
- void OnEnumerationComplete(scoped_ptr<base::ListValue> devices);
+ void OnEnumerationComplete(std::unique_ptr<base::ListValue> devices);
DISALLOW_COPY_AND_ASSIGN(HidGetDevicesFunction);
};
@@ -65,8 +65,7 @@ class HidGetUserSelectedDevicesFunction : public UIThreadExtensionFunction {
void OnDevicesChosen(
const std::vector<scoped_refptr<device::HidDeviceInfo>>& devices);
- HidDeviceManager* device_manager_;
- scoped_ptr<DevicePermissionsPrompt> prompt_;
+ std::unique_ptr<DevicePermissionsPrompt> prompt_;
DISALLOW_COPY_AND_ASSIGN(HidGetUserSelectedDevicesFunction);
};
@@ -143,7 +142,7 @@ class HidReceiveFunction : public HidConnectionIoFunction {
scoped_refptr<net::IOBuffer> buffer,
size_t size);
- scoped_ptr<api::hid::Receive::Params> parameters_;
+ std::unique_ptr<api::hid::Receive::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(HidReceiveFunction);
};
@@ -163,7 +162,7 @@ class HidSendFunction : public HidConnectionIoFunction {
void OnFinished(bool success);
- scoped_ptr<api::hid::Send::Params> parameters_;
+ std::unique_ptr<api::hid::Send::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(HidSendFunction);
};
@@ -186,7 +185,7 @@ class HidReceiveFeatureReportFunction : public HidConnectionIoFunction {
scoped_refptr<net::IOBuffer> buffer,
size_t size);
- scoped_ptr<api::hid::ReceiveFeatureReport::Params> parameters_;
+ std::unique_ptr<api::hid::ReceiveFeatureReport::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(HidReceiveFeatureReportFunction);
};
@@ -206,7 +205,7 @@ class HidSendFeatureReportFunction : public HidConnectionIoFunction {
void OnFinished(bool success);
- scoped_ptr<api::hid::SendFeatureReport::Params> parameters_;
+ std::unique_ptr<api::hid::SendFeatureReport::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(HidSendFeatureReportFunction);
};
diff --git a/chromium/extensions/browser/api/hid/hid_apitest.cc b/chromium/extensions/browser/api/hid/hid_apitest.cc
index 706419dd393..3fb9357af3a 100644
--- a/chromium/extensions/browser/api/hid/hid_apitest.cc
+++ b/chromium/extensions/browser/api/hid/hid_apitest.cc
@@ -6,8 +6,9 @@
#include <stdint.h>
#include "base/bind.h"
+#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "device/core/mock_device_client.h"
#include "device/hid/hid_collection_info.h"
@@ -147,9 +148,9 @@ class TestExtensionsAPIClient : public ShellExtensionsAPIClient {
public:
TestExtensionsAPIClient() : ShellExtensionsAPIClient() {}
- scoped_ptr<DevicePermissionsPrompt> CreateDevicePermissionsPrompt(
+ std::unique_ptr<DevicePermissionsPrompt> CreateDevicePermissionsPrompt(
content::WebContents* web_contents) const override {
- return make_scoped_ptr(new TestDevicePermissionsPrompt(web_contents));
+ return base::WrapUnique(new TestDevicePermissionsPrompt(web_contents));
}
};
@@ -207,7 +208,7 @@ class HidApiTest : public ShellApiTest {
}
protected:
- scoped_ptr<MockDeviceClient> device_client_;
+ std::unique_ptr<MockDeviceClient> device_client_;
};
IN_PROC_BROWSER_TEST_F(HidApiTest, HidApp) {
diff --git a/chromium/extensions/browser/api/hid/hid_device_manager.cc b/chromium/extensions/browser/api/hid/hid_device_manager.cc
index 11e1569ffe9..745813f4271 100644
--- a/chromium/extensions/browser/api/hid/hid_device_manager.cc
+++ b/chromium/extensions/browser/api/hid/hid_device_manager.cc
@@ -11,6 +11,7 @@
#include <vector>
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "device/core/device_client.h"
#include "device/hid/hid_device_filter.h"
#include "device/hid/hid_service.h"
@@ -121,20 +122,20 @@ void HidDeviceManager::GetApiDevices(
LazyInitialize();
if (enumeration_ready_) {
- scoped_ptr<base::ListValue> devices =
+ std::unique_ptr<base::ListValue> devices =
CreateApiDeviceList(extension, filters);
base::MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(callback, base::Passed(&devices)));
} else {
- pending_enumerations_.push_back(
- make_scoped_ptr(new GetApiDevicesParams(extension, filters, callback)));
+ pending_enumerations_.push_back(base::WrapUnique(
+ new GetApiDevicesParams(extension, filters, callback)));
}
}
-scoped_ptr<base::ListValue> HidDeviceManager::GetApiDevicesFromList(
+std::unique_ptr<base::ListValue> HidDeviceManager::GetApiDevicesFromList(
const std::vector<scoped_refptr<HidDeviceInfo>>& devices) {
DCHECK(thread_checker_.CalledOnValidThread());
- scoped_ptr<base::ListValue> device_list(new base::ListValue());
+ std::unique_ptr<base::ListValue> device_list(new base::ListValue());
for (const auto& device : devices) {
const auto device_entry = resource_ids_.find(device->device_id());
DCHECK(device_entry != resource_ids_.end());
@@ -224,7 +225,7 @@ void HidDeviceManager::OnDeviceAdded(scoped_refptr<HidDeviceInfo> device_info) {
PopulateHidDeviceInfo(&api_device_info, device_info);
if (api_device_info.collections.size() > 0) {
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
hid::OnDeviceAdded::Create(api_device_info));
DispatchEvent(events::HID_ON_DEVICE_ADDED, hid::OnDeviceAdded::kEventName,
std::move(args), device_info);
@@ -245,7 +246,8 @@ void HidDeviceManager::OnDeviceRemoved(
if (event_router_) {
DCHECK(enumeration_ready_);
- scoped_ptr<base::ListValue> args(hid::OnDeviceRemoved::Create(resource_id));
+ std::unique_ptr<base::ListValue> args(
+ hid::OnDeviceRemoved::Create(resource_id));
DispatchEvent(events::HID_ON_DEVICE_REMOVED,
hid::OnDeviceRemoved::kEventName, std::move(args),
device_info);
@@ -268,13 +270,13 @@ void HidDeviceManager::LazyInitialize() {
initialized_ = true;
}
-scoped_ptr<base::ListValue> HidDeviceManager::CreateApiDeviceList(
+std::unique_ptr<base::ListValue> HidDeviceManager::CreateApiDeviceList(
const Extension* extension,
const std::vector<HidDeviceFilter>& filters) {
HidService* hid_service = device::DeviceClient::Get()->GetHidService();
DCHECK(hid_service);
- scoped_ptr<base::ListValue> api_devices(new base::ListValue());
+ std::unique_ptr<base::ListValue> api_devices(new base::ListValue());
for (const ResourceIdToDeviceIdMap::value_type& map_entry : device_ids_) {
int resource_id = map_entry.first;
const HidDeviceId& device_id = map_entry.second;
@@ -317,18 +319,19 @@ void HidDeviceManager::OnEnumerationComplete(
enumeration_ready_ = true;
for (const auto& params : pending_enumerations_) {
- scoped_ptr<base::ListValue> devices =
+ std::unique_ptr<base::ListValue> devices =
CreateApiDeviceList(params->extension, params->filters);
params->callback.Run(std::move(devices));
}
pending_enumerations_.clear();
}
-void HidDeviceManager::DispatchEvent(events::HistogramValue histogram_value,
- const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
- scoped_refptr<HidDeviceInfo> device_info) {
- scoped_ptr<Event> event(
+void HidDeviceManager::DispatchEvent(
+ events::HistogramValue histogram_value,
+ const std::string& event_name,
+ std::unique_ptr<base::ListValue> event_args,
+ scoped_refptr<HidDeviceInfo> device_info) {
+ std::unique_ptr<Event> event(
new Event(histogram_value, event_name, std::move(event_args)));
event->will_dispatch_callback = base::Bind(
&WillDispatchDeviceEvent, weak_factory_.GetWeakPtr(), device_info);
diff --git a/chromium/extensions/browser/api/hid/hid_device_manager.h b/chromium/extensions/browser/api/hid/hid_device_manager.h
index 0e57e6f68f1..f75e59a0b0a 100644
--- a/chromium/extensions/browser/api/hid/hid_device_manager.h
+++ b/chromium/extensions/browser/api/hid/hid_device_manager.h
@@ -6,11 +6,11 @@
#define EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_
#include <map>
+#include <memory>
#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "base/threading/thread_checker.h"
#include "device/hid/hid_service.h"
@@ -34,7 +34,7 @@ class HidDeviceManager : public BrowserContextKeyedAPI,
public device::HidService::Observer,
public EventRouter::Observer {
public:
- typedef base::Callback<void(scoped_ptr<base::ListValue>)>
+ typedef base::Callback<void(std::unique_ptr<base::ListValue>)>
GetApiDevicesCallback;
explicit HidDeviceManager(content::BrowserContext* context);
@@ -58,7 +58,7 @@ class HidDeviceManager : public BrowserContextKeyedAPI,
// Converts a list of HidDeviceInfo objects into a value that can be returned
// through the API.
- scoped_ptr<base::ListValue> GetApiDevicesFromList(
+ std::unique_ptr<base::ListValue> GetApiDevicesFromList(
const std::vector<scoped_refptr<device::HidDeviceInfo>>& devices);
scoped_refptr<device::HidDeviceInfo> GetDeviceInfo(int resource_id);
@@ -101,7 +101,7 @@ class HidDeviceManager : public BrowserContextKeyedAPI,
// Builds a list of device info objects representing the currently enumerated
// devices, taking into account the permissions held by the given extension
// and the filters provided.
- scoped_ptr<base::ListValue> CreateApiDeviceList(
+ std::unique_ptr<base::ListValue> CreateApiDeviceList(
const Extension* extension,
const std::vector<device::HidDeviceFilter>& filters);
void OnEnumerationComplete(
@@ -109,7 +109,7 @@ class HidDeviceManager : public BrowserContextKeyedAPI,
void DispatchEvent(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
scoped_refptr<device::HidDeviceInfo> device_info);
base::ThreadChecker thread_checker_;
@@ -119,7 +119,7 @@ class HidDeviceManager : public BrowserContextKeyedAPI,
ScopedObserver<device::HidService, device::HidService::Observer>
hid_service_observer_;
bool enumeration_ready_ = false;
- std::vector<scoped_ptr<GetApiDevicesParams>> pending_enumerations_;
+ std::vector<std::unique_ptr<GetApiDevicesParams>> pending_enumerations_;
int next_resource_id_ = 0;
ResourceIdToDeviceIdMap device_ids_;
DeviceIdToResourceIdMap resource_ids_;
diff --git a/chromium/extensions/browser/api/idle/idle_api_unittest.cc b/chromium/extensions/browser/api/idle/idle_api_unittest.cc
index 7e3b5a82356..f73b83aff36 100644
--- a/chromium/extensions/browser/api/idle/idle_api_unittest.cc
+++ b/chromium/extensions/browser/api/idle/idle_api_unittest.cc
@@ -5,13 +5,15 @@
#include "extensions/browser/api/idle/idle_api.h"
#include <limits.h>
+
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "extensions/browser/api/idle/idle_api_constants.h"
-#include "extensions/browser/api/idle/idle_manager_factory.h"
#include "extensions/browser/api/idle/idle_manager.h"
+#include "extensions/browser/api/idle/idle_manager_factory.h"
#include "extensions/browser/api_unittest.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_registry.h"
@@ -112,9 +114,9 @@ ScopedListen::~ScopedListen() {
idle_manager_->OnListenerRemoved(details);
}
-scoped_ptr<KeyedService> IdleManagerTestFactory(
+std::unique_ptr<KeyedService> IdleManagerTestFactory(
content::BrowserContext* context) {
- return make_scoped_ptr(new IdleManager(context));
+ return base::WrapUnique(new IdleManager(context));
}
} // namespace
@@ -138,10 +140,10 @@ void IdleTest::SetUp() {
idle_provider_ = new TestIdleProvider();
idle_manager_->SetIdleTimeProviderForTest(
- scoped_ptr<IdleManager::IdleTimeProvider>(idle_provider_));
+ std::unique_ptr<IdleManager::IdleTimeProvider>(idle_provider_));
event_delegate_ = new testing::StrictMock<MockEventDelegate>();
idle_manager_->SetEventDelegateForTest(
- scoped_ptr<IdleManager::EventDelegate>(event_delegate_));
+ std::unique_ptr<IdleManager::EventDelegate>(event_delegate_));
idle_manager_->Init();
}
@@ -150,7 +152,7 @@ TEST_F(IdleTest, QueryLockedActive) {
idle_provider_->set_locked(true);
idle_provider_->set_idle_time(0);
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new IdleQueryStateFunction(), "[60]"));
std::string idle_state;
@@ -163,7 +165,7 @@ TEST_F(IdleTest, QueryLockedIdle) {
idle_provider_->set_locked(true);
idle_provider_->set_idle_time(INT_MAX);
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new IdleQueryStateFunction(), "[60]"));
std::string idle_state;
@@ -180,7 +182,7 @@ TEST_F(IdleTest, QueryActive) {
SCOPED_TRACE(time);
idle_provider_->set_idle_time(time);
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new IdleQueryStateFunction(), "[60]"));
std::string idle_state;
@@ -198,7 +200,7 @@ TEST_F(IdleTest, QueryIdle) {
SCOPED_TRACE(time);
idle_provider_->set_idle_time(time);
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new IdleQueryStateFunction(), "[60]"));
std::string idle_state;
@@ -219,7 +221,7 @@ TEST_F(IdleTest, QueryMinThreshold) {
idle_provider_->set_idle_time(time);
std::string args = "[" + base::IntToString(threshold) + "]";
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new IdleQueryStateFunction(), args));
std::string idle_state;
@@ -248,7 +250,7 @@ TEST_F(IdleTest, QueryMaxThreshold) {
idle_provider_->set_idle_time(time);
std::string args = "[" + base::IntToString(threshold) + "]";
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new IdleQueryStateFunction(), args));
std::string idle_state;
@@ -399,7 +401,7 @@ TEST_F(IdleTest, SetDetectionInterval) {
ScopedListen listen_default(idle_manager_, "default");
ScopedListen listen_extension(idle_manager_, extension()->id());
- scoped_ptr<base::Value> result45(RunFunctionAndReturnValue(
+ std::unique_ptr<base::Value> result45(RunFunctionAndReturnValue(
new IdleSetDetectionIntervalFunction(), "[45]"));
idle_provider_->set_locked(false);
@@ -422,7 +424,7 @@ TEST_F(IdleTest, SetDetectionInterval) {
// Verifies that setting the detection interval before creating the listener
// works correctly.
TEST_F(IdleTest, SetDetectionIntervalBeforeListener) {
- scoped_ptr<base::Value> result45(RunFunctionAndReturnValue(
+ std::unique_ptr<base::Value> result45(RunFunctionAndReturnValue(
new IdleSetDetectionIntervalFunction(), "[45]"));
ScopedListen listen_extension(idle_manager_, extension()->id());
@@ -442,7 +444,7 @@ TEST_F(IdleTest, SetDetectionIntervalBeforeListener) {
TEST_F(IdleTest, SetDetectionIntervalMaximum) {
ScopedListen listen_extension(idle_manager_, extension()->id());
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
RunFunctionAndReturnValue(new IdleSetDetectionIntervalFunction(),
"[18000]")); // five hours in seconds
@@ -461,7 +463,7 @@ TEST_F(IdleTest, SetDetectionIntervalMaximum) {
TEST_F(IdleTest, SetDetectionIntervalMinimum) {
ScopedListen listen_extension(idle_manager_, extension()->id());
- scoped_ptr<base::Value> result(RunFunctionAndReturnValue(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnValue(
new IdleSetDetectionIntervalFunction(), "[10]"));
idle_provider_->set_locked(false);
@@ -479,7 +481,7 @@ TEST_F(IdleTest, UnloadCleanup) {
{
ScopedListen listen(idle_manager_, extension()->id());
- scoped_ptr<base::Value> result45(RunFunctionAndReturnValue(
+ std::unique_ptr<base::Value> result45(RunFunctionAndReturnValue(
new IdleSetDetectionIntervalFunction(), "[15]"));
}
diff --git a/chromium/extensions/browser/api/idle/idle_manager.cc b/chromium/extensions/browser/api/idle/idle_manager.cc
index 695e52f2766..cecb1e23f8e 100644
--- a/chromium/extensions/browser/api/idle/idle_manager.cc
+++ b/chromium/extensions/browser/api/idle/idle_manager.cc
@@ -47,11 +47,11 @@ DefaultEventDelegate::~DefaultEventDelegate() {
void DefaultEventDelegate::OnStateChanged(const std::string& extension_id,
ui::IdleState new_state) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(IdleManager::CreateIdleValue(new_state));
- scoped_ptr<Event> event(new Event(events::IDLE_ON_STATE_CHANGED,
- idle::OnStateChanged::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::IDLE_ON_STATE_CHANGED,
+ idle::OnStateChanged::kEventName,
+ std::move(args)));
event->restrict_to_browser_context = context_;
EventRouter::Get(context_)
->DispatchEventToExtension(extension_id, std::move(event));
@@ -195,13 +195,13 @@ base::StringValue* IdleManager::CreateIdleValue(ui::IdleState idle_state) {
}
void IdleManager::SetEventDelegateForTest(
- scoped_ptr<EventDelegate> event_delegate) {
+ std::unique_ptr<EventDelegate> event_delegate) {
DCHECK(thread_checker_.CalledOnValidThread());
event_delegate_ = std::move(event_delegate);
}
void IdleManager::SetIdleTimeProviderForTest(
- scoped_ptr<IdleTimeProvider> idle_time_provider) {
+ std::unique_ptr<IdleTimeProvider> idle_time_provider) {
DCHECK(thread_checker_.CalledOnValidThread());
idle_time_provider_ = std::move(idle_time_provider);
}
diff --git a/chromium/extensions/browser/api/idle/idle_manager.h b/chromium/extensions/browser/api/idle/idle_manager.h
index 9394c7a753a..5d1eb71f3a8 100644
--- a/chromium/extensions/browser/api/idle/idle_manager.h
+++ b/chromium/extensions/browser/api/idle/idle_manager.h
@@ -93,11 +93,12 @@ class IdleManager : public ExtensionRegistryObserver,
static base::StringValue* CreateIdleValue(ui::IdleState idle_state);
// Override default event class. Callee assumes ownership. Used for testing.
- void SetEventDelegateForTest(scoped_ptr<EventDelegate> event_delegate);
+ void SetEventDelegateForTest(std::unique_ptr<EventDelegate> event_delegate);
// Override default idle time calculations. Callee assumes ownership. Used
// for testing.
- void SetIdleTimeProviderForTest(scoped_ptr<IdleTimeProvider> idle_provider);
+ void SetIdleTimeProviderForTest(
+ std::unique_ptr<IdleTimeProvider> idle_provider);
private:
FRIEND_TEST_ALL_PREFIXES(IdleTest, ActiveToIdle);
@@ -129,8 +130,8 @@ class IdleManager : public ExtensionRegistryObserver,
base::RepeatingTimer poll_timer_;
- scoped_ptr<IdleTimeProvider> idle_time_provider_;
- scoped_ptr<EventDelegate> event_delegate_;
+ std::unique_ptr<IdleTimeProvider> idle_time_provider_;
+ std::unique_ptr<EventDelegate> event_delegate_;
base::ThreadChecker thread_checker_;
diff --git a/chromium/extensions/browser/api/management/management_api.cc b/chromium/extensions/browser/api/management/management_api.cc
index 984f41c7380..a1695195ab5 100644
--- a/chromium/extensions/browser/api/management/management_api.cc
+++ b/chromium/extensions/browser/api/management/management_api.cc
@@ -4,6 +4,7 @@
#include "extensions/browser/api/management/management_api.h"
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -13,7 +14,6 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -280,7 +280,7 @@ bool ManagementGetAllFunction::RunSync() {
}
bool ManagementGetFunction::RunSync() {
- scoped_ptr<management::Get::Params> params(
+ std::unique_ptr<management::Get::Params> params(
management::Get::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context());
@@ -307,7 +307,7 @@ bool ManagementGetSelfFunction::RunSync() {
}
bool ManagementGetPermissionWarningsByIdFunction::RunSync() {
- scoped_ptr<management::GetPermissionWarningsById::Params> params(
+ std::unique_ptr<management::GetPermissionWarningsById::Params> params(
management::GetPermissionWarningsById::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -326,7 +326,7 @@ bool ManagementGetPermissionWarningsByIdFunction::RunSync() {
}
bool ManagementGetPermissionWarningsByManifestFunction::RunAsync() {
- scoped_ptr<management::GetPermissionWarningsByManifest::Params> params(
+ std::unique_ptr<management::GetPermissionWarningsByManifest::Params> params(
management::GetPermissionWarningsByManifest::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -351,7 +351,7 @@ bool ManagementGetPermissionWarningsByManifestFunction::RunAsync() {
}
void ManagementGetPermissionWarningsByManifestFunction::OnParseSuccess(
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
if (!value->IsType(base::Value::TYPE_DICTIONARY)) {
OnParseFailure(keys::kManifestParseError);
return;
@@ -386,7 +386,7 @@ void ManagementGetPermissionWarningsByManifestFunction::OnParseFailure(
}
bool ManagementLaunchAppFunction::RunSync() {
- scoped_ptr<management::LaunchApp::Params> params(
+ std::unique_ptr<management::LaunchApp::Params> params(
management::LaunchApp::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
const Extension* extension =
@@ -415,7 +415,7 @@ ManagementSetEnabledFunction::~ManagementSetEnabledFunction() {
}
ExtensionFunction::ResponseAction ManagementSetEnabledFunction::Run() {
- scoped_ptr<management::SetEnabled::Params> params(
+ std::unique_ptr<management::SetEnabled::Params> params(
management::SetEnabled::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context());
@@ -602,7 +602,7 @@ ManagementUninstallFunction::~ManagementUninstallFunction() {
}
ExtensionFunction::ResponseAction ManagementUninstallFunction::Run() {
- scoped_ptr<management::Uninstall::Params> params(
+ std::unique_ptr<management::Uninstall::Params> params(
management::Uninstall::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -619,7 +619,7 @@ ManagementUninstallSelfFunction::~ManagementUninstallSelfFunction() {
}
ExtensionFunction::ResponseAction ManagementUninstallSelfFunction::Run() {
- scoped_ptr<management::UninstallSelf::Params> params(
+ std::unique_ptr<management::UninstallSelf::Params> params(
management::UninstallSelf::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
EXTENSION_FUNCTION_VALIDATE(extension_.get());
@@ -655,7 +655,7 @@ bool ManagementCreateAppShortcutFunction::RunAsync() {
return false;
}
- scoped_ptr<management::CreateAppShortcut::Params> params(
+ std::unique_ptr<management::CreateAppShortcut::Params> params(
management::CreateAppShortcut::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
const Extension* extension =
@@ -706,7 +706,7 @@ bool ManagementSetLaunchTypeFunction::RunSync() {
return false;
}
- scoped_ptr<management::SetLaunchType::Params> params(
+ std::unique_ptr<management::SetLaunchType::Params> params(
management::SetLaunchType::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
const Extension* extension =
@@ -787,7 +787,7 @@ bool ManagementGenerateAppForLinkFunction::RunAsync() {
return false;
}
- scoped_ptr<management::GenerateAppForLink::Params> params(
+ std::unique_ptr<management::GenerateAppForLink::Params> params(
management::GenerateAppForLink::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -862,7 +862,7 @@ void ManagementEventRouter::BroadcastEvent(
const char* event_name) {
if (extension->ShouldNotBeVisible())
return; // Don't dispatch events for built-in extenions.
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
if (event_name == management::OnUninstalled::kEventName) {
args->Append(new base::StringValue(extension->id()));
} else {
@@ -870,7 +870,7 @@ void ManagementEventRouter::BroadcastEvent(
}
EventRouter::Get(browser_context_)
- ->BroadcastEvent(scoped_ptr<Event>(
+ ->BroadcastEvent(std::unique_ptr<Event>(
new Event(histogram_value, event_name, std::move(args))));
}
diff --git a/chromium/extensions/browser/api/management/management_api.h b/chromium/extensions/browser/api/management/management_api.h
index fc9b563bd1a..1f4f973eb5b 100644
--- a/chromium/extensions/browser/api/management/management_api.h
+++ b/chromium/extensions/browser/api/management/management_api.h
@@ -17,8 +17,6 @@
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_registry_observer.h"
-class ExtensionRegistry;
-class ExtensionUninstallDialog;
struct WebApplicationInfo;
namespace extensions {
@@ -87,7 +85,7 @@ class ManagementGetPermissionWarningsByManifestFunction
MANAGEMENT_GETPERMISSIONWARNINGSBYMANIFEST);
// Called when utility process finishes.
- void OnParseSuccess(scoped_ptr<base::Value> value);
+ void OnParseSuccess(std::unique_ptr<base::Value> value);
void OnParseFailure(const std::string& error);
protected:
@@ -127,9 +125,9 @@ class ManagementSetEnabledFunction : public UIThreadExtensionFunction {
std::string extension_id_;
- scoped_ptr<InstallPromptDelegate> install_prompt_;
+ std::unique_ptr<InstallPromptDelegate> install_prompt_;
- scoped_ptr<RequirementsChecker> requirements_checker_;
+ std::unique_ptr<RequirementsChecker> requirements_checker_;
};
class ManagementUninstallFunctionBase : public UIThreadExtensionFunction {
@@ -153,7 +151,7 @@ class ManagementUninstallFunctionBase : public UIThreadExtensionFunction {
std::string target_extension_id_;
- scoped_ptr<UninstallDialogDelegate> uninstall_dialog_;
+ std::unique_ptr<UninstallDialogDelegate> uninstall_dialog_;
};
class ManagementUninstallFunction : public ManagementUninstallFunctionBase {
@@ -221,7 +219,7 @@ class ManagementGenerateAppForLinkFunction : public AsyncManagementFunction {
bool RunAsync() override;
private:
- scoped_ptr<AppForLinkDelegate> app_for_link_delegate_;
+ std::unique_ptr<AppForLinkDelegate> app_for_link_delegate_;
};
class ManagementEventRouter : public ExtensionRegistryObserver {
@@ -285,9 +283,9 @@ class ManagementAPI : public BrowserContextKeyedAPI,
static const bool kServiceRedirectedInIncognito = true;
// Created lazily upon OnListenerAdded.
- scoped_ptr<ManagementEventRouter> management_event_router_;
+ std::unique_ptr<ManagementEventRouter> management_event_router_;
- scoped_ptr<ManagementAPIDelegate> delegate_;
+ std::unique_ptr<ManagementAPIDelegate> delegate_;
DISALLOW_COPY_AND_ASSIGN(ManagementAPI);
};
diff --git a/chromium/extensions/browser/api/management/management_api_delegate.h b/chromium/extensions/browser/api/management/management_api_delegate.h
index 9e127eeb7f1..330d6fef91f 100644
--- a/chromium/extensions/browser/api/management/management_api_delegate.h
+++ b/chromium/extensions/browser/api/management/management_api_delegate.h
@@ -78,14 +78,15 @@ class ManagementAPIDelegate {
// Used to show a dialog prompt in chrome when management.setEnabled extension
// function is called.
- virtual scoped_ptr<InstallPromptDelegate> SetEnabledFunctionDelegate(
+ virtual std::unique_ptr<InstallPromptDelegate> SetEnabledFunctionDelegate(
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const Extension* extension,
const base::Callback<void(bool)>& callback) const = 0;
// Returns a new RequirementsChecker.
- virtual scoped_ptr<RequirementsChecker> CreateRequirementsChecker() const = 0;
+ virtual std::unique_ptr<RequirementsChecker> CreateRequirementsChecker()
+ const = 0;
// Enables the extension identified by |extension_id|.
virtual void EnableExtension(content::BrowserContext* context,
@@ -98,7 +99,7 @@ class ManagementAPIDelegate {
Extension::DisableReason disable_reason) const = 0;
// Used to show a confirmation dialog when uninstalling |target_extension|.
- virtual scoped_ptr<UninstallDialogDelegate> UninstallFunctionDelegate(
+ virtual std::unique_ptr<UninstallDialogDelegate> UninstallFunctionDelegate(
ManagementUninstallFunctionBase* function,
const Extension* target_extension,
bool show_programmatic_uninstall_ui) const = 0;
@@ -121,7 +122,8 @@ class ManagementAPIDelegate {
LaunchType launch_type) const = 0;
// Creates a bookmark app for |launch_url|.
- virtual scoped_ptr<AppForLinkDelegate> GenerateAppForLinkFunctionDelegate(
+ virtual std::unique_ptr<AppForLinkDelegate>
+ GenerateAppForLinkFunctionDelegate(
ManagementGenerateAppForLinkFunction* function,
content::BrowserContext* context,
const std::string& title,
diff --git a/chromium/extensions/browser/api/messaging/native_message_host.h b/chromium/extensions/browser/api/messaging/native_message_host.h
index da241e06f83..2d4b82f312f 100644
--- a/chromium/extensions/browser/api/messaging/native_message_host.h
+++ b/chromium/extensions/browser/api/messaging/native_message_host.h
@@ -5,9 +5,9 @@
#ifndef EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGE_HOST_H_
#define EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGE_HOST_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "base/single_thread_task_runner.h"
#include "ui/gfx/native_widget_types.h"
@@ -37,7 +37,7 @@ class NativeMessageHost {
};
// Creates the NativeMessageHost based on the |native_host_name|.
- static scoped_ptr<NativeMessageHost> Create(
+ static std::unique_ptr<NativeMessageHost> Create(
gfx::NativeView native_view,
const std::string& source_extension_id,
const std::string& native_host_name,
diff --git a/chromium/extensions/browser/api/messaging/native_messaging_channel.h b/chromium/extensions/browser/api/messaging/native_messaging_channel.h
index b368706dad9..bd03486a4a3 100644
--- a/chromium/extensions/browser/api/messaging/native_messaging_channel.h
+++ b/chromium/extensions/browser/api/messaging/native_messaging_channel.h
@@ -5,8 +5,9 @@
#ifndef EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
#define EXTENSIONS_BROWSER_API_MESSAGING_NATIVE_MESSAGING_CHANNEL_H_
+#include <memory>
+
#include "base/callback.h"
-#include "base/memory/scoped_ptr.h"
namespace base {
class Value;
@@ -23,7 +24,7 @@ class NativeMessagingChannel {
class EventHandler {
public:
// Called when a message is received from the other endpoint.
- virtual void OnMessage(scoped_ptr<base::Value> message) = 0;
+ virtual void OnMessage(std::unique_ptr<base::Value> message) = 0;
// Called when the channel is disconnected.
// EventHandler is guaranteed not to be called after OnDisconnect().
@@ -38,7 +39,7 @@ class NativeMessagingChannel {
virtual void Start(EventHandler* event_handler) = 0;
// Sends a message to the other endpoint.
- virtual void SendMessage(scoped_ptr<base::Value> message) = 0;
+ virtual void SendMessage(std::unique_ptr<base::Value> message) = 0;
};
} // namespace extensions
diff --git a/chromium/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc b/chromium/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc
index d88335890b7..d8e1035097b 100644
--- a/chromium/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc
+++ b/chromium/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc
@@ -4,9 +4,10 @@
#include "extensions/browser/api/mime_handler_private/mime_handler_private.h"
+#include <memory>
#include <utility>
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "content/public/browser/stream_handle.h"
#include "content/public/browser/stream_info.h"
@@ -40,8 +41,8 @@ class TestStreamHandle : public content::StreamHandle {
class MimeHandlerServiceImplTest : public testing::Test {
public:
void SetUp() override {
- scoped_ptr<content::StreamInfo> stream_info(new content::StreamInfo);
- stream_info->handle = make_scoped_ptr(new TestStreamHandle);
+ std::unique_ptr<content::StreamInfo> stream_info(new content::StreamInfo);
+ stream_info->handle = base::WrapUnique(new TestStreamHandle);
stream_info->mime_type = "test/unit";
stream_info->original_url = GURL("test://extensions_unittests");
stream_container_.reset(
@@ -60,9 +61,9 @@ class MimeHandlerServiceImplTest : public testing::Test {
}
base::MessageLoop message_loop_;
- scoped_ptr<StreamContainer> stream_container_;
+ std::unique_ptr<StreamContainer> stream_container_;
mime_handler::MimeHandlerServicePtr service_ptr_;
- scoped_ptr<mime_handler::MimeHandlerService> service_;
+ std::unique_ptr<mime_handler::MimeHandlerService> service_;
bool abort_called_ = false;
mime_handler::StreamInfoPtr stream_info_;
};
diff --git a/chromium/extensions/browser/api/networking_config/networking_config_api.h b/chromium/extensions/browser/api/networking_config/networking_config_api.h
index a5c8a0fa6bb..f5560000229 100644
--- a/chromium/extensions/browser/api/networking_config/networking_config_api.h
+++ b/chromium/extensions/browser/api/networking_config/networking_config_api.h
@@ -24,7 +24,7 @@ class NetworkingConfigSetNetworkFilterFunction
protected:
~NetworkingConfigSetNetworkFilterFunction() override;
- scoped_ptr<api::networking_config::SetNetworkFilter::Params> parameters_;
+ std::unique_ptr<api::networking_config::SetNetworkFilter::Params> parameters_;
private:
DISALLOW_COPY_AND_ASSIGN(NetworkingConfigSetNetworkFilterFunction);
@@ -43,7 +43,8 @@ class NetworkingConfigFinishAuthenticationFunction
protected:
~NetworkingConfigFinishAuthenticationFunction() override;
- scoped_ptr<api::networking_config::FinishAuthentication::Params> parameters_;
+ std::unique_ptr<api::networking_config::FinishAuthentication::Params>
+ parameters_;
private:
DISALLOW_COPY_AND_ASSIGN(NetworkingConfigFinishAuthenticationFunction);
diff --git a/chromium/extensions/browser/api/networking_config/networking_config_service.cc b/chromium/extensions/browser/api/networking_config/networking_config_service.cc
index 0f14345bbf9..c9240e0065f 100644
--- a/chromium/extensions/browser/api/networking_config/networking_config_service.cc
+++ b/chromium/extensions/browser/api/networking_config/networking_config_service.cc
@@ -6,12 +6,14 @@
#include <stddef.h>
#include <stdint.h>
+
#include <algorithm>
#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "chromeos/network/managed_network_configuration_handler.h"
@@ -51,7 +53,7 @@ NetworkingConfigService::AuthenticationResult::AuthenticationResult(
NetworkingConfigService::NetworkingConfigService(
content::BrowserContext* browser_context,
- scoped_ptr<EventDelegate> event_delegate,
+ std::unique_ptr<EventDelegate> event_delegate,
ExtensionRegistry* extension_registry)
: browser_context_(browser_context),
registry_observer_(this),
@@ -148,7 +150,7 @@ void NetworkingConfigService::OnGotProperties(
// Try to extract |bssid| field.
const base::DictionaryValue* wifi_with_state = nullptr;
std::string bssid;
- scoped_ptr<Event> event;
+ std::unique_ptr<Event> event;
if (onc_network_config.GetDictionaryWithoutPathExpansion(
::onc::network_config::kWiFi, &wifi_with_state) &&
wifi_with_state->GetStringWithoutPathExpansion(::onc::wifi::kBSSID,
@@ -166,16 +168,17 @@ void NetworkingConfigService::OnGetPropertiesFailed(
const std::string& extension_id,
const std::string& guid,
const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data) {
+ std::unique_ptr<base::DictionaryValue> error_data) {
LOG(WARNING) << "Failed to determine BSSID for network with guid " << guid
<< ": " << error_name;
- scoped_ptr<Event> event =
+ std::unique_ptr<Event> event =
CreatePortalDetectedEventAndDispatch(extension_id, guid, nullptr);
EventRouter::Get(browser_context_)
->DispatchEventToExtension(extension_id, std::move(event));
}
-scoped_ptr<Event> NetworkingConfigService::CreatePortalDetectedEventAndDispatch(
+std::unique_ptr<Event>
+NetworkingConfigService::CreatePortalDetectedEventAndDispatch(
const std::string& extension_id,
const std::string& guid,
const std::string* bssid) {
@@ -190,14 +193,14 @@ scoped_ptr<Event> NetworkingConfigService::CreatePortalDetectedEventAndDispatch(
network_info.type = api::networking_config::NETWORK_TYPE_WIFI;
const std::vector<uint8_t>& raw_ssid = network->raw_ssid();
std::string hex_ssid = base::HexEncode(raw_ssid.data(), raw_ssid.size());
- network_info.hex_ssid = make_scoped_ptr(new std::string(hex_ssid));
- network_info.ssid = make_scoped_ptr(new std::string(network->name()));
- network_info.guid = make_scoped_ptr(new std::string(network->guid()));
+ network_info.hex_ssid = base::WrapUnique(new std::string(hex_ssid));
+ network_info.ssid = base::WrapUnique(new std::string(network->name()));
+ network_info.guid = base::WrapUnique(new std::string(network->guid()));
if (bssid)
network_info.bssid.reset(new std::string(*bssid));
- scoped_ptr<base::ListValue> results =
+ std::unique_ptr<base::ListValue> results =
api::networking_config::OnCaptivePortalDetected::Create(network_info);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::NETWORKING_CONFIG_ON_CAPTIVE_PORTAL_DETECTED,
api::networking_config::OnCaptivePortalDetected::kEventName,
std::move(results)));
diff --git a/chromium/extensions/browser/api/networking_config/networking_config_service.h b/chromium/extensions/browser/api/networking_config/networking_config_service.h
index fae6c68fe7e..dd6985f130c 100644
--- a/chromium/extensions/browser/api/networking_config/networking_config_service.h
+++ b/chromium/extensions/browser/api/networking_config/networking_config_service.h
@@ -6,10 +6,10 @@
#define EXTENSIONS_BROWSER_API_NETWORKING_CONFIG_NETWORKING_CONFIG_SERVICE_H_
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "base/values.h"
@@ -54,7 +54,7 @@ class NetworkingConfigService : public ExtensionRegistryObserver,
// Note: |extension_registry| must outlive this class.
NetworkingConfigService(content::BrowserContext* browser_context,
- scoped_ptr<EventDelegate> event_delegate,
+ std::unique_ptr<EventDelegate> event_delegate,
ExtensionRegistry* extension_registry);
~NetworkingConfigService() override;
@@ -116,13 +116,13 @@ class NetworkingConfigService : public ExtensionRegistryObserver,
void OnGetPropertiesFailed(const std::string& extension_id,
const std::string& guid,
const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data);
+ std::unique_ptr<base::DictionaryValue> error_data);
// Creates the captive portal event about the network with guid |guid| that is
// to be dispatched to the extension identified by |extension_id|. |bssid|
// contains a human readable, hex-encoded version of the BSSID with bytes
// separated by colons, e.g. 45:67:89:ab:cd:ef.
- scoped_ptr<Event> CreatePortalDetectedEventAndDispatch(
+ std::unique_ptr<Event> CreatePortalDetectedEventAndDispatch(
const std::string& extension_id,
const std::string& guid,
const std::string* bssid);
@@ -135,7 +135,7 @@ class NetworkingConfigService : public ExtensionRegistryObserver,
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
registry_observer_;
- scoped_ptr<EventDelegate> event_delegate_;
+ std::unique_ptr<EventDelegate> event_delegate_;
// This map associates a given hex encoded SSID to an extension entry.
std::map<std::string, std::string> hex_ssid_to_extension_id_;
diff --git a/chromium/extensions/browser/api/networking_config/networking_config_service_chromeos_unittest.cc b/chromium/extensions/browser/api/networking_config/networking_config_service_chromeos_unittest.cc
index 93bab3a429a..a04f4f10bc0 100644
--- a/chromium/extensions/browser/api/networking_config/networking_config_service_chromeos_unittest.cc
+++ b/chromium/extensions/browser/api/networking_config/networking_config_service_chromeos_unittest.cc
@@ -45,19 +45,20 @@ class NetworkingConfigServiceTest : public ApiUnitTest {
void SetUp() override {
ApiUnitTest::SetUp();
- extension_registry_ = scoped_ptr<ExtensionRegistry>(
+ extension_registry_ = std::unique_ptr<ExtensionRegistry>(
new ExtensionRegistry(browser_context()));
- scoped_ptr<MockEventDelegate> mock_event_delegate =
- scoped_ptr<MockEventDelegate>(new MockEventDelegate());
- service_ = scoped_ptr<NetworkingConfigService>(new NetworkingConfigService(
- browser_context(), std::move(mock_event_delegate),
- extension_registry_.get()));
+ std::unique_ptr<MockEventDelegate> mock_event_delegate =
+ std::unique_ptr<MockEventDelegate>(new MockEventDelegate());
+ service_ =
+ std::unique_ptr<NetworkingConfigService>(new NetworkingConfigService(
+ browser_context(), std::move(mock_event_delegate),
+ extension_registry_.get()));
DCHECK(service_);
}
protected:
- scoped_ptr<ExtensionRegistry> extension_registry_;
- scoped_ptr<NetworkingConfigService> service_;
+ std::unique_ptr<ExtensionRegistry> extension_registry_;
+ std::unique_ptr<NetworkingConfigService> service_;
};
TEST_F(NetworkingConfigServiceTest, BasicRegisterHexSsid) {
diff --git a/chromium/extensions/browser/api/networking_config/networking_config_service_factory.cc b/chromium/extensions/browser/api/networking_config/networking_config_service_factory.cc
index 38b9f902a24..a8375941a39 100644
--- a/chromium/extensions/browser/api/networking_config/networking_config_service_factory.cc
+++ b/chromium/extensions/browser/api/networking_config/networking_config_service_factory.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "base/memory/ptr_util.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/api/networking_config/networking_config_service.h"
#include "extensions/browser/extension_registry_factory.h"
@@ -71,7 +72,7 @@ NetworkingConfigServiceFactory::~NetworkingConfigServiceFactory() {
KeyedService* NetworkingConfigServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
return new NetworkingConfigService(
- context, make_scoped_ptr(new DefaultEventDelegate(context)),
+ context, base::WrapUnique(new DefaultEventDelegate(context)),
ExtensionRegistry::Get(context));
}
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_api.cc b/chromium/extensions/browser/api/networking_private/networking_private_api.cc
index 4e6368fc054..e9c086d680a 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_api.cc
+++ b/chromium/extensions/browser/api/networking_private/networking_private_api.cc
@@ -50,7 +50,7 @@ NetworkingPrivateGetPropertiesFunction::
}
bool NetworkingPrivateGetPropertiesFunction::RunAsync() {
- scoped_ptr<private_api::GetProperties::Params> params =
+ std::unique_ptr<private_api::GetProperties::Params> params =
private_api::GetProperties::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -63,7 +63,7 @@ bool NetworkingPrivateGetPropertiesFunction::RunAsync() {
}
void NetworkingPrivateGetPropertiesFunction::Success(
- scoped_ptr<base::DictionaryValue> result) {
+ std::unique_ptr<base::DictionaryValue> result) {
SetResult(result.release());
SendResponse(true);
}
@@ -81,7 +81,7 @@ NetworkingPrivateGetManagedPropertiesFunction::
}
bool NetworkingPrivateGetManagedPropertiesFunction::RunAsync() {
- scoped_ptr<private_api::GetManagedProperties::Params> params =
+ std::unique_ptr<private_api::GetManagedProperties::Params> params =
private_api::GetManagedProperties::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -96,7 +96,7 @@ bool NetworkingPrivateGetManagedPropertiesFunction::RunAsync() {
}
void NetworkingPrivateGetManagedPropertiesFunction::Success(
- scoped_ptr<base::DictionaryValue> result) {
+ std::unique_ptr<base::DictionaryValue> result) {
SetResult(result.release());
SendResponse(true);
}
@@ -114,7 +114,7 @@ NetworkingPrivateGetStateFunction::~NetworkingPrivateGetStateFunction() {
}
bool NetworkingPrivateGetStateFunction::RunAsync() {
- scoped_ptr<private_api::GetState::Params> params =
+ std::unique_ptr<private_api::GetState::Params> params =
private_api::GetState::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -126,7 +126,7 @@ bool NetworkingPrivateGetStateFunction::RunAsync() {
}
void NetworkingPrivateGetStateFunction::Success(
- scoped_ptr<base::DictionaryValue> result) {
+ std::unique_ptr<base::DictionaryValue> result) {
SetResult(result.release());
SendResponse(true);
}
@@ -144,11 +144,11 @@ NetworkingPrivateSetPropertiesFunction::
}
bool NetworkingPrivateSetPropertiesFunction::RunAsync() {
- scoped_ptr<private_api::SetProperties::Params> params =
+ std::unique_ptr<private_api::SetProperties::Params> params =
private_api::SetProperties::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
- scoped_ptr<base::DictionaryValue> properties_dict(
+ std::unique_ptr<base::DictionaryValue> properties_dict(
params->properties.ToValue());
GetDelegate(browser_context())
@@ -176,11 +176,11 @@ NetworkingPrivateCreateNetworkFunction::
}
bool NetworkingPrivateCreateNetworkFunction::RunAsync() {
- scoped_ptr<private_api::CreateNetwork::Params> params =
+ std::unique_ptr<private_api::CreateNetwork::Params> params =
private_api::CreateNetwork::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
- scoped_ptr<base::DictionaryValue> properties_dict(
+ std::unique_ptr<base::DictionaryValue> properties_dict(
params->properties.ToValue());
GetDelegate(browser_context())
@@ -209,7 +209,7 @@ NetworkingPrivateForgetNetworkFunction::
}
bool NetworkingPrivateForgetNetworkFunction::RunAsync() {
- scoped_ptr<private_api::ForgetNetwork::Params> params =
+ std::unique_ptr<private_api::ForgetNetwork::Params> params =
private_api::ForgetNetwork::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -237,7 +237,7 @@ NetworkingPrivateGetNetworksFunction::~NetworkingPrivateGetNetworksFunction() {
}
bool NetworkingPrivateGetNetworksFunction::RunAsync() {
- scoped_ptr<private_api::GetNetworks::Params> params =
+ std::unique_ptr<private_api::GetNetworks::Params> params =
private_api::GetNetworks::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -258,7 +258,7 @@ bool NetworkingPrivateGetNetworksFunction::RunAsync() {
}
void NetworkingPrivateGetNetworksFunction::Success(
- scoped_ptr<base::ListValue> network_list) {
+ std::unique_ptr<base::ListValue> network_list) {
SetResult(network_list.release());
SendResponse(true);
}
@@ -276,7 +276,7 @@ NetworkingPrivateGetVisibleNetworksFunction::
}
bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() {
- scoped_ptr<private_api::GetVisibleNetworks::Params> params =
+ std::unique_ptr<private_api::GetVisibleNetworks::Params> params =
private_api::GetVisibleNetworks::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -295,7 +295,7 @@ bool NetworkingPrivateGetVisibleNetworksFunction::RunAsync() {
}
void NetworkingPrivateGetVisibleNetworksFunction::Success(
- scoped_ptr<base::ListValue> network_properties_list) {
+ std::unique_ptr<base::ListValue> network_properties_list) {
SetResult(network_properties_list.release());
SendResponse(true);
}
@@ -314,13 +314,13 @@ NetworkingPrivateGetEnabledNetworkTypesFunction::
}
bool NetworkingPrivateGetEnabledNetworkTypesFunction::RunSync() {
- scoped_ptr<base::ListValue> enabled_networks_onc_types(
+ std::unique_ptr<base::ListValue> enabled_networks_onc_types(
GetDelegate(browser_context())->GetEnabledNetworkTypes());
if (!enabled_networks_onc_types) {
error_ = networking_private::kErrorNotSupported;
return false;
}
- scoped_ptr<base::ListValue> enabled_networks_list(new base::ListValue);
+ std::unique_ptr<base::ListValue> enabled_networks_list(new base::ListValue);
for (base::ListValue::iterator iter = enabled_networks_onc_types->begin();
iter != enabled_networks_onc_types->end(); ++iter) {
std::string type;
@@ -354,14 +354,14 @@ NetworkingPrivateGetDeviceStatesFunction::
}
bool NetworkingPrivateGetDeviceStatesFunction::RunSync() {
- scoped_ptr<NetworkingPrivateDelegate::DeviceStateList> device_states(
+ std::unique_ptr<NetworkingPrivateDelegate::DeviceStateList> device_states(
GetDelegate(browser_context())->GetDeviceStateList());
if (!device_states) {
error_ = networking_private::kErrorNotSupported;
return false;
}
- scoped_ptr<base::ListValue> device_state_list(new base::ListValue);
+ std::unique_ptr<base::ListValue> device_state_list(new base::ListValue);
for (const auto& properties : *device_states)
device_state_list->Append(properties->ToValue().release());
SetResult(device_state_list.release());
@@ -376,7 +376,7 @@ NetworkingPrivateEnableNetworkTypeFunction::
}
bool NetworkingPrivateEnableNetworkTypeFunction::RunSync() {
- scoped_ptr<private_api::EnableNetworkType::Params> params =
+ std::unique_ptr<private_api::EnableNetworkType::Params> params =
private_api::EnableNetworkType::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -392,7 +392,7 @@ NetworkingPrivateDisableNetworkTypeFunction::
}
bool NetworkingPrivateDisableNetworkTypeFunction::RunSync() {
- scoped_ptr<private_api::DisableNetworkType::Params> params =
+ std::unique_ptr<private_api::DisableNetworkType::Params> params =
private_api::DisableNetworkType::Params::Create(*args_);
return GetDelegate(browser_context())
@@ -418,7 +418,7 @@ NetworkingPrivateStartConnectFunction::
}
bool NetworkingPrivateStartConnectFunction::RunAsync() {
- scoped_ptr<private_api::StartConnect::Params> params =
+ std::unique_ptr<private_api::StartConnect::Params> params =
private_api::StartConnect::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -447,7 +447,7 @@ NetworkingPrivateStartDisconnectFunction::
}
bool NetworkingPrivateStartDisconnectFunction::RunAsync() {
- scoped_ptr<private_api::StartDisconnect::Params> params =
+ std::unique_ptr<private_api::StartDisconnect::Params> params =
private_api::StartDisconnect::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -477,7 +477,7 @@ NetworkingPrivateStartActivateFunction::
}
bool NetworkingPrivateStartActivateFunction::RunAsync() {
- scoped_ptr<private_api::StartActivate::Params> params =
+ std::unique_ptr<private_api::StartActivate::Params> params =
private_api::StartActivate::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -506,7 +506,7 @@ NetworkingPrivateVerifyDestinationFunction::
}
bool NetworkingPrivateVerifyDestinationFunction::RunAsync() {
- scoped_ptr<private_api::VerifyDestination::Params> params =
+ std::unique_ptr<private_api::VerifyDestination::Params> params =
private_api::VerifyDestination::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -539,7 +539,7 @@ NetworkingPrivateVerifyAndEncryptCredentialsFunction::
}
bool NetworkingPrivateVerifyAndEncryptCredentialsFunction::RunAsync() {
- scoped_ptr<private_api::VerifyAndEncryptCredentials::Params> params =
+ std::unique_ptr<private_api::VerifyAndEncryptCredentials::Params> params =
private_api::VerifyAndEncryptCredentials::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -575,7 +575,7 @@ NetworkingPrivateVerifyAndEncryptDataFunction::
}
bool NetworkingPrivateVerifyAndEncryptDataFunction::RunAsync() {
- scoped_ptr<private_api::VerifyAndEncryptData::Params> params =
+ std::unique_ptr<private_api::VerifyAndEncryptData::Params> params =
private_api::VerifyAndEncryptData::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -609,7 +609,7 @@ NetworkingPrivateSetWifiTDLSEnabledStateFunction::
}
bool NetworkingPrivateSetWifiTDLSEnabledStateFunction::RunAsync() {
- scoped_ptr<private_api::SetWifiTDLSEnabledState::Params> params =
+ std::unique_ptr<private_api::SetWifiTDLSEnabledState::Params> params =
private_api::SetWifiTDLSEnabledState::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -644,7 +644,7 @@ NetworkingPrivateGetWifiTDLSStatusFunction::
}
bool NetworkingPrivateGetWifiTDLSStatusFunction::RunAsync() {
- scoped_ptr<private_api::GetWifiTDLSStatus::Params> params =
+ std::unique_ptr<private_api::GetWifiTDLSStatus::Params> params =
private_api::GetWifiTDLSStatus::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -679,7 +679,7 @@ NetworkingPrivateGetCaptivePortalStatusFunction::
}
bool NetworkingPrivateGetCaptivePortalStatusFunction::RunAsync() {
- scoped_ptr<private_api::GetCaptivePortalStatus::Params> params =
+ std::unique_ptr<private_api::GetCaptivePortalStatus::Params> params =
private_api::GetCaptivePortalStatus::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -713,7 +713,7 @@ NetworkingPrivateUnlockCellularSimFunction::
~NetworkingPrivateUnlockCellularSimFunction() {}
bool NetworkingPrivateUnlockCellularSimFunction::RunAsync() {
- scoped_ptr<private_api::UnlockCellularSim::Params> params =
+ std::unique_ptr<private_api::UnlockCellularSim::Params> params =
private_api::UnlockCellularSim::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
@@ -744,7 +744,7 @@ NetworkingPrivateSetCellularSimStateFunction::
~NetworkingPrivateSetCellularSimStateFunction() {}
bool NetworkingPrivateSetCellularSimStateFunction::RunAsync() {
- scoped_ptr<private_api::SetCellularSimState::Params> params =
+ std::unique_ptr<private_api::SetCellularSimState::Params> params =
private_api::SetCellularSimState::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_api.h b/chromium/extensions/browser/api/networking_private/networking_private_api.h
index 6283839f547..b2a6892d626 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_api.h
+++ b/chromium/extensions/browser/api/networking_private/networking_private_api.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_
#define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "extensions/browser/extension_function.h"
@@ -40,7 +40,7 @@ class NetworkingPrivateGetPropertiesFunction : public AsyncExtensionFunction {
bool RunAsync() override;
private:
- void Success(scoped_ptr<base::DictionaryValue> result);
+ void Success(std::unique_ptr<base::DictionaryValue> result);
void Failure(const std::string& error_name);
DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction);
@@ -61,7 +61,7 @@ class NetworkingPrivateGetManagedPropertiesFunction
bool RunAsync() override;
private:
- void Success(scoped_ptr<base::DictionaryValue> result);
+ void Success(std::unique_ptr<base::DictionaryValue> result);
void Failure(const std::string& error);
DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetManagedPropertiesFunction);
@@ -81,7 +81,7 @@ class NetworkingPrivateGetStateFunction : public AsyncExtensionFunction {
bool RunAsync() override;
private:
- void Success(scoped_ptr<base::DictionaryValue> result);
+ void Success(std::unique_ptr<base::DictionaryValue> result);
void Failure(const std::string& error);
DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetStateFunction);
@@ -161,7 +161,7 @@ class NetworkingPrivateGetNetworksFunction : public AsyncExtensionFunction {
bool RunAsync() override;
private:
- void Success(scoped_ptr<base::ListValue> network_list);
+ void Success(std::unique_ptr<base::ListValue> network_list);
void Failure(const std::string& error);
DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetNetworksFunction);
@@ -182,7 +182,7 @@ class NetworkingPrivateGetVisibleNetworksFunction
bool RunAsync() override;
private:
- void Success(scoped_ptr<base::ListValue> network_list);
+ void Success(std::unique_ptr<base::ListValue> network_list);
void Failure(const std::string& error);
DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction);
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_chromeos.cc b/chromium/extensions/browser/api/networking_private/networking_private_chromeos.cc
index a7108488a2a..2a072744b30 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_chromeos.cc
+++ b/chromium/extensions/browser/api/networking_private/networking_private_chromeos.cc
@@ -126,7 +126,7 @@ void AppendDeviceState(
break;
}
DCHECK_NE(private_api::DEVICE_STATE_TYPE_NONE, state);
- scoped_ptr<private_api::DeviceStateProperties> properties(
+ std::unique_ptr<private_api::DeviceStateProperties> properties(
new private_api::DeviceStateProperties);
properties->type = private_api::ParseNetworkType(type);
properties->state = state;
@@ -143,7 +143,7 @@ void AppendDeviceState(
void NetworkHandlerFailureCallback(
const NetworkingPrivateDelegate::FailureCallback& callback,
const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data) {
+ std::unique_ptr<base::DictionaryValue> error_data) {
callback.Run(error_name);
}
@@ -207,7 +207,7 @@ namespace extensions {
NetworkingPrivateChromeOS::NetworkingPrivateChromeOS(
content::BrowserContext* browser_context,
- scoped_ptr<VerifyDelegate> verify_delegate)
+ std::unique_ptr<VerifyDelegate> verify_delegate)
: NetworkingPrivateDelegate(std::move(verify_delegate)),
browser_context_(browser_context),
weak_ptr_factory_(this) {}
@@ -279,7 +279,7 @@ void NetworkingPrivateChromeOS::GetState(
return;
}
- scoped_ptr<base::DictionaryValue> network_properties =
+ std::unique_ptr<base::DictionaryValue> network_properties =
chromeos::network_util::TranslateNetworkStateToONC(network_state);
AppendThirdPartyProviderName(network_properties.get());
@@ -288,7 +288,7 @@ void NetworkingPrivateChromeOS::GetState(
void NetworkingPrivateChromeOS::SetProperties(
const std::string& guid,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const VoidCallback& success_callback,
const FailureCallback& failure_callback) {
std::string service_path, error;
@@ -311,7 +311,7 @@ void NetworkHandlerCreateCallback(
void NetworkingPrivateChromeOS::CreateNetwork(
bool shared,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const StringCallback& success_callback,
const FailureCallback& failure_callback) {
std::string user_id_hash, error;
@@ -352,7 +352,7 @@ void NetworkingPrivateChromeOS::GetNetworks(
const FailureCallback& failure_callback) {
NetworkTypePattern pattern =
chromeos::onc::NetworkTypePatternFromOncType(network_type);
- scoped_ptr<base::ListValue> network_properties_list =
+ std::unique_ptr<base::ListValue> network_properties_list =
chromeos::network_util::TranslateNetworkListToONC(
pattern, configured_only, visible_only, limit);
@@ -549,11 +549,11 @@ void NetworkingPrivateChromeOS::SetCellularSimState(
base::Bind(&NetworkHandlerFailureCallback, failure_callback));
}
-scoped_ptr<base::ListValue>
+std::unique_ptr<base::ListValue>
NetworkingPrivateChromeOS::GetEnabledNetworkTypes() {
chromeos::NetworkStateHandler* state_handler = GetStateHandler();
- scoped_ptr<base::ListValue> network_list(new base::ListValue);
+ std::unique_ptr<base::ListValue> network_list(new base::ListValue);
if (state_handler->IsTechnologyEnabled(NetworkTypePattern::Ethernet()))
network_list->AppendString(::onc::network_type::kEthernet);
@@ -567,13 +567,13 @@ NetworkingPrivateChromeOS::GetEnabledNetworkTypes() {
return network_list;
}
-scoped_ptr<NetworkingPrivateDelegate::DeviceStateList>
+std::unique_ptr<NetworkingPrivateDelegate::DeviceStateList>
NetworkingPrivateChromeOS::GetDeviceStateList() {
std::set<std::string> technologies_found;
NetworkStateHandler::DeviceStateList devices;
NetworkHandler::Get()->network_state_handler()->GetDeviceList(&devices);
- scoped_ptr<DeviceStateList> device_state_list(new DeviceStateList);
+ std::unique_ptr<DeviceStateList> device_state_list(new DeviceStateList);
for (const DeviceState* device : devices) {
std::string onc_type =
chromeos::network_util::TranslateShillTypeToONC(device->type());
@@ -627,7 +627,7 @@ void NetworkingPrivateChromeOS::GetPropertiesCallback(
const DictionaryCallback& callback,
const std::string& service_path,
const base::DictionaryValue& dictionary) {
- scoped_ptr<base::DictionaryValue> dictionary_copy(dictionary.DeepCopy());
+ std::unique_ptr<base::DictionaryValue> dictionary_copy(dictionary.DeepCopy());
AppendThirdPartyProviderName(dictionary_copy.get());
callback.Run(std::move(dictionary_copy));
}
@@ -660,7 +660,7 @@ void NetworkingPrivateChromeOS::ConnectFailureCallback(
const VoidCallback& success_callback,
const FailureCallback& failure_callback,
const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data) {
+ std::unique_ptr<base::DictionaryValue> error_data) {
// TODO(stevenjb): Temporary workaround to show the configuration UI.
// Eventually the caller (e.g. Settings) should handle any failures and
// show its own configuration UI. crbug.com/380937.
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_chromeos.h b/chromium/extensions/browser/api/networking_private/networking_private_chromeos.h
index f393fcb6137..9cf77ba755c 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_chromeos.h
+++ b/chromium/extensions/browser/api/networking_private/networking_private_chromeos.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CHROMEOS_H_
#define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_CHROMEOS_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "extensions/browser/api/networking_private/networking_private_delegate.h"
@@ -28,7 +28,7 @@ class NetworkingPrivateChromeOS : public NetworkingPrivateDelegate {
public:
// |verify_delegate| is passed to NetworkingPrivateDelegate and may be NULL.
NetworkingPrivateChromeOS(content::BrowserContext* browser_context,
- scoped_ptr<VerifyDelegate> verify_delegate);
+ std::unique_ptr<VerifyDelegate> verify_delegate);
~NetworkingPrivateChromeOS() override;
// NetworkingPrivateApi
@@ -42,11 +42,11 @@ class NetworkingPrivateChromeOS : public NetworkingPrivateDelegate {
const DictionaryCallback& success_callback,
const FailureCallback& failure_callback) override;
void SetProperties(const std::string& guid,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const VoidCallback& success_callback,
const FailureCallback& failure_callback) override;
void CreateNetwork(bool shared,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const StringCallback& success_callback,
const FailureCallback& failure_callback) override;
void ForgetNetwork(const std::string& guid,
@@ -90,8 +90,8 @@ class NetworkingPrivateChromeOS : public NetworkingPrivateDelegate {
const std::string& new_pin,
const VoidCallback& success_callback,
const FailureCallback& failure_callback) override;
- scoped_ptr<base::ListValue> GetEnabledNetworkTypes() override;
- scoped_ptr<DeviceStateList> GetDeviceStateList() override;
+ std::unique_ptr<base::ListValue> GetEnabledNetworkTypes() override;
+ std::unique_ptr<DeviceStateList> GetDeviceStateList() override;
bool EnableNetworkType(const std::string& type) override;
bool DisableNetworkType(const std::string& type) override;
bool RequestScan() override;
@@ -111,11 +111,12 @@ class NetworkingPrivateChromeOS : public NetworkingPrivateDelegate {
// Handles connection failures, possibly showing UI for configuration
// failures, then calls the appropriate callback.
- void ConnectFailureCallback(const std::string& guid,
- const VoidCallback& success_callback,
- const FailureCallback& failure_callback,
- const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data);
+ void ConnectFailureCallback(
+ const std::string& guid,
+ const VoidCallback& success_callback,
+ const FailureCallback& failure_callback,
+ const std::string& error_name,
+ std::unique_ptr<base::DictionaryValue> error_data);
content::BrowserContext* browser_context_;
base::WeakPtrFactory<NetworkingPrivateChromeOS> weak_ptr_factory_;
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_delegate.cc b/chromium/extensions/browser/api/networking_private/networking_private_delegate.cc
index b9c722e5bf6..03be932348a 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_delegate.cc
+++ b/chromium/extensions/browser/api/networking_private/networking_private_delegate.cc
@@ -19,7 +19,7 @@ NetworkingPrivateDelegate::UIDelegate::UIDelegate() {}
NetworkingPrivateDelegate::UIDelegate::~UIDelegate() {}
NetworkingPrivateDelegate::NetworkingPrivateDelegate(
- scoped_ptr<VerifyDelegate> verify_delegate)
+ std::unique_ptr<VerifyDelegate> verify_delegate)
: verify_delegate_(std::move(verify_delegate)) {}
NetworkingPrivateDelegate::~NetworkingPrivateDelegate() {
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_delegate.h b/chromium/extensions/browser/api/networking_private/networking_private_delegate.h
index 410d4858d84..06ab8b8c347 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_delegate.h
+++ b/chromium/extensions/browser/api/networking_private/networking_private_delegate.h
@@ -5,12 +5,12 @@
#ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_H_
#define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/values.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -33,14 +33,15 @@ struct VerificationProperties;
class NetworkingPrivateDelegate : public KeyedService {
public:
using DictionaryCallback =
- base::Callback<void(scoped_ptr<base::DictionaryValue>)>;
+ base::Callback<void(std::unique_ptr<base::DictionaryValue>)>;
using VoidCallback = base::Callback<void()>;
using BoolCallback = base::Callback<void(bool)>;
using StringCallback = base::Callback<void(const std::string&)>;
- using NetworkListCallback = base::Callback<void(scoped_ptr<base::ListValue>)>;
+ using NetworkListCallback =
+ base::Callback<void(std::unique_ptr<base::ListValue>)>;
using FailureCallback = base::Callback<void(const std::string&)>;
- using DeviceStateList =
- std::vector<scoped_ptr<api::networking_private::DeviceStateProperties>>;
+ using DeviceStateList = std::vector<
+ std::unique_ptr<api::networking_private::DeviceStateProperties>>;
using VerificationProperties =
api::networking_private::VerificationProperties;
@@ -99,10 +100,10 @@ class NetworkingPrivateDelegate : public KeyedService {
// If |verify_delegate| is not NULL, the Verify* methods will be forwarded
// to the delegate. Otherwise they will fail with a NotSupported error.
explicit NetworkingPrivateDelegate(
- scoped_ptr<VerifyDelegate> verify_delegate);
+ std::unique_ptr<VerifyDelegate> verify_delegate);
~NetworkingPrivateDelegate() override;
- void set_ui_delegate(scoped_ptr<UIDelegate> ui_delegate) {
+ void set_ui_delegate(std::unique_ptr<UIDelegate> ui_delegate) {
ui_delegate_.reset(ui_delegate.release());
}
@@ -120,11 +121,11 @@ class NetworkingPrivateDelegate : public KeyedService {
const DictionaryCallback& success_callback,
const FailureCallback& failure_callback) = 0;
virtual void SetProperties(const std::string& guid,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const VoidCallback& success_callback,
const FailureCallback& failure_callback) = 0;
virtual void CreateNetwork(bool shared,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const StringCallback& success_callback,
const FailureCallback& failure_callback) = 0;
virtual void ForgetNetwork(const std::string& guid,
@@ -174,10 +175,10 @@ class NetworkingPrivateDelegate : public KeyedService {
// Synchronous methods
// Returns a list of ONC type strings.
- virtual scoped_ptr<base::ListValue> GetEnabledNetworkTypes() = 0;
+ virtual std::unique_ptr<base::ListValue> GetEnabledNetworkTypes() = 0;
// Returns a list of DeviceStateProperties.
- virtual scoped_ptr<DeviceStateList> GetDeviceStateList() = 0;
+ virtual std::unique_ptr<DeviceStateList> GetDeviceStateList() = 0;
// Returns true if the ONC network type |type| is enabled.
virtual bool EnableNetworkType(const std::string& type) = 0;
@@ -211,10 +212,10 @@ class NetworkingPrivateDelegate : public KeyedService {
private:
// Interface for Verify* methods. May be null.
- scoped_ptr<VerifyDelegate> verify_delegate_;
+ std::unique_ptr<VerifyDelegate> verify_delegate_;
// Interface for UI methods. May be null.
- scoped_ptr<UIDelegate> ui_delegate_;
+ std::unique_ptr<UIDelegate> ui_delegate_;
DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDelegate);
};
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_delegate_factory.cc b/chromium/extensions/browser/api/networking_private/networking_private_delegate_factory.cc
index 972cda00ba1..2cee55591e6 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_delegate_factory.cc
+++ b/chromium/extensions/browser/api/networking_private/networking_private_delegate_factory.cc
@@ -58,19 +58,19 @@ NetworkingPrivateDelegateFactory::~NetworkingPrivateDelegateFactory() {
}
void NetworkingPrivateDelegateFactory::SetVerifyDelegateFactory(
- scoped_ptr<VerifyDelegateFactory> factory) {
+ std::unique_ptr<VerifyDelegateFactory> factory) {
verify_factory_.reset(factory.release());
}
void NetworkingPrivateDelegateFactory::SetUIDelegateFactory(
- scoped_ptr<UIDelegateFactory> factory) {
+ std::unique_ptr<UIDelegateFactory> factory) {
ui_factory_.reset(factory.release());
}
KeyedService* NetworkingPrivateDelegateFactory::BuildServiceInstanceFor(
BrowserContext* browser_context) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- scoped_ptr<NetworkingPrivateDelegate::VerifyDelegate> verify_delegate;
+ std::unique_ptr<NetworkingPrivateDelegate::VerifyDelegate> verify_delegate;
if (verify_factory_)
verify_delegate = verify_factory_->CreateDelegate();
@@ -79,10 +79,9 @@ KeyedService* NetworkingPrivateDelegateFactory::BuildServiceInstanceFor(
delegate = new NetworkingPrivateChromeOS(browser_context,
std::move(verify_delegate));
#elif defined(OS_LINUX)
- delegate =
- new NetworkingPrivateLinux(browser_context, std::move(verify_delegate));
+ delegate = new NetworkingPrivateLinux(std::move(verify_delegate));
#elif defined(OS_WIN) || defined(OS_MACOSX)
- scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create());
+ std::unique_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create());
delegate = new NetworkingPrivateServiceClient(std::move(wifi_service),
std::move(verify_delegate));
#else
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_delegate_factory.h b/chromium/extensions/browser/api/networking_private/networking_private_delegate_factory.h
index e048d72b3e8..9aa3063a020 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_delegate_factory.h
+++ b/chromium/extensions/browser/api/networking_private/networking_private_delegate_factory.h
@@ -4,8 +4,9 @@
#ifndef EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_FACTORY_H_
#define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_DELEGATE_FACTORY_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "build/build_config.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
@@ -36,7 +37,7 @@ class NetworkingPrivateDelegateFactory
VerifyDelegateFactory();
virtual ~VerifyDelegateFactory();
- virtual scoped_ptr<NetworkingPrivateDelegate::VerifyDelegate>
+ virtual std::unique_ptr<NetworkingPrivateDelegate::VerifyDelegate>
CreateDelegate() = 0;
private:
@@ -48,7 +49,7 @@ class NetworkingPrivateDelegateFactory
UIDelegateFactory();
virtual ~UIDelegateFactory();
- virtual scoped_ptr<NetworkingPrivateDelegate::UIDelegate>
+ virtual std::unique_ptr<NetworkingPrivateDelegate::UIDelegate>
CreateDelegate() = 0;
private:
@@ -56,8 +57,8 @@ class NetworkingPrivateDelegateFactory
};
// Provide optional factories for creating delegate instances.
- void SetVerifyDelegateFactory(scoped_ptr<VerifyDelegateFactory> factory);
- void SetUIDelegateFactory(scoped_ptr<UIDelegateFactory> factory);
+ void SetVerifyDelegateFactory(std::unique_ptr<VerifyDelegateFactory> factory);
+ void SetUIDelegateFactory(std::unique_ptr<UIDelegateFactory> factory);
static NetworkingPrivateDelegate* GetForBrowserContext(
content::BrowserContext* browser_context);
@@ -77,8 +78,8 @@ class NetworkingPrivateDelegateFactory
bool ServiceIsCreatedWithBrowserContext() const override;
bool ServiceIsNULLWhileTesting() const override;
- scoped_ptr<VerifyDelegateFactory> verify_factory_;
- scoped_ptr<UIDelegateFactory> ui_factory_;
+ std::unique_ptr<VerifyDelegateFactory> verify_factory_;
+ std::unique_ptr<UIDelegateFactory> ui_factory_;
DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDelegateFactory);
};
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_event_router_chromeos.cc b/chromium/extensions/browser/api/networking_private/networking_private_event_router_chromeos.cc
index 259fcd3671a..a05de423be0 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_event_router_chromeos.cc
+++ b/chromium/extensions/browser/api/networking_private/networking_private_event_router_chromeos.cc
@@ -166,9 +166,9 @@ void NetworkingPrivateEventRouterImpl::NetworkListChanged() {
changes.push_back((*iter)->guid());
}
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
api::networking_private::OnNetworkListChanged::Create(changes));
- scoped_ptr<Event> extension_event(
+ std::unique_ptr<Event> extension_event(
new Event(events::NETWORKING_PRIVATE_ON_NETWORK_LIST_CHANGED,
api::networking_private::OnNetworkListChanged::kEventName,
std::move(args)));
@@ -182,9 +182,9 @@ void NetworkingPrivateEventRouterImpl::DeviceListChanged() {
return;
}
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
api::networking_private::OnDeviceStateListChanged::Create());
- scoped_ptr<Event> extension_event(
+ std::unique_ptr<Event> extension_event(
new Event(events::NETWORKING_PRIVATE_ON_DEVICE_STATE_LIST_CHANGED,
api::networking_private::OnDeviceStateListChanged::kEventName,
std::move(args)));
@@ -201,10 +201,10 @@ void NetworkingPrivateEventRouterImpl::NetworkPropertiesUpdated(
return;
}
NET_LOG_EVENT("NetworkingPrivate.NetworkPropertiesUpdated", network->path());
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
api::networking_private::OnNetworksChanged::Create(
std::vector<std::string>(1, network->guid())));
- scoped_ptr<Event> extension_event(new Event(
+ std::unique_ptr<Event> extension_event(new Event(
events::NETWORKING_PRIVATE_ON_NETWORKS_CHANGED,
api::networking_private::OnNetworksChanged::kEventName, std::move(args)));
event_router->BroadcastEvent(std::move(extension_event));
@@ -262,10 +262,10 @@ void NetworkingPrivateEventRouterImpl::OnPortalDetectionCompleted(
break;
}
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
api::networking_private::OnPortalDetectionCompleted::Create(path,
status));
- scoped_ptr<Event> extension_event(
+ std::unique_ptr<Event> extension_event(
new Event(events::NETWORKING_PRIVATE_ON_PORTAL_DETECTION_COMPLETED,
api::networking_private::OnPortalDetectionCompleted::kEventName,
std::move(args)));
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_event_router_nonchromeos.cc b/chromium/extensions/browser/api/networking_private/networking_private_event_router_nonchromeos.cc
index 99db0a132c9..36304835b7b 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_event_router_nonchromeos.cc
+++ b/chromium/extensions/browser/api/networking_private/networking_private_event_router_nonchromeos.cc
@@ -135,9 +135,9 @@ void NetworkingPrivateEventRouterImpl::OnNetworksChangedEvent(
EventRouter* event_router = EventRouter::Get(browser_context_);
if (!event_router)
return;
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
api::networking_private::OnNetworksChanged::Create(network_guids));
- scoped_ptr<Event> netchanged_event(new Event(
+ std::unique_ptr<Event> netchanged_event(new Event(
events::NETWORKING_PRIVATE_ON_NETWORKS_CHANGED,
api::networking_private::OnNetworksChanged::kEventName, std::move(args)));
event_router->BroadcastEvent(std::move(netchanged_event));
@@ -148,9 +148,9 @@ void NetworkingPrivateEventRouterImpl::OnNetworkListChangedEvent(
EventRouter* event_router = EventRouter::Get(browser_context_);
if (!event_router)
return;
- scoped_ptr<base::ListValue> args(
+ std::unique_ptr<base::ListValue> args(
api::networking_private::OnNetworkListChanged::Create(network_guids));
- scoped_ptr<Event> netlistchanged_event(
+ std::unique_ptr<Event> netlistchanged_event(
new Event(events::NETWORKING_PRIVATE_ON_NETWORK_LIST_CHANGED,
api::networking_private::OnNetworkListChanged::kEventName,
std::move(args)));
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_linux.cc b/chromium/extensions/browser/api/networking_private/networking_private_linux.cc
index dd489034c13..fe119c520f0 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_linux.cc
+++ b/chromium/extensions/browser/api/networking_private/networking_private_linux.cc
@@ -15,7 +15,6 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/sequenced_worker_pool.h"
#include "components/onc/onc_constants.h"
-#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "dbus/bus.h"
#include "dbus/message.h"
@@ -79,9 +78,9 @@ bool GuidToSsid(const std::string& guid, std::string* ssid) {
// Iterates over the map cloning the contained networks to a
// list then returns the list.
-scoped_ptr<base::ListValue> CopyNetworkMapToList(
+std::unique_ptr<base::ListValue> CopyNetworkMapToList(
const NetworkingPrivateLinux::NetworkMap& network_map) {
- scoped_ptr<base::ListValue> network_list(new base::ListValue);
+ std::unique_ptr<base::ListValue> network_list(new base::ListValue);
for (const auto& network : network_map) {
network_list->Append(network.second->DeepCopy());
@@ -109,7 +108,7 @@ void ReportNotSupported(
// Fires the appropriate callback when the network connect operation succeeds
// or fails.
void OnNetworkConnectOperationCompleted(
- scoped_ptr<std::string> error,
+ std::unique_ptr<std::string> error,
const NetworkingPrivateDelegate::VoidCallback& success_callback,
const NetworkingPrivateDelegate::FailureCallback& failure_callback) {
if (!error->empty()) {
@@ -122,8 +121,8 @@ void OnNetworkConnectOperationCompleted(
// Fires the appropriate callback when the network properties are returned
// from the |dbus_thread_|.
void GetCachedNetworkPropertiesCallback(
- scoped_ptr<std::string> error,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<std::string> error,
+ std::unique_ptr<base::DictionaryValue> properties,
const NetworkingPrivateDelegate::DictionaryCallback& success_callback,
const NetworkingPrivateDelegate::FailureCallback& failure_callback) {
if (!error->empty()) {
@@ -136,10 +135,8 @@ void GetCachedNetworkPropertiesCallback(
} // namespace
NetworkingPrivateLinux::NetworkingPrivateLinux(
- content::BrowserContext* browser_context,
- scoped_ptr<VerifyDelegate> verify_delegate)
+ std::unique_ptr<VerifyDelegate> verify_delegate)
: NetworkingPrivateDelegate(std::move(verify_delegate)),
- browser_context_(browser_context),
dbus_thread_("Networking Private DBus"),
network_manager_proxy_(NULL) {
base::Thread::Options thread_options(base::MessageLoop::Type::TYPE_IO, 0);
@@ -211,8 +208,8 @@ void NetworkingPrivateLinux::GetState(
if (!CheckNetworkManagerSupported(failure_callback))
return;
- scoped_ptr<std::string> error(new std::string);
- scoped_ptr<base::DictionaryValue> network_properties(
+ std::unique_ptr<std::string> error(new std::string);
+ std::unique_ptr<base::DictionaryValue> network_properties(
new base::DictionaryValue);
// Runs GetCachedNetworkProperties on |dbus_thread|.
@@ -246,7 +243,7 @@ void NetworkingPrivateLinux::GetCachedNetworkProperties(
}
// Make a copy of the properties out of the cached map.
- scoped_ptr<base::DictionaryValue> temp_properties(
+ std::unique_ptr<base::DictionaryValue> temp_properties(
network_iter->second->DeepCopy());
// Swap the new copy into the dictionary that is shared with the reply.
@@ -255,7 +252,7 @@ void NetworkingPrivateLinux::GetCachedNetworkProperties(
void NetworkingPrivateLinux::SetProperties(
const std::string& guid,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const VoidCallback& success_callback,
const FailureCallback& failure_callback) {
ReportNotSupported("SetProperties", failure_callback);
@@ -263,7 +260,7 @@ void NetworkingPrivateLinux::SetProperties(
void NetworkingPrivateLinux::CreateNetwork(
bool shared,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const StringCallback& success_callback,
const FailureCallback& failure_callback) {
ReportNotSupported("CreateNetwork", failure_callback);
@@ -288,7 +285,7 @@ void NetworkingPrivateLinux::GetNetworks(
return;
}
- scoped_ptr<NetworkMap> network_map(new NetworkMap);
+ std::unique_ptr<NetworkMap> network_map(new NetworkMap);
if (!(network_type == ::onc::network_type::kWiFi ||
network_type == ::onc::network_type::kWireless ||
@@ -316,7 +313,7 @@ bool NetworkingPrivateLinux::GetNetworksForScanRequest() {
return false;
}
- scoped_ptr<NetworkMap> network_map(new NetworkMap);
+ std::unique_ptr<NetworkMap> network_map(new NetworkMap);
// Runs GetAllWiFiAccessPoints on the dbus_thread and returns the
// results back to SendNetworkListChangedEvent to fire the event. No
@@ -402,7 +399,7 @@ void NetworkingPrivateLinux::ConnectToNetwork(const std::string& guid,
builder.AppendObjectPath(device_path);
builder.AppendObjectPath(access_point_path);
- scoped_ptr<dbus::Response> response(
+ std::unique_ptr<dbus::Response> response(
network_manager_proxy_->CallMethodAndBlock(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
if (!response) {
@@ -461,7 +458,7 @@ void NetworkingPrivateLinux::DisconnectFromNetwork(const std::string& guid,
return;
}
- scoped_ptr<NetworkMap> network_map(new NetworkMap);
+ std::unique_ptr<NetworkMap> network_map(new NetworkMap);
GetAllWiFiAccessPoints(false /* configured_only */, false /* visible_only */,
0 /* limit */, network_map.get());
@@ -487,7 +484,7 @@ void NetworkingPrivateLinux::DisconnectFromNetwork(const std::string& guid,
dbus::MethodCall method_call(
networking_private::kNetworkManagerDeviceNamespace,
networking_private::kNetworkManagerDisconnectMethod);
- scoped_ptr<dbus::Response> response(device_proxy->CallMethodAndBlock(
+ std::unique_ptr<dbus::Response> response(device_proxy->CallMethodAndBlock(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
if (!response) {
@@ -504,7 +501,7 @@ void NetworkingPrivateLinux::StartConnect(
if (!CheckNetworkManagerSupported(failure_callback))
return;
- scoped_ptr<std::string> error(new std::string);
+ std::unique_ptr<std::string> error(new std::string);
// Runs ConnectToNetwork on |dbus_thread|.
dbus_thread_.task_runner()->PostTaskAndReply(
@@ -522,7 +519,7 @@ void NetworkingPrivateLinux::StartDisconnect(
if (!CheckNetworkManagerSupported(failure_callback))
return;
- scoped_ptr<std::string> error(new std::string);
+ std::unique_ptr<std::string> error(new std::string);
// Runs DisconnectFromNetwork on |dbus_thread|.
dbus_thread_.task_runner()->PostTaskAndReply(
@@ -574,16 +571,17 @@ void NetworkingPrivateLinux::SetCellularSimState(
ReportNotSupported("SetCellularSimState", failure_callback);
}
-scoped_ptr<base::ListValue> NetworkingPrivateLinux::GetEnabledNetworkTypes() {
- scoped_ptr<base::ListValue> network_list(new base::ListValue);
+std::unique_ptr<base::ListValue>
+NetworkingPrivateLinux::GetEnabledNetworkTypes() {
+ std::unique_ptr<base::ListValue> network_list(new base::ListValue);
network_list->AppendString(::onc::network_type::kWiFi);
return network_list;
}
-scoped_ptr<NetworkingPrivateDelegate::DeviceStateList>
+std::unique_ptr<NetworkingPrivateDelegate::DeviceStateList>
NetworkingPrivateLinux::GetDeviceStateList() {
- scoped_ptr<DeviceStateList> device_state_list(new DeviceStateList);
- scoped_ptr<api::networking_private::DeviceStateProperties> properties(
+ std::unique_ptr<DeviceStateList> device_state_list(new DeviceStateList);
+ std::unique_ptr<api::networking_private::DeviceStateProperties> properties(
new api::networking_private::DeviceStateProperties);
properties->type = api::networking_private::NETWORK_TYPE_WIFI;
properties->state = api::networking_private::DEVICE_STATE_TYPE_ENABLED;
@@ -614,10 +612,11 @@ void NetworkingPrivateLinux::RemoveObserver(
}
void NetworkingPrivateLinux::OnAccessPointsFound(
- scoped_ptr<NetworkMap> network_map,
+ std::unique_ptr<NetworkMap> network_map,
const NetworkListCallback& success_callback,
const FailureCallback& failure_callback) {
- scoped_ptr<base::ListValue> network_list = CopyNetworkMapToList(*network_map);
+ std::unique_ptr<base::ListValue> network_list =
+ CopyNetworkMapToList(*network_map);
// Give ownership to the member variable.
network_map_.swap(network_map);
SendNetworkListChangedEvent(*network_list);
@@ -625,8 +624,9 @@ void NetworkingPrivateLinux::OnAccessPointsFound(
}
void NetworkingPrivateLinux::OnAccessPointsFoundViaScan(
- scoped_ptr<NetworkMap> network_map) {
- scoped_ptr<base::ListValue> network_list = CopyNetworkMapToList(*network_map);
+ std::unique_ptr<NetworkMap> network_map) {
+ std::unique_ptr<base::ListValue> network_list =
+ CopyNetworkMapToList(*network_map);
// Give ownership to the member variable.
network_map_.swap(network_map);
SendNetworkListChangedEvent(*network_list);
@@ -656,7 +656,7 @@ bool NetworkingPrivateLinux::GetNetworkDevices(
networking_private::kNetworkManagerNamespace,
networking_private::kNetworkManagerGetDevicesMethod);
- scoped_ptr<dbus::Response> device_response(
+ std::unique_ptr<dbus::Response> device_response(
network_manager_proxy_->CallMethodAndBlock(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
@@ -684,7 +684,7 @@ NetworkingPrivateLinux::DeviceType NetworkingPrivateLinux::GetDeviceType(
builder.AppendString(networking_private::kNetworkManagerDeviceNamespace);
builder.AppendString(networking_private::kNetworkManagerDeviceType);
- scoped_ptr<dbus::Response> response(device_proxy->CallMethodAndBlock(
+ std::unique_ptr<dbus::Response> response(device_proxy->CallMethodAndBlock(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
if (!response) {
@@ -733,7 +733,7 @@ void NetworkingPrivateLinux::GetAllWiFiAccessPoints(bool configured_only,
}
}
-scoped_ptr<dbus::Response> NetworkingPrivateLinux::GetAccessPointProperty(
+std::unique_ptr<dbus::Response> NetworkingPrivateLinux::GetAccessPointProperty(
dbus::ObjectProxy* access_point_proxy,
const std::string& property_name) {
AssertOnDBusThread();
@@ -742,8 +742,9 @@ scoped_ptr<dbus::Response> NetworkingPrivateLinux::GetAccessPointProperty(
dbus::MessageWriter builder(&method_call);
builder.AppendString(networking_private::kNetworkManagerAccessPointNamespace);
builder.AppendString(property_name);
- scoped_ptr<dbus::Response> response = access_point_proxy->CallMethodAndBlock(
- &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT);
+ std::unique_ptr<dbus::Response> response =
+ access_point_proxy->CallMethodAndBlock(
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT);
if (!response) {
LOG(ERROR) << "Failed to get property for " << property_name;
}
@@ -752,14 +753,14 @@ scoped_ptr<dbus::Response> NetworkingPrivateLinux::GetAccessPointProperty(
bool NetworkingPrivateLinux::GetAccessPointInfo(
const dbus::ObjectPath& access_point_path,
- const scoped_ptr<base::DictionaryValue>& access_point_info) {
+ const std::unique_ptr<base::DictionaryValue>& access_point_info) {
AssertOnDBusThread();
dbus::ObjectProxy* access_point_proxy = dbus_->GetObjectProxy(
networking_private::kNetworkManagerNamespace, access_point_path);
// Read the SSID. The GUID is derived from the Ssid.
{
- scoped_ptr<dbus::Response> response(GetAccessPointProperty(
+ std::unique_ptr<dbus::Response> response(GetAccessPointProperty(
access_point_proxy, networking_private::kNetworkManagerSsidProperty));
if (!response) {
@@ -791,7 +792,7 @@ bool NetworkingPrivateLinux::GetAccessPointInfo(
// Read signal strength.
{
- scoped_ptr<dbus::Response> response(GetAccessPointProperty(
+ std::unique_ptr<dbus::Response> response(GetAccessPointProperty(
access_point_proxy,
networking_private::kNetworkManagerStrengthProperty));
if (!response) {
@@ -816,7 +817,7 @@ bool NetworkingPrivateLinux::GetAccessPointInfo(
uint32_t wpa_security_flags = 0;
{
- scoped_ptr<dbus::Response> response(GetAccessPointProperty(
+ std::unique_ptr<dbus::Response> response(GetAccessPointProperty(
access_point_proxy,
networking_private::kNetworkManagerWpaFlagsProperty));
if (!response) {
@@ -834,7 +835,7 @@ bool NetworkingPrivateLinux::GetAccessPointInfo(
uint32_t rsn_security_flags = 0;
{
- scoped_ptr<dbus::Response> response(GetAccessPointProperty(
+ std::unique_ptr<dbus::Response> response(GetAccessPointProperty(
access_point_proxy,
networking_private::kNetworkManagerRsnFlagsProperty));
if (!response) {
@@ -872,7 +873,7 @@ bool NetworkingPrivateLinux::AddAccessPointsFromDevice(
dbus::MethodCall method_call(
networking_private::kNetworkManagerWirelessDeviceNamespace,
networking_private::kNetworkManagerGetAccessPointsMethod);
- scoped_ptr<dbus::Response> response(device_proxy->CallMethodAndBlock(
+ std::unique_ptr<dbus::Response> response(device_proxy->CallMethodAndBlock(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
if (!response) {
@@ -890,7 +891,8 @@ bool NetworkingPrivateLinux::AddAccessPointsFromDevice(
}
for (const auto& access_point_path : access_point_paths) {
- scoped_ptr<base::DictionaryValue> access_point(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> access_point(
+ new base::DictionaryValue);
if (GetAccessPointInfo(access_point_path, access_point)) {
std::string connection_state =
@@ -920,7 +922,7 @@ bool NetworkingPrivateLinux::AddAccessPointsFromDevice(
void NetworkingPrivateLinux::AddOrUpdateAccessPoint(
NetworkMap* network_map,
const std::string& network_guid,
- scoped_ptr<base::DictionaryValue>& access_point) {
+ std::unique_ptr<base::DictionaryValue>& access_point) {
base::string16 ssid;
std::string connection_state;
int signal_strength;
@@ -992,7 +994,7 @@ bool NetworkingPrivateLinux::GetConnectedAccessPoint(
builder.AppendString(networking_private::kNetworkManagerNamespace);
builder.AppendString(networking_private::kNetworkManagerActiveConnections);
- scoped_ptr<dbus::Response> response(
+ std::unique_ptr<dbus::Response> response(
network_manager_proxy_->CallMethodAndBlock(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
@@ -1050,7 +1052,7 @@ bool NetworkingPrivateLinux::GetDeviceOfConnection(
networking_private::kNetworkManagerActiveConnectionNamespace);
builder.AppendString("Devices");
- scoped_ptr<dbus::Response> response(connection_proxy->CallMethodAndBlock(
+ std::unique_ptr<dbus::Response> response(connection_proxy->CallMethodAndBlock(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
if (!response) {
@@ -1098,7 +1100,7 @@ bool NetworkingPrivateLinux::GetAccessPointForConnection(
networking_private::kNetworkManagerActiveConnectionNamespace);
builder.AppendString(networking_private::kNetworkManagerSpecificObject);
- scoped_ptr<dbus::Response> response(connection_proxy->CallMethodAndBlock(
+ std::unique_ptr<dbus::Response> response(connection_proxy->CallMethodAndBlock(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
if (!response) {
@@ -1159,7 +1161,7 @@ bool NetworkingPrivateLinux::SetConnectionStateAndPostEvent(
network_iter->second->SetString(kAccessPointInfoConnectionState,
connection_state);
- scoped_ptr<GuidList> changed_networks(new GuidList());
+ std::unique_ptr<GuidList> changed_networks(new GuidList());
changed_networks->push_back(guid);
// Only add a second network if it exists and it is not the same as the
@@ -1189,7 +1191,7 @@ void NetworkingPrivateLinux::OnNetworkListChangedEventOnUIThread(
}
void NetworkingPrivateLinux::PostOnNetworksChangedToUIThread(
- scoped_ptr<GuidList> guid_list) {
+ std::unique_ptr<GuidList> guid_list) {
AssertOnDBusThread();
content::BrowserThread::PostTask(
@@ -1199,7 +1201,7 @@ void NetworkingPrivateLinux::PostOnNetworksChangedToUIThread(
}
void NetworkingPrivateLinux::OnNetworksChangedEventTask(
- scoped_ptr<GuidList> guid_list) {
+ std::unique_ptr<GuidList> guid_list) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
OnNetworksChangedEventOnUIThread(*guid_list);
}
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_linux.h b/chromium/extensions/browser/api/networking_private/networking_private_linux.h
index e33c7b889cd..39e93bd255b 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_linux.h
+++ b/chromium/extensions/browser/api/networking_private/networking_private_linux.h
@@ -17,10 +17,6 @@
#include "components/keyed_service/core/keyed_service.h"
#include "extensions/browser/api/networking_private/networking_private_delegate.h"
-namespace content {
-class BrowserContext;
-}
-
namespace dbus {
class Bus;
class ObjectPath;
@@ -38,8 +34,8 @@ class NetworkingPrivateLinux : public NetworkingPrivateDelegate {
typedef std::vector<std::string> GuidList;
- NetworkingPrivateLinux(content::BrowserContext* browser_context,
- scoped_ptr<VerifyDelegate> verify_delegate);
+ explicit NetworkingPrivateLinux(
+ std::unique_ptr<VerifyDelegate> verify_delegate);
// NetworkingPrivateDelegate
void GetProperties(const std::string& guid,
@@ -52,11 +48,11 @@ class NetworkingPrivateLinux : public NetworkingPrivateDelegate {
const DictionaryCallback& success_callback,
const FailureCallback& failure_callback) override;
void SetProperties(const std::string& guid,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const VoidCallback& success_callback,
const FailureCallback& failure_callback) override;
void CreateNetwork(bool shared,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const StringCallback& success_callback,
const FailureCallback& failure_callback) override;
void ForgetNetwork(const std::string& guid,
@@ -97,8 +93,8 @@ class NetworkingPrivateLinux : public NetworkingPrivateDelegate {
const VoidCallback& success_callback,
const FailureCallback& failure_callback) override;
- scoped_ptr<base::ListValue> GetEnabledNetworkTypes() override;
- scoped_ptr<DeviceStateList> GetDeviceStateList() override;
+ std::unique_ptr<base::ListValue> GetEnabledNetworkTypes() override;
+ std::unique_ptr<DeviceStateList> GetDeviceStateList() override;
bool EnableNetworkType(const std::string& type) override;
bool DisableNetworkType(const std::string& type) override;
bool RequestScan() override;
@@ -181,13 +177,13 @@ class NetworkingPrivateLinux : public NetworkingPrivateDelegate {
// Reply callback accepts the map of networks and fires the
// OnNetworkListChanged event and user callbacks.
- void OnAccessPointsFound(scoped_ptr<NetworkMap> network_map,
+ void OnAccessPointsFound(std::unique_ptr<NetworkMap> network_map,
const NetworkListCallback& success_callback,
const FailureCallback& failure_callback);
// Reply callback accepts the map of networks and fires the
// OnNetworkListChanged event.
- void OnAccessPointsFoundViaScan(scoped_ptr<NetworkMap> network_map);
+ void OnAccessPointsFoundViaScan(std::unique_ptr<NetworkMap> network_map);
// Helper function for OnAccessPointsFound and OnAccessPointsFoundViaScan to
// fire the OnNetworkListChangedEvent.
@@ -198,21 +194,22 @@ class NetworkingPrivateLinux : public NetworkingPrivateDelegate {
// supplied |access_point_path|.
bool GetAccessPointInfo(
const dbus::ObjectPath& access_point_path,
- const scoped_ptr<base::DictionaryValue>& access_point_info);
+ const std::unique_ptr<base::DictionaryValue>& access_point_info);
// Helper function to extract a property from a device.
// Returns the dbus::Response object from calling Get on the supplied
// |property_name|.
- scoped_ptr<dbus::Response> GetAccessPointProperty(
+ std::unique_ptr<dbus::Response> GetAccessPointProperty(
dbus::ObjectProxy* access_point_proxy,
const std::string& property_name);
// If the access_point is not already in the map it is added. Otherwise
// the access point is updated (eg. with the max of the signal
// strength).
- void AddOrUpdateAccessPoint(NetworkMap* network_map,
- const std::string& network_guid,
- scoped_ptr<base::DictionaryValue>& access_point);
+ void AddOrUpdateAccessPoint(
+ NetworkMap* network_map,
+ const std::string& network_guid,
+ std::unique_ptr<base::DictionaryValue>& access_point);
// Maps the WPA security flags to a human readable string.
void MapSecurityFlagsToString(uint32_t securityFlags, std::string* security);
@@ -245,11 +242,11 @@ class NetworkingPrivateLinux : public NetworkingPrivateDelegate {
// Helper method to post an OnNetworkChanged event to the UI thread from the
// dbus thread. Used for connection status progress during |StartConnect|.
- void PostOnNetworksChangedToUIThread(scoped_ptr<GuidList> guid_list);
+ void PostOnNetworksChangedToUIThread(std::unique_ptr<GuidList> guid_list);
// Helper method to be called from the UI thread and manage ownership of the
// passed vector from the |dbus_thread_|.
- void OnNetworksChangedEventTask(scoped_ptr<GuidList> guid_list);
+ void OnNetworksChangedEventTask(std::unique_ptr<GuidList> guid_list);
void GetCachedNetworkProperties(const std::string& guid,
base::DictionaryValue* properties,
@@ -259,8 +256,6 @@ class NetworkingPrivateLinux : public NetworkingPrivateDelegate {
void OnNetworkListChangedEventOnUIThread(const GuidList& network_guids);
- // Browser context.
- content::BrowserContext* browser_context_;
// Thread used for DBus actions.
base::Thread dbus_thread_;
// DBus instance. Only access on |dbus_thread_|.
@@ -270,7 +265,7 @@ class NetworkingPrivateLinux : public NetworkingPrivateDelegate {
// This is owned by |dbus_| object. Only access on |dbus_thread_|.
dbus::ObjectProxy* network_manager_proxy_;
// Holds the current mapping of known networks. Only access on |dbus_thread_|.
- scoped_ptr<NetworkMap> network_map_;
+ std::unique_ptr<NetworkMap> network_map_;
// Observers to Network Events.
base::ObserverList<NetworkingPrivateDelegateObserver>
network_events_observers_;
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_service_client.cc b/chromium/extensions/browser/api/networking_private/networking_private_service_client.cc
index d9c5cf0f64d..5a40cc13b7d 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_service_client.cc
+++ b/chromium/extensions/browser/api/networking_private/networking_private_service_client.cc
@@ -7,7 +7,7 @@
#include "base/base64.h"
#include "base/bind.h"
#include "base/sequenced_task_runner.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "base/threading/worker_pool.h"
#include "components/onc/onc_constants.h"
#include "content/public/browser/browser_thread.h"
@@ -24,7 +24,8 @@ namespace {
const char kNetworkingPrivateSequenceTokenName[] = "NetworkingPrivate";
// Deletes WiFiService object on the worker thread.
-void ShutdownWifiServiceOnWorkerThread(scoped_ptr<WiFiService> wifi_service) {
+void ShutdownWifiServiceOnWorkerThread(
+ std::unique_ptr<WiFiService> wifi_service) {
DCHECK(wifi_service.get());
}
@@ -37,8 +38,8 @@ NetworkingPrivateServiceClient::ServiceCallbacks::~ServiceCallbacks() {
}
NetworkingPrivateServiceClient::NetworkingPrivateServiceClient(
- scoped_ptr<WiFiService> wifi_service,
- scoped_ptr<VerifyDelegate> verify_delegate)
+ std::unique_ptr<WiFiService> wifi_service,
+ std::unique_ptr<VerifyDelegate> verify_delegate)
: NetworkingPrivateDelegate(std::move(verify_delegate)),
wifi_service_(std::move(wifi_service)),
weak_factory_(this) {
@@ -124,7 +125,7 @@ void NetworkingPrivateServiceClient::GetProperties(
service_callbacks->failure_callback = failure_callback;
service_callbacks->get_properties_callback = success_callback;
- scoped_ptr<base::DictionaryValue> properties(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> properties(new base::DictionaryValue);
std::string* error = new std::string;
base::DictionaryValue* properties_ptr = properties.get();
@@ -145,7 +146,7 @@ void NetworkingPrivateServiceClient::GetManagedProperties(
service_callbacks->failure_callback = failure_callback;
service_callbacks->get_properties_callback = success_callback;
- scoped_ptr<base::DictionaryValue> properties(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> properties(new base::DictionaryValue);
std::string* error = new std::string;
base::DictionaryValue* properties_ptr = properties.get();
@@ -166,7 +167,7 @@ void NetworkingPrivateServiceClient::GetState(
service_callbacks->failure_callback = failure_callback;
service_callbacks->get_properties_callback = success_callback;
- scoped_ptr<base::DictionaryValue> properties(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> properties(new base::DictionaryValue);
std::string* error = new std::string;
base::DictionaryValue* properties_ptr = properties.get();
@@ -181,7 +182,7 @@ void NetworkingPrivateServiceClient::GetState(
void NetworkingPrivateServiceClient::SetProperties(
const std::string& guid,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const VoidCallback& success_callback,
const FailureCallback& failure_callback) {
ServiceCallbacks* service_callbacks = AddServiceCallbacks();
@@ -201,7 +202,7 @@ void NetworkingPrivateServiceClient::SetProperties(
void NetworkingPrivateServiceClient::CreateNetwork(
bool shared,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const StringCallback& success_callback,
const FailureCallback& failure_callback) {
ServiceCallbacks* service_callbacks = AddServiceCallbacks();
@@ -239,7 +240,7 @@ void NetworkingPrivateServiceClient::GetNetworks(
service_callbacks->failure_callback = failure_callback;
service_callbacks->get_visible_networks_callback = success_callback;
- scoped_ptr<base::ListValue> networks(new base::ListValue);
+ std::unique_ptr<base::ListValue> networks(new base::ListValue);
// TODO(stevenjb/mef): Apply filters (configured, visible, limit).
@@ -330,17 +331,17 @@ void NetworkingPrivateServiceClient::SetCellularSimState(
failure_callback.Run(networking_private::kErrorNotSupported);
}
-scoped_ptr<base::ListValue>
+std::unique_ptr<base::ListValue>
NetworkingPrivateServiceClient::GetEnabledNetworkTypes() {
- scoped_ptr<base::ListValue> network_list;
+ std::unique_ptr<base::ListValue> network_list;
network_list->AppendString(::onc::network_type::kWiFi);
return network_list;
}
-scoped_ptr<NetworkingPrivateDelegate::DeviceStateList>
+std::unique_ptr<NetworkingPrivateDelegate::DeviceStateList>
NetworkingPrivateServiceClient::GetDeviceStateList() {
- scoped_ptr<DeviceStateList> device_state_list(new DeviceStateList);
- scoped_ptr<api::networking_private::DeviceStateProperties> properties(
+ std::unique_ptr<DeviceStateList> device_state_list(new DeviceStateList);
+ std::unique_ptr<api::networking_private::DeviceStateProperties> properties(
new api::networking_private::DeviceStateProperties);
properties->type = api::networking_private::NETWORK_TYPE_WIFI;
properties->state = api::networking_private::DEVICE_STATE_TYPE_ENABLED;
@@ -370,7 +371,7 @@ bool NetworkingPrivateServiceClient::RequestScan() {
void NetworkingPrivateServiceClient::AfterGetProperties(
ServiceCallbacksID callback_id,
const std::string& network_guid,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const std::string* error) {
ServiceCallbacks* service_callbacks = callbacks_map_.Lookup(callback_id);
DCHECK(service_callbacks);
@@ -386,7 +387,7 @@ void NetworkingPrivateServiceClient::AfterGetProperties(
void NetworkingPrivateServiceClient::AfterGetVisibleNetworks(
ServiceCallbacksID callback_id,
- scoped_ptr<base::ListValue> networks) {
+ std::unique_ptr<base::ListValue> networks) {
ServiceCallbacks* service_callbacks = callbacks_map_.Lookup(callback_id);
DCHECK(service_callbacks);
DCHECK(!service_callbacks->get_visible_networks_callback.is_null());
diff --git a/chromium/extensions/browser/api/networking_private/networking_private_service_client.h b/chromium/extensions/browser/api/networking_private/networking_private_service_client.h
index 63805db98a2..6e59b68ea04 100644
--- a/chromium/extensions/browser/api/networking_private/networking_private_service_client.h
+++ b/chromium/extensions/browser/api/networking_private/networking_private_service_client.h
@@ -7,12 +7,12 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/id_map.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"
@@ -43,8 +43,9 @@ class NetworkingPrivateServiceClient
// Takes ownership of |wifi_service| which is accessed and deleted on the
// worker thread. The deletion task is posted from the destructor.
// |verify_delegate| is passed to NetworkingPrivateDelegate and may be NULL.
- NetworkingPrivateServiceClient(scoped_ptr<wifi::WiFiService> wifi_service,
- scoped_ptr<VerifyDelegate> verify_delegate);
+ NetworkingPrivateServiceClient(
+ std::unique_ptr<wifi::WiFiService> wifi_service,
+ std::unique_ptr<VerifyDelegate> verify_delegate);
// KeyedService
void Shutdown() override;
@@ -60,11 +61,11 @@ class NetworkingPrivateServiceClient
const DictionaryCallback& success_callback,
const FailureCallback& failure_callback) override;
void SetProperties(const std::string& guid,
- scoped_ptr<base::DictionaryValue> properties_dict,
+ std::unique_ptr<base::DictionaryValue> properties_dict,
const VoidCallback& success_callback,
const FailureCallback& failure_callback) override;
void CreateNetwork(bool shared,
- scoped_ptr<base::DictionaryValue> properties_dict,
+ std::unique_ptr<base::DictionaryValue> properties_dict,
const StringCallback& success_callback,
const FailureCallback& failure_callback) override;
void ForgetNetwork(const std::string& guid,
@@ -104,8 +105,8 @@ class NetworkingPrivateServiceClient
const std::string& new_pin,
const VoidCallback& success_callback,
const FailureCallback& failure_callback) override;
- scoped_ptr<base::ListValue> GetEnabledNetworkTypes() override;
- scoped_ptr<DeviceStateList> GetDeviceStateList() override;
+ std::unique_ptr<base::ListValue> GetEnabledNetworkTypes() override;
+ std::unique_ptr<DeviceStateList> GetDeviceStateList() override;
bool EnableNetworkType(const std::string& type) override;
bool DisableNetworkType(const std::string& type) override;
bool RequestScan() override;
@@ -142,7 +143,7 @@ class NetworkingPrivateServiceClient
// Callback wrappers.
void AfterGetProperties(ServiceCallbacksID callback_id,
const std::string& network_guid,
- scoped_ptr<base::DictionaryValue> properties,
+ std::unique_ptr<base::DictionaryValue> properties,
const std::string* error);
void AfterSetProperties(ServiceCallbacksID callback_id,
const std::string* error);
@@ -150,7 +151,7 @@ class NetworkingPrivateServiceClient
const std::string* network_guid,
const std::string* error);
void AfterGetVisibleNetworks(ServiceCallbacksID callback_id,
- scoped_ptr<base::ListValue> networks);
+ std::unique_ptr<base::ListValue> networks);
void AfterStartConnect(ServiceCallbacksID callback_id,
const std::string* error);
void AfterStartDisconnect(ServiceCallbacksID callback_id,
@@ -172,7 +173,7 @@ class NetworkingPrivateServiceClient
base::ObserverList<NetworkingPrivateDelegateObserver>
network_events_observers_;
// Interface to WiFiService. Used and deleted on the worker thread.
- scoped_ptr<wifi::WiFiService> wifi_service_;
+ std::unique_ptr<wifi::WiFiService> wifi_service_;
// Sequence token associated with wifi tasks.
base::SequencedWorkerPool::SequenceToken sequence_token_;
// Task runner for worker tasks.
diff --git a/chromium/extensions/browser/api/power/power_api.cc b/chromium/extensions/browser/api/power/power_api.cc
index 4c9ed0dcd98..e8b1c53c50a 100644
--- a/chromium/extensions/browser/api/power/power_api.cc
+++ b/chromium/extensions/browser/api/power/power_api.cc
@@ -35,7 +35,7 @@ base::LazyInstance<BrowserContextKeyedAPIFactory<PowerAPI>> g_factory =
} // namespace
bool PowerRequestKeepAwakeFunction::RunSync() {
- scoped_ptr<api::power::RequestKeepAwake::Params> params(
+ std::unique_ptr<api::power::RequestKeepAwake::Params> params(
api::power::RequestKeepAwake::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
EXTENSION_FUNCTION_VALIDATE(params->level != api::power::LEVEL_NONE);
@@ -112,7 +112,7 @@ void PowerAPI::UpdatePowerSaveBlocker() {
if (!power_save_blocker_ || new_level != current_level_) {
content::PowerSaveBlocker::PowerSaveBlockerType type =
LevelToPowerSaveBlockerType(new_level);
- scoped_ptr<content::PowerSaveBlocker> new_blocker(
+ std::unique_ptr<content::PowerSaveBlocker> new_blocker(
create_blocker_function_.Run(type,
content::PowerSaveBlocker::kReasonOther,
kPowerSaveBlockerDescription));
diff --git a/chromium/extensions/browser/api/power/power_api.h b/chromium/extensions/browser/api/power/power_api.h
index 313151d7757..e68bd57f6b2 100644
--- a/chromium/extensions/browser/api/power/power_api.h
+++ b/chromium/extensions/browser/api/power/power_api.h
@@ -6,11 +6,11 @@
#define EXTENSIONS_BROWSER_API_POWER_POWER_API_H_
#include <map>
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "content/public/browser/power_save_blocker.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#include "extensions/browser/extension_function.h"
@@ -53,10 +53,11 @@ class PowerReleaseKeepAwakeFunction : public SyncExtensionFunction {
class PowerAPI : public BrowserContextKeyedAPI,
public extensions::ExtensionRegistryObserver {
public:
- typedef base::Callback<scoped_ptr<content::PowerSaveBlocker>(
+ typedef base::Callback<std::unique_ptr<content::PowerSaveBlocker>(
content::PowerSaveBlocker::PowerSaveBlockerType,
content::PowerSaveBlocker::Reason,
- const std::string&)> CreateBlockerFunction;
+ const std::string&)>
+ CreateBlockerFunction;
static PowerAPI* Get(content::BrowserContext* context);
@@ -103,7 +104,7 @@ class PowerAPI : public BrowserContextKeyedAPI,
// actually changing the system power-saving settings.
CreateBlockerFunction create_blocker_function_;
- scoped_ptr<content::PowerSaveBlocker> power_save_blocker_;
+ std::unique_ptr<content::PowerSaveBlocker> power_save_blocker_;
// Current level used by |power_save_blocker_|. Meaningless if
// |power_save_blocker_| is NULL.
diff --git a/chromium/extensions/browser/api/power/power_api_unittest.cc b/chromium/extensions/browser/api/power/power_api_unittest.cc
index 693abd10b04..54b8403d9e4 100644
--- a/chromium/extensions/browser/api/power/power_api_unittest.cc
+++ b/chromium/extensions/browser/api/power/power_api_unittest.cc
@@ -5,11 +5,11 @@
#include "extensions/browser/api/power/power_api.h"
#include <deque>
+#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/power_save_blocker.h"
#include "extensions/browser/api_test_utils.h"
@@ -88,7 +88,7 @@ class PowerSaveBlockerStubManager {
private:
// Creates a new PowerSaveBlockerStub of type |type|.
- scoped_ptr<content::PowerSaveBlocker> CreateStub(
+ std::unique_ptr<content::PowerSaveBlocker> CreateStub(
content::PowerSaveBlocker::PowerSaveBlockerType type,
content::PowerSaveBlocker::Reason reason,
const std::string& description) {
@@ -103,11 +103,9 @@ class PowerSaveBlockerStubManager {
unblock_request = UNBLOCK_DISPLAY_SLEEP;
break;
}
- return scoped_ptr<content::PowerSaveBlocker>(
- new PowerSaveBlockerStub(
- base::Bind(&PowerSaveBlockerStubManager::AppendRequest,
- weak_ptr_factory_.GetWeakPtr(),
- unblock_request)));
+ return std::unique_ptr<content::PowerSaveBlocker>(new PowerSaveBlockerStub(
+ base::Bind(&PowerSaveBlockerStubManager::AppendRequest,
+ weak_ptr_factory_.GetWeakPtr(), unblock_request)));
}
void AppendRequest(Request request) {
@@ -169,7 +167,7 @@ class PowerAPITest : public ApiUnitTest {
UnloadedExtensionInfo::REASON_UNINSTALL);
}
- scoped_ptr<PowerSaveBlockerStubManager> manager_;
+ std::unique_ptr<PowerSaveBlockerStubManager> manager_;
};
TEST_F(PowerAPITest, RequestAndRelease) {
diff --git a/chromium/extensions/browser/api/printer_provider/printer_provider_api.cc b/chromium/extensions/browser/api/printer_provider/printer_provider_api.cc
index ed776e5b4df..762bd7e0c12 100644
--- a/chromium/extensions/browser/api/printer_provider/printer_provider_api.cc
+++ b/chromium/extensions/browser/api/printer_provider/printer_provider_api.cc
@@ -523,12 +523,12 @@ void PrinterProviderAPIImpl::DispatchGetPrintersRequested(
// be needed later on.
int request_id = pending_get_printers_requests_.Add(callback);
- scoped_ptr<base::ListValue> internal_args(new base::ListValue);
+ std::unique_ptr<base::ListValue> internal_args(new base::ListValue);
// Request id is not part of the public API, but it will be massaged out in
// custom bindings.
internal_args->AppendInteger(request_id);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::PRINTER_PROVIDER_ON_GET_PRINTERS_REQUESTED,
api::printer_provider::OnGetPrintersRequested::kEventName,
std::move(internal_args)));
@@ -561,13 +561,13 @@ void PrinterProviderAPIImpl::DispatchGetCapabilityRequested(
int request_id = pending_capability_requests_[extension_id].Add(callback);
- scoped_ptr<base::ListValue> internal_args(new base::ListValue);
+ std::unique_ptr<base::ListValue> internal_args(new base::ListValue);
// Request id is not part of the public API, but it will be massaged out in
// custom bindings.
internal_args->AppendInteger(request_id);
internal_args->AppendString(internal_printer_id);
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::PRINTER_PROVIDER_ON_GET_CAPABILITY_REQUESTED,
api::printer_provider::OnGetCapabilityRequested::kEventName,
std::move(internal_args)));
@@ -596,7 +596,8 @@ void PrinterProviderAPIImpl::DispatchPrintRequested(
print_job.printer_id = internal_printer_id;
JSONStringValueDeserializer deserializer(job.ticket_json);
- scoped_ptr<base::Value> ticket_value = deserializer.Deserialize(NULL, NULL);
+ std::unique_ptr<base::Value> ticket_value =
+ deserializer.Deserialize(NULL, NULL);
if (!ticket_value ||
!api::printer_provider::PrintJob::Ticket::Populate(*ticket_value,
&print_job.ticket)) {
@@ -609,12 +610,12 @@ void PrinterProviderAPIImpl::DispatchPrintRequested(
print_job.title = base::UTF16ToUTF8(job.job_title);
int request_id = pending_print_requests_[extension_id].Add(job, callback);
- scoped_ptr<base::ListValue> internal_args(new base::ListValue);
+ std::unique_ptr<base::ListValue> internal_args(new base::ListValue);
// Request id is not part of the public API and it will be massaged out in
// custom bindings.
internal_args->AppendInteger(request_id);
internal_args->Append(print_job.ToValue().release());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::PRINTER_PROVIDER_ON_PRINT_REQUESTED,
api::printer_provider::OnPrintRequested::kEventName,
std::move(internal_args)));
@@ -647,12 +648,12 @@ void PrinterProviderAPIImpl::DispatchGetUsbPrinterInfoRequested(
api::usb::Device api_device;
UsbGuidMap::Get(browser_context_)->GetApiDevice(device, &api_device);
- scoped_ptr<base::ListValue> internal_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> internal_args(new base::ListValue());
// Request id is not part of the public API and it will be massaged out in
// custom bindings.
internal_args->AppendInteger(request_id);
internal_args->Append(api_device.ToValue());
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::PRINTER_PROVIDER_ON_GET_USB_PRINTER_INFO_REQUESTED,
api::printer_provider::OnGetUsbPrinterInfoRequested::kEventName,
std::move(internal_args)));
@@ -668,7 +669,7 @@ void PrinterProviderAPIImpl::OnGetPrintersResult(
// Update some printer description properties to better identify the extension
// managing the printer.
for (const api::printer_provider::PrinterInfo& p : result) {
- scoped_ptr<base::DictionaryValue> printer(p.ToValue());
+ std::unique_ptr<base::DictionaryValue> printer(p.ToValue());
UpdatePrinterWithExtensionInfo(printer.get(), extension);
printer_list.Append(std::move(printer));
}
@@ -702,7 +703,7 @@ void PrinterProviderAPIImpl::OnGetUsbPrinterInfoResult(
int request_id,
const api::printer_provider::PrinterInfo* result) {
if (result) {
- scoped_ptr<base::DictionaryValue> printer(result->ToValue());
+ std::unique_ptr<base::DictionaryValue> printer(result->ToValue());
UpdatePrinterWithExtensionInfo(printer.get(), extension);
pending_usb_printer_info_requests_[extension->id()].Complete(request_id,
*printer);
diff --git a/chromium/extensions/browser/api/printer_provider/printer_provider_apitest.cc b/chromium/extensions/browser/api/printer_provider/printer_provider_apitest.cc
index b49663c8691..ca949ec43c5 100644
--- a/chromium/extensions/browser/api/printer_provider/printer_provider_apitest.cc
+++ b/chromium/extensions/browser/api/printer_provider/printer_provider_apitest.cc
@@ -297,7 +297,8 @@ class PrinterProviderApiTest : public ShellApiTest {
test_param, &extension_id);
ASSERT_FALSE(extension_id.empty());
- scoped_ptr<base::Value> expected_printer_info(new base::DictionaryValue());
+ std::unique_ptr<base::Value> expected_printer_info(
+ new base::DictionaryValue());
base::RunLoop run_loop;
StartGetUsbPrinterInfoRequest(
extension_id, device,
@@ -330,7 +331,7 @@ class PrinterProviderApiTest : public ShellApiTest {
// in |expoected_printers| are unique.
void ValidatePrinterListValue(
const base::ListValue& printers,
- const std::vector<scoped_ptr<base::Value>> expected_printers) {
+ const std::vector<std::unique_ptr<base::Value>> expected_printers) {
ASSERT_EQ(expected_printers.size(), printers.GetSize());
for (const auto& printer_value : expected_printers) {
EXPECT_TRUE(printers.Find(*printer_value.get()) != printers.end())
@@ -489,7 +490,7 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetPrintersSuccess) {
run_loop.Run();
- std::vector<scoped_ptr<base::Value>> expected_printers;
+ std::vector<std::unique_ptr<base::Value>> expected_printers;
expected_printers.push_back(
DictionaryBuilder()
.Set("description", "Test printer")
@@ -528,7 +529,7 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetPrintersAsyncSuccess) {
run_loop.Run();
- std::vector<scoped_ptr<base::Value>> expected_printers;
+ std::vector<std::unique_ptr<base::Value>> expected_printers;
expected_printers.push_back(
DictionaryBuilder()
.Set("description", "Test printer")
@@ -566,7 +567,7 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetPrintersTwoExtensions) {
run_loop.Run();
- std::vector<scoped_ptr<base::Value>> expected_printers;
+ std::vector<std::unique_ptr<base::Value>> expected_printers;
expected_printers.push_back(
DictionaryBuilder()
.Set("description", "Test printer")
@@ -661,7 +662,7 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest,
run_loop.Run();
- std::vector<scoped_ptr<base::Value>> expected_printers;
+ std::vector<std::unique_ptr<base::Value>> expected_printers;
expected_printers.push_back(
DictionaryBuilder()
.Set("description", "Test printer")
@@ -708,7 +709,7 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest,
run_loop.Run();
- std::vector<scoped_ptr<base::Value>> expected_printers;
+ std::vector<std::unique_ptr<base::Value>> expected_printers;
expected_printers.push_back(
DictionaryBuilder()
.Set("description", "Test printer")
@@ -826,7 +827,7 @@ IN_PROC_BROWSER_TEST_F(PrinterProviderApiTest, GetUsbPrinterInfo) {
ASSERT_FALSE(extension_id.empty());
UsbGuidMap* guid_map = UsbGuidMap::Get(browser_context());
- scoped_ptr<base::Value> expected_printer_info(
+ std::unique_ptr<base::Value> expected_printer_info(
DictionaryBuilder()
.Set("description", "This printer is a USB device.")
.Set("extensionId", extension_id)
diff --git a/chromium/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.cc b/chromium/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.cc
index e032703dfeb..e9f3e0b5ab7 100644
--- a/chromium/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.cc
+++ b/chromium/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.cc
@@ -4,6 +4,7 @@
#include "extensions/browser/api/printer_provider_internal/printer_provider_internal_api.h"
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -13,7 +14,6 @@
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/memory/ref_counted_memory.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "content/public/browser/blob_handle.h"
#include "content/public/browser/browser_context.h"
@@ -106,7 +106,7 @@ PrinterProviderInternalReportPrintResultFunction::
ExtensionFunction::ResponseAction
PrinterProviderInternalReportPrintResultFunction::Run() {
- scoped_ptr<internal_api::ReportPrintResult::Params> params(
+ std::unique_ptr<internal_api::ReportPrintResult::Params> params(
internal_api::ReportPrintResult::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -126,7 +126,7 @@ PrinterProviderInternalReportPrinterCapabilityFunction::
ExtensionFunction::ResponseAction
PrinterProviderInternalReportPrinterCapabilityFunction::Run() {
- scoped_ptr<internal_api::ReportPrinterCapability::Params> params(
+ std::unique_ptr<internal_api::ReportPrinterCapability::Params> params(
internal_api::ReportPrinterCapability::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -154,7 +154,7 @@ PrinterProviderInternalReportPrintersFunction::
ExtensionFunction::ResponseAction
PrinterProviderInternalReportPrintersFunction::Run() {
- scoped_ptr<internal_api::ReportPrinters::Params> params(
+ std::unique_ptr<internal_api::ReportPrinters::Params> params(
internal_api::ReportPrinters::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -184,7 +184,7 @@ PrinterProviderInternalGetPrintDataFunction::
ExtensionFunction::ResponseAction
PrinterProviderInternalGetPrintDataFunction::Run() {
- scoped_ptr<internal_api::GetPrintData::Params> params(
+ std::unique_ptr<internal_api::GetPrintData::Params> params(
internal_api::GetPrintData::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -221,7 +221,7 @@ void PrinterProviderInternalGetPrintDataFunction::OnBlob(
const std::string& type,
int size,
const scoped_refptr<base::RefCountedMemory>& data,
- scoped_ptr<content::BlobHandle> blob) {
+ std::unique_ptr<content::BlobHandle> blob) {
if (!blob) {
SetError("Unable to create the blob.");
SendResponse(false);
@@ -256,7 +256,7 @@ PrinterProviderInternalReportUsbPrinterInfoFunction::
ExtensionFunction::ResponseAction
PrinterProviderInternalReportUsbPrinterInfoFunction::Run() {
- scoped_ptr<internal_api::ReportUsbPrinterInfo::Params> params(
+ std::unique_ptr<internal_api::ReportUsbPrinterInfo::Params> params(
internal_api::ReportUsbPrinterInfo::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chromium/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.h b/chromium/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.h
index 472cf193f67..0f082a94a01 100644
--- a/chromium/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.h
+++ b/chromium/extensions/browser/api/printer_provider_internal/printer_provider_internal_api.h
@@ -154,7 +154,7 @@ class PrinterProviderInternalGetPrintDataFunction
void OnBlob(const std::string& type,
int size,
const scoped_refptr<base::RefCountedMemory>& data,
- scoped_ptr<content::BlobHandle> blob);
+ std::unique_ptr<content::BlobHandle> blob);
DECLARE_EXTENSION_FUNCTION("printerProviderInternal.getPrintData",
PRINTERPROVIDERINTERNAL_GETPRINTDATA)
diff --git a/chromium/extensions/browser/api/runtime/runtime_api.cc b/chromium/extensions/browser/api/runtime/runtime_api.cc
index a42e4662ba7..e62805e6742 100644
--- a/chromium/extensions/browser/api/runtime/runtime_api.cc
+++ b/chromium/extensions/browser/api/runtime/runtime_api.cc
@@ -4,11 +4,11 @@
#include "extensions/browser/api/runtime/runtime_api.h"
+#include <memory>
#include <utility>
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/values.h"
#include "base/version.h"
@@ -113,10 +113,10 @@ void DispatchOnStartupEventImpl(BrowserContext* browser_context,
return;
}
- scoped_ptr<base::ListValue> event_args(new base::ListValue());
- scoped_ptr<Event> event(new Event(events::RUNTIME_ON_STARTUP,
- runtime::OnStartup::kEventName,
- std::move(event_args)));
+ std::unique_ptr<base::ListValue> event_args(new base::ListValue());
+ std::unique_ptr<Event> event(new Event(events::RUNTIME_ON_STARTUP,
+ runtime::OnStartup::kEventName,
+ std::move(event_args)));
EventRouter::Get(browser_context)
->DispatchEventToExtension(extension_id, std::move(event));
}
@@ -287,7 +287,7 @@ void RuntimeAPI::StorePendingOnInstallInfoToPref(const Extension* extension) {
// |pending_on_install_info| currently only contains a version string. Instead
// of making the pref hold a plain string, we store it as a dictionary value
// so that we can add more stuff to it in the future if necessary.
- scoped_ptr<base::DictionaryValue> pending_on_install_info(
+ std::unique_ptr<base::DictionaryValue> pending_on_install_info(
new base::DictionaryValue());
base::Version previous_version =
delegate_->GetPreviousExtensionVersion(extension);
@@ -346,7 +346,7 @@ void RuntimeEventRouter::DispatchOnInstalledEvent(
if (!system)
return;
- scoped_ptr<base::ListValue> event_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> event_args(new base::ListValue());
base::DictionaryValue* info = new base::DictionaryValue();
event_args->Append(info);
if (old_version.IsValid()) {
@@ -359,9 +359,9 @@ void RuntimeEventRouter::DispatchOnInstalledEvent(
}
EventRouter* event_router = EventRouter::Get(context);
DCHECK(event_router);
- scoped_ptr<Event> event(new Event(events::RUNTIME_ON_INSTALLED,
- runtime::OnInstalled::kEventName,
- std::move(event_args)));
+ std::unique_ptr<Event> event(new Event(events::RUNTIME_ON_INSTALLED,
+ runtime::OnInstalled::kEventName,
+ std::move(event_args)));
event_router->DispatchEventWithLazyListener(extension_id, std::move(event));
if (old_version.IsValid()) {
@@ -369,20 +369,20 @@ void RuntimeEventRouter::DispatchOnInstalledEvent(
ExtensionRegistry::Get(context)->enabled_extensions().GetByID(
extension_id);
if (extension && SharedModuleInfo::IsSharedModule(extension)) {
- scoped_ptr<ExtensionSet> dependents =
+ std::unique_ptr<ExtensionSet> dependents =
system->GetDependentExtensions(extension);
for (ExtensionSet::const_iterator i = dependents->begin();
i != dependents->end();
i++) {
- scoped_ptr<base::ListValue> sm_event_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> sm_event_args(new base::ListValue());
base::DictionaryValue* sm_info = new base::DictionaryValue();
sm_event_args->Append(sm_info);
sm_info->SetString(kInstallReason, kInstallReasonSharedModuleUpdate);
sm_info->SetString(kInstallPreviousVersion, old_version.GetString());
sm_info->SetString(kInstallId, extension_id);
- scoped_ptr<Event> sm_event(new Event(events::RUNTIME_ON_INSTALLED,
- runtime::OnInstalled::kEventName,
- std::move(sm_event_args)));
+ std::unique_ptr<Event> sm_event(new Event(
+ events::RUNTIME_ON_INSTALLED, runtime::OnInstalled::kEventName,
+ std::move(sm_event_args)));
event_router->DispatchEventWithLazyListener((*i)->id(),
std::move(sm_event));
}
@@ -399,13 +399,13 @@ void RuntimeEventRouter::DispatchOnUpdateAvailableEvent(
if (!system)
return;
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(manifest->DeepCopy());
EventRouter* event_router = EventRouter::Get(context);
DCHECK(event_router);
- scoped_ptr<Event> event(new Event(events::RUNTIME_ON_UPDATE_AVAILABLE,
- runtime::OnUpdateAvailable::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::RUNTIME_ON_UPDATE_AVAILABLE,
+ runtime::OnUpdateAvailable::kEventName,
+ std::move(args)));
event_router->DispatchEventToExtension(extension_id, std::move(event));
}
@@ -416,10 +416,10 @@ void RuntimeEventRouter::DispatchOnBrowserUpdateAvailableEvent(
if (!system)
return;
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
EventRouter* event_router = EventRouter::Get(context);
DCHECK(event_router);
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
events::RUNTIME_ON_BROWSER_UPDATE_AVAILABLE,
runtime::OnBrowserUpdateAvailable::kEventName, std::move(args)));
event_router->BroadcastEvent(std::move(event));
@@ -434,7 +434,7 @@ void RuntimeEventRouter::DispatchOnRestartRequiredEvent(
if (!system)
return;
- scoped_ptr<Event> event(
+ std::unique_ptr<Event> event(
new Event(events::RUNTIME_ON_RESTART_REQUIRED,
runtime::OnRestartRequired::kEventName,
api::runtime::OnRestartRequired::Create(reason)));
diff --git a/chromium/extensions/browser/api/runtime/runtime_api.h b/chromium/extensions/browser/api/runtime/runtime_api.h
index 5f6fbe5a2d3..187f7b0d7f1 100644
--- a/chromium/extensions/browser/api/runtime/runtime_api.h
+++ b/chromium/extensions/browser/api/runtime/runtime_api.h
@@ -102,7 +102,7 @@ class RuntimeAPI : public BrowserContextKeyedAPI,
void RemovePendingOnInstallInfoFromPref(const ExtensionId& extension_id);
void StorePendingOnInstallInfoToPref(const Extension* extension);
- scoped_ptr<RuntimeAPIDelegate> delegate_;
+ std::unique_ptr<RuntimeAPIDelegate> delegate_;
content::BrowserContext* browser_context_;
diff --git a/chromium/extensions/browser/api/runtime/runtime_apitest.cc b/chromium/extensions/browser/api/runtime/runtime_apitest.cc
index cc7226687a0..78f5998cffd 100644
--- a/chromium/extensions/browser/api/runtime/runtime_apitest.cc
+++ b/chromium/extensions/browser/api/runtime/runtime_apitest.cc
@@ -53,7 +53,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeRuntimeOpenOptionsPageError) {
}
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeRuntimeGetPlatformInfo) {
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
extension_function_test_utils::RunFunctionAndReturnSingleResult(
new RuntimeGetPlatformInfoFunction(), "[]", browser()));
ASSERT_TRUE(result.get() != NULL);
diff --git a/chromium/extensions/browser/api/serial/serial_api.cc b/chromium/extensions/browser/api/serial/serial_api.cc
index 74346baa2f5..3f126a80046 100644
--- a/chromium/extensions/browser/api/serial/serial_api.cc
+++ b/chromium/extensions/browser/api/serial/serial_api.cc
@@ -43,7 +43,7 @@ const char kErrorSerialConnectionNotFound[] = "Serial connection not found.";
const char kErrorGetControlSignalsFailed[] = "Failed to get control signals.";
template <class T>
-void SetDefaultScopedPtrValue(scoped_ptr<T>& ptr, const T& value) {
+void SetDefaultScopedPtrValue(std::unique_ptr<T>& ptr, const T& value) {
if (!ptr.get())
ptr.reset(new T(value));
}
@@ -86,7 +86,7 @@ bool SerialGetDevicesFunction::Prepare() {
void SerialGetDevicesFunction::Work() {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
- scoped_ptr<device::SerialDeviceEnumerator> enumerator =
+ std::unique_ptr<device::SerialDeviceEnumerator> enumerator =
device::SerialDeviceEnumerator::Create();
mojo::Array<device::serial::DeviceInfoPtr> devices = enumerator->GetDevices();
results_ = serial::GetDevices::Results::Create(
diff --git a/chromium/extensions/browser/api/serial/serial_api.h b/chromium/extensions/browser/api/serial/serial_api.h
index c6831fb6730..d22808f23b1 100644
--- a/chromium/extensions/browser/api/serial/serial_api.h
+++ b/chromium/extensions/browser/api/serial/serial_api.h
@@ -72,7 +72,7 @@ class SerialConnectFunction : public SerialAsyncApiFunction {
void OnConnected(bool success);
void FinishConnect();
- scoped_ptr<serial::Connect::Params> params_;
+ std::unique_ptr<serial::Connect::Params> params_;
// SerialEventDispatcher is owned by a BrowserContext.
SerialEventDispatcher* serial_event_dispatcher_;
@@ -98,7 +98,7 @@ class SerialUpdateFunction : public SerialAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<serial::Update::Params> params_;
+ std::unique_ptr<serial::Update::Params> params_;
};
class SerialDisconnectFunction : public SerialAsyncApiFunction {
@@ -115,7 +115,7 @@ class SerialDisconnectFunction : public SerialAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<serial::Disconnect::Params> params_;
+ std::unique_ptr<serial::Disconnect::Params> params_;
};
class SerialSetPausedFunction : public SerialAsyncApiFunction {
@@ -132,7 +132,7 @@ class SerialSetPausedFunction : public SerialAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<serial::SetPaused::Params> params_;
+ std::unique_ptr<serial::SetPaused::Params> params_;
SerialEventDispatcher* serial_event_dispatcher_;
};
@@ -150,7 +150,7 @@ class SerialGetInfoFunction : public SerialAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<serial::GetInfo::Params> params_;
+ std::unique_ptr<serial::GetInfo::Params> params_;
};
class SerialGetConnectionsFunction : public SerialAsyncApiFunction {
@@ -183,7 +183,7 @@ class SerialSendFunction : public SerialAsyncApiFunction {
private:
void OnSendComplete(int bytes_sent, serial::SendError error);
- scoped_ptr<serial::Send::Params> params_;
+ std::unique_ptr<serial::Send::Params> params_;
};
class SerialFlushFunction : public SerialAsyncApiFunction {
@@ -200,7 +200,7 @@ class SerialFlushFunction : public SerialAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<serial::Flush::Params> params_;
+ std::unique_ptr<serial::Flush::Params> params_;
};
class SerialGetControlSignalsFunction : public SerialAsyncApiFunction {
@@ -218,7 +218,7 @@ class SerialGetControlSignalsFunction : public SerialAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<serial::GetControlSignals::Params> params_;
+ std::unique_ptr<serial::GetControlSignals::Params> params_;
};
class SerialSetControlSignalsFunction : public SerialAsyncApiFunction {
@@ -236,7 +236,7 @@ class SerialSetControlSignalsFunction : public SerialAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<serial::SetControlSignals::Params> params_;
+ std::unique_ptr<serial::SetControlSignals::Params> params_;
};
class SerialSetBreakFunction : public SerialAsyncApiFunction {
@@ -252,7 +252,7 @@ class SerialSetBreakFunction : public SerialAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<serial::SetBreak::Params> params_;
+ std::unique_ptr<serial::SetBreak::Params> params_;
};
class SerialClearBreakFunction : public SerialAsyncApiFunction {
@@ -268,7 +268,7 @@ class SerialClearBreakFunction : public SerialAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<serial::ClearBreak::Params> params_;
+ std::unique_ptr<serial::ClearBreak::Params> params_;
};
} // namespace api
diff --git a/chromium/extensions/browser/api/serial/serial_apitest.cc b/chromium/extensions/browser/api/serial/serial_apitest.cc
index f56ff94345c..40ee4e919f0 100644
--- a/chromium/extensions/browser/api/serial/serial_apitest.cc
+++ b/chromium/extensions/browser/api/serial/serial_apitest.cc
@@ -138,7 +138,7 @@ void CreateTestSerialServiceOnFileThread(
io_handler_factory,
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::IO));
- scoped_ptr<device::SerialDeviceEnumerator> device_enumerator(
+ std::unique_ptr<device::SerialDeviceEnumerator> device_enumerator(
new FakeSerialDeviceEnumerator);
new device::SerialServiceImpl(
connection_factory, std::move(device_enumerator), std::move(request));
diff --git a/chromium/extensions/browser/api/serial/serial_connection.cc b/chromium/extensions/browser/api/serial/serial_connection.cc
index 6e4cde90309..06dae2c9a4c 100644
--- a/chromium/extensions/browser/api/serial/serial_connection.cc
+++ b/chromium/extensions/browser/api/serial/serial_connection.cc
@@ -9,6 +9,7 @@
#include "base/files/file_path.h"
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "device/serial/buffer.h"
#include "extensions/browser/api/api_resource_manager.h"
@@ -222,7 +223,7 @@ bool SerialConnection::Receive(const ReceiveCompleteCallback& callback) {
return false;
receive_complete_ = callback;
receive_buffer_ = new net::IOBuffer(buffer_size_);
- io_handler_->Read(make_scoped_ptr(new device::ReceiveBuffer(
+ io_handler_->Read(base::WrapUnique(new device::ReceiveBuffer(
receive_buffer_, buffer_size_,
base::Bind(&SerialConnection::OnAsyncReadComplete, AsWeakPtr()))));
receive_timeout_task_.reset();
@@ -240,7 +241,7 @@ bool SerialConnection::Send(const std::vector<char>& data,
if (!send_complete_.is_null())
return false;
send_complete_ = callback;
- io_handler_->Write(make_scoped_ptr(new device::SendBuffer(
+ io_handler_->Write(base::WrapUnique(new device::SendBuffer(
data, base::Bind(&SerialConnection::OnAsyncWriteComplete, AsWeakPtr()))));
send_timeout_task_.reset();
if (send_timeout_ > 0) {
diff --git a/chromium/extensions/browser/api/serial/serial_connection.h b/chromium/extensions/browser/api/serial/serial_connection.h
index 428e2d66ea4..d9ab5d79756 100644
--- a/chromium/extensions/browser/api/serial/serial_connection.h
+++ b/chromium/extensions/browser/api/serial/serial_connection.h
@@ -187,11 +187,11 @@ class SerialConnection : public ApiResource,
// Closure which will trigger a receive timeout unless cancelled. Reset on
// initialization and after every successful Receive().
- scoped_ptr<TimeoutTask> receive_timeout_task_;
+ std::unique_ptr<TimeoutTask> receive_timeout_task_;
// Write timeout closure. Reset on initialization and after every successful
// Send().
- scoped_ptr<TimeoutTask> send_timeout_task_;
+ std::unique_ptr<TimeoutTask> send_timeout_task_;
scoped_refptr<net::IOBuffer> receive_buffer_;
diff --git a/chromium/extensions/browser/api/serial/serial_event_dispatcher.cc b/chromium/extensions/browser/api/serial/serial_event_dispatcher.cc
index 31e44b041b0..31fb191d904 100644
--- a/chromium/extensions/browser/api/serial/serial_event_dispatcher.cc
+++ b/chromium/extensions/browser/api/serial/serial_event_dispatcher.cc
@@ -107,8 +107,9 @@ void SerialEventDispatcher::ReceiveCallback(const ReceiveParams& params,
serial::ReceiveInfo receive_info;
receive_info.connection_id = params.connection_id;
receive_info.data = data;
- scoped_ptr<base::ListValue> args = serial::OnReceive::Create(receive_info);
- scoped_ptr<extensions::Event> event(
+ std::unique_ptr<base::ListValue> args =
+ serial::OnReceive::Create(receive_info);
+ std::unique_ptr<extensions::Event> event(
new extensions::Event(extensions::events::SERIAL_ON_RECEIVE,
serial::OnReceive::kEventName, std::move(args)));
PostEvent(params, std::move(event));
@@ -118,9 +119,9 @@ void SerialEventDispatcher::ReceiveCallback(const ReceiveParams& params,
serial::ReceiveErrorInfo error_info;
error_info.connection_id = params.connection_id;
error_info.error = error;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
serial::OnReceiveError::Create(error_info);
- scoped_ptr<extensions::Event> event(new extensions::Event(
+ std::unique_ptr<extensions::Event> event(new extensions::Event(
extensions::events::SERIAL_ON_RECEIVE_ERROR,
serial::OnReceiveError::kEventName, std::move(args)));
PostEvent(params, std::move(event));
@@ -138,8 +139,9 @@ void SerialEventDispatcher::ReceiveCallback(const ReceiveParams& params,
}
// static
-void SerialEventDispatcher::PostEvent(const ReceiveParams& params,
- scoped_ptr<extensions::Event> event) {
+void SerialEventDispatcher::PostEvent(
+ const ReceiveParams& params,
+ std::unique_ptr<extensions::Event> event) {
DCHECK_CURRENTLY_ON(params.thread_id);
BrowserThread::PostTask(
@@ -149,9 +151,10 @@ void SerialEventDispatcher::PostEvent(const ReceiveParams& params,
}
// static
-void SerialEventDispatcher::DispatchEvent(void* browser_context_id,
- const std::string& extension_id,
- scoped_ptr<extensions::Event> event) {
+void SerialEventDispatcher::DispatchEvent(
+ void* browser_context_id,
+ const std::string& extension_id,
+ std::unique_ptr<extensions::Event> event) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::BrowserContext* context =
diff --git a/chromium/extensions/browser/api/serial/serial_event_dispatcher.h b/chromium/extensions/browser/api/serial/serial_event_dispatcher.h
index 10188af493a..70588ca0353 100644
--- a/chromium/extensions/browser/api/serial/serial_event_dispatcher.h
+++ b/chromium/extensions/browser/api/serial/serial_event_dispatcher.h
@@ -65,11 +65,11 @@ class SerialEventDispatcher : public BrowserContextKeyedAPI {
serial::ReceiveError error);
static void PostEvent(const ReceiveParams& params,
- scoped_ptr<extensions::Event> event);
+ std::unique_ptr<extensions::Event> event);
static void DispatchEvent(void* browser_context_id,
const std::string& extension_id,
- scoped_ptr<extensions::Event> event);
+ std::unique_ptr<extensions::Event> event);
content::BrowserThread::ID thread_id_;
content::BrowserContext* const context_;
diff --git a/chromium/extensions/browser/api/socket/app_firewall_hole_manager.cc b/chromium/extensions/browser/api/socket/app_firewall_hole_manager.cc
index f5973734081..db9d3d76d26 100644
--- a/chromium/extensions/browser/api/socket/app_firewall_hole_manager.cc
+++ b/chromium/extensions/browser/api/socket/app_firewall_hole_manager.cc
@@ -97,7 +97,7 @@ void AppFirewallHole::SetVisible(bool app_visible) {
}
void AppFirewallHole::OnFirewallHoleOpened(
- scoped_ptr<FirewallHole> firewall_hole) {
+ std::unique_ptr<FirewallHole> firewall_hole) {
if (app_visible_) {
DCHECK(!firewall_hole_);
firewall_hole_ = std::move(firewall_hole);
@@ -117,11 +117,11 @@ AppFirewallHoleManager* AppFirewallHoleManager::Get(BrowserContext* context) {
return AppFirewallHoleManagerFactory::GetForBrowserContext(context, true);
}
-scoped_ptr<AppFirewallHole> AppFirewallHoleManager::Open(
+std::unique_ptr<AppFirewallHole> AppFirewallHoleManager::Open(
AppFirewallHole::PortType type,
uint16_t port,
const std::string& extension_id) {
- scoped_ptr<AppFirewallHole> hole(
+ std::unique_ptr<AppFirewallHole> hole(
new AppFirewallHole(this, type, port, extension_id));
tracked_holes_.insert(std::make_pair(extension_id, hole.get()));
if (HasVisibleAppWindows(context_, extension_id)) {
diff --git a/chromium/extensions/browser/api/socket/app_firewall_hole_manager.h b/chromium/extensions/browser/api/socket/app_firewall_hole_manager.h
index 0c125201938..d839071ab74 100644
--- a/chromium/extensions/browser/api/socket/app_firewall_hole_manager.h
+++ b/chromium/extensions/browser/api/socket/app_firewall_hole_manager.h
@@ -43,7 +43,8 @@ class AppFirewallHole {
const std::string& extension_id);
void SetVisible(bool app_visible);
- void OnFirewallHoleOpened(scoped_ptr<chromeos::FirewallHole> firewall_hole);
+ void OnFirewallHoleOpened(
+ std::unique_ptr<chromeos::FirewallHole> firewall_hole);
PortType type_;
uint16_t port_;
@@ -55,7 +56,7 @@ class AppFirewallHole {
AppFirewallHoleManager* manager_;
// This will hold the FirewallHole object if one is opened.
- scoped_ptr<chromeos::FirewallHole> firewall_hole_;
+ std::unique_ptr<chromeos::FirewallHole> firewall_hole_;
base::WeakPtrFactory<AppFirewallHole> weak_factory_;
};
@@ -74,9 +75,9 @@ class AppFirewallHoleManager : public KeyedService,
// Takes ownership of the AppFirewallHole and will open a port on the system
// firewall if the associated application is currently visible.
- scoped_ptr<AppFirewallHole> Open(AppFirewallHole::PortType type,
- uint16_t port,
- const std::string& extension_id);
+ std::unique_ptr<AppFirewallHole> Open(AppFirewallHole::PortType type,
+ uint16_t port,
+ const std::string& extension_id);
private:
friend class AppFirewallHole;
diff --git a/chromium/extensions/browser/api/socket/socket.h b/chromium/extensions/browser/api/socket/socket.h
index fefe6bc0f20..ef1c43605da 100644
--- a/chromium/extensions/browser/api/socket/socket.h
+++ b/chromium/extensions/browser/api/socket/socket.h
@@ -40,7 +40,7 @@ typedef base::Callback<void(int,
scoped_refptr<net::IOBuffer> io_buffer,
const std::string&,
uint16_t)> RecvFromCompletionCallback;
-typedef base::Callback<void(int, scoped_ptr<net::TCPClientSocket>)>
+typedef base::Callback<void(int, std::unique_ptr<net::TCPClientSocket>)>
AcceptCompletionCallback;
// A Socket wraps a low-level socket and includes housekeeping information that
@@ -64,7 +64,7 @@ class Socket : public ApiResource {
#if defined(OS_CHROMEOS)
void set_firewall_hole(
- scoped_ptr<AppFirewallHole, content::BrowserThread::DeleteOnUIThread>
+ std::unique_ptr<AppFirewallHole, content::BrowserThread::DeleteOnUIThread>
firewall_hole) {
firewall_hole_ = std::move(firewall_hole);
}
@@ -149,7 +149,7 @@ class Socket : public ApiResource {
#if defined(OS_CHROMEOS)
// Represents a hole punched in the system firewall for this socket.
- scoped_ptr<AppFirewallHole, content::BrowserThread::DeleteOnUIThread>
+ std::unique_ptr<AppFirewallHole, content::BrowserThread::DeleteOnUIThread>
firewall_hole_;
#endif // OS_CHROMEOS
};
diff --git a/chromium/extensions/browser/api/socket/socket_api.cc b/chromium/extensions/browser/api/socket/socket_api.cc
index 4b1074a0085..b69d56f6744 100644
--- a/chromium/extensions/browser/api/socket/socket_api.cc
+++ b/chromium/extensions/browser/api/socket/socket_api.cc
@@ -12,6 +12,7 @@
#include "build/build_config.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/resource_context.h"
+#include "content/public/browser/storage_partition.h"
#include "extensions/browser/api/dns/host_resolver_wrapper.h"
#include "extensions/browser/api/socket/socket.h"
#include "extensions/browser/api/socket/tcp_socket.h"
@@ -74,9 +75,9 @@ bool SocketAsyncApiFunction::PrePrepare() {
bool SocketAsyncApiFunction::Respond() { return error_.empty(); }
-scoped_ptr<SocketResourceManagerInterface>
+std::unique_ptr<SocketResourceManagerInterface>
SocketAsyncApiFunction::CreateSocketResourceManager() {
- return scoped_ptr<SocketResourceManagerInterface>(
+ return std::unique_ptr<SocketResourceManagerInterface>(
new SocketResourceManager<Socket>());
}
@@ -138,7 +139,7 @@ void SocketAsyncApiFunction::OpenFirewallHoleOnUIThread(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
AppFirewallHoleManager* manager =
AppFirewallHoleManager::Get(browser_context());
- scoped_ptr<AppFirewallHole, BrowserThread::DeleteOnUIThread> hole(
+ std::unique_ptr<AppFirewallHole, BrowserThread::DeleteOnUIThread> hole(
manager->Open(type, port, extension_id()).release());
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@@ -148,7 +149,7 @@ void SocketAsyncApiFunction::OpenFirewallHoleOnUIThread(
void SocketAsyncApiFunction::OnFirewallHoleOpened(
int socket_id,
- scoped_ptr<AppFirewallHole, BrowserThread::DeleteOnUIThread> hole) {
+ std::unique_ptr<AppFirewallHole, BrowserThread::DeleteOnUIThread> hole) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
if (!hole) {
error_ = kFirewallFailure;
@@ -460,8 +461,9 @@ void SocketAcceptFunction::AsyncWorkStart() {
}
}
-void SocketAcceptFunction::OnAccept(int result_code,
- scoped_ptr<net::TCPClientSocket> socket) {
+void SocketAcceptFunction::OnAccept(
+ int result_code,
+ std::unique_ptr<net::TCPClientSocket> socket) {
base::DictionaryValue* result = new base::DictionaryValue();
result->SetInteger(kResultCodeKey, result_code);
if (socket) {
@@ -1010,7 +1012,8 @@ bool SocketSecureFunction::Prepare() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
params_ = api::socket::Secure::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
- url_request_getter_ = browser_context()->GetRequestContext();
+ url_request_getter_ = content::BrowserContext::GetDefaultStoragePartition(
+ browser_context())->GetURLRequestContext();
return true;
}
@@ -1056,7 +1059,7 @@ void SocketSecureFunction::AsyncWorkStart() {
base::Bind(&SocketSecureFunction::TlsConnectDone, this));
}
-void SocketSecureFunction::TlsConnectDone(scoped_ptr<TLSSocket> socket,
+void SocketSecureFunction::TlsConnectDone(std::unique_ptr<TLSSocket> socket,
int result) {
// if an error occurred, socket MUST be NULL.
DCHECK(result == net::OK || socket == NULL);
diff --git a/chromium/extensions/browser/api/socket/socket_api.h b/chromium/extensions/browser/api/socket/socket_api.h
index 9094f6097d6..9a73a82d6c8 100644
--- a/chromium/extensions/browser/api/socket/socket_api.h
+++ b/chromium/extensions/browser/api/socket/socket_api.h
@@ -117,8 +117,8 @@ class SocketAsyncApiFunction : public AsyncApiFunction {
bool PrePrepare() override;
bool Respond() override;
- virtual scoped_ptr<SocketResourceManagerInterface>
- CreateSocketResourceManager();
+ virtual std::unique_ptr<SocketResourceManagerInterface>
+ CreateSocketResourceManager();
int AddSocket(Socket* socket);
Socket* GetSocket(int api_resource_id);
@@ -138,11 +138,11 @@ class SocketAsyncApiFunction : public AsyncApiFunction {
int socket_id);
void OnFirewallHoleOpened(
int socket_id,
- scoped_ptr<AppFirewallHole, content::BrowserThread::DeleteOnUIThread>
+ std::unique_ptr<AppFirewallHole, content::BrowserThread::DeleteOnUIThread>
hole);
#endif // OS_CHROMEOS
- scoped_ptr<SocketResourceManagerInterface> manager_;
+ std::unique_ptr<SocketResourceManagerInterface> manager_;
};
class SocketExtensionWithDnsLookupFunction : public SocketAsyncApiFunction {
@@ -182,7 +182,7 @@ class SocketCreateFunction : public SocketAsyncApiFunction {
FRIEND_TEST_ALL_PREFIXES(SocketUnitTest, Create);
enum SocketType { kSocketTypeInvalid = -1, kSocketTypeTCP, kSocketTypeUDP };
- scoped_ptr<api::socket::Create::Params> params_;
+ std::unique_ptr<api::socket::Create::Params> params_;
SocketType socket_type_;
};
@@ -272,7 +272,7 @@ class SocketListenFunction : public SocketAsyncApiFunction {
void AsyncWorkStart() override;
private:
- scoped_ptr<api::socket::Listen::Params> params_;
+ std::unique_ptr<api::socket::Listen::Params> params_;
};
class SocketAcceptFunction : public SocketAsyncApiFunction {
@@ -289,9 +289,9 @@ class SocketAcceptFunction : public SocketAsyncApiFunction {
void AsyncWorkStart() override;
private:
- void OnAccept(int result_code, scoped_ptr<net::TCPClientSocket> socket);
+ void OnAccept(int result_code, std::unique_ptr<net::TCPClientSocket> socket);
- scoped_ptr<api::socket::Accept::Params> params_;
+ std::unique_ptr<api::socket::Accept::Params> params_;
};
class SocketReadFunction : public SocketAsyncApiFunction {
@@ -309,7 +309,7 @@ class SocketReadFunction : public SocketAsyncApiFunction {
void OnCompleted(int result, scoped_refptr<net::IOBuffer> io_buffer);
private:
- scoped_ptr<api::socket::Read::Params> params_;
+ std::unique_ptr<api::socket::Read::Params> params_;
};
class SocketWriteFunction : public SocketAsyncApiFunction {
@@ -350,7 +350,7 @@ class SocketRecvFromFunction : public SocketAsyncApiFunction {
uint16_t port);
private:
- scoped_ptr<api::socket::RecvFrom::Params> params_;
+ std::unique_ptr<api::socket::RecvFrom::Params> params_;
};
class SocketSendToFunction : public SocketExtensionWithDnsLookupFunction {
@@ -394,7 +394,7 @@ class SocketSetKeepAliveFunction : public SocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<api::socket::SetKeepAlive::Params> params_;
+ std::unique_ptr<api::socket::SetKeepAlive::Params> params_;
};
class SocketSetNoDelayFunction : public SocketAsyncApiFunction {
@@ -411,7 +411,7 @@ class SocketSetNoDelayFunction : public SocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<api::socket::SetNoDelay::Params> params_;
+ std::unique_ptr<api::socket::SetNoDelay::Params> params_;
};
class SocketGetInfoFunction : public SocketAsyncApiFunction {
@@ -428,7 +428,7 @@ class SocketGetInfoFunction : public SocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<api::socket::GetInfo::Params> params_;
+ std::unique_ptr<api::socket::GetInfo::Params> params_;
};
class SocketGetNetworkListFunction : public AsyncExtensionFunction {
@@ -459,7 +459,7 @@ class SocketJoinGroupFunction : public SocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<api::socket::JoinGroup::Params> params_;
+ std::unique_ptr<api::socket::JoinGroup::Params> params_;
};
class SocketLeaveGroupFunction : public SocketAsyncApiFunction {
@@ -476,7 +476,7 @@ class SocketLeaveGroupFunction : public SocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<api::socket::LeaveGroup::Params> params_;
+ std::unique_ptr<api::socket::LeaveGroup::Params> params_;
};
class SocketSetMulticastTimeToLiveFunction : public SocketAsyncApiFunction {
@@ -494,7 +494,7 @@ class SocketSetMulticastTimeToLiveFunction : public SocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<api::socket::SetMulticastTimeToLive::Params> params_;
+ std::unique_ptr<api::socket::SetMulticastTimeToLive::Params> params_;
};
class SocketSetMulticastLoopbackModeFunction : public SocketAsyncApiFunction {
@@ -512,7 +512,7 @@ class SocketSetMulticastLoopbackModeFunction : public SocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<api::socket::SetMulticastLoopbackMode::Params> params_;
+ std::unique_ptr<api::socket::SetMulticastLoopbackMode::Params> params_;
};
class SocketGetJoinedGroupsFunction : public SocketAsyncApiFunction {
@@ -530,7 +530,7 @@ class SocketGetJoinedGroupsFunction : public SocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<api::socket::GetJoinedGroups::Params> params_;
+ std::unique_ptr<api::socket::GetJoinedGroups::Params> params_;
};
class SocketSecureFunction : public SocketAsyncApiFunction {
@@ -547,9 +547,9 @@ class SocketSecureFunction : public SocketAsyncApiFunction {
private:
// Callback from TLSSocket::UpgradeSocketToTLS().
- void TlsConnectDone(scoped_ptr<TLSSocket> socket, int result);
+ void TlsConnectDone(std::unique_ptr<TLSSocket> socket, int result);
- scoped_ptr<api::socket::Secure::Params> params_;
+ std::unique_ptr<api::socket::Secure::Params> params_;
scoped_refptr<net::URLRequestContextGetter> url_request_getter_;
DISALLOW_COPY_AND_ASSIGN(SocketSecureFunction);
diff --git a/chromium/extensions/browser/api/socket/socket_apitest.cc b/chromium/extensions/browser/api/socket/socket_apitest.cc
index edc5a84541c..3d581041860 100644
--- a/chromium/extensions/browser/api/socket/socket_apitest.cc
+++ b/chromium/extensions/browser/api/socket/socket_apitest.cc
@@ -24,7 +24,7 @@ IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketUDPCreateGood) {
socket_create_function->set_extension(empty_extension.get());
socket_create_function->set_has_callback(true);
- scoped_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
socket_create_function.get(), "[\"udp\"]", browser_context()));
base::DictionaryValue* value = NULL;
ASSERT_TRUE(result->GetAsDictionary(&value));
@@ -41,7 +41,7 @@ IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketTCPCreateGood) {
socket_create_function->set_extension(empty_extension.get());
socket_create_function->set_has_callback(true);
- scoped_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
socket_create_function.get(), "[\"tcp\"]", browser_context()));
base::DictionaryValue* value = NULL;
ASSERT_TRUE(result->GetAsDictionary(&value));
@@ -58,7 +58,7 @@ IN_PROC_BROWSER_TEST_F(SocketApiTest, GetNetworkList) {
socket_function->set_extension(empty_extension.get());
socket_function->set_has_callback(true);
- scoped_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
socket_function.get(), "[]", browser_context()));
// If we're invoking socket tests, all we can confirm is that we have at
diff --git a/chromium/extensions/browser/api/socket/tcp_socket.cc b/chromium/extensions/browser/api/socket/tcp_socket.cc
index d4aaafbd6c2..5053b869378 100644
--- a/chromium/extensions/browser/api/socket/tcp_socket.cc
+++ b/chromium/extensions/browser/api/socket/tcp_socket.cc
@@ -7,6 +7,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "extensions/browser/api/api_resource.h"
#include "net/base/address_list.h"
#include "net/base/ip_endpoint.h"
@@ -45,7 +46,7 @@ ApiResourceManager<ResumableTCPServerSocket>::GetFactoryInstance() {
TCPSocket::TCPSocket(const std::string& owner_extension_id)
: Socket(owner_extension_id), socket_mode_(UNKNOWN) {}
-TCPSocket::TCPSocket(scoped_ptr<net::TCPClientSocket> tcp_client_socket,
+TCPSocket::TCPSocket(std::unique_ptr<net::TCPClientSocket> tcp_client_socket,
const std::string& owner_extension_id,
bool is_connected)
: Socket(owner_extension_id),
@@ -54,7 +55,7 @@ TCPSocket::TCPSocket(scoped_ptr<net::TCPClientSocket> tcp_client_socket,
this->is_connected_ = is_connected;
}
-TCPSocket::TCPSocket(scoped_ptr<net::TCPServerSocket> tcp_server_socket,
+TCPSocket::TCPSocket(std::unique_ptr<net::TCPServerSocket> tcp_server_socket,
const std::string& owner_extension_id)
: Socket(owner_extension_id),
server_socket_(std::move(tcp_server_socket)),
@@ -62,7 +63,7 @@ TCPSocket::TCPSocket(scoped_ptr<net::TCPServerSocket> tcp_server_socket,
// static
TCPSocket* TCPSocket::CreateSocketForTesting(
- scoped_ptr<net::TCPClientSocket> tcp_client_socket,
+ std::unique_ptr<net::TCPClientSocket> tcp_client_socket,
const std::string& owner_extension_id,
bool is_connected) {
return new TCPSocket(std::move(tcp_client_socket), owner_extension_id,
@@ -71,7 +72,7 @@ TCPSocket* TCPSocket::CreateSocketForTesting(
// static
TCPSocket* TCPSocket::CreateServerSocketForTesting(
- scoped_ptr<net::TCPServerSocket> tcp_server_socket,
+ std::unique_ptr<net::TCPServerSocket> tcp_server_socket,
const std::string& owner_extension_id) {
return new TCPSocket(std::move(tcp_server_socket), owner_extension_id);
}
@@ -99,7 +100,7 @@ void TCPSocket::Connect(const net::AddressList& address,
int result = net::ERR_CONNECTION_FAILED;
if (!is_connected_) {
socket_.reset(
- new net::TCPClientSocket(address, NULL, net::NetLog::Source()));
+ new net::TCPClientSocket(address, NULL, NULL, net::NetLog::Source()));
result = socket_->Connect(
base::Bind(&TCPSocket::OnConnectComplete, base::Unretained(this)));
}
@@ -299,7 +300,7 @@ void TCPSocket::OnAccept(int result) {
DCHECK(!accept_callback_.is_null());
if (result == net::OK && accept_socket_.get()) {
accept_callback_.Run(result,
- make_scoped_ptr(static_cast<net::TCPClientSocket*>(
+ base::WrapUnique(static_cast<net::TCPClientSocket*>(
accept_socket_.release())));
} else {
accept_callback_.Run(result, NULL);
@@ -344,7 +345,7 @@ ResumableTCPSocket::ResumableTCPSocket(const std::string& owner_extension_id)
paused_(false) {}
ResumableTCPSocket::ResumableTCPSocket(
- scoped_ptr<net::TCPClientSocket> tcp_client_socket,
+ std::unique_ptr<net::TCPClientSocket> tcp_client_socket,
const std::string& owner_extension_id,
bool is_connected)
: TCPSocket(std::move(tcp_client_socket), owner_extension_id, is_connected),
diff --git a/chromium/extensions/browser/api/socket/tcp_socket.h b/chromium/extensions/browser/api/socket/tcp_socket.h
index b6f3281a9da..38f6187c315 100644
--- a/chromium/extensions/browser/api/socket/tcp_socket.h
+++ b/chromium/extensions/browser/api/socket/tcp_socket.h
@@ -25,7 +25,7 @@ namespace extensions {
class TCPSocket : public Socket {
public:
explicit TCPSocket(const std::string& owner_extension_id);
- TCPSocket(scoped_ptr<net::TCPClientSocket> tcp_client_socket,
+ TCPSocket(std::unique_ptr<net::TCPClientSocket> tcp_client_socket,
const std::string& owner_extension_id,
bool is_connected = false);
@@ -62,11 +62,11 @@ class TCPSocket : public Socket {
Socket::SocketType GetSocketType() const override;
static TCPSocket* CreateSocketForTesting(
- scoped_ptr<net::TCPClientSocket> tcp_client_socket,
+ std::unique_ptr<net::TCPClientSocket> tcp_client_socket,
const std::string& owner_extension_id,
bool is_connected = false);
static TCPSocket* CreateServerSocketForTesting(
- scoped_ptr<net::TCPServerSocket> tcp_server_socket,
+ std::unique_ptr<net::TCPServerSocket> tcp_server_socket,
const std::string& owner_extension_id);
// Returns NULL if GetSocketType() isn't TYPE_TCP or if the connection
@@ -87,11 +87,11 @@ class TCPSocket : public Socket {
void OnReadComplete(scoped_refptr<net::IOBuffer> io_buffer, int result);
void OnAccept(int result);
- TCPSocket(scoped_ptr<net::TCPServerSocket> tcp_server_socket,
+ TCPSocket(std::unique_ptr<net::TCPServerSocket> tcp_server_socket,
const std::string& owner_extension_id);
- scoped_ptr<net::TCPClientSocket> socket_;
- scoped_ptr<net::TCPServerSocket> server_socket_;
+ std::unique_ptr<net::TCPClientSocket> socket_;
+ std::unique_ptr<net::TCPServerSocket> server_socket_;
enum SocketMode { UNKNOWN = 0, CLIENT, SERVER, };
SocketMode socket_mode_;
@@ -100,7 +100,7 @@ class TCPSocket : public Socket {
ReadCompletionCallback read_callback_;
- scoped_ptr<net::StreamSocket> accept_socket_;
+ std::unique_ptr<net::StreamSocket> accept_socket_;
AcceptCompletionCallback accept_callback_;
};
@@ -111,7 +111,7 @@ class ResumableTCPSocket : public TCPSocket {
public:
explicit ResumableTCPSocket(const std::string& owner_extension_id);
explicit ResumableTCPSocket(
- scoped_ptr<net::TCPClientSocket> tcp_client_socket,
+ std::unique_ptr<net::TCPClientSocket> tcp_client_socket,
const std::string& owner_extension_id,
bool is_connected);
diff --git a/chromium/extensions/browser/api/socket/tls_socket.cc b/chromium/extensions/browser/api/socket/tls_socket.cc
index 1dc86345eb3..686d37f5ba8 100644
--- a/chromium/extensions/browser/api/socket/tls_socket.cc
+++ b/chromium/extensions/browser/api/socket/tls_socket.cc
@@ -36,7 +36,7 @@ uint16_t SSLProtocolVersionFromString(const std::string& version_str) {
return version;
}
-void TlsConnectDone(scoped_ptr<net::SSLClientSocket> ssl_socket,
+void TlsConnectDone(std::unique_ptr<net::SSLClientSocket> ssl_socket,
const std::string& extension_id,
const extensions::TLSSocket::SecureCallback& callback,
int result) {
@@ -47,14 +47,14 @@ void TlsConnectDone(scoped_ptr<net::SSLClientSocket> ssl_socket,
// which is promoted here to a new API-accessible socket (via a TLSSocket
// wrapper), or deleted.
if (result != net::OK) {
- callback.Run(scoped_ptr<extensions::TLSSocket>(), result);
+ callback.Run(std::unique_ptr<extensions::TLSSocket>(), result);
return;
};
// Wrap the StreamSocket in a TLSSocket, which matches the extension 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(
+ std::unique_ptr<extensions::TLSSocket> wrapper(
new extensions::TLSSocket(std::move(ssl_socket), extension_id));
// Caller will end up deleting the prior TCPSocket, once it calls
@@ -69,7 +69,7 @@ namespace extensions {
const char kTLSSocketTypeInvalidError[] =
"Cannot listen on a socket that is already connected.";
-TLSSocket::TLSSocket(scoped_ptr<net::StreamSocket> tls_socket,
+TLSSocket::TLSSocket(std::unique_ptr<net::StreamSocket> tls_socket,
const std::string& owner_extension_id)
: ResumableTCPSocket(owner_extension_id),
tls_socket_(std::move(tls_socket)) {}
@@ -186,7 +186,7 @@ void TLSSocket::UpgradeSocketToTLS(
const TLSSocket::SecureCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
TCPSocket* tcp_socket = static_cast<TCPSocket*>(socket);
- scoped_ptr<net::SSLClientSocket> null_sock;
+ std::unique_ptr<net::SSLClientSocket> null_sock;
if (!tcp_socket || tcp_socket->GetSocketType() != Socket::TYPE_TCP ||
!tcp_socket->ClientStream() || !tcp_socket->IsConnected() ||
@@ -227,14 +227,14 @@ void TLSSocket::UpgradeSocketToTLS(
net::HostPortPair host_and_port(canon_host, dest_host_port_pair.port());
- scoped_ptr<net::ClientSocketHandle> socket_handle(
+ std::unique_ptr<net::ClientSocketHandle> socket_handle(
new net::ClientSocketHandle());
// Set the socket handle to the socket's client stream (that should be the
// only one active here). Then have the old socket release ownership on
// that client stream.
socket_handle->SetSocket(
- scoped_ptr<net::StreamSocket>(tcp_socket->ClientStream()));
+ std::unique_ptr<net::StreamSocket>(tcp_socket->ClientStream()));
tcp_socket->Release();
DCHECK(transport_security_state);
@@ -266,7 +266,7 @@ void TLSSocket::UpgradeSocketToTLS(
net::ClientSocketFactory::GetDefaultFactory();
// Create the socket.
- scoped_ptr<net::SSLClientSocket> ssl_socket(
+ std::unique_ptr<net::SSLClientSocket> ssl_socket(
socket_factory->CreateSSLClientSocket(
std::move(socket_handle), host_and_port, ssl_config, context));
diff --git a/chromium/extensions/browser/api/socket/tls_socket.h b/chromium/extensions/browser/api/socket/tls_socket.h
index 2bd5ea7c392..2f7a683efb4 100644
--- a/chromium/extensions/browser/api/socket/tls_socket.h
+++ b/chromium/extensions/browser/api/socket/tls_socket.h
@@ -36,9 +36,9 @@ class TLSSocket;
// touch any socket state.
class TLSSocket : public ResumableTCPSocket {
public:
- typedef base::Callback<void(scoped_ptr<TLSSocket>, int)> SecureCallback;
+ typedef base::Callback<void(std::unique_ptr<TLSSocket>, int)> SecureCallback;
- TLSSocket(scoped_ptr<net::StreamSocket> tls_socket,
+ TLSSocket(std::unique_ptr<net::StreamSocket> tls_socket,
const std::string& owner_extension_id);
~TLSSocket() override;
@@ -110,7 +110,7 @@ class TLSSocket : public ResumableTCPSocket {
void OnReadComplete(const scoped_refptr<net::IOBuffer>& io_buffer,
int result);
- scoped_ptr<net::StreamSocket> tls_socket_;
+ std::unique_ptr<net::StreamSocket> tls_socket_;
ReadCompletionCallback read_callback_;
};
diff --git a/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc b/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc
index be36153cbbc..b2c06096008 100644
--- a/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc
+++ b/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api.cc
@@ -5,6 +5,7 @@
#include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/storage_partition.h"
#include "content/public/common/socket_permission_request.h"
#include "extensions/browser/api/socket/tcp_socket.h"
#include "extensions/browser/api/socket/tls_socket.h"
@@ -87,9 +88,9 @@ using content::SocketPermissionRequest;
TCPSocketAsyncApiFunction::~TCPSocketAsyncApiFunction() {}
-scoped_ptr<SocketResourceManagerInterface>
+std::unique_ptr<SocketResourceManagerInterface>
TCPSocketAsyncApiFunction::CreateSocketResourceManager() {
- return scoped_ptr<SocketResourceManagerInterface>(
+ return std::unique_ptr<SocketResourceManagerInterface>(
new SocketResourceManager<ResumableTCPSocket>());
}
@@ -100,9 +101,9 @@ ResumableTCPSocket* TCPSocketAsyncApiFunction::GetTcpSocket(int socket_id) {
TCPSocketExtensionWithDnsLookupFunction::
~TCPSocketExtensionWithDnsLookupFunction() {}
-scoped_ptr<SocketResourceManagerInterface>
+std::unique_ptr<SocketResourceManagerInterface>
TCPSocketExtensionWithDnsLookupFunction::CreateSocketResourceManager() {
- return scoped_ptr<SocketResourceManagerInterface>(
+ return std::unique_ptr<SocketResourceManagerInterface>(
new SocketResourceManager<ResumableTCPSocket>());
}
@@ -455,7 +456,8 @@ bool SocketsTcpSecureFunction::Prepare() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
params_ = api::sockets_tcp::Secure::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params_.get());
- url_request_getter_ = browser_context()->GetRequestContext();
+ url_request_getter_ = content::BrowserContext::GetDefaultStoragePartition(
+ browser_context())->GetURLRequestContext();
return true;
}
@@ -520,7 +522,7 @@ void SocketsTcpSecureFunction::AsyncWorkStart() {
base::Bind(&SocketsTcpSecureFunction::TlsConnectDone, this));
}
-void SocketsTcpSecureFunction::TlsConnectDone(scoped_ptr<TLSSocket> socket,
+void SocketsTcpSecureFunction::TlsConnectDone(std::unique_ptr<TLSSocket> socket,
int result) {
// If an error occurred, socket MUST be NULL
DCHECK(result == net::OK || socket == NULL);
diff --git a/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api.h b/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api.h
index bbea8f4c3dc..c4b3ee883c6 100644
--- a/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api.h
+++ b/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api.h
@@ -26,7 +26,7 @@ class TCPSocketAsyncApiFunction : public SocketAsyncApiFunction {
protected:
~TCPSocketAsyncApiFunction() override;
- scoped_ptr<SocketResourceManagerInterface> CreateSocketResourceManager()
+ std::unique_ptr<SocketResourceManagerInterface> CreateSocketResourceManager()
override;
ResumableTCPSocket* GetTcpSocket(int socket_id);
@@ -37,7 +37,7 @@ class TCPSocketExtensionWithDnsLookupFunction
protected:
~TCPSocketExtensionWithDnsLookupFunction() override;
- scoped_ptr<SocketResourceManagerInterface> CreateSocketResourceManager()
+ std::unique_ptr<SocketResourceManagerInterface> CreateSocketResourceManager()
override;
ResumableTCPSocket* GetTcpSocket(int socket_id);
@@ -58,7 +58,7 @@ class SocketsTcpCreateFunction : public TCPSocketAsyncApiFunction {
private:
FRIEND_TEST_ALL_PREFIXES(SocketsTcpUnitTest, Create);
- scoped_ptr<sockets_tcp::Create::Params> params_;
+ std::unique_ptr<sockets_tcp::Create::Params> params_;
};
class SocketsTcpUpdateFunction : public TCPSocketAsyncApiFunction {
@@ -75,7 +75,7 @@ class SocketsTcpUpdateFunction : public TCPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_tcp::Update::Params> params_;
+ std::unique_ptr<sockets_tcp::Update::Params> params_;
};
class SocketsTcpSetPausedFunction : public TCPSocketAsyncApiFunction {
@@ -92,7 +92,7 @@ class SocketsTcpSetPausedFunction : public TCPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_tcp::SetPaused::Params> params_;
+ std::unique_ptr<sockets_tcp::SetPaused::Params> params_;
TCPSocketEventDispatcher* socket_event_dispatcher_;
};
@@ -111,7 +111,7 @@ class SocketsTcpSetKeepAliveFunction : public TCPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_tcp::SetKeepAlive::Params> params_;
+ std::unique_ptr<sockets_tcp::SetKeepAlive::Params> params_;
};
class SocketsTcpSetNoDelayFunction : public TCPSocketAsyncApiFunction {
@@ -128,7 +128,7 @@ class SocketsTcpSetNoDelayFunction : public TCPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_tcp::SetNoDelay::Params> params_;
+ std::unique_ptr<sockets_tcp::SetNoDelay::Params> params_;
};
class SocketsTcpConnectFunction
@@ -152,7 +152,7 @@ class SocketsTcpConnectFunction
void StartConnect();
void OnCompleted(int net_result);
- scoped_ptr<sockets_tcp::Connect::Params> params_;
+ std::unique_ptr<sockets_tcp::Connect::Params> params_;
TCPSocketEventDispatcher* socket_event_dispatcher_;
};
@@ -170,7 +170,7 @@ class SocketsTcpDisconnectFunction : public TCPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_tcp::Disconnect::Params> params_;
+ std::unique_ptr<sockets_tcp::Disconnect::Params> params_;
};
class SocketsTcpSendFunction : public TCPSocketAsyncApiFunction {
@@ -190,7 +190,7 @@ class SocketsTcpSendFunction : public TCPSocketAsyncApiFunction {
void OnCompleted(int net_result);
void SetSendResult(int net_result, int bytes_sent);
- scoped_ptr<sockets_tcp::Send::Params> params_;
+ std::unique_ptr<sockets_tcp::Send::Params> params_;
scoped_refptr<net::IOBuffer> io_buffer_;
size_t io_buffer_size_;
};
@@ -209,7 +209,7 @@ class SocketsTcpCloseFunction : public TCPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_tcp::Close::Params> params_;
+ std::unique_ptr<sockets_tcp::Close::Params> params_;
};
class SocketsTcpGetInfoFunction : public TCPSocketAsyncApiFunction {
@@ -226,7 +226,7 @@ class SocketsTcpGetInfoFunction : public TCPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_tcp::GetInfo::Params> params_;
+ std::unique_ptr<sockets_tcp::GetInfo::Params> params_;
};
class SocketsTcpGetSocketsFunction : public TCPSocketAsyncApiFunction {
@@ -255,12 +255,12 @@ class SocketsTcpSecureFunction : public TCPSocketAsyncApiFunction {
void AsyncWorkStart() override;
private:
- virtual void TlsConnectDone(scoped_ptr<extensions::TLSSocket> sock,
+ virtual void TlsConnectDone(std::unique_ptr<extensions::TLSSocket> sock,
int result);
bool paused_;
bool persistent_;
- scoped_ptr<sockets_tcp::Secure::Params> params_;
+ std::unique_ptr<sockets_tcp::Secure::Params> params_;
scoped_refptr<net::URLRequestContextGetter> url_request_getter_;
DISALLOW_COPY_AND_ASSIGN(SocketsTcpSecureFunction);
diff --git a/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api_unittest.cc b/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api_unittest.cc
index 83c9faeaa39..fa52b9d5ee9 100644
--- a/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api_unittest.cc
+++ b/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_api_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 "base/memory/scoped_ptr.h"
+#include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h"
+
+#include <memory>
+
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "content/public/test/test_browser_context.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/browser/api/socket/socket.h"
#include "extensions/browser/api/socket/tcp_socket.h"
-#include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h"
#include "extensions/browser/api_unittest.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -16,9 +19,9 @@
namespace extensions {
namespace api {
-static scoped_ptr<KeyedService> ApiResourceManagerTestFactory(
+static std::unique_ptr<KeyedService> ApiResourceManagerTestFactory(
content::BrowserContext* context) {
- return make_scoped_ptr(new ApiResourceManager<ResumableTCPSocket>(context));
+ return base::WrapUnique(new ApiResourceManager<ResumableTCPSocket>(context));
}
class SocketsTcpUnitTest : public ApiUnitTest {
@@ -42,7 +45,7 @@ TEST_F(SocketsTcpUnitTest, Create) {
function->set_work_thread_id(id);
// Run tests
- scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
+ std::unique_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
function, "[{\"persistent\": true, \"name\": \"foo\"}]"));
ASSERT_TRUE(result.get());
}
diff --git a/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc b/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc
index f11908d4979..bb5665f333a 100644
--- a/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc
+++ b/chromium/extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc
@@ -60,12 +60,12 @@ IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketsTcpCreateGood) {
socket_create_function->set_extension(empty_extension.get());
socket_create_function->set_has_callback(true);
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
api_test_utils::RunFunctionAndReturnSingleResult(
socket_create_function.get(), "[]", browser_context()));
ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType());
- scoped_ptr<base::DictionaryValue> value =
+ std::unique_ptr<base::DictionaryValue> value =
base::DictionaryValue::From(std::move(result));
int socketId = -1;
EXPECT_TRUE(value->GetInteger("socketId", &socketId));
@@ -73,9 +73,11 @@ IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketsTcpCreateGood) {
}
IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketTcpExtension) {
- scoped_ptr<net::SpawnedTestServer> test_server(new net::SpawnedTestServer(
- net::SpawnedTestServer::TYPE_TCP_ECHO, net::SpawnedTestServer::kLocalhost,
- base::FilePath(FILE_PATH_LITERAL("net/data"))));
+ std::unique_ptr<net::SpawnedTestServer> test_server(
+ new net::SpawnedTestServer(
+ net::SpawnedTestServer::TYPE_TCP_ECHO,
+ net::SpawnedTestServer::kLocalhost,
+ base::FilePath(FILE_PATH_LITERAL("net/data"))));
EXPECT_TRUE(test_server->Start());
net::HostPortPair host_port_pair = test_server->host_port_pair();
@@ -99,7 +101,7 @@ IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketTcpExtension) {
}
IN_PROC_BROWSER_TEST_F(SocketsTcpApiTest, SocketTcpExtensionTLS) {
- scoped_ptr<net::SpawnedTestServer> test_https_server(
+ std::unique_ptr<net::SpawnedTestServer> test_https_server(
new net::SpawnedTestServer(
net::SpawnedTestServer::TYPE_HTTPS, net::BaseTestServer::SSLOptions(),
base::FilePath(FILE_PATH_LITERAL("net/data"))));
diff --git a/chromium/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc b/chromium/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc
index 7d2f2ca46cf..205593a2562 100644
--- a/chromium/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc
+++ b/chromium/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.cc
@@ -134,11 +134,11 @@ void TCPSocketEventDispatcher::ReadCallback(
sockets_tcp::ReceiveInfo receive_info;
receive_info.socket_id = params.socket_id;
receive_info.data.assign(io_buffer->data(), io_buffer->data() + bytes_read);
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
sockets_tcp::OnReceive::Create(receive_info);
- scoped_ptr<Event> event(new Event(events::SOCKETS_TCP_ON_RECEIVE,
- sockets_tcp::OnReceive::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::SOCKETS_TCP_ON_RECEIVE,
+ sockets_tcp::OnReceive::kEventName,
+ std::move(args)));
PostEvent(params, std::move(event));
// Post a task to delay the read until the socket is available, as
@@ -156,11 +156,11 @@ void TCPSocketEventDispatcher::ReadCallback(
sockets_tcp::ReceiveErrorInfo receive_error_info;
receive_error_info.socket_id = params.socket_id;
receive_error_info.result_code = bytes_read;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
sockets_tcp::OnReceiveError::Create(receive_error_info);
- scoped_ptr<Event> event(new Event(events::SOCKETS_TCP_ON_RECEIVE_ERROR,
- sockets_tcp::OnReceiveError::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(
+ new Event(events::SOCKETS_TCP_ON_RECEIVE_ERROR,
+ sockets_tcp::OnReceiveError::kEventName, std::move(args)));
PostEvent(params, std::move(event));
// Since we got an error, the socket is now "paused" until the application
@@ -175,7 +175,7 @@ void TCPSocketEventDispatcher::ReadCallback(
// static
void TCPSocketEventDispatcher::PostEvent(const ReadParams& params,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK_CURRENTLY_ON(params.thread_id);
BrowserThread::PostTask(
@@ -187,7 +187,7 @@ void TCPSocketEventDispatcher::PostEvent(const ReadParams& params,
// static
void TCPSocketEventDispatcher::DispatchEvent(void* browser_context_id,
const std::string& extension_id,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::BrowserContext* context =
diff --git a/chromium/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.h b/chromium/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.h
index 0c90980fb5e..be933113073 100644
--- a/chromium/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.h
+++ b/chromium/extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.h
@@ -78,12 +78,12 @@ class TCPSocketEventDispatcher
scoped_refptr<net::IOBuffer> io_buffer);
// Post an extension event from IO to UI thread
- static void PostEvent(const ReadParams& params, scoped_ptr<Event> event);
+ static void PostEvent(const ReadParams& params, std::unique_ptr<Event> event);
// Dispatch an extension event on to EventRouter instance on UI thread.
static void DispatchEvent(void* browser_context_id,
const std::string& extension_id,
- scoped_ptr<Event> event);
+ std::unique_ptr<Event> event);
// Usually IO thread (except for unit testing).
content::BrowserThread::ID thread_id_;
diff --git a/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc b/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc
index bc39c83fe88..87b332a60c4 100644
--- a/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc
+++ b/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.cc
@@ -62,9 +62,9 @@ namespace api {
TCPServerSocketAsyncApiFunction::~TCPServerSocketAsyncApiFunction() {}
-scoped_ptr<SocketResourceManagerInterface>
+std::unique_ptr<SocketResourceManagerInterface>
TCPServerSocketAsyncApiFunction::CreateSocketResourceManager() {
- return scoped_ptr<SocketResourceManagerInterface>(
+ return std::unique_ptr<SocketResourceManagerInterface>(
new SocketResourceManager<ResumableTCPServerSocket>());
}
diff --git a/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h b/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h
index a125b283ebd..b5f93c633c4 100644
--- a/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h
+++ b/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_api.h
@@ -20,7 +20,7 @@ class TCPServerSocketAsyncApiFunction : public SocketAsyncApiFunction {
protected:
~TCPServerSocketAsyncApiFunction() override;
- scoped_ptr<SocketResourceManagerInterface> CreateSocketResourceManager()
+ std::unique_ptr<SocketResourceManagerInterface> CreateSocketResourceManager()
override;
ResumableTCPServerSocket* GetTcpSocket(int socket_id);
@@ -42,7 +42,7 @@ class SocketsTcpServerCreateFunction : public TCPServerSocketAsyncApiFunction {
private:
FRIEND_TEST_ALL_PREFIXES(SocketsTcpServerUnitTest, Create);
- scoped_ptr<sockets_tcp_server::Create::Params> params_;
+ std::unique_ptr<sockets_tcp_server::Create::Params> params_;
};
class SocketsTcpServerUpdateFunction : public TCPServerSocketAsyncApiFunction {
@@ -60,7 +60,7 @@ class SocketsTcpServerUpdateFunction : public TCPServerSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_tcp_server::Update::Params> params_;
+ std::unique_ptr<sockets_tcp_server::Update::Params> params_;
};
class SocketsTcpServerSetPausedFunction
@@ -79,7 +79,7 @@ class SocketsTcpServerSetPausedFunction
void Work() override;
private:
- scoped_ptr<sockets_tcp_server::SetPaused::Params> params_;
+ std::unique_ptr<sockets_tcp_server::SetPaused::Params> params_;
TCPServerSocketEventDispatcher* socket_event_dispatcher_;
};
@@ -98,7 +98,7 @@ class SocketsTcpServerListenFunction : public TCPServerSocketAsyncApiFunction {
void AsyncWorkStart() override;
private:
- scoped_ptr<sockets_tcp_server::Listen::Params> params_;
+ std::unique_ptr<sockets_tcp_server::Listen::Params> params_;
TCPServerSocketEventDispatcher* socket_event_dispatcher_;
};
@@ -118,7 +118,7 @@ class SocketsTcpServerDisconnectFunction
void Work() override;
private:
- scoped_ptr<sockets_tcp_server::Disconnect::Params> params_;
+ std::unique_ptr<sockets_tcp_server::Disconnect::Params> params_;
};
class SocketsTcpServerCloseFunction : public TCPServerSocketAsyncApiFunction {
@@ -136,7 +136,7 @@ class SocketsTcpServerCloseFunction : public TCPServerSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_tcp_server::Close::Params> params_;
+ std::unique_ptr<sockets_tcp_server::Close::Params> params_;
};
class SocketsTcpServerGetInfoFunction : public TCPServerSocketAsyncApiFunction {
@@ -154,7 +154,7 @@ class SocketsTcpServerGetInfoFunction : public TCPServerSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_tcp_server::GetInfo::Params> params_;
+ std::unique_ptr<sockets_tcp_server::GetInfo::Params> params_;
};
class SocketsTcpServerGetSocketsFunction
diff --git a/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc b/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc
index c54724ba7c5..cff342458a8 100644
--- a/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc
+++ b/chromium/extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc
@@ -59,11 +59,11 @@ IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPCreateGood) {
socket_create_function->set_extension(empty_extension.get());
socket_create_function->set_has_callback(true);
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
api_test_utils::RunFunctionAndReturnSingleResult(
socket_create_function.get(), "[]", browser_context()));
ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType());
- scoped_ptr<base::DictionaryValue> value =
+ std::unique_ptr<base::DictionaryValue> value =
base::DictionaryValue::From(std::move(result));
int socketId = -1;
EXPECT_TRUE(value->GetInteger("socketId", &socketId));
diff --git a/chromium/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc b/chromium/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc
index a43d6be185f..a8d8adeacae 100644
--- a/chromium/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc
+++ b/chromium/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.cc
@@ -124,7 +124,7 @@ void TCPServerSocketEventDispatcher::StartAccept(const AcceptParams& params) {
void TCPServerSocketEventDispatcher::AcceptCallback(
const AcceptParams& params,
int result_code,
- scoped_ptr<net::TCPClientSocket> socket) {
+ std::unique_ptr<net::TCPClientSocket> socket) {
DCHECK_CURRENTLY_ON(params.thread_id);
if (result_code >= 0) {
@@ -137,11 +137,11 @@ void TCPServerSocketEventDispatcher::AcceptCallback(
sockets_tcp_server::AcceptInfo accept_info;
accept_info.socket_id = params.socket_id;
accept_info.client_socket_id = client_socket_id;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
sockets_tcp_server::OnAccept::Create(accept_info);
- scoped_ptr<Event> event(new Event(events::SOCKETS_TCP_SERVER_ON_ACCEPT,
- sockets_tcp_server::OnAccept::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(
+ new Event(events::SOCKETS_TCP_SERVER_ON_ACCEPT,
+ sockets_tcp_server::OnAccept::kEventName, std::move(args)));
PostEvent(params, std::move(event));
// Post a task to delay the "accept" until the socket is available, as
@@ -156,9 +156,9 @@ void TCPServerSocketEventDispatcher::AcceptCallback(
sockets_tcp_server::AcceptErrorInfo accept_error_info;
accept_error_info.socket_id = params.socket_id;
accept_error_info.result_code = result_code;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
sockets_tcp_server::OnAcceptError::Create(accept_error_info);
- scoped_ptr<Event> event(new Event(
+ std::unique_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));
@@ -175,7 +175,7 @@ void TCPServerSocketEventDispatcher::AcceptCallback(
// static
void TCPServerSocketEventDispatcher::PostEvent(const AcceptParams& params,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK_CURRENTLY_ON(params.thread_id);
BrowserThread::PostTask(
@@ -188,7 +188,7 @@ void TCPServerSocketEventDispatcher::PostEvent(const AcceptParams& params,
void TCPServerSocketEventDispatcher::DispatchEvent(
void* browser_context_id,
const std::string& extension_id,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::BrowserContext* context =
diff --git a/chromium/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h b/chromium/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h
index e792b829cde..13aa0e2bc58 100644
--- a/chromium/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h
+++ b/chromium/extensions/browser/api/sockets_tcp_server/tcp_server_socket_event_dispatcher.h
@@ -78,15 +78,16 @@ class TCPServerSocketEventDispatcher
// Called when socket accepts a new connection.
static void AcceptCallback(const AcceptParams& params,
int result_code,
- scoped_ptr<net::TCPClientSocket> socket);
+ std::unique_ptr<net::TCPClientSocket> socket);
// Post an extension event from |thread_id| to UI thread
- static void PostEvent(const AcceptParams& params, scoped_ptr<Event> event);
+ static void PostEvent(const AcceptParams& params,
+ std::unique_ptr<Event> event);
// Dispatch an extension event on to EventRouter instance on UI thread.
static void DispatchEvent(void* browser_context_id,
const std::string& extension_id,
- scoped_ptr<Event> event);
+ std::unique_ptr<Event> event);
// Usually IO thread (except for unit testing).
content::BrowserThread::ID thread_id_;
diff --git a/chromium/extensions/browser/api/sockets_udp/sockets_udp_api.cc b/chromium/extensions/browser/api/sockets_udp/sockets_udp_api.cc
index dfefb738ce8..9e2e607a4bd 100644
--- a/chromium/extensions/browser/api/sockets_udp/sockets_udp_api.cc
+++ b/chromium/extensions/browser/api/sockets_udp/sockets_udp_api.cc
@@ -22,9 +22,9 @@ const int kWildcardPort = 0;
UDPSocketAsyncApiFunction::~UDPSocketAsyncApiFunction() {}
-scoped_ptr<SocketResourceManagerInterface>
+std::unique_ptr<SocketResourceManagerInterface>
UDPSocketAsyncApiFunction::CreateSocketResourceManager() {
- return scoped_ptr<SocketResourceManagerInterface>(
+ return std::unique_ptr<SocketResourceManagerInterface>(
new SocketResourceManager<ResumableUDPSocket>());
}
@@ -35,9 +35,9 @@ ResumableUDPSocket* UDPSocketAsyncApiFunction::GetUdpSocket(int socket_id) {
UDPSocketExtensionWithDnsLookupFunction::
~UDPSocketExtensionWithDnsLookupFunction() {}
-scoped_ptr<SocketResourceManagerInterface>
+std::unique_ptr<SocketResourceManagerInterface>
UDPSocketExtensionWithDnsLookupFunction::CreateSocketResourceManager() {
- return scoped_ptr<SocketResourceManagerInterface>(
+ return std::unique_ptr<SocketResourceManagerInterface>(
new SocketResourceManager<ResumableUDPSocket>());
}
diff --git a/chromium/extensions/browser/api/sockets_udp/sockets_udp_api.h b/chromium/extensions/browser/api/sockets_udp/sockets_udp_api.h
index 3ade564eb91..27ee801af2a 100644
--- a/chromium/extensions/browser/api/sockets_udp/sockets_udp_api.h
+++ b/chromium/extensions/browser/api/sockets_udp/sockets_udp_api.h
@@ -24,7 +24,7 @@ class UDPSocketAsyncApiFunction : public SocketAsyncApiFunction {
protected:
~UDPSocketAsyncApiFunction() override;
- scoped_ptr<SocketResourceManagerInterface> CreateSocketResourceManager()
+ std::unique_ptr<SocketResourceManagerInterface> CreateSocketResourceManager()
override;
ResumableUDPSocket* GetUdpSocket(int socket_id);
@@ -35,7 +35,7 @@ class UDPSocketExtensionWithDnsLookupFunction
protected:
~UDPSocketExtensionWithDnsLookupFunction() override;
- scoped_ptr<SocketResourceManagerInterface> CreateSocketResourceManager()
+ std::unique_ptr<SocketResourceManagerInterface> CreateSocketResourceManager()
override;
ResumableUDPSocket* GetUdpSocket(int socket_id);
@@ -56,7 +56,7 @@ class SocketsUdpCreateFunction : public UDPSocketAsyncApiFunction {
private:
FRIEND_TEST_ALL_PREFIXES(SocketsUdpUnitTest, Create);
- scoped_ptr<sockets_udp::Create::Params> params_;
+ std::unique_ptr<sockets_udp::Create::Params> params_;
};
class SocketsUdpUpdateFunction : public UDPSocketAsyncApiFunction {
@@ -73,7 +73,7 @@ class SocketsUdpUpdateFunction : public UDPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_udp::Update::Params> params_;
+ std::unique_ptr<sockets_udp::Update::Params> params_;
};
class SocketsUdpSetPausedFunction : public UDPSocketAsyncApiFunction {
@@ -90,7 +90,7 @@ class SocketsUdpSetPausedFunction : public UDPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_udp::SetPaused::Params> params_;
+ std::unique_ptr<sockets_udp::SetPaused::Params> params_;
UDPSocketEventDispatcher* socket_event_dispatcher_;
};
@@ -108,7 +108,7 @@ class SocketsUdpBindFunction : public UDPSocketAsyncApiFunction {
void AsyncWorkStart() override;
private:
- scoped_ptr<sockets_udp::Bind::Params> params_;
+ std::unique_ptr<sockets_udp::Bind::Params> params_;
UDPSocketEventDispatcher* socket_event_dispatcher_;
};
@@ -133,7 +133,7 @@ class SocketsUdpSendFunction : public UDPSocketExtensionWithDnsLookupFunction {
private:
void StartSendTo();
- scoped_ptr<sockets_udp::Send::Params> params_;
+ std::unique_ptr<sockets_udp::Send::Params> params_;
scoped_refptr<net::IOBuffer> io_buffer_;
size_t io_buffer_size_;
};
@@ -152,7 +152,7 @@ class SocketsUdpCloseFunction : public UDPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_udp::Close::Params> params_;
+ std::unique_ptr<sockets_udp::Close::Params> params_;
};
class SocketsUdpGetInfoFunction : public UDPSocketAsyncApiFunction {
@@ -169,7 +169,7 @@ class SocketsUdpGetInfoFunction : public UDPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_udp::GetInfo::Params> params_;
+ std::unique_ptr<sockets_udp::GetInfo::Params> params_;
};
class SocketsUdpGetSocketsFunction : public UDPSocketAsyncApiFunction {
@@ -200,7 +200,7 @@ class SocketsUdpJoinGroupFunction : public UDPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_udp::JoinGroup::Params> params_;
+ std::unique_ptr<sockets_udp::JoinGroup::Params> params_;
};
class SocketsUdpLeaveGroupFunction : public UDPSocketAsyncApiFunction {
@@ -217,7 +217,7 @@ class SocketsUdpLeaveGroupFunction : public UDPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_udp::LeaveGroup::Params> params_;
+ std::unique_ptr<sockets_udp::LeaveGroup::Params> params_;
};
class SocketsUdpSetMulticastTimeToLiveFunction
@@ -236,7 +236,7 @@ class SocketsUdpSetMulticastTimeToLiveFunction
void Work() override;
private:
- scoped_ptr<sockets_udp::SetMulticastTimeToLive::Params> params_;
+ std::unique_ptr<sockets_udp::SetMulticastTimeToLive::Params> params_;
};
class SocketsUdpSetMulticastLoopbackModeFunction
@@ -255,7 +255,7 @@ class SocketsUdpSetMulticastLoopbackModeFunction
void Work() override;
private:
- scoped_ptr<sockets_udp::SetMulticastLoopbackMode::Params> params_;
+ std::unique_ptr<sockets_udp::SetMulticastLoopbackMode::Params> params_;
};
class SocketsUdpGetJoinedGroupsFunction : public UDPSocketAsyncApiFunction {
@@ -273,7 +273,7 @@ class SocketsUdpGetJoinedGroupsFunction : public UDPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_udp::GetJoinedGroups::Params> params_;
+ std::unique_ptr<sockets_udp::GetJoinedGroups::Params> params_;
};
class SocketsUdpSetBroadcastFunction : public UDPSocketAsyncApiFunction {
@@ -291,7 +291,7 @@ class SocketsUdpSetBroadcastFunction : public UDPSocketAsyncApiFunction {
void Work() override;
private:
- scoped_ptr<sockets_udp::SetBroadcast::Params> params_;
+ std::unique_ptr<sockets_udp::SetBroadcast::Params> params_;
};
} // namespace api
diff --git a/chromium/extensions/browser/api/sockets_udp/sockets_udp_api_unittest.cc b/chromium/extensions/browser/api/sockets_udp/sockets_udp_api_unittest.cc
index ebba7bcc1a9..5d4e4b49934 100644
--- a/chromium/extensions/browser/api/sockets_udp/sockets_udp_api_unittest.cc
+++ b/chromium/extensions/browser/api/sockets_udp/sockets_udp_api_unittest.cc
@@ -2,12 +2,15 @@
// 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/browser/api/sockets_udp/sockets_udp_api.h"
+
+#include <memory>
+
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/browser/api/socket/socket.h"
#include "extensions/browser/api/socket/udp_socket.h"
-#include "extensions/browser/api/sockets_udp/sockets_udp_api.h"
#include "extensions/browser/api_unittest.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -15,9 +18,9 @@
namespace extensions {
namespace api {
-static scoped_ptr<KeyedService> ApiResourceManagerTestFactory(
+static std::unique_ptr<KeyedService> ApiResourceManagerTestFactory(
content::BrowserContext* context) {
- return make_scoped_ptr(new ApiResourceManager<ResumableUDPSocket>(context));
+ return base::WrapUnique(new ApiResourceManager<ResumableUDPSocket>(context));
}
class SocketsUdpUnitTest : public ApiUnitTest {
@@ -41,7 +44,7 @@ TEST_F(SocketsUdpUnitTest, Create) {
function->set_work_thread_id(id);
// Run tests
- scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
+ std::unique_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
function, "[{\"persistent\": true, \"name\": \"foo\"}]"));
ASSERT_TRUE(result.get());
}
diff --git a/chromium/extensions/browser/api/sockets_udp/sockets_udp_apitest.cc b/chromium/extensions/browser/api/sockets_udp/sockets_udp_apitest.cc
index 85cbfffdb89..a602d41da6e 100644
--- a/chromium/extensions/browser/api/sockets_udp/sockets_udp_apitest.cc
+++ b/chromium/extensions/browser/api/sockets_udp/sockets_udp_apitest.cc
@@ -59,7 +59,7 @@ IN_PROC_BROWSER_TEST_F(SocketsUdpApiTest, SocketsUdpCreateGood) {
socket_create_function->set_extension(empty_extension.get());
socket_create_function->set_has_callback(true);
- scoped_ptr<base::Value> result(
+ std::unique_ptr<base::Value> result(
api_test_utils::RunFunctionAndReturnSingleResult(
socket_create_function.get(), "[]", browser_context()));
@@ -71,9 +71,11 @@ IN_PROC_BROWSER_TEST_F(SocketsUdpApiTest, SocketsUdpCreateGood) {
}
IN_PROC_BROWSER_TEST_F(SocketsUdpApiTest, SocketsUdpExtension) {
- scoped_ptr<net::SpawnedTestServer> test_server(new net::SpawnedTestServer(
- net::SpawnedTestServer::TYPE_UDP_ECHO, net::SpawnedTestServer::kLocalhost,
- base::FilePath(FILE_PATH_LITERAL("net/data"))));
+ std::unique_ptr<net::SpawnedTestServer> test_server(
+ new net::SpawnedTestServer(
+ net::SpawnedTestServer::TYPE_UDP_ECHO,
+ net::SpawnedTestServer::kLocalhost,
+ base::FilePath(FILE_PATH_LITERAL("net/data"))));
EXPECT_TRUE(test_server->Start());
net::HostPortPair host_port_pair = test_server->host_port_pair();
diff --git a/chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc b/chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc
index 07e2a22f929..33f3fc7e910 100644
--- a/chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc
+++ b/chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.cc
@@ -119,11 +119,11 @@ void UDPSocketEventDispatcher::ReceiveCallback(
receive_info.data.assign(io_buffer->data(), io_buffer->data() + bytes_read);
receive_info.remote_address = address;
receive_info.remote_port = port;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
sockets_udp::OnReceive::Create(receive_info);
- scoped_ptr<Event> event(new Event(events::SOCKETS_UDP_ON_RECEIVE,
- sockets_udp::OnReceive::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::SOCKETS_UDP_ON_RECEIVE,
+ sockets_udp::OnReceive::kEventName,
+ std::move(args)));
PostEvent(params, std::move(event));
// Post a task to delay the read until the socket is available, as
@@ -141,11 +141,11 @@ void UDPSocketEventDispatcher::ReceiveCallback(
sockets_udp::ReceiveErrorInfo receive_error_info;
receive_error_info.socket_id = params.socket_id;
receive_error_info.result_code = bytes_read;
- scoped_ptr<base::ListValue> args =
+ std::unique_ptr<base::ListValue> args =
sockets_udp::OnReceiveError::Create(receive_error_info);
- scoped_ptr<Event> event(new Event(events::SOCKETS_UDP_ON_RECEIVE_ERROR,
- sockets_udp::OnReceiveError::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(
+ new Event(events::SOCKETS_UDP_ON_RECEIVE_ERROR,
+ sockets_udp::OnReceiveError::kEventName, std::move(args)));
PostEvent(params, std::move(event));
// Since we got an error, the socket is now "paused" until the application
@@ -160,7 +160,7 @@ void UDPSocketEventDispatcher::ReceiveCallback(
/* static */
void UDPSocketEventDispatcher::PostEvent(const ReceiveParams& params,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK_CURRENTLY_ON(params.thread_id);
BrowserThread::PostTask(
@@ -172,7 +172,7 @@ void UDPSocketEventDispatcher::PostEvent(const ReceiveParams& params,
/*static*/
void UDPSocketEventDispatcher::DispatchEvent(void* browser_context_id,
const std::string& extension_id,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::BrowserContext* context =
diff --git a/chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h b/chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h
index ff8f111c295..dcc8b397054 100644
--- a/chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h
+++ b/chromium/extensions/browser/api/sockets_udp/udp_socket_event_dispatcher.h
@@ -79,12 +79,13 @@ class UDPSocketEventDispatcher
uint16_t port);
// Post an extension event from IO to UI thread
- static void PostEvent(const ReceiveParams& params, scoped_ptr<Event> event);
+ static void PostEvent(const ReceiveParams& params,
+ std::unique_ptr<Event> event);
// Dispatch an extension event on to EventRouter instance on UI thread.
static void DispatchEvent(void* browser_context_id,
const std::string& extension_id,
- scoped_ptr<Event> event);
+ std::unique_ptr<Event> event);
// Usually IO thread (except for unit testing).
content::BrowserThread::ID thread_id_;
diff --git a/chromium/extensions/browser/api/storage/local_value_store_cache.cc b/chromium/extensions/browser/api/storage/local_value_store_cache.cc
index 920d1305db3..5a941185b72 100644
--- a/chromium/extensions/browser/api/storage/local_value_store_cache.cc
+++ b/chromium/extensions/browser/api/storage/local_value_store_cache.cc
@@ -78,7 +78,7 @@ ValueStore* LocalValueStoreCache::GetStorage(const Extension* extension) {
ValueStoreFactory::ModelType model_type =
extension->is_app() ? ValueStoreFactory::ModelType::APP
: ValueStoreFactory::ModelType::EXTENSION;
- scoped_ptr<ValueStore> store = storage_factory_->CreateSettingsStore(
+ std::unique_ptr<ValueStore> store = storage_factory_->CreateSettingsStore(
settings_namespace::LOCAL, model_type, extension->id());
linked_ptr<SettingsStorageQuotaEnforcer> storage(
new SettingsStorageQuotaEnforcer(quota_, std::move(store)));
diff --git a/chromium/extensions/browser/api/storage/local_value_store_cache.h b/chromium/extensions/browser/api/storage/local_value_store_cache.h
index c3303a5ef66..b125bbb3006 100644
--- a/chromium/extensions/browser/api/storage/local_value_store_cache.h
+++ b/chromium/extensions/browser/api/storage/local_value_store_cache.h
@@ -5,11 +5,12 @@
#ifndef EXTENSIONS_BROWSER_API_STORAGE_LOCAL_VALUE_STORE_CACHE_H_
#define EXTENSIONS_BROWSER_API_STORAGE_LOCAL_VALUE_STORE_CACHE_H_
+#include <memory>
+
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
#include "extensions/browser/api/storage/value_store_cache.h"
diff --git a/chromium/extensions/browser/api/storage/settings_quota_unittest.cc b/chromium/extensions/browser/api/storage/settings_quota_unittest.cc
index 3681401a49c..b431df5182f 100644
--- a/chromium/extensions/browser/api/storage/settings_quota_unittest.cc
+++ b/chromium/extensions/browser/api/storage/settings_quota_unittest.cc
@@ -4,9 +4,11 @@
#include <stddef.h>
+#include <memory>
+
#include "base/json/json_writer.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
#include "extensions/browser/value_store/testing_value_store.h"
@@ -55,7 +57,7 @@ class ExtensionSettingsQuotaTest : public testing::Test {
SettingsStorageQuotaEnforcer::Limits limits =
{ quota_bytes, quota_bytes_per_item, max_items };
storage_.reset(
- new SettingsStorageQuotaEnforcer(limits, make_scoped_ptr(delegate_)));
+ new SettingsStorageQuotaEnforcer(limits, base::WrapUnique(delegate_)));
}
// Returns whether the settings in |storage_| and |delegate_| are the same as
@@ -71,7 +73,7 @@ class ExtensionSettingsQuotaTest : public testing::Test {
base::ListValue byte_value_256_;
// Quota enforcing storage area being tested.
- scoped_ptr<SettingsStorageQuotaEnforcer> storage_;
+ std::unique_ptr<SettingsStorageQuotaEnforcer> storage_;
// In-memory storage area being delegated to. Always owned by |storage_|.
TestingValueStore* delegate_;
diff --git a/chromium/extensions/browser/api/storage/settings_storage_quota_enforcer.cc b/chromium/extensions/browser/api/storage/settings_storage_quota_enforcer.cc
index 7d3703cd4db..d4e9e699b8f 100644
--- a/chromium/extensions/browser/api/storage/settings_storage_quota_enforcer.cc
+++ b/chromium/extensions/browser/api/storage/settings_storage_quota_enforcer.cc
@@ -4,9 +4,10 @@
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
+#include <memory>
+
#include "base/bind.h"
#include "base/json/json_writer.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/stl_util.h"
@@ -72,7 +73,7 @@ ValueStore::Status QuotaExceededError(Resource resource) {
SettingsStorageQuotaEnforcer::SettingsStorageQuotaEnforcer(
const Limits& limits,
- scoped_ptr<ValueStore> delegate)
+ std::unique_ptr<ValueStore> delegate)
: limits_(limits),
delegate_(std::move(delegate)),
used_total_(0),
diff --git a/chromium/extensions/browser/api/storage/settings_storage_quota_enforcer.h b/chromium/extensions/browser/api/storage/settings_storage_quota_enforcer.h
index 33de5b7fa13..ae8b511e984 100644
--- a/chromium/extensions/browser/api/storage/settings_storage_quota_enforcer.h
+++ b/chromium/extensions/browser/api/storage/settings_storage_quota_enforcer.h
@@ -8,12 +8,12 @@
#include <stddef.h>
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "extensions/browser/value_store/value_store.h"
@@ -35,7 +35,7 @@ class SettingsStorageQuotaEnforcer : public ValueStore {
};
SettingsStorageQuotaEnforcer(const Limits& limits,
- scoped_ptr<ValueStore> delegate);
+ std::unique_ptr<ValueStore> delegate);
~SettingsStorageQuotaEnforcer() override;
@@ -72,7 +72,7 @@ class SettingsStorageQuotaEnforcer : public ValueStore {
const Limits limits_;
// The delegate storage area.
- scoped_ptr<ValueStore> const delegate_;
+ std::unique_ptr<ValueStore> const delegate_;
// Total bytes in used by |delegate_|. Includes both key lengths and
// JSON-encoded values.
diff --git a/chromium/extensions/browser/api/storage/settings_test_util.cc b/chromium/extensions/browser/api/storage/settings_test_util.cc
index 44425412439..0521d235d95 100644
--- a/chromium/extensions/browser/api/storage/settings_test_util.cc
+++ b/chromium/extensions/browser/api/storage/settings_test_util.cc
@@ -17,21 +17,21 @@ namespace extensions {
namespace settings_test_util {
// Creates a kilobyte of data.
-scoped_ptr<base::Value> CreateKilobyte() {
+std::unique_ptr<base::Value> CreateKilobyte() {
std::string kilobyte_string;
for (int i = 0; i < 1024; ++i) {
kilobyte_string += "a";
}
- return scoped_ptr<base::Value>(new base::StringValue(kilobyte_string));
+ return std::unique_ptr<base::Value>(new base::StringValue(kilobyte_string));
}
// Creates a megabyte of data.
-scoped_ptr<base::Value> CreateMegabyte() {
+std::unique_ptr<base::Value> CreateMegabyte() {
base::ListValue* megabyte = new base::ListValue();
for (int i = 0; i < 1000; ++i) {
megabyte->Append(CreateKilobyte().release());
}
- return scoped_ptr<base::Value>(megabyte);
+ return std::unique_ptr<base::Value>(megabyte);
}
// Intended as a StorageCallback from GetStorage.
@@ -71,7 +71,7 @@ scoped_refptr<const Extension> AddExtensionWithIdAndPermissions(
manifest.SetString("name", std::string("Test extension ") + id);
manifest.SetString("version", "1.0");
- scoped_ptr<base::ListValue> permissions(new base::ListValue());
+ std::unique_ptr<base::ListValue> permissions(new base::ListValue());
for (std::set<std::string>::const_iterator it = permissions_set.begin();
it != permissions_set.end(); ++it) {
permissions->Append(new base::StringValue(*it));
diff --git a/chromium/extensions/browser/api/storage/settings_test_util.h b/chromium/extensions/browser/api/storage/settings_test_util.h
index 07a1d5242e1..a48480b2cff 100644
--- a/chromium/extensions/browser/api/storage/settings_test_util.h
+++ b/chromium/extensions/browser/api/storage/settings_test_util.h
@@ -5,13 +5,13 @@
#ifndef EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_TEST_UTIL_H_
#define EXTENSIONS_BROWSER_API_STORAGE_SETTINGS_TEST_UTIL_H_
+#include <memory>
#include <set>
#include <string>
#include "base/compiler_specific.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "chrome/test/base/testing_profile.h"
#include "extensions/browser/api/storage/settings_namespace.h"
#include "extensions/browser/event_router.h"
@@ -28,10 +28,10 @@ class StorageFrontend;
namespace settings_test_util {
// Creates a kilobyte of data.
-scoped_ptr<base::Value> CreateKilobyte();
+std::unique_ptr<base::Value> CreateKilobyte();
// Creates a megabyte of data.
-scoped_ptr<base::Value> CreateMegabyte();
+std::unique_ptr<base::Value> CreateMegabyte();
// Synchronously gets the storage area for an extension from |frontend|.
ValueStore* GetStorage(scoped_refptr<const Extension> extension,
diff --git a/chromium/extensions/browser/api/storage/storage_api.cc b/chromium/extensions/browser/api/storage/storage_api.cc
index 16a46b0c37d..4b1928e4711 100644
--- a/chromium/extensions/browser/api/storage/storage_api.cc
+++ b/chromium/extensions/browser/api/storage/storage_api.cc
@@ -11,6 +11,7 @@
#include <vector>
#include "base/bind.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "content/public/browser/browser_thread.h"
@@ -175,7 +176,7 @@ ExtensionFunction::ResponseValue StorageStorageAreaGetFunction::RunWithStorage(
base::DictionaryValue* with_default_values = as_dict->DeepCopy();
with_default_values->MergeDictionary(&result->settings());
return UseReadResult(ValueStore::MakeReadResult(
- make_scoped_ptr(with_default_values), result->status()));
+ base::WrapUnique(with_default_values), result->status()));
}
default:
diff --git a/chromium/extensions/browser/api/storage/storage_api_unittest.cc b/chromium/extensions/browser/api/storage/storage_api_unittest.cc
index 4a013db42a0..5fe71591e61 100644
--- a/chromium/extensions/browser/api/storage/storage_api_unittest.cc
+++ b/chromium/extensions/browser/api/storage/storage_api_unittest.cc
@@ -2,16 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "extensions/browser/api/storage/storage_api.h"
+
+#include <memory>
+
#include "base/command_line.h"
#include "base/files/file_path.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/stringprintf.h"
#include "content/public/test/test_browser_context.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/api/storage/settings_storage_quota_enforcer.h"
#include "extensions/browser/api/storage/settings_test_util.h"
-#include "extensions/browser/api/storage/storage_api.h"
#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/api_unittest.h"
#include "extensions/browser/event_router.h"
@@ -30,15 +33,16 @@ namespace extensions {
namespace {
// Caller owns the returned object.
-scoped_ptr<KeyedService> CreateStorageFrontendForTesting(
+std::unique_ptr<KeyedService> CreateStorageFrontendForTesting(
content::BrowserContext* context) {
scoped_refptr<ValueStoreFactory> factory =
new ValueStoreFactoryImpl(context->GetPath());
return StorageFrontend::CreateForTesting(factory, context);
}
-scoped_ptr<KeyedService> BuildEventRouter(content::BrowserContext* context) {
- return make_scoped_ptr(new extensions::EventRouter(context, nullptr));
+std::unique_ptr<KeyedService> BuildEventRouter(
+ content::BrowserContext* context) {
+ return base::WrapUnique(new extensions::EventRouter(context, nullptr));
}
} // namespace
@@ -61,7 +65,7 @@ class StorageApiUnittest : public ApiUnitTest {
// |value| with the string result.
testing::AssertionResult RunGetFunction(const std::string& key,
std::string* value) {
- scoped_ptr<base::Value> result = RunFunctionAndReturnValue(
+ std::unique_ptr<base::Value> result = RunFunctionAndReturnValue(
new StorageStorageAreaGetFunction(),
base::StringPrintf("[\"local\", \"%s\"]", key.c_str()));
if (!result.get())
diff --git a/chromium/extensions/browser/api/storage/storage_frontend.cc b/chromium/extensions/browser/api/storage/storage_frontend.cc
index 911a49290bf..1e60c44b747 100644
--- a/chromium/extensions/browser/api/storage/storage_frontend.cc
+++ b/chromium/extensions/browser/api/storage/storage_frontend.cc
@@ -11,6 +11,7 @@
#include "base/files/file_path.h"
#include "base/json/json_reader.h"
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/trace_event/trace_event.h"
#include "content/public/browser/browser_context.h"
@@ -46,13 +47,13 @@ class DefaultObserver : public SettingsObserver {
const std::string& change_json) override {
// TODO(gdk): This is a temporary hack while the refactoring for
// string-based event payloads is removed. http://crbug.com/136045
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(base::JSONReader::Read(change_json));
args->Append(new base::StringValue(settings_namespace::ToString(
settings_namespace)));
- scoped_ptr<Event> event(new Event(events::STORAGE_ON_CHANGED,
- api::storage::OnChanged::kEventName,
- std::move(args)));
+ std::unique_ptr<Event> event(new Event(events::STORAGE_ON_CHANGED,
+ api::storage::OnChanged::kEventName,
+ std::move(args)));
EventRouter::Get(browser_context_)
->DispatchEventToExtension(extension_id, std::move(event));
}
@@ -69,10 +70,10 @@ StorageFrontend* StorageFrontend::Get(BrowserContext* context) {
}
// static
-scoped_ptr<StorageFrontend> StorageFrontend::CreateForTesting(
+std::unique_ptr<StorageFrontend> StorageFrontend::CreateForTesting(
const scoped_refptr<ValueStoreFactory>& storage_factory,
BrowserContext* context) {
- return make_scoped_ptr(new StorageFrontend(storage_factory, context));
+ return base::WrapUnique(new StorageFrontend(storage_factory, context));
}
StorageFrontend::StorageFrontend(BrowserContext* context)
diff --git a/chromium/extensions/browser/api/storage/storage_frontend.h b/chromium/extensions/browser/api/storage/storage_frontend.h
index 6d3427fd546..c43b81e2e28 100644
--- a/chromium/extensions/browser/api/storage/storage_frontend.h
+++ b/chromium/extensions/browser/api/storage/storage_frontend.h
@@ -6,11 +6,11 @@
#define EXTENSIONS_BROWSER_API_STORAGE_STORAGE_FRONTEND_H_
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/storage/settings_namespace.h"
#include "extensions/browser/api/storage/settings_observer.h"
#include "extensions/browser/api/storage/value_store_cache.h"
@@ -31,7 +31,7 @@ class StorageFrontend : public BrowserContextKeyedAPI {
static StorageFrontend* Get(content::BrowserContext* context);
// Creates with a specific |storage_factory|.
- static scoped_ptr<StorageFrontend> CreateForTesting(
+ static std::unique_ptr<StorageFrontend> CreateForTesting(
const scoped_refptr<ValueStoreFactory>& storage_factory,
content::BrowserContext* context);
@@ -87,7 +87,7 @@ class StorageFrontend : public BrowserContextKeyedAPI {
scoped_refptr<SettingsObserverList> observers_;
// Observer for |browser_context_|.
- scoped_ptr<SettingsObserver> browser_context_observer_;
+ std::unique_ptr<SettingsObserver> browser_context_observer_;
// Maps a known namespace to its corresponding ValueStoreCache. The caches
// are owned by this object.
diff --git a/chromium/extensions/browser/api/storage/storage_frontend_unittest.cc b/chromium/extensions/browser/api/storage/storage_frontend_unittest.cc
index 5995ceb2dbe..e54f73b9156 100644
--- a/chromium/extensions/browser/api/storage/storage_frontend_unittest.cc
+++ b/chromium/extensions/browser/api/storage/storage_frontend_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/api/storage/storage_frontend.h"
+
+#include <memory>
+
#include "base/bind.h"
#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/strings/string_number_conversions.h"
#include "content/public/browser/browser_context.h"
@@ -14,7 +17,6 @@
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/api/storage/settings_namespace.h"
#include "extensions/browser/api/storage/settings_test_util.h"
-#include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/extensions_test.h"
#include "extensions/browser/value_store/value_store.h"
#include "extensions/browser/value_store/value_store_factory_impl.h"
@@ -64,7 +66,7 @@ class ExtensionSettingsFrontendTest : public ExtensionsTest {
}
base::ScopedTempDir temp_dir_;
- scoped_ptr<StorageFrontend> frontend_;
+ std::unique_ptr<StorageFrontend> frontend_;
scoped_refptr<ValueStoreFactoryImpl> storage_factory_;
private:
@@ -192,7 +194,7 @@ TEST_F(ExtensionSettingsFrontendTest,
util::GetStorage(extension, settings::LOCAL, frontend_.get());
// Sync storage should run out after ~100K.
- scoped_ptr<base::Value> kilobyte = util::CreateKilobyte();
+ std::unique_ptr<base::Value> kilobyte = util::CreateKilobyte();
for (int i = 0; i < 100; ++i) {
sync_storage->Set(DEFAULTS, base::IntToString(i), *kilobyte);
}
@@ -209,7 +211,7 @@ TEST_F(ExtensionSettingsFrontendTest,
local_storage->Set(DEFAULTS, "WontError", *kilobyte)->status().ok());
// Local storage should run out after ~5MB.
- scoped_ptr<base::Value> megabyte = util::CreateMegabyte();
+ std::unique_ptr<base::Value> megabyte = util::CreateMegabyte();
for (int i = 0; i < 5; ++i) {
local_storage->Set(DEFAULTS, base::IntToString(i), *megabyte);
}
diff --git a/chromium/extensions/browser/api/system_cpu/cpu_info_provider_win.cc b/chromium/extensions/browser/api/system_cpu/cpu_info_provider_win.cc
index eba4891b625..3aa8857f6c7 100644
--- a/chromium/extensions/browser/api/system_cpu/cpu_info_provider_win.cc
+++ b/chromium/extensions/browser/api/system_cpu/cpu_info_provider_win.cc
@@ -7,7 +7,8 @@
#include <windows.h>
#include <winternl.h>
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/sys_info.h"
namespace extensions {
@@ -38,7 +39,7 @@ bool CpuInfoProvider::QueryCpuTimePerProcessor(
CHECK(NtQuerySystemInformation != NULL);
int num_of_processors = base::SysInfo::NumberOfProcessors();
- scoped_ptr<SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION[]> processor_info(
+ std::unique_ptr<SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION[]> processor_info(
new SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION[num_of_processors]);
ULONG returned_bytes = 0,
diff --git a/chromium/extensions/browser/api/system_display/display_info_provider.cc b/chromium/extensions/browser/api/system_display/display_info_provider.cc
index 54c247af3fc..8260a842e9c 100644
--- a/chromium/extensions/browser/api/system_display/display_info_provider.cc
+++ b/chromium/extensions/browser/api/system_display/display_info_provider.cc
@@ -6,8 +6,8 @@
#include "base/strings/string_number_conversions.h"
#include "extensions/common/api/system_display.h"
-#include "ui/gfx/display.h"
-#include "ui/gfx/screen.h"
+#include "ui/display/display.h"
+#include "ui/display/screen.h"
namespace extensions {
@@ -17,15 +17,15 @@ namespace {
DisplayInfoProvider* g_display_info_provider = NULL;
// Converts Rotation enum to integer.
-int RotationToDegrees(gfx::Display::Rotation rotation) {
+int RotationToDegrees(display::Display::Rotation rotation) {
switch (rotation) {
- case gfx::Display::ROTATE_0:
+ case display::Display::ROTATE_0:
return 0;
- case gfx::Display::ROTATE_90:
+ case display::Display::ROTATE_90:
return 90;
- case gfx::Display::ROTATE_180:
+ case display::Display::ROTATE_180:
return 180;
- case gfx::Display::ROTATE_270:
+ case display::Display::ROTATE_270:
return 270;
}
return 0;
@@ -52,7 +52,7 @@ void DisplayInfoProvider::InitializeForTesting(
// static
// Creates new DisplayUnitInfo struct for |display|.
api::system_display::DisplayUnitInfo DisplayInfoProvider::CreateDisplayUnitInfo(
- const gfx::Display& display,
+ const display::Display& display,
int64_t primary_display_id) {
api::system_display::DisplayUnitInfo unit;
const gfx::Rect& bounds = display.bounds();
@@ -75,12 +75,12 @@ api::system_display::DisplayUnitInfo DisplayInfoProvider::CreateDisplayUnitInfo(
void DisplayInfoProvider::EnableUnifiedDesktop(bool enable) {}
-DisplayInfo DisplayInfoProvider::GetAllDisplaysInfo() {
- gfx::Screen* screen = gfx::Screen::GetScreen();
+DisplayUnitInfoList DisplayInfoProvider::GetAllDisplaysInfo() {
+ display::Screen* screen = display::Screen::GetScreen();
int64_t primary_id = screen->GetPrimaryDisplay().id();
- std::vector<gfx::Display> displays = screen->GetAllDisplays();
- DisplayInfo all_displays;
- for (const gfx::Display& display : displays) {
+ std::vector<display::Display> displays = screen->GetAllDisplays();
+ DisplayUnitInfoList all_displays;
+ for (const display::Display& display : displays) {
api::system_display::DisplayUnitInfo unit =
CreateDisplayUnitInfo(display, primary_id);
UpdateDisplayUnitInfoForPlatform(display, &unit);
diff --git a/chromium/extensions/browser/api/system_display/display_info_provider.h b/chromium/extensions/browser/api/system_display/display_info_provider.h
index 48e3d9e537f..22783a0658d 100644
--- a/chromium/extensions/browser/api/system_display/display_info_provider.h
+++ b/chromium/extensions/browser/api/system_display/display_info_provider.h
@@ -12,7 +12,7 @@
#include "base/macros.h"
-namespace gfx {
+namespace display {
class Display;
}
@@ -25,7 +25,7 @@ struct DisplayUnitInfo;
}
}
-typedef std::vector<api::system_display::DisplayUnitInfo> DisplayInfo;
+typedef std::vector<api::system_display::DisplayUnitInfo> DisplayUnitInfoList;
class DisplayInfoProvider {
public:
@@ -50,15 +50,15 @@ class DisplayInfoProvider {
virtual void EnableUnifiedDesktop(bool enable);
// Get display information.
- virtual DisplayInfo GetAllDisplaysInfo();
+ virtual DisplayUnitInfoList GetAllDisplaysInfo();
protected:
DisplayInfoProvider();
- // Create a DisplayUnitInfo from a gfx::Display for implementations of
+ // Create a DisplayUnitInfo from a display::Display for implementations of
// GetAllDisplaysInfo()
static api::system_display::DisplayUnitInfo CreateDisplayUnitInfo(
- const gfx::Display& display,
+ const display::Display& display,
int64_t primary_display_id);
private:
@@ -67,7 +67,7 @@ class DisplayInfoProvider {
// Update the content of the |unit| obtained for |display| using
// platform specific method.
virtual void UpdateDisplayUnitInfoForPlatform(
- const gfx::Display& display,
+ const display::Display& display,
api::system_display::DisplayUnitInfo* unit) = 0;
DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider);
diff --git a/chromium/extensions/browser/api/system_display/system_display_api.cc b/chromium/extensions/browser/api/system_display/system_display_api.cc
index 423109d2ab3..b8dc9c38752 100644
--- a/chromium/extensions/browser/api/system_display/system_display_api.cc
+++ b/chromium/extensions/browser/api/system_display/system_display_api.cc
@@ -4,6 +4,7 @@
#include "extensions/browser/api/system_display/system_display_api.h"
+#include <memory>
#include <string>
#include "build/build_config.h"
@@ -11,9 +12,7 @@
#include "extensions/common/api/system_display.h"
#if defined(OS_CHROMEOS)
-#include "base/memory/scoped_ptr.h"
#include "extensions/common/manifest_handlers/kiosk_mode_info.h"
-#include "ui/gfx/screen.h"
#endif
namespace extensions {
@@ -23,7 +22,7 @@ using api::system_display::DisplayUnitInfo;
namespace SetDisplayProperties = api::system_display::SetDisplayProperties;
bool SystemDisplayGetInfoFunction::RunSync() {
- DisplayInfo all_displays_info =
+ DisplayUnitInfoList all_displays_info =
DisplayInfoProvider::Get()->GetAllDisplaysInfo();
results_ = api::system_display::GetInfo::Results::Create(all_displays_info);
return true;
@@ -34,18 +33,18 @@ bool SystemDisplaySetDisplayPropertiesFunction::RunSync() {
SetError("Function available only on ChromeOS.");
return false;
#else
- if (!KioskModeInfo::IsKioskEnabled(extension())) {
+ if (extension() && !KioskModeInfo::IsKioskEnabled(extension())) {
SetError("The extension needs to be kiosk enabled to use the function.");
return false;
}
std::string error;
- scoped_ptr<SetDisplayProperties::Params> params(
+ std::unique_ptr<SetDisplayProperties::Params> params(
SetDisplayProperties::Params::Create(*args_));
- bool success =
+ bool result =
DisplayInfoProvider::Get()->SetInfo(params->id, params->info, &error);
- if (!success)
+ if (!result)
SetError(error);
- return true;
+ return result;
#endif
}
@@ -54,7 +53,7 @@ bool SystemDisplayEnableUnifiedDesktopFunction::RunSync() {
SetError("Function available only on ChromeOS.");
return false;
#else
- scoped_ptr<api::system_display::EnableUnifiedDesktop::Params> params(
+ std::unique_ptr<api::system_display::EnableUnifiedDesktop::Params> params(
api::system_display::EnableUnifiedDesktop::Params::Create(*args_));
DisplayInfoProvider::Get()->EnableUnifiedDesktop(params->enabled);
return true;
diff --git a/chromium/extensions/browser/api/system_display/system_display_apitest.cc b/chromium/extensions/browser/api/system_display/system_display_apitest.cc
index 2c0548ec7ce..bdca5c36caa 100644
--- a/chromium/extensions/browser/api/system_display/system_display_apitest.cc
+++ b/chromium/extensions/browser/api/system_display/system_display_apitest.cc
@@ -15,15 +15,14 @@
#include "extensions/browser/api_test_utils.h"
#include "extensions/common/api/system_display.h"
#include "extensions/shell/test/shell_apitest.h"
-#include "ui/gfx/display.h"
-#include "ui/gfx/display_observer.h"
-#include "ui/gfx/screen.h"
+#include "ui/display/display.h"
+#include "ui/display/screen.h"
namespace extensions {
using api::system_display::Bounds;
using api::system_display::DisplayUnitInfo;
-using gfx::Screen;
+using display::Screen;
class MockScreen : public Screen {
public:
@@ -31,7 +30,7 @@ class MockScreen : public Screen {
for (int i = 0; i < 4; i++) {
gfx::Rect bounds(0, 0, 1280, 720);
gfx::Rect work_area(0, 0, 960, 720);
- gfx::Display display(i, bounds);
+ display::Display display(i, bounds);
display.set_work_area(work_area);
displays_.push_back(display);
}
@@ -39,35 +38,36 @@ class MockScreen : public Screen {
~MockScreen() override {}
protected:
- // Overridden from gfx::Screen:
+ // Overridden from display::Screen:
gfx::Point GetCursorScreenPoint() override { return gfx::Point(); }
- gfx::NativeWindow GetWindowUnderCursor() override {
- return gfx::NativeWindow();
- }
+ bool IsWindowUnderCursor(gfx::NativeWindow window) override { return false; }
gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override {
return gfx::NativeWindow();
}
int GetNumDisplays() const override {
return static_cast<int>(displays_.size());
}
- std::vector<gfx::Display> GetAllDisplays() const override {
+ std::vector<display::Display> GetAllDisplays() const override {
return displays_;
}
- gfx::Display GetDisplayNearestWindow(gfx::NativeView window) const override {
- return gfx::Display(0);
+ display::Display GetDisplayNearestWindow(
+ gfx::NativeView window) const override {
+ return display::Display(0);
}
- gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override {
- return gfx::Display(0);
+ display::Display GetDisplayNearestPoint(
+ const gfx::Point& point) const override {
+ return display::Display(0);
}
- gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override {
- return gfx::Display(0);
+ display::Display GetDisplayMatching(
+ const gfx::Rect& match_rect) const override {
+ return display::Display(0);
}
- gfx::Display GetPrimaryDisplay() const override { return displays_[0]; }
- void AddObserver(gfx::DisplayObserver* observer) override {}
- void RemoveObserver(gfx::DisplayObserver* observer) override {}
+ display::Display GetPrimaryDisplay() const override { return displays_[0]; }
+ void AddObserver(display::DisplayObserver* observer) override {}
+ void RemoveObserver(display::DisplayObserver* observer) override {}
private:
- std::vector<gfx::Display> displays_;
+ std::vector<display::Display> displays_;
DISALLOW_COPY_AND_ASSIGN(MockScreen);
};
@@ -92,7 +92,7 @@ class MockDisplayInfoProvider : public DisplayInfoProvider {
unified_desktop_enabled_ = enable;
}
- scoped_ptr<base::DictionaryValue> GetSetInfoValue() {
+ std::unique_ptr<base::DictionaryValue> GetSetInfoValue() {
return std::move(set_info_value_);
}
@@ -104,7 +104,7 @@ class MockDisplayInfoProvider : public DisplayInfoProvider {
// Update the content of the |unit| obtained for |display| using
// platform specific method.
void UpdateDisplayUnitInfoForPlatform(
- const gfx::Display& display,
+ const display::Display& display,
extensions::api::system_display::DisplayUnitInfo* unit) override {
int64_t id = display.id();
unit->name = "DISPLAY NAME FOR " + base::Int64ToString(id);
@@ -124,7 +124,7 @@ class MockDisplayInfoProvider : public DisplayInfoProvider {
}
}
- scoped_ptr<base::DictionaryValue> set_info_value_;
+ std::unique_ptr<base::DictionaryValue> set_info_value_;
std::string set_info_display_id_;
bool unified_desktop_enabled_ = false;
@@ -140,14 +140,14 @@ class SystemDisplayApiTest : public ShellApiTest {
void SetUpOnMainThread() override {
ShellApiTest::SetUpOnMainThread();
- ANNOTATE_LEAKING_OBJECT_PTR(gfx::Screen::GetScreen());
- gfx::Screen::SetScreenInstance(screen_.get());
+ ANNOTATE_LEAKING_OBJECT_PTR(display::Screen::GetScreen());
+ display::Screen::SetScreenInstance(screen_.get());
DisplayInfoProvider::InitializeForTesting(provider_.get());
}
protected:
- scoped_ptr<MockDisplayInfoProvider> provider_;
- scoped_ptr<gfx::Screen> screen_;
+ std::unique_ptr<MockDisplayInfoProvider> provider_;
+ std::unique_ptr<display::Screen> screen_;
private:
DISALLOW_COPY_AND_ASSIGN(SystemDisplayApiTest);
@@ -169,24 +169,24 @@ IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplay) {
api_test_utils::RunFunctionAndReturnError(
set_info_function.get(), "[\"display_id\", {}]", browser_context()));
- scoped_ptr<base::DictionaryValue> set_info = provider_->GetSetInfoValue();
+ std::unique_ptr<base::DictionaryValue> set_info =
+ provider_->GetSetInfoValue();
EXPECT_FALSE(set_info);
}
#endif // !defined(OS_CHROMEOS)
#if defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplayNotKioskEnabled) {
- scoped_ptr<base::DictionaryValue> test_extension_value(
- api_test_utils::ParseDictionary(
- "{\n"
- " \"name\": \"Test\",\n"
- " \"version\": \"1.0\",\n"
- " \"app\": {\n"
- " \"background\": {\n"
- " \"scripts\": [\"background.js\"]\n"
- " }\n"
- " }\n"
- "}"));
+ std::unique_ptr<base::DictionaryValue> test_extension_value(
+ api_test_utils::ParseDictionary("{\n"
+ " \"name\": \"Test\",\n"
+ " \"version\": \"1.0\",\n"
+ " \"app\": {\n"
+ " \"background\": {\n"
+ " \"scripts\": [\"background.js\"]\n"
+ " }\n"
+ " }\n"
+ "}"));
scoped_refptr<Extension> test_extension(
api_test_utils::CreateExtension(test_extension_value.get()));
@@ -201,23 +201,23 @@ IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplayNotKioskEnabled) {
api_test_utils::RunFunctionAndReturnError(
set_info_function.get(), "[\"display_id\", {}]", browser_context()));
- scoped_ptr<base::DictionaryValue> set_info = provider_->GetSetInfoValue();
+ std::unique_ptr<base::DictionaryValue> set_info =
+ provider_->GetSetInfoValue();
EXPECT_FALSE(set_info);
}
IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplayKioskEnabled) {
- scoped_ptr<base::DictionaryValue> test_extension_value(
- api_test_utils::ParseDictionary(
- "{\n"
- " \"name\": \"Test\",\n"
- " \"version\": \"1.0\",\n"
- " \"app\": {\n"
- " \"background\": {\n"
- " \"scripts\": [\"background.js\"]\n"
- " }\n"
- " },\n"
- " \"kiosk_enabled\": true\n"
- "}"));
+ std::unique_ptr<base::DictionaryValue> test_extension_value(
+ api_test_utils::ParseDictionary("{\n"
+ " \"name\": \"Test\",\n"
+ " \"version\": \"1.0\",\n"
+ " \"app\": {\n"
+ " \"background\": {\n"
+ " \"scripts\": [\"background.js\"]\n"
+ " }\n"
+ " },\n"
+ " \"kiosk_enabled\": true\n"
+ "}"));
scoped_refptr<Extension> test_extension(
api_test_utils::CreateExtension(test_extension_value.get()));
@@ -239,7 +239,8 @@ IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplayKioskEnabled) {
"}]",
browser_context()));
- scoped_ptr<base::DictionaryValue> set_info = provider_->GetSetInfoValue();
+ std::unique_ptr<base::DictionaryValue> set_info =
+ provider_->GetSetInfoValue();
ASSERT_TRUE(set_info);
EXPECT_TRUE(api_test_utils::GetBoolean(set_info.get(), "isPrimary"));
EXPECT_EQ("mirroringId",
@@ -258,7 +259,7 @@ IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, SetDisplayKioskEnabled) {
}
IN_PROC_BROWSER_TEST_F(SystemDisplayApiTest, EnableUnifiedDesktop) {
- scoped_ptr<base::DictionaryValue> test_extension_value(
+ std::unique_ptr<base::DictionaryValue> test_extension_value(
api_test_utils::ParseDictionary("{\n"
" \"name\": \"Test\",\n"
" \"version\": \"1.0\",\n"
diff --git a/chromium/extensions/browser/api/system_info/system_info_api.cc b/chromium/extensions/browser/api/system_info/system_info_api.cc
index 42679d66afd..dbd98376150 100644
--- a/chromium/extensions/browser/api/system_info/system_info_api.cc
+++ b/chromium/extensions/browser/api/system_info/system_info_api.cc
@@ -6,13 +6,13 @@
#include <stdint.h>
+#include <memory>
#include <set>
#include <utility>
#include "base/bind.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/strings/string_util.h"
#include "base/values.h"
@@ -24,8 +24,8 @@
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/common/api/system_display.h"
#include "extensions/common/api/system_storage.h"
-#include "ui/gfx/display_observer.h"
-#include "ui/gfx/screen.h"
+#include "ui/display/display_observer.h"
+#include "ui/display/screen.h"
namespace extensions {
@@ -49,7 +49,7 @@ bool IsSystemStorageEvent(const std::string& event_name) {
// Event router for systemInfo API. It is a singleton instance shared by
// multiple profiles.
-class SystemInfoEventRouter : public gfx::DisplayObserver,
+class SystemInfoEventRouter : public display::DisplayObserver,
public storage_monitor::RemovableStorageObserver {
public:
static SystemInfoEventRouter* GetInstance();
@@ -62,10 +62,10 @@ class SystemInfoEventRouter : public gfx::DisplayObserver,
void RemoveEventListener(const std::string& event_name);
private:
- // gfx::DisplayObserver:
- void OnDisplayAdded(const gfx::Display& new_display) override;
- void OnDisplayRemoved(const gfx::Display& old_display) override;
- void OnDisplayMetricsChanged(const gfx::Display& display,
+ // display::DisplayObserver:
+ void OnDisplayAdded(const display::Display& new_display) override;
+ void OnDisplayRemoved(const display::Display& old_display) override;
+ void OnDisplayMetricsChanged(const display::Display& display,
uint32_t metrics) override;
// RemovableStorageObserver implementation.
@@ -78,7 +78,7 @@ class SystemInfoEventRouter : public gfx::DisplayObserver,
// processes cross multiple profiles.
void DispatchEvent(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args);
+ std::unique_ptr<base::ListValue> args);
// Called to dispatch the systemInfo.display.onDisplayChanged event.
void OnDisplayChanged();
@@ -119,7 +119,7 @@ void SystemInfoEventRouter::AddEventListener(const std::string& event_name) {
return;
if (IsDisplayChangedEvent(event_name)) {
- gfx::Screen* screen = gfx::Screen::GetScreen();
+ display::Screen* screen = display::Screen::GetScreen();
if (screen)
screen->AddObserver(this);
}
@@ -145,7 +145,7 @@ void SystemInfoEventRouter::RemoveEventListener(const std::string& event_name) {
}
if (IsDisplayChangedEvent(event_name)) {
- gfx::Screen* screen = gfx::Screen::GetScreen();
+ display::Screen* screen = display::Screen::GetScreen();
if (screen)
screen->RemoveObserver(this);
}
@@ -166,7 +166,7 @@ void SystemInfoEventRouter::OnRemovableStorageAttached(
const storage_monitor::StorageInfo& info) {
StorageUnitInfo unit;
systeminfo::BuildStorageUnitInfo(info, &unit);
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
args->Append(unit.ToValue().release());
DispatchEvent(events::SYSTEM_STORAGE_ON_ATTACHED,
system_storage::OnAttached::kEventName, std::move(args));
@@ -174,7 +174,7 @@ void SystemInfoEventRouter::OnRemovableStorageAttached(
void SystemInfoEventRouter::OnRemovableStorageDetached(
const storage_monitor::StorageInfo& info) {
- scoped_ptr<base::ListValue> args(new base::ListValue);
+ std::unique_ptr<base::ListValue> args(new base::ListValue);
std::string transient_id =
StorageMonitor::GetInstance()->GetTransientIdForDeviceId(
info.device_id());
@@ -184,21 +184,24 @@ void SystemInfoEventRouter::OnRemovableStorageDetached(
system_storage::OnDetached::kEventName, std::move(args));
}
-void SystemInfoEventRouter::OnDisplayAdded(const gfx::Display& new_display) {
+void SystemInfoEventRouter::OnDisplayAdded(
+ const display::Display& new_display) {
OnDisplayChanged();
}
-void SystemInfoEventRouter::OnDisplayRemoved(const gfx::Display& old_display) {
+void SystemInfoEventRouter::OnDisplayRemoved(
+ const display::Display& old_display) {
OnDisplayChanged();
}
-void SystemInfoEventRouter::OnDisplayMetricsChanged(const gfx::Display& display,
- uint32_t metrics) {
+void SystemInfoEventRouter::OnDisplayMetricsChanged(
+ const display::Display& display,
+ uint32_t metrics) {
OnDisplayChanged();
}
void SystemInfoEventRouter::OnDisplayChanged() {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
DispatchEvent(events::SYSTEM_DISPLAY_ON_DISPLAY_CHANGED,
system_display::OnDisplayChanged::kEventName, std::move(args));
}
@@ -206,7 +209,7 @@ void SystemInfoEventRouter::OnDisplayChanged() {
void SystemInfoEventRouter::DispatchEvent(
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args) {
+ std::unique_ptr<base::ListValue> args) {
ExtensionsBrowserClient::Get()->BroadcastEventToRenderers(
histogram_value, event_name, std::move(args));
}
diff --git a/chromium/extensions/browser/api/system_memory/system_memory_apitest.cc b/chromium/extensions/browser/api/system_memory/system_memory_apitest.cc
index 64be93c4f56..4c892c26991 100644
--- a/chromium/extensions/browser/api/system_memory/system_memory_apitest.cc
+++ b/chromium/extensions/browser/api/system_memory/system_memory_apitest.cc
@@ -35,7 +35,7 @@ class SystemMemoryApiTest : public ShellApiTest {
}
private:
- scoped_ptr<base::MessageLoop> message_loop_;
+ std::unique_ptr<base::MessageLoop> message_loop_;
};
IN_PROC_BROWSER_TEST_F(SystemMemoryApiTest, Memory) {
diff --git a/chromium/extensions/browser/api/system_network/system_network_api.cc b/chromium/extensions/browser/api/system_network/system_network_api.cc
index 0b196bd617e..ece1ebbe9ff 100644
--- a/chromium/extensions/browser/api/system_network/system_network_api.cc
+++ b/chromium/extensions/browser/api/system_network/system_network_api.cc
@@ -4,8 +4,6 @@
#include "extensions/browser/api/system_network/system_network_api.h"
-#include "net/base/ip_address_number.h"
-
namespace {
const char kNetworkListError[] = "Network lookup failed or unsupported";
} // namespace
diff --git a/chromium/extensions/browser/api/system_network/system_network_apitest.cc b/chromium/extensions/browser/api/system_network/system_network_apitest.cc
index f7c1964345b..047857e2120 100644
--- a/chromium/extensions/browser/api/system_network/system_network_apitest.cc
+++ b/chromium/extensions/browser/api/system_network/system_network_apitest.cc
@@ -34,7 +34,7 @@ IN_PROC_BROWSER_TEST_F(SystemNetworkApiTest, GetNetworkInterfaces) {
socket_function->set_extension(empty_extension.get());
socket_function->set_has_callback(true);
- scoped_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
+ std::unique_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
socket_function.get(), "[]", browser_context()));
ASSERT_EQ(base::Value::TYPE_LIST, result->GetType());
diff --git a/chromium/extensions/browser/api/system_storage/system_storage_api.cc b/chromium/extensions/browser/api/system_storage/system_storage_api.cc
index de460183ea3..cd20f4f6b4c 100644
--- a/chromium/extensions/browser/api/system_storage/system_storage_api.cc
+++ b/chromium/extensions/browser/api/system_storage/system_storage_api.cc
@@ -41,7 +41,8 @@ SystemStorageEjectDeviceFunction::~SystemStorageEjectDeviceFunction() {
bool SystemStorageEjectDeviceFunction::RunAsync() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- scoped_ptr<EjectDevice::Params> params(EjectDevice::Params::Create(*args_));
+ std::unique_ptr<EjectDevice::Params> params(
+ EjectDevice::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
StorageMonitor::GetInstance()->EnsureInitialized(
@@ -102,7 +103,7 @@ SystemStorageGetAvailableCapacityFunction::
bool SystemStorageGetAvailableCapacityFunction::RunAsync() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- scoped_ptr<GetAvailableCapacity::Params> params(
+ std::unique_ptr<GetAvailableCapacity::Params> params(
GetAvailableCapacity::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chromium/extensions/browser/api/system_storage/system_storage_apitest.cc b/chromium/extensions/browser/api/system_storage/system_storage_apitest.cc
index c57b311ec1d..3d0168cace7 100644
--- a/chromium/extensions/browser/api/system_storage/system_storage_apitest.cc
+++ b/chromium/extensions/browser/api/system_storage/system_storage_apitest.cc
@@ -102,7 +102,7 @@ class SystemStorageApiTest : public extensions::ShellApiTest {
}
private:
- scoped_ptr<base::MessageLoop> message_loop_;
+ std::unique_ptr<base::MessageLoop> message_loop_;
};
IN_PROC_BROWSER_TEST_F(SystemStorageApiTest, Storage) {
diff --git a/chromium/extensions/browser/api/usb/usb_api.cc b/chromium/extensions/browser/api/usb/usb_api.cc
index 49ad2c2ebcd..6c8328fa2a7 100644
--- a/chromium/extensions/browser/api/usb/usb_api.cc
+++ b/chromium/extensions/browser/api/usb/usb_api.cc
@@ -5,13 +5,13 @@
#include "extensions/browser/api/usb/usb_api.h"
#include <algorithm>
+#include <memory>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
#include "base/barrier_closure.h"
-#include "base/memory/scoped_ptr.h"
#include "device/core/device_client.h"
#include "device/usb/usb_descriptors.h"
#include "device/usb/usb_device_handle.h"
@@ -459,15 +459,21 @@ UsbTransferFunction::~UsbTransferFunction() {
void UsbTransferFunction::OnCompleted(UsbTransferStatus status,
scoped_refptr<net::IOBuffer> data,
size_t length) {
- scoped_ptr<base::DictionaryValue> transfer_info(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> transfer_info(
+ new base::DictionaryValue());
transfer_info->SetInteger(kResultCodeKey, status);
- transfer_info->Set(kDataKey, base::BinaryValue::CreateWithCopiedBuffer(
- data->data(), length));
+
+ if (data) {
+ transfer_info->Set(kDataKey, base::BinaryValue::CreateWithCopiedBuffer(
+ data->data(), length));
+ } else {
+ transfer_info->Set(kDataKey, new base::BinaryValue());
+ }
if (status == device::USB_TRANSFER_COMPLETED) {
Respond(OneArgument(std::move(transfer_info)));
} else {
- scoped_ptr<base::ListValue> error_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> error_args(new base::ListValue());
error_args->Append(std::move(transfer_info));
// Using ErrorWithArguments is discouraged but required to provide the
// detailed transfer info as the transfer may have partially succeeded.
@@ -483,7 +489,7 @@ UsbFindDevicesFunction::~UsbFindDevicesFunction() {
}
ExtensionFunction::ResponseAction UsbFindDevicesFunction::Run() {
- scoped_ptr<extensions::api::usb::FindDevices::Params> parameters =
+ std::unique_ptr<extensions::api::usb::FindDevices::Params> parameters =
FindDevices::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -549,7 +555,7 @@ UsbGetDevicesFunction::~UsbGetDevicesFunction() {
}
ExtensionFunction::ResponseAction UsbGetDevicesFunction::Run() {
- scoped_ptr<extensions::api::usb::GetDevices::Params> parameters =
+ std::unique_ptr<extensions::api::usb::GetDevices::Params> parameters =
GetDevices::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -579,7 +585,7 @@ ExtensionFunction::ResponseAction UsbGetDevicesFunction::Run() {
void UsbGetDevicesFunction::OnGetDevicesComplete(
const std::vector<scoped_refptr<UsbDevice>>& devices) {
- scoped_ptr<base::ListValue> result(new base::ListValue());
+ std::unique_ptr<base::ListValue> result(new base::ListValue());
UsbGuidMap* guid_map = UsbGuidMap::Get(browser_context());
for (const scoped_refptr<UsbDevice>& device : devices) {
if ((filters_.empty() || UsbDeviceFilter::MatchesAny(device, filters_)) &&
@@ -600,8 +606,8 @@ UsbGetUserSelectedDevicesFunction::~UsbGetUserSelectedDevicesFunction() {
}
ExtensionFunction::ResponseAction UsbGetUserSelectedDevicesFunction::Run() {
- scoped_ptr<extensions::api::usb::GetUserSelectedDevices::Params> parameters =
- GetUserSelectedDevices::Params::Create(*args_);
+ std::unique_ptr<extensions::api::usb::GetUserSelectedDevices::Params>
+ parameters = GetUserSelectedDevices::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
if (!user_gesture()) {
@@ -635,7 +641,7 @@ ExtensionFunction::ResponseAction UsbGetUserSelectedDevicesFunction::Run() {
void UsbGetUserSelectedDevicesFunction::OnDevicesChosen(
const std::vector<scoped_refptr<UsbDevice>>& devices) {
- scoped_ptr<base::ListValue> result(new base::ListValue());
+ std::unique_ptr<base::ListValue> result(new base::ListValue());
UsbGuidMap* guid_map = UsbGuidMap::Get(browser_context());
for (const auto& device : devices) {
Device api_device;
@@ -651,7 +657,7 @@ UsbGetConfigurationsFunction::UsbGetConfigurationsFunction() {}
UsbGetConfigurationsFunction::~UsbGetConfigurationsFunction() {}
ExtensionFunction::ResponseAction UsbGetConfigurationsFunction::Run() {
- scoped_ptr<extensions::api::usb::GetConfigurations::Params> parameters =
+ std::unique_ptr<extensions::api::usb::GetConfigurations::Params> parameters =
GetConfigurations::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -677,7 +683,7 @@ ExtensionFunction::ResponseAction UsbGetConfigurationsFunction::Run() {
return RespondNow(Error(kErrorNoDevice));
}
- scoped_ptr<base::ListValue> configs(new base::ListValue());
+ std::unique_ptr<base::ListValue> configs(new base::ListValue());
const UsbConfigDescriptor* active_config = device->GetActiveConfiguration();
for (const UsbConfigDescriptor& config : device->configurations()) {
ConfigDescriptor api_config = ConvertConfigDescriptor(config);
@@ -697,7 +703,7 @@ UsbRequestAccessFunction::~UsbRequestAccessFunction() {
}
ExtensionFunction::ResponseAction UsbRequestAccessFunction::Run() {
- scoped_ptr<extensions::api::usb::RequestAccess::Params> parameters =
+ std::unique_ptr<extensions::api::usb::RequestAccess::Params> parameters =
RequestAccess::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
return RespondNow(OneArgument(new base::FundamentalValue(true)));
@@ -710,7 +716,7 @@ UsbOpenDeviceFunction::~UsbOpenDeviceFunction() {
}
ExtensionFunction::ResponseAction UsbOpenDeviceFunction::Run() {
- scoped_ptr<extensions::api::usb::OpenDevice::Params> parameters =
+ std::unique_ptr<extensions::api::usb::OpenDevice::Params> parameters =
OpenDevice::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -764,7 +770,7 @@ UsbSetConfigurationFunction::~UsbSetConfigurationFunction() {
}
ExtensionFunction::ResponseAction UsbSetConfigurationFunction::Run() {
- scoped_ptr<extensions::api::usb::SetConfiguration::Params> parameters =
+ std::unique_ptr<extensions::api::usb::SetConfiguration::Params> parameters =
SetConfiguration::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -795,7 +801,7 @@ UsbGetConfigurationFunction::~UsbGetConfigurationFunction() {
}
ExtensionFunction::ResponseAction UsbGetConfigurationFunction::Run() {
- scoped_ptr<extensions::api::usb::GetConfiguration::Params> parameters =
+ std::unique_ptr<extensions::api::usb::GetConfiguration::Params> parameters =
GetConfiguration::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -823,7 +829,7 @@ UsbListInterfacesFunction::~UsbListInterfacesFunction() {
}
ExtensionFunction::ResponseAction UsbListInterfacesFunction::Run() {
- scoped_ptr<extensions::api::usb::ListInterfaces::Params> parameters =
+ std::unique_ptr<extensions::api::usb::ListInterfaces::Params> parameters =
ListInterfaces::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -838,7 +844,7 @@ ExtensionFunction::ResponseAction UsbListInterfacesFunction::Run() {
if (config_descriptor) {
ConfigDescriptor config = ConvertConfigDescriptor(*config_descriptor);
- scoped_ptr<base::ListValue> result(new base::ListValue);
+ std::unique_ptr<base::ListValue> result(new base::ListValue);
for (size_t i = 0; i < config.interfaces.size(); ++i) {
result->Append(config.interfaces[i].ToValue());
}
@@ -856,7 +862,7 @@ UsbCloseDeviceFunction::~UsbCloseDeviceFunction() {
}
ExtensionFunction::ResponseAction UsbCloseDeviceFunction::Run() {
- scoped_ptr<extensions::api::usb::CloseDevice::Params> parameters =
+ std::unique_ptr<extensions::api::usb::CloseDevice::Params> parameters =
CloseDevice::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -878,7 +884,7 @@ UsbClaimInterfaceFunction::~UsbClaimInterfaceFunction() {
}
ExtensionFunction::ResponseAction UsbClaimInterfaceFunction::Run() {
- scoped_ptr<extensions::api::usb::ClaimInterface::Params> parameters =
+ std::unique_ptr<extensions::api::usb::ClaimInterface::Params> parameters =
ClaimInterface::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -909,7 +915,7 @@ UsbReleaseInterfaceFunction::~UsbReleaseInterfaceFunction() {
}
ExtensionFunction::ResponseAction UsbReleaseInterfaceFunction::Run() {
- scoped_ptr<extensions::api::usb::ReleaseInterface::Params> parameters =
+ std::unique_ptr<extensions::api::usb::ReleaseInterface::Params> parameters =
ReleaseInterface::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -942,7 +948,7 @@ UsbSetInterfaceAlternateSettingFunction::
ExtensionFunction::ResponseAction
UsbSetInterfaceAlternateSettingFunction::Run() {
- scoped_ptr<extensions::api::usb::SetInterfaceAlternateSetting::Params>
+ std::unique_ptr<extensions::api::usb::SetInterfaceAlternateSetting::Params>
parameters = SetInterfaceAlternateSetting::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -973,7 +979,7 @@ UsbControlTransferFunction::~UsbControlTransferFunction() {
}
ExtensionFunction::ResponseAction UsbControlTransferFunction::Run() {
- scoped_ptr<extensions::api::usb::ControlTransfer::Params> parameters =
+ std::unique_ptr<extensions::api::usb::ControlTransfer::Params> parameters =
ControlTransfer::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -1030,7 +1036,7 @@ UsbBulkTransferFunction::~UsbBulkTransferFunction() {
}
ExtensionFunction::ResponseAction UsbBulkTransferFunction::Run() {
- scoped_ptr<extensions::api::usb::BulkTransfer::Params> parameters =
+ std::unique_ptr<extensions::api::usb::BulkTransfer::Params> parameters =
BulkTransfer::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -1076,7 +1082,7 @@ UsbInterruptTransferFunction::~UsbInterruptTransferFunction() {
}
ExtensionFunction::ResponseAction UsbInterruptTransferFunction::Run() {
- scoped_ptr<extensions::api::usb::InterruptTransfer::Params> parameters =
+ std::unique_ptr<extensions::api::usb::InterruptTransfer::Params> parameters =
InterruptTransfer::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
@@ -1122,8 +1128,8 @@ UsbIsochronousTransferFunction::~UsbIsochronousTransferFunction() {
}
ExtensionFunction::ResponseAction UsbIsochronousTransferFunction::Run() {
- scoped_ptr<extensions::api::usb::IsochronousTransfer::Params> parameters =
- IsochronousTransfer::Params::Create(*args_);
+ std::unique_ptr<extensions::api::usb::IsochronousTransfer::Params>
+ parameters = IsochronousTransfer::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(parameters.get());
scoped_refptr<UsbDeviceHandle> device_handle =
@@ -1186,7 +1192,7 @@ void UsbIsochronousTransferFunction::OnCompleted(
[](const size_t& a, const UsbDeviceHandle::IsochronousPacket& packet) {
return a + packet.transferred_length;
});
- scoped_ptr<char[]> buffer(new char[length]);
+ std::unique_ptr<char[]> buffer(new char[length]);
UsbTransferStatus status = device::USB_TRANSFER_COMPLETED;
size_t buffer_offset = 0;
@@ -1198,20 +1204,23 @@ void UsbIsochronousTransferFunction::OnCompleted(
status = packet.status;
}
- memcpy(&buffer[buffer_offset], data->data() + data_offset,
- packet.transferred_length);
+ if (data) {
+ memcpy(&buffer[buffer_offset], data->data() + data_offset,
+ packet.transferred_length);
+ }
buffer_offset += packet.transferred_length;
data_offset += packet.length;
}
- scoped_ptr<base::DictionaryValue> transfer_info(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> transfer_info(
+ new base::DictionaryValue());
transfer_info->SetInteger(kResultCodeKey, status);
transfer_info->Set(kDataKey,
new base::BinaryValue(std::move(buffer), length));
if (status == device::USB_TRANSFER_COMPLETED) {
Respond(OneArgument(std::move(transfer_info)));
} else {
- scoped_ptr<base::ListValue> error_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> error_args(new base::ListValue());
error_args->Append(std::move(transfer_info));
// Using ErrorWithArguments is discouraged but required to provide the
// detailed transfer info as the transfer may have partially succeeded.
@@ -1252,7 +1261,7 @@ void UsbResetDeviceFunction::OnComplete(bool success) {
}
ReleaseDeviceHandle(parameters_->handle);
- scoped_ptr<base::ListValue> error_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> error_args(new base::ListValue());
error_args->AppendBoolean(false);
// Using ErrorWithArguments is discouraged but required to maintain
// compatibility with existing applications.
diff --git a/chromium/extensions/browser/api/usb/usb_api.h b/chromium/extensions/browser/api/usb/usb_api.h
index 397b1ad78d0..0146e6b7c2f 100644
--- a/chromium/extensions/browser/api/usb/usb_api.h
+++ b/chromium/extensions/browser/api/usb/usb_api.h
@@ -8,12 +8,12 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "device/usb/usb_device.h"
#include "device/usb/usb_device_filter.h"
#include "device/usb/usb_device_handle.h"
@@ -83,7 +83,7 @@ class UsbFindDevicesFunction : public UIThreadExtensionFunction {
uint16_t vendor_id_;
uint16_t product_id_;
- scoped_ptr<base::ListValue> result_;
+ std::unique_ptr<base::ListValue> result_;
base::Closure barrier_;
DISALLOW_COPY_AND_ASSIGN(UsbFindDevicesFunction);
@@ -125,7 +125,7 @@ class UsbGetUserSelectedDevicesFunction : public UIThreadExtensionFunction {
void OnDevicesChosen(
const std::vector<scoped_refptr<device::UsbDevice>>& devices);
- scoped_ptr<DevicePermissionsPrompt> prompt_;
+ std::unique_ptr<DevicePermissionsPrompt> prompt_;
DISALLOW_COPY_AND_ASSIGN(UsbGetUserSelectedDevicesFunction);
};
@@ -369,7 +369,7 @@ class UsbResetDeviceFunction : public UsbConnectionFunction {
void OnComplete(bool success);
- scoped_ptr<extensions::api::usb::ResetDevice::Params> parameters_;
+ std::unique_ptr<extensions::api::usb::ResetDevice::Params> parameters_;
DISALLOW_COPY_AND_ASSIGN(UsbResetDeviceFunction);
};
diff --git a/chromium/extensions/browser/api/usb/usb_apitest.cc b/chromium/extensions/browser/api/usb/usb_apitest.cc
index 887ae2170fb..e9f41fc69d0 100644
--- a/chromium/extensions/browser/api/usb/usb_apitest.cc
+++ b/chromium/extensions/browser/api/usb/usb_apitest.cc
@@ -6,6 +6,7 @@
#include <numeric>
+#include "base/memory/ptr_util.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_utils.h"
@@ -45,8 +46,13 @@ ACTION_TEMPLATE(InvokeCallback,
ACTION_TEMPLATE(InvokeUsbTransferCallback,
HAS_1_TEMPLATE_PARAMS(int, k),
AND_1_VALUE_PARAMS(p1)) {
- net::IOBuffer* io_buffer = new net::IOBuffer(1);
- memset(io_buffer->data(), 0, 1); // Avoid uninitialized reads.
+ net::IOBuffer* io_buffer = nullptr;
+ size_t length = 0;
+ if (p1 != device::USB_TRANSFER_ERROR) {
+ length = 1;
+ io_buffer = new net::IOBuffer(length);
+ memset(io_buffer->data(), 0, length); // Avoid uninitialized reads.
+ }
::std::tr1::get<k>(args).Run(p1, io_buffer, 1);
}
@@ -112,9 +118,9 @@ class TestExtensionsAPIClient : public ShellExtensionsAPIClient {
public:
TestExtensionsAPIClient() : ShellExtensionsAPIClient() {}
- scoped_ptr<DevicePermissionsPrompt> CreateDevicePermissionsPrompt(
+ std::unique_ptr<DevicePermissionsPrompt> CreateDevicePermissionsPrompt(
content::WebContents* web_contents) const override {
- return make_scoped_ptr(new TestDevicePermissionsPrompt(web_contents));
+ return base::WrapUnique(new TestDevicePermissionsPrompt(web_contents));
}
};
@@ -141,7 +147,7 @@ class UsbApiTest : public ShellApiTest {
protected:
scoped_refptr<MockUsbDeviceHandle> mock_device_handle_;
scoped_refptr<MockUsbDevice> mock_device_;
- scoped_ptr<MockDeviceClient> device_client_;
+ std::unique_ptr<MockDeviceClient> device_client_;
};
} // namespace
diff --git a/chromium/extensions/browser/api/usb/usb_event_router.cc b/chromium/extensions/browser/api/usb/usb_event_router.cc
index 8c8acdd4a3d..31b550c1e09 100644
--- a/chromium/extensions/browser/api/usb/usb_event_router.cc
+++ b/chromium/extensions/browser/api/usb/usb_event_router.cc
@@ -105,7 +105,7 @@ void UsbEventRouter::DispatchEvent(const std::string& event_name,
usb::Device device_obj;
UsbGuidMap::Get(browser_context_)->GetApiDevice(device, &device_obj);
- scoped_ptr<Event> event;
+ std::unique_ptr<Event> event;
if (event_name == usb::OnDeviceAdded::kEventName) {
event.reset(new Event(events::USB_ON_DEVICE_ADDED,
usb::OnDeviceAdded::kEventName,
diff --git a/chromium/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.cc b/chromium/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.cc
index cb85a9f98f5..cad4f8b9a1d 100644
--- a/chromium/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.cc
+++ b/chromium/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.cc
@@ -136,7 +136,7 @@ bool VirtualKeyboardPrivateOpenSettingsFunction::RunSync() {
bool VirtualKeyboardPrivateSetModeFunction::RunSync() {
VirtualKeyboardDelegate* delegate = GetDelegate(this);
if (delegate) {
- scoped_ptr<SetMode::Params> params = SetMode::Params::Create(*args_);
+ std::unique_ptr<SetMode::Params> params = SetMode::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
if (!delegate->SetVirtualKeyboardMode(params->mode)) {
error_ = kVirtualKeyboardNotEnabled;
@@ -152,7 +152,7 @@ bool VirtualKeyboardPrivateSetModeFunction::RunSync() {
bool VirtualKeyboardPrivateSetKeyboardStateFunction::RunSync() {
VirtualKeyboardDelegate* delegate = GetDelegate(this);
if (delegate) {
- scoped_ptr<SetRequestedKeyboardState::Params> params =
+ std::unique_ptr<SetRequestedKeyboardState::Params> params =
SetRequestedKeyboardState::Params::Create(*args_);
EXTENSION_FUNCTION_VALIDATE(params);
if (!delegate->SetRequestedKeyboardState(params->state)) {
diff --git a/chromium/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h b/chromium/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h
index ebf0720feaf..929eb0aca11 100644
--- a/chromium/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h
+++ b/chromium/extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h
@@ -165,7 +165,7 @@ class VirtualKeyboardAPI : public BrowserContextKeyedAPI {
// Require accces to delegate while incognito or during login.
static const bool kServiceHasOwnInstanceInIncognito = true;
- scoped_ptr<VirtualKeyboardDelegate> delegate_;
+ std::unique_ptr<VirtualKeyboardDelegate> delegate_;
};
} // namespace extensions
diff --git a/chromium/extensions/browser/api/vpn_provider/vpn_provider_api.cc b/chromium/extensions/browser/api/vpn_provider/vpn_provider_api.cc
index 601835db076..5856f3deff5 100644
--- a/chromium/extensions/browser/api/vpn_provider/vpn_provider_api.cc
+++ b/chromium/extensions/browser/api/vpn_provider/vpn_provider_api.cc
@@ -4,11 +4,11 @@
#include "extensions/browser/api/vpn_provider/vpn_provider_api.h"
+#include <memory>
#include <vector>
#include "base/bind.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/values.h"
@@ -189,7 +189,7 @@ VpnProviderCreateConfigFunction::~VpnProviderCreateConfigFunction() {
}
ExtensionFunction::ResponseAction VpnProviderCreateConfigFunction::Run() {
- scoped_ptr<api_vpn::CreateConfig::Params> params(
+ std::unique_ptr<api_vpn::CreateConfig::Params> params(
api_vpn::CreateConfig::Params::Create(*args_));
if (!params) {
return RespondNow(Error("Invalid arguments."));
@@ -219,7 +219,7 @@ VpnProviderDestroyConfigFunction::~VpnProviderDestroyConfigFunction() {
}
ExtensionFunction::ResponseAction VpnProviderDestroyConfigFunction::Run() {
- scoped_ptr<api_vpn::DestroyConfig::Params> params(
+ std::unique_ptr<api_vpn::DestroyConfig::Params> params(
api_vpn::DestroyConfig::Params::Create(*args_));
if (!params) {
return RespondNow(Error("Invalid arguments."));
@@ -246,7 +246,7 @@ VpnProviderSetParametersFunction::~VpnProviderSetParametersFunction() {
}
ExtensionFunction::ResponseAction VpnProviderSetParametersFunction::Run() {
- scoped_ptr<api_vpn::SetParameters::Params> params(
+ std::unique_ptr<api_vpn::SetParameters::Params> params(
api_vpn::SetParameters::Params::Create(*args_));
if (!params) {
return RespondNow(Error("Invalid arguments."));
@@ -281,7 +281,7 @@ VpnProviderSendPacketFunction::~VpnProviderSendPacketFunction() {
}
ExtensionFunction::ResponseAction VpnProviderSendPacketFunction::Run() {
- scoped_ptr<api_vpn::SendPacket::Params> params(
+ std::unique_ptr<api_vpn::SendPacket::Params> params(
api_vpn::SendPacket::Params::Create(*args_));
if (!params) {
return RespondNow(Error("Invalid arguments."));
@@ -310,7 +310,7 @@ VpnProviderNotifyConnectionStateChangedFunction::
ExtensionFunction::ResponseAction
VpnProviderNotifyConnectionStateChangedFunction::Run() {
- scoped_ptr<api_vpn::NotifyConnectionStateChanged::Params> params(
+ std::unique_ptr<api_vpn::NotifyConnectionStateChanged::Params> params(
api_vpn::NotifyConnectionStateChanged::Params::Create(*args_));
if (!params) {
return RespondNow(Error("Invalid arguments."));
diff --git a/chromium/extensions/browser/api/vpn_provider/vpn_service.cc b/chromium/extensions/browser/api/vpn_provider/vpn_service.cc
index 09452d5290f..1f1b95bb251 100644
--- a/chromium/extensions/browser/api/vpn_provider/vpn_service.cc
+++ b/chromium/extensions/browser/api/vpn_provider/vpn_service.cc
@@ -99,7 +99,7 @@ void VpnService::VpnConfiguration::OnPacketReceived(
if (!vpn_service_) {
return;
}
- scoped_ptr<base::ListValue> event_args =
+ std::unique_ptr<base::ListValue> event_args =
api_vpn::OnPacketReceived::Create(data);
vpn_service_->SendSignalToExtension(
extension_id_, extensions::events::VPN_PROVIDER_ON_PACKET_RECEIVED,
@@ -124,8 +124,9 @@ void VpnService::VpnConfiguration::OnPlatformMessage(uint32_t message) {
// TODO(kaliamoorthi): Update the lower layers to get the error message and
// pass in the error instead of std::string().
- scoped_ptr<base::ListValue> event_args = api_vpn::OnPlatformMessage::Create(
- configuration_name_, platform_message, std::string());
+ std::unique_ptr<base::ListValue> event_args =
+ api_vpn::OnPlatformMessage::Create(configuration_name_, platform_message,
+ std::string());
vpn_service_->SendSignalToExtension(
extension_id_, extensions::events::VPN_PROVIDER_ON_PLATFORM_MESSAGE,
@@ -225,7 +226,7 @@ void VpnService::OnConfigurationRemoved(const std::string& service_path,
VpnConfiguration* configuration =
service_path_to_configuration_map_[service_path];
- scoped_ptr<base::ListValue> event_args =
+ std::unique_ptr<base::ListValue> event_args =
api_vpn::OnConfigRemoved::Create(configuration->configuration_name());
SendSignalToExtension(configuration->extension_id(),
extensions::events::VPN_PROVIDER_ON_CONFIG_REMOVED,
@@ -282,8 +283,7 @@ void VpnService::OnGetPropertiesSuccess(
void VpnService::OnGetPropertiesFailure(
const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data) {
-}
+ std::unique_ptr<base::DictionaryValue> error_data) {}
void VpnService::NetworkListChanged() {
NetworkStateHandler::NetworkStateList network_list;
@@ -512,7 +512,7 @@ void VpnService::OnCreateConfigurationFailure(
const VpnService::FailureCallback& callback,
VpnConfiguration* configuration,
const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data) {
+ std::unique_ptr<base::DictionaryValue> error_data) {
DestroyConfigurationInternal(configuration);
callback.Run(error_name, std::string());
}
@@ -525,7 +525,7 @@ void VpnService::OnRemoveConfigurationSuccess(
void VpnService::OnRemoveConfigurationFailure(
const VpnService::FailureCallback& callback,
const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data) {
+ std::unique_ptr<base::DictionaryValue> error_data) {
callback.Run(error_name, std::string());
}
@@ -533,8 +533,8 @@ void VpnService::SendSignalToExtension(
const std::string& extension_id,
extensions::events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) {
- scoped_ptr<extensions::Event> event(new extensions::Event(
+ std::unique_ptr<base::ListValue> event_args) {
+ std::unique_ptr<extensions::Event> event(new extensions::Event(
histogram_value, event_name, std::move(event_args), browser_context_));
event_router_->DispatchEventToExtension(extension_id, std::move(event));
diff --git a/chromium/extensions/browser/api/vpn_provider/vpn_service.h b/chromium/extensions/browser/api/vpn_provider/vpn_service.h
index 6e515c9b41f..b439a3e255e 100644
--- a/chromium/extensions/browser/api/vpn_provider/vpn_service.h
+++ b/chromium/extensions/browser/api/vpn_provider/vpn_service.h
@@ -6,12 +6,12 @@
#define EXTENSIONS_BROWSER_API_VPN_PROVIDER_VPN_SERVICE_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chromeos/network/network_configuration_observer.h"
#include "chromeos/network/network_state_handler_observer.h"
@@ -178,7 +178,7 @@ class VpnService : public KeyedService,
const FailureCallback& callback,
VpnConfiguration* configuration,
const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data);
+ std::unique_ptr<base::DictionaryValue> error_data);
// Callback used to indicate that removing a configuration succeeded.
void OnRemoveConfigurationSuccess(const SuccessCallback& callback);
@@ -187,15 +187,16 @@ class VpnService : public KeyedService,
void OnRemoveConfigurationFailure(
const FailureCallback& callback,
const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data);
+ std::unique_ptr<base::DictionaryValue> error_data);
// Callback used to indicate that GetProperties was successful.
void OnGetPropertiesSuccess(const std::string& service_path,
const base::DictionaryValue& dictionary);
// Callback used to indicate that GetProperties failed.
- void OnGetPropertiesFailure(const std::string& error_name,
- scoped_ptr<base::DictionaryValue> error_data);
+ void OnGetPropertiesFailure(
+ const std::string& error_name,
+ std::unique_ptr<base::DictionaryValue> error_data);
// Creates and adds the configuration to the internal store.
VpnConfiguration* CreateConfigurationInternal(
@@ -216,7 +217,7 @@ class VpnService : public KeyedService,
void SendSignalToExtension(const std::string& extension_id,
extensions::events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args);
+ std::unique_ptr<base::ListValue> event_args);
// Destroy configurations belonging to the extension.
void DestroyConfigurationsForExtension(
diff --git a/chromium/extensions/browser/api/web_contents_capture_client.cc b/chromium/extensions/browser/api/web_contents_capture_client.cc
index 6dff09e7d56..97b8436f495 100644
--- a/chromium/extensions/browser/api/web_contents_capture_client.cc
+++ b/chromium/extensions/browser/api/web_contents_capture_client.cc
@@ -11,11 +11,11 @@
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_function.h"
#include "extensions/common/constants.h"
+#include "ui/display/display.h"
+#include "ui/display/screen.h"
#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/codec/png_codec.h"
-#include "ui/gfx/display.h"
#include "ui/gfx/geometry/size_conversions.h"
-#include "ui/gfx/screen.h"
using content::RenderWidgetHost;
using content::RenderWidgetHostView;
@@ -64,7 +64,7 @@ bool WebContentsCaptureClient::CaptureAsync(
const gfx::Size view_size = view->GetViewBounds().size();
gfx::Size bitmap_size = view_size;
const gfx::NativeView native_view = view->GetNativeView();
- gfx::Screen* const screen = gfx::Screen::GetScreen();
+ display::Screen* const screen = display::Screen::GetScreen();
const float scale =
screen->GetDisplayNearestWindow(native_view).device_scale_factor();
if (scale > 1.0f)
diff --git a/chromium/extensions/browser/api/web_request/form_data_parser.cc b/chromium/extensions/browser/api/web_request/form_data_parser.cc
index f81c1099564..6966e431b82 100644
--- a/chromium/extensions/browser/api/web_request/form_data_parser.cc
+++ b/chromium/extensions/browser/api/web_request/form_data_parser.cc
@@ -296,7 +296,7 @@ FormDataParser::Result::~Result() {}
FormDataParser::~FormDataParser() {}
// static
-scoped_ptr<FormDataParser> FormDataParser::Create(
+std::unique_ptr<FormDataParser> FormDataParser::Create(
const net::URLRequest& request) {
std::string value;
const bool found = request.extra_request_headers().GetHeader(
@@ -305,7 +305,7 @@ scoped_ptr<FormDataParser> FormDataParser::Create(
}
// static
-scoped_ptr<FormDataParser> FormDataParser::CreateFromContentTypeHeader(
+std::unique_ptr<FormDataParser> FormDataParser::CreateFromContentTypeHeader(
const std::string* content_type_header) {
enum ParserChoice {URL_ENCODED, MULTIPART, ERROR_CHOICE};
ParserChoice choice = ERROR_CHOICE;
@@ -326,7 +326,7 @@ scoped_ptr<FormDataParser> FormDataParser::CreateFromContentTypeHeader(
size_t offset = content_type_header->find(kBoundaryString);
if (offset == std::string::npos) {
// Malformed header.
- return scoped_ptr<FormDataParser>();
+ return std::unique_ptr<FormDataParser>();
}
offset += sizeof(kBoundaryString) - 1;
boundary = content_type_header->substr(
@@ -339,14 +339,15 @@ scoped_ptr<FormDataParser> FormDataParser::CreateFromContentTypeHeader(
switch (choice) {
case URL_ENCODED:
- return scoped_ptr<FormDataParser>(new FormDataParserUrlEncoded());
+ return std::unique_ptr<FormDataParser>(new FormDataParserUrlEncoded());
case MULTIPART:
- return scoped_ptr<FormDataParser>(new FormDataParserMultipart(boundary));
+ return std::unique_ptr<FormDataParser>(
+ new FormDataParserMultipart(boundary));
case ERROR_CHOICE:
- return scoped_ptr<FormDataParser>();
+ return std::unique_ptr<FormDataParser>();
}
NOTREACHED(); // Some compilers do not believe this is unreachable.
- return scoped_ptr<FormDataParser>();
+ return std::unique_ptr<FormDataParser>();
}
FormDataParser::FormDataParser() {}
diff --git a/chromium/extensions/browser/api/web_request/form_data_parser.h b/chromium/extensions/browser/api/web_request/form_data_parser.h
index 0c49caa0138..7487a2439d5 100644
--- a/chromium/extensions/browser/api/web_request/form_data_parser.h
+++ b/chromium/extensions/browser/api/web_request/form_data_parser.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_FORM_DATA_PARSER_H_
#define EXTENSIONS_BROWSER_API_WEB_REQUEST_FORM_DATA_PARSER_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
// Cannot forward declare StringPiece because it is a typedef.
#include "base/strings/string_piece.h"
@@ -44,12 +44,12 @@ class FormDataParser {
// Creates a correct parser instance based on the |request|. Returns NULL
// on failure.
- static scoped_ptr<FormDataParser> Create(const net::URLRequest& request);
+ static std::unique_ptr<FormDataParser> Create(const net::URLRequest& request);
// Creates a correct parser instance based on |content_type_header|, the
// "Content-Type" request header value. If |content_type_header| is NULL, it
// defaults to "application/x-www-form-urlencoded". Returns NULL on failure.
- static scoped_ptr<FormDataParser> CreateFromContentTypeHeader(
+ static std::unique_ptr<FormDataParser> CreateFromContentTypeHeader(
const std::string* content_type_header);
// Returns true if there was some data, it was well formed and all was read.
diff --git a/chromium/extensions/browser/api/web_request/form_data_parser_unittest.cc b/chromium/extensions/browser/api/web_request/form_data_parser_unittest.cc
index 6f700c7ae6d..8a5648f626e 100644
--- a/chromium/extensions/browser/api/web_request/form_data_parser_unittest.cc
+++ b/chromium/extensions/browser/api/web_request/form_data_parser_unittest.cc
@@ -16,11 +16,12 @@ namespace {
// Attempts to create a parser corresponding to the |content_type_header|.
// On success, returns the parser.
-scoped_ptr<FormDataParser> InitParser(const std::string& content_type_header) {
- scoped_ptr<FormDataParser> parser(
+std::unique_ptr<FormDataParser> InitParser(
+ const std::string& content_type_header) {
+ std::unique_ptr<FormDataParser> parser(
FormDataParser::CreateFromContentTypeHeader(&content_type_header));
if (parser.get() == NULL)
- return scoped_ptr<FormDataParser>();
+ return std::unique_ptr<FormDataParser>();
return parser;
}
@@ -33,7 +34,7 @@ bool RunParser(const std::string& content_type_header,
std::vector<std::string>* output) {
DCHECK(output);
output->clear();
- scoped_ptr<FormDataParser> parser(InitParser(content_type_header));
+ std::unique_ptr<FormDataParser> parser(InitParser(content_type_header));
if (!parser.get())
return false;
FormDataParser::Result result;
@@ -54,7 +55,7 @@ bool RunParser(const std::string& content_type_header,
bool CheckParserFails(const std::string& content_type_header,
const std::vector<const base::StringPiece*>& bytes) {
std::vector<std::string> output;
- scoped_ptr<FormDataParser> parser(InitParser(content_type_header));
+ std::unique_ptr<FormDataParser> parser(InitParser(content_type_header));
if (!parser.get())
return false;
FormDataParser::Result result;
diff --git a/chromium/extensions/browser/api/web_request/upload_data_presenter.cc b/chromium/extensions/browser/api/web_request/upload_data_presenter.cc
index bdd80d69081..48a88c7d32e 100644
--- a/chromium/extensions/browser/api/web_request/upload_data_presenter.cc
+++ b/chromium/extensions/browser/api/web_request/upload_data_presenter.cc
@@ -81,7 +81,7 @@ bool RawDataPresenter::Succeeded() {
return success_;
}
-scoped_ptr<base::Value> RawDataPresenter::Result() {
+std::unique_ptr<base::Value> RawDataPresenter::Result() {
if (!success_)
return nullptr;
@@ -136,7 +136,7 @@ bool ParsedDataPresenter::Succeeded() {
return success_;
}
-scoped_ptr<base::Value> ParsedDataPresenter::Result() {
+std::unique_ptr<base::Value> ParsedDataPresenter::Result() {
if (!success_)
return nullptr;
@@ -144,9 +144,10 @@ scoped_ptr<base::Value> ParsedDataPresenter::Result() {
}
// static
-scoped_ptr<ParsedDataPresenter> ParsedDataPresenter::CreateForTests() {
+std::unique_ptr<ParsedDataPresenter> ParsedDataPresenter::CreateForTests() {
const std::string form_type("application/x-www-form-urlencoded");
- return scoped_ptr<ParsedDataPresenter>(new ParsedDataPresenter(form_type));
+ return std::unique_ptr<ParsedDataPresenter>(
+ new ParsedDataPresenter(form_type));
}
ParsedDataPresenter::ParsedDataPresenter(const std::string& form_type)
diff --git a/chromium/extensions/browser/api/web_request/upload_data_presenter.h b/chromium/extensions/browser/api/web_request/upload_data_presenter.h
index 90e3d44796b..05630f3dcbc 100644
--- a/chromium/extensions/browser/api/web_request/upload_data_presenter.h
+++ b/chromium/extensions/browser/api/web_request/upload_data_presenter.h
@@ -7,12 +7,12 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
namespace base {
class DictionaryValue;
@@ -57,7 +57,7 @@ class UploadDataPresenter {
virtual ~UploadDataPresenter();
virtual void FeedNext(const net::UploadElementReader& reader) = 0;
virtual bool Succeeded() = 0;
- virtual scoped_ptr<base::Value> Result() = 0;
+ virtual std::unique_ptr<base::Value> Result() = 0;
protected:
UploadDataPresenter() {}
@@ -77,7 +77,7 @@ class RawDataPresenter : public UploadDataPresenter {
// Implementation of UploadDataPresenter.
void FeedNext(const net::UploadElementReader& reader) override;
bool Succeeded() override;
- scoped_ptr<base::Value> Result() override;
+ std::unique_ptr<base::Value> Result() override;
private:
void FeedNextBytes(const char* bytes, size_t size);
@@ -85,7 +85,7 @@ class RawDataPresenter : public UploadDataPresenter {
FRIEND_TEST_ALL_PREFIXES(WebRequestUploadDataPresenterTest, RawData);
bool success_;
- scoped_ptr<base::ListValue> list_;
+ std::unique_ptr<base::ListValue> list_;
DISALLOW_COPY_AND_ASSIGN(RawDataPresenter);
};
@@ -107,12 +107,12 @@ class ParsedDataPresenter : public UploadDataPresenter {
// Implementation of UploadDataPresenter.
void FeedNext(const net::UploadElementReader& reader) override;
bool Succeeded() override;
- scoped_ptr<base::Value> Result() override;
+ std::unique_ptr<base::Value> Result() override;
// Allows to create ParsedDataPresenter without the URLRequest. Uses the
// parser for "application/x-www-form-urlencoded" form encoding. Only use this
// in tests.
- static scoped_ptr<ParsedDataPresenter> CreateForTests();
+ static std::unique_ptr<ParsedDataPresenter> CreateForTests();
private:
// This constructor is used in CreateForTests.
@@ -120,9 +120,9 @@ class ParsedDataPresenter : public UploadDataPresenter {
// Clears resources and the success flag.
void Abort();
- scoped_ptr<FormDataParser> parser_;
+ std::unique_ptr<FormDataParser> parser_;
bool success_;
- scoped_ptr<base::DictionaryValue> dictionary_;
+ std::unique_ptr<base::DictionaryValue> dictionary_;
DISALLOW_COPY_AND_ASSIGN(ParsedDataPresenter);
};
diff --git a/chromium/extensions/browser/api/web_request/upload_data_presenter_unittest.cc b/chromium/extensions/browser/api/web_request/upload_data_presenter_unittest.cc
index f28619dfbd3..50b648680ca 100644
--- a/chromium/extensions/browser/api/web_request/upload_data_presenter_unittest.cc
+++ b/chromium/extensions/browser/api/web_request/upload_data_presenter_unittest.cc
@@ -23,18 +23,18 @@ TEST(WebRequestUploadDataPresenterTest, ParsedData) {
net::UploadBytesElementReader element(block, sizeof(block) - 1);
// Expected output.
- scoped_ptr<base::ListValue> values(new base::ListValue);
+ std::unique_ptr<base::ListValue> values(new base::ListValue);
values->Append(new base::StringValue("value"));
base::DictionaryValue expected_form;
expected_form.SetWithoutPathExpansion("key.with.dots", values.release());
// Real output.
- scoped_ptr<ParsedDataPresenter> parsed_data_presenter(
+ std::unique_ptr<ParsedDataPresenter> parsed_data_presenter(
ParsedDataPresenter::CreateForTests());
ASSERT_TRUE(parsed_data_presenter.get() != NULL);
parsed_data_presenter->FeedNext(element);
EXPECT_TRUE(parsed_data_presenter->Succeeded());
- scoped_ptr<base::Value> result = parsed_data_presenter->Result();
+ std::unique_ptr<base::Value> result = parsed_data_presenter->Result();
ASSERT_TRUE(result.get() != NULL);
EXPECT_TRUE(result->Equals(&expected_form));
@@ -49,13 +49,13 @@ TEST(WebRequestUploadDataPresenterTest, RawData) {
const size_t block2_size = sizeof(block2) - 1;
// Expected output.
- scoped_ptr<base::BinaryValue> expected_a(
+ std::unique_ptr<base::BinaryValue> expected_a(
base::BinaryValue::CreateWithCopiedBuffer(block1, block1_size));
ASSERT_TRUE(expected_a.get() != NULL);
- scoped_ptr<base::StringValue> expected_b(
+ std::unique_ptr<base::StringValue> expected_b(
new base::StringValue(kFilename));
ASSERT_TRUE(expected_b.get() != NULL);
- scoped_ptr<base::BinaryValue> expected_c(
+ std::unique_ptr<base::BinaryValue> expected_c(
base::BinaryValue::CreateWithCopiedBuffer(block2, block2_size));
ASSERT_TRUE(expected_c.get() != NULL);
@@ -73,7 +73,7 @@ TEST(WebRequestUploadDataPresenterTest, RawData) {
raw_presenter.FeedNextFile(kFilename);
raw_presenter.FeedNextBytes(block2, block2_size);
EXPECT_TRUE(raw_presenter.Succeeded());
- scoped_ptr<base::Value> result = raw_presenter.Result();
+ std::unique_ptr<base::Value> result = raw_presenter.Result();
ASSERT_TRUE(result.get() != NULL);
EXPECT_TRUE(result->Equals(&expected_list));
diff --git a/chromium/extensions/browser/api/web_request/web_request_api.cc b/chromium/extensions/browser/api/web_request/web_request_api.cc
index d8da8ecdc05..34922a281af 100644
--- a/chromium/extensions/browser/api/web_request/web_request_api.cc
+++ b/chromium/extensions/browser/api/web_request/web_request_api.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <algorithm>
+#include <memory>
#include <utility>
#include <vector>
@@ -15,7 +16,6 @@
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -234,7 +234,7 @@ void SendOnMessageEventOnUI(
const std::string& extension_id,
bool is_web_view_guest,
const WebViewRendererState::WebViewInfo& web_view_info,
- scoped_ptr<WebRequestEventDetails> event_details) {
+ std::unique_ptr<WebRequestEventDetails> event_details) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::BrowserContext* browser_context =
@@ -242,7 +242,7 @@ void SendOnMessageEventOnUI(
if (!ExtensionsBrowserClient::Get()->IsValidContext(browser_context))
return;
- scoped_ptr<base::ListValue> event_args(new base::ListValue);
+ std::unique_ptr<base::ListValue> event_args(new base::ListValue);
event_details->DetermineFrameIdOnUI();
event_args->Append(event_details->GetAndClearDict());
@@ -264,7 +264,7 @@ void SendOnMessageEventOnUI(
event_name = declarative_keys::kOnMessage;
}
- scoped_ptr<Event> event(new Event(
+ std::unique_ptr<Event> event(new Event(
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));
@@ -594,11 +594,11 @@ void ExtensionWebRequestEventRouter::RegisterRulesRegistry(
rules_registries_.erase(key);
}
-scoped_ptr<WebRequestEventDetails>
+std::unique_ptr<WebRequestEventDetails>
ExtensionWebRequestEventRouter::CreateEventDetails(
const net::URLRequest* request,
int extra_info_spec) {
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
new WebRequestEventDetails(request, extra_info_spec));
int render_frame_id = -1;
@@ -646,7 +646,7 @@ int ExtensionWebRequestEventRouter::OnBeforeRequest(
web_request::OnBeforeRequest::kEventName, request, &extra_info_spec);
if (!listeners.empty() &&
!GetAndSetSignaled(request->identifier(), kOnBeforeRequest)) {
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
CreateEventDetails(request, extra_info_spec));
event_details->SetRequestBody(request);
@@ -695,7 +695,7 @@ int ExtensionWebRequestEventRouter::OnBeforeSendHeaders(
request, &extra_info_spec);
if (!listeners.empty() &&
!GetAndSetSignaled(request->identifier(), kOnBeforeSendHeaders)) {
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
CreateEventDetails(request, extra_info_spec));
event_details->SetRequestHeaders(*headers);
@@ -743,7 +743,7 @@ void ExtensionWebRequestEventRouter::OnSendHeaders(
if (listeners.empty())
return;
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
CreateEventDetails(request, extra_info_spec));
event_details->SetRequestHeaders(headers);
@@ -774,7 +774,7 @@ int ExtensionWebRequestEventRouter::OnHeadersReceived(
if (!listeners.empty() &&
!GetAndSetSignaled(request->identifier(), kOnHeadersReceived)) {
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
CreateEventDetails(request, extra_info_spec));
event_details->SetResponseHeaders(request, original_response_headers);
@@ -826,7 +826,7 @@ ExtensionWebRequestEventRouter::OnAuthRequired(
if (listeners.empty())
return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION;
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
CreateEventDetails(request, extra_info_spec));
event_details->SetResponseHeaders(request, request->response_headers());
event_details->SetAuthInfo(auth_info);
@@ -868,7 +868,7 @@ void ExtensionWebRequestEventRouter::OnBeforeRedirect(
if (listeners.empty())
return;
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
CreateEventDetails(request, extra_info_spec));
event_details->SetResponseHeaders(request, request->response_headers());
event_details->SetResponseSource(request);
@@ -895,7 +895,7 @@ void ExtensionWebRequestEventRouter::OnResponseStarted(
if (listeners.empty())
return;
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
CreateEventDetails(request, extra_info_spec));
event_details->SetResponseHeaders(request, request->response_headers());
event_details->SetResponseSource(request);
@@ -933,7 +933,7 @@ void ExtensionWebRequestEventRouter::OnCompleted(
if (listeners.empty())
return;
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
CreateEventDetails(request, extra_info_spec));
event_details->SetResponseHeaders(request, request->response_headers());
event_details->SetResponseSource(request);
@@ -973,7 +973,7 @@ void ExtensionWebRequestEventRouter::OnErrorOccurred(
if (listeners.empty())
return;
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
CreateEventDetails(request, extra_info_spec));
if (started)
event_details->SetResponseSource(request);
@@ -1005,12 +1005,12 @@ bool ExtensionWebRequestEventRouter::DispatchEvent(
void* browser_context,
net::URLRequest* request,
const std::vector<const EventListener*>& listeners,
- scoped_ptr<WebRequestEventDetails> event_details) {
+ std::unique_ptr<WebRequestEventDetails> event_details) {
// TODO(mpcomplete): Consider consolidating common (extension_id,json_args)
// pairs into a single message sent to a list of sub_event_names.
int num_handlers_blocking = 0;
- scoped_ptr<std::vector<EventListener>> listeners_to_dispatch(
+ std::unique_ptr<std::vector<EventListener>> listeners_to_dispatch(
new std::vector<EventListener>());
listeners_to_dispatch->reserve(listeners.size());
for (const EventListener* listener : listeners) {
@@ -1050,8 +1050,8 @@ bool ExtensionWebRequestEventRouter::DispatchEvent(
void ExtensionWebRequestEventRouter::DispatchEventToListeners(
void* browser_context,
- scoped_ptr<std::vector<EventListener>> listeners,
- scoped_ptr<WebRequestEventDetails> event_details) {
+ std::unique_ptr<std::vector<EventListener>> listeners,
+ std::unique_ptr<WebRequestEventDetails> event_details) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(listeners.get());
DCHECK_GT(listeners->size(), 0UL);
@@ -1084,7 +1084,7 @@ void ExtensionWebRequestEventRouter::DispatchEventToListeners(
continue;
// Filter out the optional keys that this listener didn't request.
- scoped_ptr<base::ListValue> args_filtered(new base::ListValue);
+ std::unique_ptr<base::ListValue> args_filtered(new base::ListValue);
args_filtered->Append(
event_details->GetFilteredDict(listener->extra_info_spec));
@@ -1182,6 +1182,16 @@ void ExtensionWebRequestEventRouter::RemoveEventListener(
if (it == event_listeners.end())
return;
+#if defined(OS_WIN)
+ // Debugging https://crbug.com/589735
+ // Please post crash reports at the following lines to the above issue.
+ unsigned event_listener_count = event_listeners.count(listener);
+ CHECK_GE(event_listener_count, 0u);
+ CHECK_GE(event_listener_count, 1u);
+ CHECK_LE(event_listener_count, 2u);
+ CHECK_EQ(event_listener_count, 1u);
+ CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+#endif // OS_WIN
CHECK_EQ(event_listeners.count(listener), 1u) <<
"extension=" << extension_id << " event=" << event_name;
@@ -1492,7 +1502,7 @@ helpers::EventResponseDelta* CalculateDelta(
}
base::Value* SerializeResponseHeaders(const helpers::ResponseHeaders& headers) {
- scoped_ptr<base::ListValue> serialized_headers(new base::ListValue());
+ std::unique_ptr<base::ListValue> serialized_headers(new base::ListValue());
for (const auto& it : headers) {
serialized_headers->Append(
helpers::CreateHeaderDictionary(it.first, it.second));
@@ -1507,9 +1517,9 @@ base::Value* SerializeResponseHeaders(const helpers::ResponseHeaders& headers) {
template <typename CookieType>
base::ListValue* SummarizeCookieModifications(
const std::vector<linked_ptr<CookieType>>& modifications) {
- scoped_ptr<base::ListValue> cookie_modifications(new base::ListValue());
+ std::unique_ptr<base::ListValue> cookie_modifications(new base::ListValue());
for (const auto& it : modifications) {
- scoped_ptr<base::DictionaryValue> summary(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> summary(new base::DictionaryValue());
const CookieType& mod = *(it.get());
switch (mod.type) {
case helpers::ADD:
@@ -1552,16 +1562,16 @@ base::ListValue* SummarizeCookieModifications(
// Converts an EventResponseDelta object to a dictionary value suitable for the
// activity log.
-scoped_ptr<base::DictionaryValue> SummarizeResponseDelta(
+std::unique_ptr<base::DictionaryValue> SummarizeResponseDelta(
const std::string& event_name,
const helpers::EventResponseDelta& delta) {
- scoped_ptr<base::DictionaryValue> details(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue());
if (delta.cancel)
details->SetBoolean(activity_log::kCancelKey, true);
if (!delta.new_url.is_empty())
details->SetString(activity_log::kNewUrlKey, delta.new_url.spec());
- scoped_ptr<base::ListValue> modified_headers(new base::ListValue());
+ std::unique_ptr<base::ListValue> modified_headers(new base::ListValue());
net::HttpRequestHeaders::Iterator iter(delta.modified_request_headers);
while (iter.GetNext()) {
modified_headers->Append(
@@ -1572,7 +1582,7 @@ scoped_ptr<base::DictionaryValue> SummarizeResponseDelta(
modified_headers.release());
}
- scoped_ptr<base::ListValue> deleted_headers(new base::ListValue());
+ std::unique_ptr<base::ListValue> deleted_headers(new base::ListValue());
deleted_headers->AppendStrings(delta.deleted_request_headers);
if (!deleted_headers->empty()) {
details->Set(activity_log::kDeletedRequestHeadersKey,
@@ -1610,7 +1620,7 @@ void ExtensionWebRequestEventRouter::LogExtensionActivity(
const std::string& extension_id,
const GURL& url,
const std::string& api_call,
- scoped_ptr<base::DictionaryValue> details) {
+ std::unique_ptr<base::DictionaryValue> details) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(
BrowserThread::UI,
@@ -1638,7 +1648,7 @@ void ExtensionWebRequestEventRouter::DecrementBlockCount(
const std::string& event_name,
uint64_t request_id,
EventResponse* response) {
- scoped_ptr<EventResponse> response_scoped(response);
+ std::unique_ptr<EventResponse> response_scoped(response);
// It's possible that this request was deleted, or cancelled by a previous
// event handler. If so, ignore this response.
@@ -1704,7 +1714,7 @@ void ExtensionWebRequestEventRouter::SendMessages(
for (const auto& delta : deltas) {
const std::set<std::string>& messages = delta->messages_to_extension;
for (const std::string& message : messages) {
- scoped_ptr<WebRequestEventDetails> event_details(
+ std::unique_ptr<WebRequestEventDetails> event_details(
CreateEventDetails(blocked_request.request, /* extra_info_spec */ 0));
WebViewRendererState::WebViewInfo web_view_info;
bool is_web_view_guest = GetWebViewInfo(blocked_request.request,
@@ -2120,7 +2130,7 @@ void WebRequestInternalEventHandledFunction::RespondWithError(
const std::string& event_name,
const std::string& sub_event_name,
uint64_t request_id,
- scoped_ptr<ExtensionWebRequestEventRouter::EventResponse> response,
+ std::unique_ptr<ExtensionWebRequestEventRouter::EventResponse> response,
const std::string& error) {
error_ = error;
ExtensionWebRequestEventRouter::GetInstance()->OnEventHandled(
@@ -2145,7 +2155,7 @@ bool WebRequestInternalEventHandledFunction::RunSync() {
EXTENSION_FUNCTION_VALIDATE(base::StringToUint64(request_id_str,
&request_id));
- scoped_ptr<ExtensionWebRequestEventRouter::EventResponse> response;
+ std::unique_ptr<ExtensionWebRequestEventRouter::EventResponse> response;
if (HasOptionalArgument(3)) {
base::DictionaryValue* value = NULL;
EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(3, &value));
@@ -2196,8 +2206,8 @@ bool WebRequestInternalEventHandledFunction::RunSync() {
}
base::ListValue* headers_value = NULL;
- scoped_ptr<net::HttpRequestHeaders> request_headers;
- scoped_ptr<helpers::ResponseHeaders> response_headers;
+ std::unique_ptr<net::HttpRequestHeaders> request_headers;
+ std::unique_ptr<helpers::ResponseHeaders> response_headers;
if (has_request_headers) {
request_headers.reset(new net::HttpRequestHeaders());
EXTENSION_FUNCTION_VALIDATE(value->GetList(keys::kRequestHeadersKey,
diff --git a/chromium/extensions/browser/api/web_request/web_request_api.h b/chromium/extensions/browser/api/web_request/web_request_api.h
index 382860d7420..51948382bbc 100644
--- a/chromium/extensions/browser/api/web_request/web_request_api.h
+++ b/chromium/extensions/browser/api/web_request/web_request_api.h
@@ -146,11 +146,11 @@ class ExtensionWebRequestEventRouter
// Response values. These are mutually exclusive.
bool cancel;
GURL new_url;
- scoped_ptr<net::HttpRequestHeaders> request_headers;
- scoped_ptr<extension_web_request_api_helpers::ResponseHeaders>
+ std::unique_ptr<net::HttpRequestHeaders> request_headers;
+ std::unique_ptr<extension_web_request_api_helpers::ResponseHeaders>
response_headers;
- scoped_ptr<net::AuthCredentials> auth_credentials;
+ std::unique_ptr<net::AuthCredentials> auth_credentials;
private:
DISALLOW_COPY_AND_ASSIGN(EventResponse);
@@ -325,12 +325,12 @@ class ExtensionWebRequestEventRouter
bool DispatchEvent(void* browser_context,
net::URLRequest* request,
const std::vector<const EventListener*>& listeners,
- scoped_ptr<WebRequestEventDetails> event_details);
+ std::unique_ptr<WebRequestEventDetails> event_details);
void DispatchEventToListeners(
void* browser_context,
- scoped_ptr<std::vector<EventListener>> listeners,
- scoped_ptr<WebRequestEventDetails> event_details);
+ std::unique_ptr<std::vector<EventListener>> listeners,
+ std::unique_ptr<WebRequestEventDetails> event_details);
// Returns a list of event listeners that care about the given event, based
// on their filter parameters. |extra_info_spec| will contain the combined
@@ -373,13 +373,12 @@ class ExtensionWebRequestEventRouter
EventResponse* response);
// Logs an extension action.
- void LogExtensionActivity(
- void* browser_context_id,
- bool is_incognito,
- const std::string& extension_id,
- const GURL& url,
- const std::string& api_call,
- scoped_ptr<base::DictionaryValue> details);
+ void LogExtensionActivity(void* browser_context_id,
+ bool is_incognito,
+ const std::string& extension_id,
+ const GURL& url,
+ const std::string& api_call,
+ std::unique_ptr<base::DictionaryValue> details);
// Processes the generated deltas from blocked_requests_ on the specified
// request. If |call_back| is true, the callback registered in
@@ -418,7 +417,7 @@ class ExtensionWebRequestEventRouter
extensions::RequestStage request_stage);
// Returns event details for a given request.
- scoped_ptr<WebRequestEventDetails> CreateEventDetails(
+ std::unique_ptr<WebRequestEventDetails> CreateEventDetails(
const net::URLRequest* request,
int extra_info_spec);
@@ -465,7 +464,7 @@ class ExtensionWebRequestEventRouter
// Keeps track of time spent waiting on extensions using the blocking
// webRequest API.
- scoped_ptr<ExtensionWebRequestTimeTracker> request_time_tracker_;
+ std::unique_ptr<ExtensionWebRequestTimeTracker> request_time_tracker_;
CallbacksForPageLoad callbacks_for_page_load_;
@@ -475,7 +474,7 @@ class ExtensionWebRequestEventRouter
std::map<RulesRegistryKey,
scoped_refptr<extensions::WebRequestRulesRegistry> > rules_registries_;
- scoped_ptr<extensions::WebRequestEventRouterDelegate>
+ std::unique_ptr<extensions::WebRequestEventRouterDelegate>
web_request_event_router_delegate_;
DISALLOW_COPY_AND_ASSIGN(ExtensionWebRequestEventRouter);
@@ -523,7 +522,7 @@ class WebRequestInternalEventHandledFunction
const std::string& event_name,
const std::string& sub_event_name,
uint64_t request_id,
- scoped_ptr<ExtensionWebRequestEventRouter::EventResponse> response,
+ std::unique_ptr<ExtensionWebRequestEventRouter::EventResponse> response,
const std::string& error);
// ExtensionFunction:
diff --git a/chromium/extensions/browser/api/web_request/web_request_api_helpers.cc b/chromium/extensions/browser/api/web_request/web_request_api_helpers.cc
index 6bdb87c7bef..11b15638792 100644
--- a/chromium/extensions/browser/api/web_request/web_request_api_helpers.cc
+++ b/chromium/extensions/browser/api/web_request/web_request_api_helpers.cc
@@ -260,10 +260,10 @@ net::NetLog::ParametersCallback CreateNetLogExtensionIdCallback(
}
// Creates NetLog parameters to indicate that an extension modified a request.
-scoped_ptr<base::Value> NetLogModificationCallback(
+std::unique_ptr<base::Value> NetLogModificationCallback(
const EventResponseDelta* delta,
net::NetLogCaptureMode capture_mode) {
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("extension_id", delta->extension_id);
base::ListValue* modified_headers = new base::ListValue();
@@ -429,7 +429,7 @@ EventResponseDelta* CalculateOnAuthRequiredDelta(
const std::string& extension_id,
const base::Time& extension_install_time,
bool cancel,
- scoped_ptr<net::AuthCredentials>* auth_credentials) {
+ std::unique_ptr<net::AuthCredentials>* auth_credentials) {
EventResponseDelta* result =
new EventResponseDelta(extension_id, extension_install_time);
result->cancel = cancel;
diff --git a/chromium/extensions/browser/api/web_request/web_request_api_helpers.h b/chromium/extensions/browser/api/web_request/web_request_api_helpers.h
index a41c52ff484..450f3cae2f0 100644
--- a/chromium/extensions/browser/api/web_request/web_request_api_helpers.h
+++ b/chromium/extensions/browser/api/web_request/web_request_api_helpers.h
@@ -8,13 +8,13 @@
#define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_API_HELPERS_H_
#include <list>
+#include <memory>
#include <set>
#include <string>
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "content/public/common/resource_type.h"
#include "extensions/browser/warning_set.h"
@@ -66,8 +66,9 @@ struct ExtraInfoSpec {
struct RequestCookie {
RequestCookie();
~RequestCookie();
- scoped_ptr<std::string> name;
- scoped_ptr<std::string> value;
+ std::unique_ptr<std::string> name;
+ std::unique_ptr<std::string> value;
+
private:
DISALLOW_COPY_AND_ASSIGN(RequestCookie);
};
@@ -79,14 +80,15 @@ bool NullableEquals(const RequestCookie* a, const RequestCookie* b);
struct ResponseCookie {
ResponseCookie();
~ResponseCookie();
- scoped_ptr<std::string> name;
- scoped_ptr<std::string> value;
- scoped_ptr<std::string> expires;
- scoped_ptr<int> max_age;
- scoped_ptr<std::string> domain;
- scoped_ptr<std::string> path;
- scoped_ptr<bool> secure;
- scoped_ptr<bool> http_only;
+ std::unique_ptr<std::string> name;
+ std::unique_ptr<std::string> value;
+ std::unique_ptr<std::string> expires;
+ std::unique_ptr<int> max_age;
+ std::unique_ptr<std::string> domain;
+ std::unique_ptr<std::string> path;
+ std::unique_ptr<bool> secure;
+ std::unique_ptr<bool> http_only;
+
private:
DISALLOW_COPY_AND_ASSIGN(ResponseCookie);
};
@@ -98,9 +100,10 @@ bool NullableEquals(const ResponseCookie* a, const ResponseCookie* b);
struct FilterResponseCookie : ResponseCookie {
FilterResponseCookie();
~FilterResponseCookie();
- scoped_ptr<int> age_lower_bound;
- scoped_ptr<int> age_upper_bound;
- scoped_ptr<bool> session_cookie;
+ std::unique_ptr<int> age_lower_bound;
+ std::unique_ptr<int> age_upper_bound;
+ std::unique_ptr<bool> session_cookie;
+
private:
DISALLOW_COPY_AND_ASSIGN(FilterResponseCookie);
};
@@ -119,9 +122,10 @@ struct RequestCookieModification {
~RequestCookieModification();
CookieModificationType type;
// Used for EDIT and REMOVE. NULL for ADD.
- scoped_ptr<RequestCookie> filter;
+ std::unique_ptr<RequestCookie> filter;
// Used for ADD and EDIT. NULL for REMOVE.
- scoped_ptr<RequestCookie> modification;
+ std::unique_ptr<RequestCookie> modification;
+
private:
DISALLOW_COPY_AND_ASSIGN(RequestCookieModification);
};
@@ -134,9 +138,10 @@ struct ResponseCookieModification {
~ResponseCookieModification();
CookieModificationType type;
// Used for EDIT and REMOVE.
- scoped_ptr<FilterResponseCookie> filter;
+ std::unique_ptr<FilterResponseCookie> filter;
// Used for ADD and EDIT.
- scoped_ptr<ResponseCookie> modification;
+ std::unique_ptr<ResponseCookie> modification;
+
private:
DISALLOW_COPY_AND_ASSIGN(ResponseCookieModification);
};
@@ -177,7 +182,7 @@ struct EventResponseDelta {
ResponseHeaders deleted_response_headers;
// Authentication Credentials to use.
- scoped_ptr<net::AuthCredentials> auth_credentials;
+ std::unique_ptr<net::AuthCredentials> auth_credentials;
// Modifications to cookies in request headers.
RequestCookieModifications request_cookie_modifications;
@@ -243,7 +248,7 @@ EventResponseDelta* CalculateOnAuthRequiredDelta(
const std::string& extension_id,
const base::Time& extension_install_time,
bool cancel,
- scoped_ptr<net::AuthCredentials>* auth_credentials);
+ std::unique_ptr<net::AuthCredentials>* auth_credentials);
// These functions merge the responses (the |deltas|) of request handlers.
// The |deltas| need to be sorted in decreasing order of precedence of
diff --git a/chromium/extensions/browser/api/web_request/web_request_event_details.cc b/chromium/extensions/browser/api/web_request/web_request_event_details.cc
index 04fa9fbfeaa..a9f2f839123 100644
--- a/chromium/extensions/browser/api/web_request/web_request_event_details.cc
+++ b/chromium/extensions/browser/api/web_request/web_request_event_details.cc
@@ -74,7 +74,7 @@ void WebRequestEventDetails::SetRequestBody(const net::URLRequest* request) {
static const char* const kKeys[] = {keys::kRequestBodyFormDataKey,
keys::kRequestBodyRawKey};
- const std::vector<scoped_ptr<net::UploadElementReader>>* readers =
+ const std::vector<std::unique_ptr<net::UploadElementReader>>* readers =
upload_data->GetElementReaders();
bool some_succeeded = false;
if (readers) {
@@ -160,16 +160,16 @@ void WebRequestEventDetails::DetermineFrameIdOnUI() {
void WebRequestEventDetails::DetermineFrameIdOnIO(
const DeterminedFrameIdCallback& callback) {
- scoped_ptr<WebRequestEventDetails> self(this);
+ std::unique_ptr<WebRequestEventDetails> self(this);
ExtensionApiFrameIdMap::Get()->GetFrameDataOnIO(
render_process_id_, render_frame_id_,
base::Bind(&WebRequestEventDetails::OnDeterminedFrameId,
base::Unretained(this), base::Passed(&self), callback));
}
-scoped_ptr<base::DictionaryValue> WebRequestEventDetails::GetFilteredDict(
+std::unique_ptr<base::DictionaryValue> WebRequestEventDetails::GetFilteredDict(
int extra_info_spec) const {
- scoped_ptr<base::DictionaryValue> result = dict_.CreateDeepCopy();
+ std::unique_ptr<base::DictionaryValue> result = dict_.CreateDeepCopy();
if ((extra_info_spec & ExtraInfoSpec::REQUEST_BODY) && request_body_)
result->Set(keys::kRequestBodyKey, request_body_->CreateDeepCopy());
if ((extra_info_spec & ExtraInfoSpec::REQUEST_HEADERS) && request_headers_)
@@ -179,14 +179,15 @@ scoped_ptr<base::DictionaryValue> WebRequestEventDetails::GetFilteredDict(
return result;
}
-scoped_ptr<base::DictionaryValue> WebRequestEventDetails::GetAndClearDict() {
- scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue);
+std::unique_ptr<base::DictionaryValue>
+WebRequestEventDetails::GetAndClearDict() {
+ std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue);
dict_.Swap(result.get());
return result;
}
void WebRequestEventDetails::OnDeterminedFrameId(
- scoped_ptr<WebRequestEventDetails> self,
+ std::unique_ptr<WebRequestEventDetails> self,
const DeterminedFrameIdCallback& callback,
const ExtensionApiFrameIdMap::FrameData& frame_data) {
dict_.SetInteger(keys::kFrameIdKey, frame_data.frame_id);
diff --git a/chromium/extensions/browser/api/web_request/web_request_event_details.h b/chromium/extensions/browser/api/web_request/web_request_event_details.h
index 7bb36448f0e..bd9c995a15b 100644
--- a/chromium/extensions/browser/api/web_request/web_request_event_details.h
+++ b/chromium/extensions/browser/api/web_request/web_request_event_details.h
@@ -5,11 +5,11 @@
#ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_EVENT_DETAILS_H_
#define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_EVENT_DETAILS_H_
+#include <memory>
#include <string>
#include "base/callback_forward.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "extensions/browser/extension_api_frame_id_map.h"
@@ -37,7 +37,7 @@ namespace extensions {
class WebRequestEventDetails {
public:
using DeterminedFrameIdCallback =
- base::Callback<void(scoped_ptr<WebRequestEventDetails>)>;
+ base::Callback<void(std::unique_ptr<WebRequestEventDetails>)>;
// Create a WebRequestEventDetails with the following keys:
// - method
@@ -111,14 +111,15 @@ class WebRequestEventDetails {
// Create an event dictionary that contains all required keys, and also the
// extra keys as specified by the |extra_info_spec| filter.
// This can be called from any thread.
- scoped_ptr<base::DictionaryValue> GetFilteredDict(int extra_info_spec) const;
+ std::unique_ptr<base::DictionaryValue> GetFilteredDict(
+ int extra_info_spec) const;
// Get the internal dictionary, unfiltered. After this call, the internal
// dictionary is empty.
- scoped_ptr<base::DictionaryValue> GetAndClearDict();
+ std::unique_ptr<base::DictionaryValue> GetAndClearDict();
private:
- void OnDeterminedFrameId(scoped_ptr<WebRequestEventDetails> self,
+ void OnDeterminedFrameId(std::unique_ptr<WebRequestEventDetails> self,
const DeterminedFrameIdCallback& callback,
const ExtensionApiFrameIdMap::FrameData& frame_data);
@@ -126,9 +127,9 @@ class WebRequestEventDetails {
base::DictionaryValue dict_;
// Extra event details: Only included when |extra_info_spec_| matches.
- scoped_ptr<base::DictionaryValue> request_body_;
- scoped_ptr<base::ListValue> request_headers_;
- scoped_ptr<base::ListValue> response_headers_;
+ std::unique_ptr<base::DictionaryValue> request_body_;
+ std::unique_ptr<base::ListValue> request_headers_;
+ std::unique_ptr<base::ListValue> response_headers_;
int extra_info_spec_;
diff --git a/chromium/extensions/browser/api/web_request/web_request_event_router_delegate.h b/chromium/extensions/browser/api/web_request/web_request_event_router_delegate.h
index 5ccf1adb715..fa23fb6b524 100644
--- a/chromium/extensions/browser/api/web_request/web_request_event_router_delegate.h
+++ b/chromium/extensions/browser/api/web_request/web_request_event_router_delegate.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_EVENT_ROUTER_DELEGATE_H_
#define EXTENSIONS_BROWSER_API_WEB_REQUEST_WEB_REQUEST_EVENT_ROUTER_DELEGATE_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
class GURL;
@@ -35,13 +35,13 @@ class WebRequestEventRouterDelegate {
virtual ~WebRequestEventRouterDelegate();
// Logs an extension action.
- virtual void LogExtensionActivity(content::BrowserContext* browser_context,
- bool is_incognito,
- const std::string& extension_id,
- const GURL& url,
- const std::string& api_call,
- scoped_ptr<base::DictionaryValue> details) {
- }
+ virtual void LogExtensionActivity(
+ content::BrowserContext* browser_context,
+ bool is_incognito,
+ const std::string& extension_id,
+ const GURL& url,
+ const std::string& api_call,
+ std::unique_ptr<base::DictionaryValue> details) {}
// Notifies that a webRequest event that normally would be forwarded to a
// listener was instead blocked because of withheld permissions.
diff --git a/chromium/extensions/browser/api/web_request/web_request_time_tracker.h b/chromium/extensions/browser/api/web_request/web_request_time_tracker.h
index af3073189d4..1314f351a62 100644
--- a/chromium/extensions/browser/api/web_request/web_request_time_tracker.h
+++ b/chromium/extensions/browser/api/web_request/web_request_time_tracker.h
@@ -9,13 +9,13 @@
#include <stdint.h>
#include <map>
+#include <memory>
#include <queue>
#include <set>
#include <string>
#include "base/gtest_prod_util.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "url/gurl.h"
@@ -115,7 +115,7 @@ class ExtensionWebRequestTimeTracker {
std::set<int64_t> moderate_delays_;
// Defaults to a delegate that sets warnings in the extension service.
- scoped_ptr<ExtensionWebRequestTimeTrackerDelegate> delegate_;
+ std::unique_ptr<ExtensionWebRequestTimeTrackerDelegate> delegate_;
FRIEND_TEST_ALL_PREFIXES(ExtensionWebRequestTimeTrackerTest, Basic);
FRIEND_TEST_ALL_PREFIXES(ExtensionWebRequestTimeTrackerTest,
diff --git a/chromium/extensions/browser/api/webcam_private/visca_webcam.cc b/chromium/extensions/browser/api/webcam_private/visca_webcam.cc
index 18c847b7d9f..7efd55ffb75 100644
--- a/chromium/extensions/browser/api/webcam_private/visca_webcam.cc
+++ b/chromium/extensions/browser/api/webcam_private/visca_webcam.cc
@@ -489,7 +489,7 @@ void ViscaWebcam::Reset(bool pan,
}
void ViscaWebcam::OpenForTesting(
- scoped_ptr<SerialConnection> serial_connection) {
+ std::unique_ptr<SerialConnection> serial_connection) {
serial_connection_ = std::move(serial_connection);
}
diff --git a/chromium/extensions/browser/api/webcam_private/visca_webcam.h b/chromium/extensions/browser/api/webcam_private/visca_webcam.h
index 0afe201f210..fb18fcbba60 100644
--- a/chromium/extensions/browser/api/webcam_private/visca_webcam.h
+++ b/chromium/extensions/browser/api/webcam_private/visca_webcam.h
@@ -114,13 +114,13 @@ class ViscaWebcam : public Webcam {
const SetPTZCompleteCallback& callback) override;
// Used only in unit tests in place of Open().
- void OpenForTesting(scoped_ptr<SerialConnection> serial_connection);
+ void OpenForTesting(std::unique_ptr<SerialConnection> serial_connection);
// Used only in unit tests to retrieve |serial_connection_| since this class
// owns it.
SerialConnection* GetSerialConnectionForTesting();
- scoped_ptr<SerialConnection> serial_connection_;
+ std::unique_ptr<SerialConnection> serial_connection_;
// Stores the response for the current command.
std::vector<char> data_buffer_;
diff --git a/chromium/extensions/browser/api/webcam_private/visca_webcam_unittest.cc b/chromium/extensions/browser/api/webcam_private/visca_webcam_unittest.cc
index 5cf98c49b12..303f4670250 100644
--- a/chromium/extensions/browser/api/webcam_private/visca_webcam_unittest.cc
+++ b/chromium/extensions/browser/api/webcam_private/visca_webcam_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/browser/api/webcam_private/visca_webcam.h"
+
#include <vector>
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
-#include "extensions/browser/api/webcam_private/visca_webcam.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
@@ -92,7 +94,7 @@ class ViscaWebcamTest : public testing::Test {
protected:
ViscaWebcamTest() {
webcam_ = new ViscaWebcam;
- webcam_->OpenForTesting(make_scoped_ptr(new TestSerialConnection));
+ webcam_->OpenForTesting(base::WrapUnique(new TestSerialConnection));
}
~ViscaWebcamTest() override {}
diff --git a/chromium/extensions/browser/api/webcam_private/webcam_private_api.h b/chromium/extensions/browser/api/webcam_private/webcam_private_api.h
index 04efcd2eec5..68752b5d403 100644
--- a/chromium/extensions/browser/api/webcam_private/webcam_private_api.h
+++ b/chromium/extensions/browser/api/webcam_private/webcam_private_api.h
@@ -6,9 +6,9 @@
#define EXTENSIONS_BROWSER_API_WEBCAM_PRIVATE_WEBCAM_PRIVATE_API_H_
#include <map>
+#include <memory>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "extensions/browser/api/api_resource_manager.h"
#include "extensions/browser/api/webcam_private/webcam.h"
@@ -73,7 +73,7 @@ class WebcamPrivateAPI : public BrowserContextKeyedAPI {
static const bool kServiceRedirectedInIncognito = true;
content::BrowserContext* const browser_context_;
- scoped_ptr<ApiResourceManager<WebcamResource>> webcam_resource_manager_;
+ std::unique_ptr<ApiResourceManager<WebcamResource>> webcam_resource_manager_;
base::WeakPtrFactory<WebcamPrivateAPI> weak_ptr_factory_;
diff --git a/chromium/extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc b/chromium/extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc
index 31e381b37f9..353517c063e 100644
--- a/chromium/extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc
+++ b/chromium/extensions/browser/api/webcam_private/webcam_private_api_chromeos.cc
@@ -13,6 +13,7 @@
#include "extensions/browser/process_manager.h"
#include "extensions/browser/process_manager_factory.h"
#include "extensions/common/api/webcam_private.h"
+#include "url/origin.h"
namespace webcam_private = extensions::api::webcam_private;
@@ -113,8 +114,8 @@ void WebcamPrivateAPI::OnOpenSerialWebcam(
bool WebcamPrivateAPI::GetDeviceId(const std::string& extension_id,
const std::string& webcam_id,
std::string* device_id) {
- GURL security_origin =
- extensions::Extension::GetBaseURLFromExtensionId(extension_id);
+ url::Origin security_origin(
+ extensions::Extension::GetBaseURLFromExtensionId(extension_id));
return content::GetMediaDeviceIDForHMAC(
content::MEDIA_DEVICE_VIDEO_CAPTURE,
@@ -126,8 +127,8 @@ bool WebcamPrivateAPI::GetDeviceId(const std::string& extension_id,
std::string WebcamPrivateAPI::GetWebcamId(const std::string& extension_id,
const std::string& device_id) {
- GURL security_origin =
- extensions::Extension::GetBaseURLFromExtensionId(extension_id);
+ url::Origin security_origin(
+ extensions::Extension::GetBaseURLFromExtensionId(extension_id));
return content::GetHMACForMediaDeviceID(
browser_context_->GetResourceContext()->GetMediaDeviceIDSalt(),
@@ -183,7 +184,7 @@ WebcamPrivateOpenSerialWebcamFunction::
}
bool WebcamPrivateOpenSerialWebcamFunction::RunAsync() {
- scoped_ptr<webcam_private::OpenSerialWebcam::Params> params(
+ std::unique_ptr<webcam_private::OpenSerialWebcam::Params> params(
webcam_private::OpenSerialWebcam::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -218,7 +219,7 @@ WebcamPrivateCloseWebcamFunction::~WebcamPrivateCloseWebcamFunction() {
}
bool WebcamPrivateCloseWebcamFunction::RunAsync() {
- scoped_ptr<webcam_private::CloseWebcam::Params> params(
+ std::unique_ptr<webcam_private::CloseWebcam::Params> params(
webcam_private::CloseWebcam::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -233,7 +234,7 @@ WebcamPrivateSetFunction::~WebcamPrivateSetFunction() {
}
bool WebcamPrivateSetFunction::RunAsync() {
- scoped_ptr<webcam_private::Set::Params> params(
+ std::unique_ptr<webcam_private::Set::Params> params(
webcam_private::Set::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -333,7 +334,7 @@ WebcamPrivateGetFunction::~WebcamPrivateGetFunction() {
}
bool WebcamPrivateGetFunction::RunAsync() {
- scoped_ptr<webcam_private::Get::Params> params(
+ std::unique_ptr<webcam_private::Get::Params> params(
webcam_private::Get::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
@@ -397,7 +398,7 @@ WebcamPrivateResetFunction::~WebcamPrivateResetFunction() {
}
bool WebcamPrivateResetFunction::RunAsync() {
- scoped_ptr<webcam_private::Reset::Params> params(
+ std::unique_ptr<webcam_private::Reset::Params> params(
webcam_private::Reset::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
diff --git a/chromium/extensions/browser/api_activity_monitor.h b/chromium/extensions/browser/api_activity_monitor.h
index b8f0cc32c40..9ef97a4a4ef 100644
--- a/chromium/extensions/browser/api_activity_monitor.h
+++ b/chromium/extensions/browser/api_activity_monitor.h
@@ -5,9 +5,9 @@
#ifndef EXTENSIONS_BROWSER_API_ACTIVITY_MONITOR_H_
#define EXTENSIONS_BROWSER_API_ACTIVITY_MONITOR_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
namespace base {
class ListValue;
@@ -21,14 +21,15 @@ namespace extensions {
class ApiActivityMonitor {
public:
// Called when an API event is dispatched to an extension.
- virtual void OnApiEventDispatched(const std::string& extension_id,
- const std::string& event_name,
- scoped_ptr<base::ListValue> event_args) = 0;
+ virtual void OnApiEventDispatched(
+ const std::string& extension_id,
+ const std::string& event_name,
+ std::unique_ptr<base::ListValue> event_args) = 0;
// Called when an extension calls an API function.
virtual void OnApiFunctionCalled(const std::string& extension_id,
const std::string& api_name,
- scoped_ptr<base::ListValue> args) = 0;
+ std::unique_ptr<base::ListValue> args) = 0;
protected:
virtual ~ApiActivityMonitor() {}
diff --git a/chromium/extensions/browser/api_test_utils.cc b/chromium/extensions/browser/api_test_utils.cc
index 7d5362423eb..0dafbbe0078 100644
--- a/chromium/extensions/browser/api_test_utils.cc
+++ b/chromium/extensions/browser/api_test_utils.cc
@@ -4,10 +4,11 @@
#include "extensions/browser/api_test_utils.h"
+#include <memory>
#include <utility>
+#include "base/callback_helpers.h"
#include "base/json/json_reader.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "components/crx_file/id_util.h"
#include "content/public/browser/browser_context.h"
@@ -21,11 +22,11 @@ using extensions::ExtensionFunctionDispatcher;
namespace {
-scoped_ptr<base::Value> ParseJSON(const std::string& data) {
+std::unique_ptr<base::Value> ParseJSON(const std::string& data) {
return base::JSONReader::Read(data);
}
-scoped_ptr<base::ListValue> ParseList(const std::string& data) {
+std::unique_ptr<base::ListValue> ParseList(const std::string& data) {
return base::ListValue::From(ParseJSON(data));
}
@@ -34,14 +35,10 @@ scoped_ptr<base::ListValue> ParseList(const std::string& data) {
class SendResponseDelegate
: public UIThreadExtensionFunction::DelegateForTests {
public:
- SendResponseDelegate() : should_post_quit_(false) {}
+ SendResponseDelegate() {}
virtual ~SendResponseDelegate() {}
- void set_should_post_quit(bool should_quit) {
- should_post_quit_ = should_quit;
- }
-
bool HasResponse() { return response_.get() != NULL; }
bool GetResponse() {
@@ -56,14 +53,19 @@ class SendResponseDelegate
ASSERT_FALSE(HasResponse());
response_.reset(new bool);
*response_ = success;
- if (should_post_quit_) {
- base::MessageLoopForUI::current()->QuitWhenIdle();
- }
+ run_loop_.Quit();
+ }
+
+ void WaitForResponse() {
+ // If the RunAsync of UIThreadExtensionFunction already called SendResponse,
+ // this will finish immediately.
+ run_loop_.Run();
}
private:
- scoped_ptr<bool> response_;
- bool should_post_quit_;
+ base::RunLoop run_loop_;
+ std::unique_ptr<bool> response_;
+ DISALLOW_COPY_AND_ASSIGN(SendResponseDelegate);
};
} // namespace
@@ -72,7 +74,8 @@ namespace extensions {
namespace api_test_utils {
-scoped_ptr<base::DictionaryValue> ParseDictionary(const std::string& data) {
+std::unique_ptr<base::DictionaryValue> ParseDictionary(
+ const std::string& data) {
return base::DictionaryValue::From(ParseJSON(data));
}
@@ -122,7 +125,7 @@ scoped_refptr<Extension> CreateExtension(
scoped_refptr<Extension> CreateEmptyExtensionWithLocation(
Manifest::Location location) {
- scoped_ptr<base::DictionaryValue> test_extension_value =
+ std::unique_ptr<base::DictionaryValue> test_extension_value =
ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}");
return CreateExtension(location, test_extension_value.get(), std::string());
}
@@ -131,7 +134,7 @@ base::Value* RunFunctionWithDelegateAndReturnSingleResult(
UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
- scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher) {
+ std::unique_ptr<extensions::ExtensionFunctionDispatcher> dispatcher) {
return RunFunctionWithDelegateAndReturnSingleResult(
function, args, context, std::move(dispatcher), NONE);
}
@@ -140,7 +143,7 @@ base::Value* RunFunctionWithDelegateAndReturnSingleResult(
UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
- scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
+ std::unique_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
RunFunctionFlags flags) {
scoped_refptr<ExtensionFunction> function_owner(function);
// Without a callback the function will not generate a result.
@@ -168,7 +171,7 @@ base::Value* RunFunctionAndReturnSingleResult(
const std::string& args,
content::BrowserContext* context,
RunFunctionFlags flags) {
- scoped_ptr<ExtensionFunctionDispatcher> dispatcher(
+ std::unique_ptr<ExtensionFunctionDispatcher> dispatcher(
new ExtensionFunctionDispatcher(context));
return RunFunctionWithDelegateAndReturnSingleResult(
@@ -185,7 +188,7 @@ std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
RunFunctionFlags flags) {
- scoped_ptr<ExtensionFunctionDispatcher> dispatcher(
+ std::unique_ptr<ExtensionFunctionDispatcher> dispatcher(
new ExtensionFunctionDispatcher(context));
scoped_refptr<ExtensionFunction> function_owner(function);
// Without a callback the function will not generate a result.
@@ -198,28 +201,30 @@ std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
bool RunFunction(UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context) {
- scoped_ptr<ExtensionFunctionDispatcher> dispatcher(
+ std::unique_ptr<ExtensionFunctionDispatcher> dispatcher(
new ExtensionFunctionDispatcher(context));
return RunFunction(function, args, context, std::move(dispatcher), NONE);
}
-bool RunFunction(UIThreadExtensionFunction* function,
- const std::string& args,
- content::BrowserContext* context,
- scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
- RunFunctionFlags flags) {
- scoped_ptr<base::ListValue> parsed_args = ParseList(args);
+bool RunFunction(
+ UIThreadExtensionFunction* function,
+ const std::string& args,
+ content::BrowserContext* context,
+ std::unique_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
+ RunFunctionFlags flags) {
+ std::unique_ptr<base::ListValue> parsed_args = ParseList(args);
EXPECT_TRUE(parsed_args.get())
<< "Could not parse extension function arguments: " << args;
return RunFunction(function, std::move(parsed_args), context,
std::move(dispatcher), flags);
}
-bool RunFunction(UIThreadExtensionFunction* function,
- scoped_ptr<base::ListValue> args,
- content::BrowserContext* context,
- scoped_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
- RunFunctionFlags flags) {
+bool RunFunction(
+ UIThreadExtensionFunction* function,
+ std::unique_ptr<base::ListValue> args,
+ content::BrowserContext* context,
+ std::unique_ptr<extensions::ExtensionFunctionDispatcher> dispatcher,
+ RunFunctionFlags flags) {
SendResponseDelegate response_delegate;
function->set_test_delegate(&response_delegate);
function->SetArgs(args.get());
@@ -230,13 +235,7 @@ bool RunFunction(UIThreadExtensionFunction* function,
function->set_browser_context(context);
function->set_include_incognito(flags & INCLUDE_INCOGNITO);
function->Run()->Execute();
-
- // If the RunAsync of |function| didn't already call SendResponse, run the
- // message loop until they do.
- if (!response_delegate.HasResponse()) {
- response_delegate.set_should_post_quit(true);
- content::RunMessageLoop();
- }
+ response_delegate.WaitForResponse();
EXPECT_TRUE(response_delegate.HasResponse());
return response_delegate.GetResponse();
diff --git a/chromium/extensions/browser/api_test_utils.h b/chromium/extensions/browser/api_test_utils.h
index 0a74f82df74..81d57a801fc 100644
--- a/chromium/extensions/browser/api_test_utils.h
+++ b/chromium/extensions/browser/api_test_utils.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_API_TEST_UTILS_H_
#define EXTENSIONS_BROWSER_API_TEST_UTILS_H_
+#include <memory>
#include <string>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/common/manifest.h"
class UIThreadExtensionFunction;
@@ -30,7 +30,7 @@ class ExtensionFunctionDispatcher;
// TODO(yoz): crbug.com/394840: Remove duplicate functionality in
// chrome/browser/extensions/extension_function_test_utils.h.
//
-// TODO(ckehoe): Accept args as scoped_ptr<base::Value>,
+// TODO(ckehoe): Accept args as std::unique_ptr<base::Value>,
// and migrate existing users to the new API.
namespace api_test_utils {
@@ -38,7 +38,7 @@ enum RunFunctionFlags { NONE = 0, INCLUDE_INCOGNITO = 1 << 0 };
// Parse JSON and return as the specified type, or NULL if the JSON is invalid
// or not the specified type.
-scoped_ptr<base::DictionaryValue> ParseDictionary(const std::string& data);
+std::unique_ptr<base::DictionaryValue> ParseDictionary(const std::string& data);
// Get |key| from |val| as the specified type. If |key| does not exist, or is
// not of the specified type, adds a failure to the current test and returns
@@ -69,12 +69,12 @@ base::Value* RunFunctionWithDelegateAndReturnSingleResult(
UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
- scoped_ptr<ExtensionFunctionDispatcher> dispatcher);
+ std::unique_ptr<ExtensionFunctionDispatcher> dispatcher);
base::Value* RunFunctionWithDelegateAndReturnSingleResult(
UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
- scoped_ptr<ExtensionFunctionDispatcher> dispatcher,
+ std::unique_ptr<ExtensionFunctionDispatcher> dispatcher,
RunFunctionFlags flags);
// RunFunctionWithDelegateAndReturnSingleResult, except with a NULL
@@ -116,12 +116,12 @@ bool RunFunction(UIThreadExtensionFunction* function,
bool RunFunction(UIThreadExtensionFunction* function,
const std::string& args,
content::BrowserContext* context,
- scoped_ptr<ExtensionFunctionDispatcher> dispatcher,
+ std::unique_ptr<ExtensionFunctionDispatcher> dispatcher,
RunFunctionFlags flags);
bool RunFunction(UIThreadExtensionFunction* function,
- scoped_ptr<base::ListValue> args,
+ std::unique_ptr<base::ListValue> args,
content::BrowserContext* context,
- scoped_ptr<ExtensionFunctionDispatcher> dispatcher,
+ std::unique_ptr<ExtensionFunctionDispatcher> dispatcher,
RunFunctionFlags flags);
} // namespace api_test_utils
diff --git a/chromium/extensions/browser/api_unittest.cc b/chromium/extensions/browser/api_unittest.cc
index ada00c01506..c8faa21048e 100644
--- a/chromium/extensions/browser/api_unittest.cc
+++ b/chromium/extensions/browser/api_unittest.cc
@@ -53,6 +53,12 @@ void ApiUnitTest::SetUp() {
.Build();
}
+void ApiUnitTest::TearDown() {
+ extension_ = nullptr;
+ contents_.reset();
+ ExtensionsTest::TearDown();
+}
+
void ApiUnitTest::CreateBackgroundPage() {
if (!contents_) {
GURL url = BackgroundInfo::GetBackgroundURL(extension());
@@ -65,19 +71,19 @@ void ApiUnitTest::CreateBackgroundPage() {
}
}
-scoped_ptr<base::Value> ApiUnitTest::RunFunctionAndReturnValue(
+std::unique_ptr<base::Value> ApiUnitTest::RunFunctionAndReturnValue(
UIThreadExtensionFunction* function,
const std::string& args) {
function->set_extension(extension());
if (contents_)
function->SetRenderFrameHost(contents_->GetMainFrame());
- return scoped_ptr<base::Value>(utils::RunFunctionAndReturnSingleResult(
+ return std::unique_ptr<base::Value>(utils::RunFunctionAndReturnSingleResult(
function, args, browser_context()));
}
-scoped_ptr<base::DictionaryValue> ApiUnitTest::RunFunctionAndReturnDictionary(
- UIThreadExtensionFunction* function,
- const std::string& args) {
+std::unique_ptr<base::DictionaryValue>
+ApiUnitTest::RunFunctionAndReturnDictionary(UIThreadExtensionFunction* function,
+ const std::string& args) {
base::Value* value = RunFunctionAndReturnValue(function, args).release();
base::DictionaryValue* dict = NULL;
@@ -87,10 +93,10 @@ scoped_ptr<base::DictionaryValue> ApiUnitTest::RunFunctionAndReturnDictionary(
// We expect to either have successfuly retrieved a dictionary from the value,
// or the value to have been NULL.
EXPECT_TRUE(dict || !value);
- return scoped_ptr<base::DictionaryValue>(dict);
+ return std::unique_ptr<base::DictionaryValue>(dict);
}
-scoped_ptr<base::ListValue> ApiUnitTest::RunFunctionAndReturnList(
+std::unique_ptr<base::ListValue> ApiUnitTest::RunFunctionAndReturnList(
UIThreadExtensionFunction* function,
const std::string& args) {
base::Value* value = RunFunctionAndReturnValue(function, args).release();
@@ -102,7 +108,7 @@ scoped_ptr<base::ListValue> ApiUnitTest::RunFunctionAndReturnList(
// We expect to either have successfuly retrieved a list from the value,
// or the value to have been NULL.
EXPECT_TRUE(list || !value);
- return scoped_ptr<base::ListValue>(list);
+ return std::unique_ptr<base::ListValue>(list);
}
std::string ApiUnitTest::RunFunctionAndReturnError(
diff --git a/chromium/extensions/browser/api_unittest.h b/chromium/extensions/browser/api_unittest.h
index 4e31c32fe88..ad46d88b1bb 100644
--- a/chromium/extensions/browser/api_unittest.h
+++ b/chromium/extensions/browser/api_unittest.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_API_UNITTEST_H_
#define EXTENSIONS_BROWSER_API_UNITTEST_H_
+#include <memory>
#include <string>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "components/pref_registry/testing_pref_service_syncable.h"
#include "extensions/browser/extensions_test.h"
@@ -49,6 +49,7 @@ class ApiUnitTest : public ExtensionsTest {
protected:
// SetUp creates and loads an empty, unpacked Extension.
void SetUp() override;
+ void TearDown() override;
// Creates a background page for |extension_|, and sets it for the WebContents
// to be used in API calls.
@@ -60,19 +61,19 @@ class ApiUnitTest : public ExtensionsTest {
// See also the RunFunction* methods in extension_function_test_utils.h.
// Return the function result as a base::Value.
- scoped_ptr<base::Value> RunFunctionAndReturnValue(
+ std::unique_ptr<base::Value> RunFunctionAndReturnValue(
UIThreadExtensionFunction* function,
const std::string& args);
// Return the function result as a base::DictionaryValue, or NULL.
// This will EXPECT-fail if the result is not a DictionaryValue.
- scoped_ptr<base::DictionaryValue> RunFunctionAndReturnDictionary(
+ std::unique_ptr<base::DictionaryValue> RunFunctionAndReturnDictionary(
UIThreadExtensionFunction* function,
const std::string& args);
// Return the function result as a base::ListValue, or NULL.
// This will EXPECT-fail if the result is not a ListValue.
- scoped_ptr<base::ListValue> RunFunctionAndReturnList(
+ std::unique_ptr<base::ListValue> RunFunctionAndReturnList(
UIThreadExtensionFunction* function,
const std::string& args);
@@ -86,14 +87,14 @@ class ApiUnitTest : public ExtensionsTest {
const std::string& args);
private:
- scoped_ptr<content::NotificationService> notification_service_;
+ std::unique_ptr<content::NotificationService> notification_service_;
- scoped_ptr<content::TestBrowserThreadBundle> thread_bundle_;
+ std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_;
user_prefs::TestingPrefServiceSyncable testing_pref_service_;
// The WebContents used to associate a RenderViewHost with API function calls,
// or null.
- scoped_ptr<content::WebContents> contents_;
+ std::unique_ptr<content::WebContents> contents_;
// The Extension used when running API function calls.
scoped_refptr<Extension> extension_;
diff --git a/chromium/extensions/browser/app_window/app_window.cc b/chromium/extensions/browser/app_window/app_window.cc
index 7294d6f8463..491332212f3 100644
--- a/chromium/extensions/browser/app_window/app_window.cc
+++ b/chromium/extensions/browser/app_window/app_window.cc
@@ -16,7 +16,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_runner.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
@@ -53,8 +53,9 @@
#include "extensions/grit/extensions_browser_resources.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/display/display.h"
+#include "ui/display/screen.h"
#include "ui/events/keycodes/keyboard_codes.h"
-#include "ui/gfx/screen.h"
#if !defined(OS_MACOSX)
#include "components/prefs/pref_service.h"
@@ -88,7 +89,7 @@ void SetBoundsProperties(const gfx::Rect& bounds,
const gfx::Size& max_size,
const std::string& bounds_name,
base::DictionaryValue* window_properties) {
- scoped_ptr<base::DictionaryValue> bounds_properties(
+ std::unique_ptr<base::DictionaryValue> bounds_properties(
new base::DictionaryValue());
bounds_properties->SetInteger("left", bounds.x());
@@ -583,7 +584,7 @@ void AppWindow::SetAppIconUrl(const GURL& url) {
image_loader_ptr_factory_.GetWeakPtr()));
}
-void AppWindow::UpdateShape(scoped_ptr<SkRegion> region) {
+void AppWindow::UpdateShape(std::unique_ptr<SkRegion> region) {
native_app_window_->UpdateShape(std::move(region));
}
@@ -857,13 +858,12 @@ void AppWindow::SetNativeWindowFullscreen() {
bool AppWindow::IntersectsWithTaskbar() const {
#if defined(OS_WIN)
- gfx::Screen* screen = gfx::Screen::GetScreen();
+ display::Screen* screen = display::Screen::GetScreen();
gfx::Rect window_bounds = native_app_window_->GetRestoredBounds();
- std::vector<gfx::Display> displays = screen->GetAllDisplays();
+ std::vector<display::Display> displays = screen->GetAllDisplays();
- for (std::vector<gfx::Display>::const_iterator it = displays.begin();
- it != displays.end();
- ++it) {
+ for (std::vector<display::Display>::const_iterator it = displays.begin();
+ it != displays.end(); ++it) {
gfx::Rect taskbar_bounds = it->bounds();
taskbar_bounds.Subtract(it->work_area());
if (taskbar_bounds.IsEmpty())
@@ -1018,7 +1018,7 @@ void AppWindow::SaveWindowPosition() {
gfx::Rect bounds = native_app_window_->GetRestoredBounds();
gfx::Rect screen_bounds =
- gfx::Screen::GetScreen()->GetDisplayMatching(bounds).work_area();
+ display::Screen::GetScreen()->GetDisplayMatching(bounds).work_area();
ui::WindowShowState window_state = native_app_window_->GetRestoredState();
cache->SaveGeometry(
extension_id(), window_key_, bounds, screen_bounds, window_state);
@@ -1084,8 +1084,8 @@ AppWindow::CreateParams AppWindow::LoadDefaults(CreateParams params)
&cached_state)) {
// App window has cached screen bounds, make sure it fits on screen in
// case the screen resolution changed.
- gfx::Screen* screen = gfx::Screen::GetScreen();
- gfx::Display display = screen->GetDisplayMatching(cached_bounds);
+ display::Screen* screen = display::Screen::GetScreen();
+ display::Display display = screen->GetDisplayMatching(cached_bounds);
gfx::Rect current_screen_bounds = display.work_area();
SizeConstraints constraints(params.GetWindowMinimumSize(gfx::Insets()),
params.GetWindowMaximumSize(gfx::Insets()));
diff --git a/chromium/extensions/browser/app_window/app_window.h b/chromium/extensions/browser/app_window/app_window.h
index e41575dae1a..e503669ab1f 100644
--- a/chromium/extensions/browser/app_window/app_window.h
+++ b/chromium/extensions/browser/app_window/app_window.h
@@ -7,12 +7,12 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/sessions/core/session_id.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
@@ -272,7 +272,7 @@ class AppWindow : public content::WebContentsDelegate,
void SetAppIconUrl(const GURL& icon_url);
// Set the window shape. Passing a NULL |region| sets the default shape.
- void UpdateShape(scoped_ptr<SkRegion> region);
+ void UpdateShape(std::unique_ptr<SkRegion> region);
// Called from the render interface to modify the draggable regions.
void UpdateDraggableRegions(const std::vector<DraggableRegion>& regions);
@@ -368,7 +368,8 @@ class AppWindow : public content::WebContentsDelegate,
// remove this TODO.
bool is_ime_window() const { return is_ime_window_; }
- void SetAppWindowContentsForTesting(scoped_ptr<AppWindowContents> contents) {
+ void SetAppWindowContentsForTesting(
+ std::unique_ptr<AppWindowContents> contents) {
app_window_contents_ = std::move(contents);
}
@@ -516,12 +517,12 @@ class AppWindow : public content::WebContentsDelegate,
GURL app_icon_url_;
// An object to load the app's icon as an extension resource.
- scoped_ptr<IconImage> app_icon_image_;
+ std::unique_ptr<IconImage> app_icon_image_;
- scoped_ptr<NativeAppWindow> native_app_window_;
- scoped_ptr<AppWindowContents> app_window_contents_;
- scoped_ptr<AppDelegate> app_delegate_;
- scoped_ptr<AppWebContentsHelper> helper_;
+ std::unique_ptr<NativeAppWindow> native_app_window_;
+ std::unique_ptr<AppWindowContents> app_window_contents_;
+ std::unique_ptr<AppDelegate> app_delegate_;
+ std::unique_ptr<AppWebContentsHelper> helper_;
// The initial url this AppWindow was navigated to.
GURL initial_url_;
diff --git a/chromium/extensions/browser/app_window/app_window_contents.h b/chromium/extensions/browser/app_window/app_window_contents.h
index 732197c391c..85b56c7d62f 100644
--- a/chromium/extensions/browser/app_window/app_window_contents.h
+++ b/chromium/extensions/browser/app_window/app_window_contents.h
@@ -7,8 +7,9 @@
#include <stdint.h>
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "content/public/browser/web_contents_observer.h"
#include "extensions/browser/app_window/app_window.h"
#include "url/gurl.h"
@@ -53,7 +54,7 @@ class AppWindowContentsImpl : public AppWindowContents,
AppWindow* host_; // This class is owned by |host_|
GURL url_;
- scoped_ptr<content::WebContents> web_contents_;
+ std::unique_ptr<content::WebContents> web_contents_;
bool is_blocking_requests_;
bool is_window_ready_;
diff --git a/chromium/extensions/browser/app_window/app_window_geometry_cache.cc b/chromium/extensions/browser/app_window/app_window_geometry_cache.cc
index adc8631d9d1..e1ee46ea411 100644
--- a/chromium/extensions/browser/app_window/app_window_geometry_cache.cc
+++ b/chromium/extensions/browser/app_window/app_window_geometry_cache.cc
@@ -106,7 +106,7 @@ void AppWindowGeometryCache::SyncToStorage() {
const std::string& extension_id = *it;
const ExtensionData& extension_data = cache_[extension_id];
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
for (ExtensionData::const_iterator it = extension_data.begin(),
eit = extension_data.end();
it != eit;
diff --git a/chromium/extensions/browser/app_window/app_window_geometry_cache.h b/chromium/extensions/browser/app_window/app_window_geometry_cache.h
index 1fbdb7333fa..f4547f7972d 100644
--- a/chromium/extensions/browser/app_window/app_window_geometry_cache.h
+++ b/chromium/extensions/browser/app_window/app_window_geometry_cache.h
@@ -8,10 +8,10 @@
#include <stddef.h>
#include <map>
+#include <memory>
#include <set>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "base/observer_list.h"
#include "base/scoped_observer.h"
diff --git a/chromium/extensions/browser/app_window/app_window_geometry_cache_unittest.cc b/chromium/extensions/browser/app_window/app_window_geometry_cache_unittest.cc
index 3c664c659fe..30f428dd088 100644
--- a/chromium/extensions/browser/app_window/app_window_geometry_cache_unittest.cc
+++ b/chromium/extensions/browser/app_window/app_window_geometry_cache_unittest.cc
@@ -6,10 +6,10 @@
#include <stddef.h>
+#include <memory>
#include <utility>
#include "base/files/file_path.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/mock_pref_change_callback.h"
@@ -74,10 +74,10 @@ class AppWindowGeometryCacheTest : public ExtensionsTest {
protected:
base::MessageLoopForUI ui_message_loop_;
content::TestBrowserThread ui_thread_;
- scoped_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
- scoped_ptr<PrefService> pref_service_;
- scoped_ptr<ExtensionPrefs> extension_prefs_;
- scoped_ptr<AppWindowGeometryCache> cache_;
+ std::unique_ptr<ExtensionPrefValueMap> extension_pref_value_map_;
+ std::unique_ptr<PrefService> pref_service_;
+ std::unique_ptr<ExtensionPrefs> extension_prefs_;
+ std::unique_ptr<AppWindowGeometryCache> cache_;
};
void AppWindowGeometryCacheTest::SetUp() {
@@ -120,7 +120,7 @@ void AppWindowGeometryCacheTest::AddGeometryAndLoadExtension(
const gfx::Rect& bounds,
const gfx::Rect& screen_bounds,
ui::WindowShowState state) {
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
base::DictionaryValue* value = new base::DictionaryValue;
value->SetInteger("x", bounds.x());
value->SetInteger("y", bounds.y());
diff --git a/chromium/extensions/browser/app_window/native_app_window.h b/chromium/extensions/browser/app_window/native_app_window.h
index 40da36834b1..943efdc7586 100644
--- a/chromium/extensions/browser/app_window/native_app_window.h
+++ b/chromium/extensions/browser/app_window/native_app_window.h
@@ -5,9 +5,9 @@
#ifndef EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_
#define EXTENSIONS_BROWSER_APP_WINDOW_NATIVE_APP_WINDOW_H_
+#include <memory>
#include <vector>
-#include "base/memory/scoped_ptr.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/base_window.h"
@@ -49,7 +49,7 @@ class NativeAppWindow : public ui::BaseWindow,
// Called when the window shape is changed. If |region| is NULL then the
// window is restored to the default shape.
- virtual void UpdateShape(scoped_ptr<SkRegion> region) = 0;
+ virtual void UpdateShape(std::unique_ptr<SkRegion> region) = 0;
// Allows the window to handle unhandled keyboard messages coming back from
// the renderer.
diff --git a/chromium/extensions/browser/app_window/test_app_window_contents.h b/chromium/extensions/browser/app_window/test_app_window_contents.h
index c118fe65e9e..8c082cbf20a 100644
--- a/chromium/extensions/browser/app_window/test_app_window_contents.h
+++ b/chromium/extensions/browser/app_window/test_app_window_contents.h
@@ -36,7 +36,7 @@ class TestAppWindowContents : public AppWindowContents {
WindowController* GetWindowController() const override;
private:
- scoped_ptr<content::WebContents> web_contents_;
+ std::unique_ptr<content::WebContents> web_contents_;
DISALLOW_COPY_AND_ASSIGN(TestAppWindowContents);
};
diff --git a/chromium/extensions/browser/blob_holder.cc b/chromium/extensions/browser/blob_holder.cc
index 552c17ada34..26e2ee91120 100644
--- a/chromium/extensions/browser/blob_holder.cc
+++ b/chromium/extensions/browser/blob_holder.cc
@@ -41,7 +41,7 @@ BlobHolder::~BlobHolder() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
}
-void BlobHolder::HoldBlobReference(scoped_ptr<content::BlobHandle> blob) {
+void BlobHolder::HoldBlobReference(std::unique_ptr<content::BlobHandle> blob) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!ContainsBlobHandle(blob.get()));
diff --git a/chromium/extensions/browser/blob_holder.h b/chromium/extensions/browser/blob_holder.h
index efaed928074..68e519d608c 100644
--- a/chromium/extensions/browser/blob_holder.h
+++ b/chromium/extensions/browser/blob_holder.h
@@ -6,12 +6,12 @@
#define EXTENSIONS_BROWSER_BLOB_HOLDER_H_
#include <map>
+#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/supports_user_data.h"
namespace content {
@@ -34,7 +34,7 @@ class BlobHolder : public base::SupportsUserData::Data {
~BlobHolder() override;
// Causes BlobHolder to take ownership of |blob|.
- void HoldBlobReference(scoped_ptr<content::BlobHandle> blob);
+ void HoldBlobReference(std::unique_ptr<content::BlobHandle> blob);
private:
typedef std::multimap<std::string, linked_ptr<content::BlobHandle> >
diff --git a/chromium/extensions/browser/computed_hashes.cc b/chromium/extensions/browser/computed_hashes.cc
index 35ea525508b..dbfe0061099 100644
--- a/chromium/extensions/browser/computed_hashes.cc
+++ b/chromium/extensions/browser/computed_hashes.cc
@@ -37,7 +37,7 @@ bool ComputedHashes::Reader::InitFromFile(const base::FilePath& path) {
return false;
base::DictionaryValue* top_dictionary = NULL;
- scoped_ptr<base::Value> value(base::JSONReader::Read(contents));
+ std::unique_ptr<base::Value> value(base::JSONReader::Read(contents));
if (!value.get() || !value->GetAsDictionary(&top_dictionary))
return false;
@@ -177,7 +177,7 @@ void ComputedHashes::ComputeHashesForContent(const std::string& contents,
const char* block_start = contents.data() + offset;
DCHECK(offset <= contents.size());
size_t bytes_to_read = std::min(contents.size() - offset, block_size);
- scoped_ptr<crypto::SecureHash> hash(
+ std::unique_ptr<crypto::SecureHash> hash(
crypto::SecureHash::Create(crypto::SecureHash::SHA256));
hash->Update(block_start, bytes_to_read);
diff --git a/chromium/extensions/browser/computed_hashes.h b/chromium/extensions/browser/computed_hashes.h
index 071abf08767..0451640e9a3 100644
--- a/chromium/extensions/browser/computed_hashes.h
+++ b/chromium/extensions/browser/computed_hashes.h
@@ -8,10 +8,10 @@
#include <stddef.h>
#include <map>
+#include <memory>
#include <string>
#include <vector>
-#include "base/memory/scoped_ptr.h"
namespace base {
class FilePath;
@@ -59,7 +59,7 @@ class ComputedHashes {
private:
// Each element of this list contains the path and block hashes for one
// file.
- scoped_ptr<base::ListValue> file_list_;
+ std::unique_ptr<base::ListValue> file_list_;
};
// Computes the SHA256 hash of each |block_size| chunk in |contents|, placing
diff --git a/chromium/extensions/browser/content_hash_fetcher.cc b/chromium/extensions/browser/content_hash_fetcher.cc
index dbe0f2185ab..678cf5f659c 100644
--- a/chromium/extensions/browser/content_hash_fetcher.cc
+++ b/chromium/extensions/browser/content_hash_fetcher.cc
@@ -21,6 +21,7 @@
#include "base/version.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/storage_partition.h"
#include "crypto/sha2.h"
#include "extensions/browser/computed_hashes.h"
#include "extensions/browser/content_hash_tree.h"
@@ -138,14 +139,14 @@ class ContentHashFetcherJob
content::BrowserThread::ID creation_thread_;
// Used for fetching content signatures.
- scoped_ptr<net::URLFetcher> url_fetcher_;
+ std::unique_ptr<net::URLFetcher> url_fetcher_;
// The key used to validate verified_contents.json.
ContentVerifierKey key_;
// The parsed contents of the verified_contents.json file, either read from
// disk or fetched from the network and then written to disk.
- scoped_ptr<VerifiedContents> verified_contents_;
+ std::unique_ptr<VerifiedContents> verified_contents_;
// Whether this job succeeded.
bool success_;
@@ -255,7 +256,7 @@ void ContentHashFetcherJob::DoneCheckingForVerifiedContents(bool found) {
// contents to be written into a file. Also ensures that the directory for
// |path| exists, creating it if needed.
static int WriteFileHelper(const base::FilePath& path,
- scoped_ptr<std::string> content) {
+ std::unique_ptr<std::string> content) {
base::FilePath dir = path.DirName();
return (base::CreateDirectoryAndGetError(dir, NULL) &&
base::WriteFile(path, content->data(), content->size()));
@@ -267,7 +268,7 @@ void ContentHashFetcherJob::OnURLFetchComplete(const net::URLFetcher* source) {
<< fetch_url_.possibly_invalid_spec();
if (IsCancelled())
return;
- scoped_ptr<std::string> response(new std::string);
+ std::unique_ptr<std::string> response(new std::string);
if (!url_fetcher_->GetStatus().is_success() ||
!url_fetcher_->GetResponseAsString(response.get())) {
DoneFetchingVerifiedContents(false);
@@ -278,7 +279,7 @@ void ContentHashFetcherJob::OnURLFetchComplete(const net::URLFetcher* source) {
// can be a login redirect html, xml file, etc. if you aren't logged in with
// the right cookies). TODO(asargent) - It would be a nice enhancement to
// move to parsing this in a sandboxed helper (crbug.com/372878).
- scoped_ptr<base::Value> parsed(base::JSONReader::Read(*response));
+ std::unique_ptr<base::Value> parsed(base::JSONReader::Read(*response));
if (parsed) {
VLOG(1) << "JSON parsed ok for " << extension_id_;
@@ -462,7 +463,9 @@ void ContentHashFetcher::DoFetch(const Extension* extension, bool force) {
GURL url =
delegate_->GetSignatureFetchUrl(extension->id(), *extension->version());
ContentHashFetcherJob* job = new ContentHashFetcherJob(
- context_->GetRequestContext(), delegate_->GetPublicKey(), extension->id(),
+ content::BrowserContext::GetDefaultStoragePartition(context_)->
+ GetURLRequestContext(),
+ delegate_->GetPublicKey(), extension->id(),
extension->path(), url, force,
base::Bind(&ContentHashFetcher::JobFinished,
weak_ptr_factory_.GetWeakPtr()));
diff --git a/chromium/extensions/browser/content_hash_reader.h b/chromium/extensions/browser/content_hash_reader.h
index 882b20b612e..b8b5c30ff9e 100644
--- a/chromium/extensions/browser/content_hash_reader.h
+++ b/chromium/extensions/browser/content_hash_reader.h
@@ -5,13 +5,13 @@
#ifndef EXTENSIONS_BROWSER_CONTENT_HASH_READER_H_
#define EXTENSIONS_BROWSER_CONTENT_HASH_READER_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/version.h"
#include "extensions/browser/content_verifier_delegate.h"
@@ -82,7 +82,7 @@ class ContentHashReader : public base::RefCountedThreadSafe<ContentHashReader> {
// The blocksize used for generating the hashes.
int block_size_;
- scoped_ptr<VerifiedContents> verified_contents_;
+ std::unique_ptr<VerifiedContents> verified_contents_;
std::vector<std::string> hashes_;
diff --git a/chromium/extensions/browser/content_hash_tree.cc b/chromium/extensions/browser/content_hash_tree.cc
index 9831c12e7f8..8abbf6fd9f1 100644
--- a/chromium/extensions/browser/content_hash_tree.cc
+++ b/chromium/extensions/browser/content_hash_tree.cc
@@ -4,7 +4,8 @@
#include "extensions/browser/content_hash_tree.h"
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/stl_util.h"
#include "crypto/secure_hash.h"
#include "crypto/sha2.h"
@@ -32,7 +33,7 @@ std::string ComputeTreeHashRoot(const std::vector<std::string>& leaf_hashes,
// |branch_factor| elements to form the hash of each parent node.
std::vector<std::string>::const_iterator i = current->begin();
while (i != current->end()) {
- scoped_ptr<crypto::SecureHash> hash(
+ std::unique_ptr<crypto::SecureHash> hash(
crypto::SecureHash::Create(crypto::SecureHash::SHA256));
for (int j = 0; j < branch_factor && i != current->end(); j++) {
DCHECK_EQ(i->size(), crypto::kSHA256Length);
diff --git a/chromium/extensions/browser/content_hash_tree_unittest.cc b/chromium/extensions/browser/content_hash_tree_unittest.cc
index b5aada8c9cc..6d35dd55b8c 100644
--- a/chromium/extensions/browser/content_hash_tree_unittest.cc
+++ b/chromium/extensions/browser/content_hash_tree_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 "base/memory/scoped_ptr.h"
+#include "extensions/browser/content_hash_tree.h"
+
+#include <memory>
+
#include "base/stl_util.h"
#include "crypto/secure_hash.h"
#include "crypto/sha2.h"
-#include "extensions/browser/content_hash_tree.h"
#include "testing/gtest/include/gtest/gtest.h"
using crypto::kSHA256Length;
@@ -38,7 +40,7 @@ TEST(ContentHashTreeTest, HashTreeBasics) {
nodes.push_back(node2);
std::string expected(kSHA256Length, 0);
- scoped_ptr<SecureHash> hash(SecureHash::Create(SecureHash::SHA256));
+ std::unique_ptr<SecureHash> hash(SecureHash::Create(SecureHash::SHA256));
hash->Update(node1.data(), node1.size());
hash->Update(node2.data(), node2.size());
hash->Finish(string_as_array(&expected), expected.size());
diff --git a/chromium/extensions/browser/content_verifier.cc b/chromium/extensions/browser/content_verifier.cc
index ea464e81be8..c47db07826f 100644
--- a/chromium/extensions/browser/content_verifier.cc
+++ b/chromium/extensions/browser/content_verifier.cc
@@ -158,13 +158,13 @@ void ContentVerifier::OnExtensionLoaded(
std::set<base::FilePath> original_image_paths =
delegate_->GetBrowserImagePaths(extension);
- scoped_ptr<std::set<base::FilePath>> image_paths(
+ std::unique_ptr<std::set<base::FilePath>> image_paths(
new std::set<base::FilePath>);
for (const auto& path : original_image_paths) {
image_paths->insert(NormalizeRelativePath(path));
}
- scoped_ptr<ContentVerifierIOData::ExtensionData> data(
+ std::unique_ptr<ContentVerifierIOData::ExtensionData> data(
new ContentVerifierIOData::ExtensionData(
std::move(image_paths),
extension->version() ? *extension->version() : base::Version()));
@@ -251,7 +251,7 @@ bool ContentVerifier::ShouldVerifyAnyPaths(
const std::set<base::FilePath>& browser_images = *(data->browser_image_paths);
base::FilePath locales_dir = extension_root.Append(kLocaleFolder);
- scoped_ptr<std::set<std::string> > all_locales;
+ std::unique_ptr<std::set<std::string>> all_locales;
for (std::set<base::FilePath>::const_iterator i = relative_paths.begin();
i != relative_paths.end();
diff --git a/chromium/extensions/browser/content_verifier.h b/chromium/extensions/browser/content_verifier.h
index 8d6f47b5c64..83707bbc04c 100644
--- a/chromium/extensions/browser/content_verifier.h
+++ b/chromium/extensions/browser/content_verifier.h
@@ -5,12 +5,12 @@
#ifndef EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_
#define EXTENSIONS_BROWSER_CONTENT_VERIFIER_H_
+#include <memory>
#include <set>
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "base/version.h"
#include "extensions/browser/content_verifier_delegate.h"
@@ -95,10 +95,10 @@ class ContentVerifier : public base::RefCountedThreadSafe<ContentVerifier>,
content::BrowserContext* context_;
- scoped_ptr<ContentVerifierDelegate> delegate_;
+ std::unique_ptr<ContentVerifierDelegate> delegate_;
// For fetching content hash signatures.
- scoped_ptr<ContentHashFetcher> fetcher_;
+ std::unique_ptr<ContentHashFetcher> fetcher_;
// For observing the ExtensionRegistry.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> observer_;
diff --git a/chromium/extensions/browser/content_verifier_io_data.cc b/chromium/extensions/browser/content_verifier_io_data.cc
index d3353be2526..8f8854c994c 100644
--- a/chromium/extensions/browser/content_verifier_io_data.cc
+++ b/chromium/extensions/browser/content_verifier_io_data.cc
@@ -11,7 +11,7 @@
namespace extensions {
ContentVerifierIOData::ExtensionData::ExtensionData(
- scoped_ptr<std::set<base::FilePath>> browser_image_paths,
+ std::unique_ptr<std::set<base::FilePath>> browser_image_paths,
const base::Version& version) {
this->browser_image_paths = std::move(browser_image_paths);
this->version = version;
@@ -27,7 +27,7 @@ ContentVerifierIOData::~ContentVerifierIOData() {
}
void ContentVerifierIOData::AddData(const std::string& extension_id,
- scoped_ptr<ExtensionData> data) {
+ std::unique_ptr<ExtensionData> data) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
CHECK(data->browser_image_paths.get());
data_map_[extension_id] = linked_ptr<ExtensionData>(data.release());
diff --git a/chromium/extensions/browser/content_verifier_io_data.h b/chromium/extensions/browser/content_verifier_io_data.h
index 92e8248b8ca..65f38efa44c 100644
--- a/chromium/extensions/browser/content_verifier_io_data.h
+++ b/chromium/extensions/browser/content_verifier_io_data.h
@@ -6,13 +6,13 @@
#define EXTENSIONS_BROWSER_CONTENT_VERIFIER_IO_DATA_H_
#include <map>
+#include <memory>
#include <set>
#include <string>
#include "base/files/file_path.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/version.h"
namespace extensions {
@@ -23,17 +23,18 @@ class ContentVerifierIOData
: public base::RefCountedThreadSafe<ContentVerifierIOData> {
public:
struct ExtensionData {
- scoped_ptr<std::set<base::FilePath>> browser_image_paths;
+ std::unique_ptr<std::set<base::FilePath>> browser_image_paths;
base::Version version;
- ExtensionData(scoped_ptr<std::set<base::FilePath>> browser_image_paths,
+ ExtensionData(std::unique_ptr<std::set<base::FilePath>> browser_image_paths,
const base::Version& version);
~ExtensionData();
};
ContentVerifierIOData();
- void AddData(const std::string& extension_id, scoped_ptr<ExtensionData> data);
+ void AddData(const std::string& extension_id,
+ std::unique_ptr<ExtensionData> data);
void RemoveData(const std::string& extension_id);
void Clear();
diff --git a/chromium/extensions/browser/content_verify_job.h b/chromium/extensions/browser/content_verify_job.h
index 30e46e1d145..fc9223026c9 100644
--- a/chromium/extensions/browser/content_verify_job.h
+++ b/chromium/extensions/browser/content_verify_job.h
@@ -7,12 +7,12 @@
#include <stdint.h>
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/thread_checker.h"
namespace base {
@@ -129,7 +129,7 @@ class ContentVerifyJob : public base::RefCountedThreadSafe<ContentVerifyJob> {
int current_block_;
// The hash we're building up for the bytes of |current_block_|.
- scoped_ptr<crypto::SecureHash> current_hash_;
+ std::unique_ptr<crypto::SecureHash> current_hash_;
// The number of bytes we've already input into |current_hash_|.
int current_hash_byte_count_;
diff --git a/chromium/extensions/browser/declarative_user_script_master.h b/chromium/extensions/browser/declarative_user_script_master.h
index 64f8daec6b3..422b747ffab 100644
--- a/chromium/extensions/browser/declarative_user_script_master.h
+++ b/chromium/extensions/browser/declarative_user_script_master.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_
#define EXTENSIONS_BROWSER_DECLARATIVE_USER_SCRIPT_MASTER_H_
+#include <memory>
#include <set>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "extensions/common/host_id.h"
@@ -65,7 +65,7 @@ class DeclarativeUserScriptMaster {
// Script loader that handles loading contents of scripts into shared memory
// and notifying renderers of script updates.
- scoped_ptr<UserScriptLoader> loader_;
+ std::unique_ptr<UserScriptLoader> loader_;
DISALLOW_COPY_AND_ASSIGN(DeclarativeUserScriptMaster);
};
diff --git a/chromium/extensions/browser/error_map.cc b/chromium/extensions/browser/error_map.cc
index 5f94e34284a..9a806002859 100644
--- a/chromium/extensions/browser/error_map.cc
+++ b/chromium/extensions/browser/error_map.cc
@@ -98,7 +98,7 @@ class ErrorMap::ExtensionEntry {
void DeleteAllErrors();
// Add the error to the list, and return a weak reference.
- const ExtensionError* AddError(scoped_ptr<ExtensionError> error);
+ const ExtensionError* AddError(std::unique_ptr<ExtensionError> error);
const ErrorList* list() const { return &list_; }
@@ -138,7 +138,7 @@ void ErrorMap::ExtensionEntry::DeleteAllErrors() {
}
const ExtensionError* ErrorMap::ExtensionEntry::AddError(
- scoped_ptr<ExtensionError> error) {
+ std::unique_ptr<ExtensionError> error) {
for (ErrorList::iterator iter = list_.begin(); iter != list_.end(); ++iter) {
// If we find a duplicate error, remove the old error and add the new one,
// incrementing the occurrence count of the error. We use the new error
@@ -182,7 +182,8 @@ const ErrorList& ErrorMap::GetErrorsForExtension(
return iter != map_.end() ? *iter->second->list() : g_empty_error_list.Get();
}
-const ExtensionError* ErrorMap::AddError(scoped_ptr<ExtensionError> error) {
+const ExtensionError* ErrorMap::AddError(
+ std::unique_ptr<ExtensionError> error) {
EntryMap::iterator iter = map_.find(error->extension_id());
if (iter == map_.end()) {
iter = map_.insert(std::pair<std::string, ExtensionEntry*>(
diff --git a/chromium/extensions/browser/error_map.h b/chromium/extensions/browser/error_map.h
index 929335ab48d..c4c7f102c21 100644
--- a/chromium/extensions/browser/error_map.h
+++ b/chromium/extensions/browser/error_map.h
@@ -9,11 +9,11 @@
#include <deque>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/extension_error.h"
namespace extensions {
@@ -61,7 +61,7 @@ class ErrorMap {
const ErrorList& GetErrorsForExtension(const std::string& extension_id) const;
// Add the |error| to the ErrorMap.
- const ExtensionError* AddError(scoped_ptr<ExtensionError> error);
+ const ExtensionError* AddError(std::unique_ptr<ExtensionError> error);
// Removes errors that match the given |filter| from the map. If non-null,
// |affected_ids| will be populated with the set of extension ids that were
diff --git a/chromium/extensions/browser/error_map_unittest.cc b/chromium/extensions/browser/error_map_unittest.cc
index a118f6e53c8..2b43f33f972 100644
--- a/chromium/extensions/browser/error_map_unittest.cc
+++ b/chromium/extensions/browser/error_map_unittest.cc
@@ -6,10 +6,10 @@
#include <stddef.h>
+#include <memory>
#include <utility>
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "components/crx_file/id_util.h"
#include "extensions/browser/extension_error.h"
@@ -151,7 +151,7 @@ TEST_F(ErrorMapUnitTest, DuplicateErrorsAreReplaced) {
// Create an error identical to the second error reported, save its
// location, and add it to the error map.
- scoped_ptr<ExtensionError> runtime_error2 =
+ std::unique_ptr<ExtensionError> runtime_error2 =
CreateNewRuntimeError(kId, base::UintToString(1u));
const ExtensionError* weak_error = runtime_error2.get();
ASSERT_TRUE(errors_.AddError(std::move(runtime_error2)));
diff --git a/chromium/extensions/browser/event_listener_map.cc b/chromium/extensions/browser/event_listener_map.cc
index af91b6fbec2..1dc908342b0 100644
--- a/chromium/extensions/browser/event_listener_map.cc
+++ b/chromium/extensions/browser/event_listener_map.cc
@@ -8,6 +8,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/event_router.h"
@@ -21,23 +22,23 @@ namespace extensions {
typedef EventFilter::MatcherID MatcherID;
// static
-scoped_ptr<EventListener> EventListener::ForExtension(
+std::unique_ptr<EventListener> EventListener::ForExtension(
const std::string& event_name,
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, std::move(filter)));
+ std::unique_ptr<base::DictionaryValue> filter) {
+ return base::WrapUnique(new EventListener(event_name, extension_id, GURL(),
+ process, std::move(filter)));
}
// static
-scoped_ptr<EventListener> EventListener::ForURL(
+std::unique_ptr<EventListener> EventListener::ForURL(
const std::string& event_name,
const GURL& listener_url,
content::RenderProcessHost* process,
- scoped_ptr<base::DictionaryValue> filter) {
- return make_scoped_ptr(new EventListener(event_name, "", listener_url,
- process, std::move(filter)));
+ std::unique_ptr<base::DictionaryValue> filter) {
+ return base::WrapUnique(new EventListener(event_name, "", listener_url,
+ process, std::move(filter)));
}
EventListener::~EventListener() {}
@@ -53,13 +54,13 @@ bool EventListener::Equals(const EventListener* other) const {
(!filter_.get() || filter_->Equals(other->filter_.get()));
}
-scoped_ptr<EventListener> EventListener::Copy() const {
- scoped_ptr<DictionaryValue> filter_copy;
+std::unique_ptr<EventListener> EventListener::Copy() const {
+ std::unique_ptr<DictionaryValue> filter_copy;
if (filter_)
filter_copy.reset(filter_->DeepCopy());
- return scoped_ptr<EventListener>(new EventListener(event_name_, extension_id_,
- listener_url_, process_,
- std::move(filter_copy)));
+ return std::unique_ptr<EventListener>(
+ new EventListener(event_name_, extension_id_, listener_url_, process_,
+ std::move(filter_copy)));
}
bool EventListener::IsLazy() const {
@@ -78,7 +79,7 @@ EventListener::EventListener(const std::string& event_name,
const std::string& extension_id,
const GURL& listener_url,
content::RenderProcessHost* process,
- scoped_ptr<DictionaryValue> filter)
+ std::unique_ptr<DictionaryValue> filter)
: event_name_(event_name),
extension_id_(extension_id),
listener_url_(listener_url),
@@ -92,11 +93,12 @@ EventListenerMap::EventListenerMap(Delegate* delegate)
EventListenerMap::~EventListenerMap() {}
-bool EventListenerMap::AddListener(scoped_ptr<EventListener> listener) {
+bool EventListenerMap::AddListener(std::unique_ptr<EventListener> listener) {
if (HasListener(listener.get()))
return false;
if (listener->filter()) {
- scoped_ptr<EventMatcher> matcher(ParseEventMatcher(listener->filter()));
+ std::unique_ptr<EventMatcher> matcher(
+ ParseEventMatcher(listener->filter()));
MatcherID id = event_filter_.AddEventMatcher(listener->event_name(),
std::move(matcher));
listener->set_matcher_id(id);
@@ -111,10 +113,10 @@ bool EventListenerMap::AddListener(scoped_ptr<EventListener> listener) {
return true;
}
-scoped_ptr<EventMatcher> EventListenerMap::ParseEventMatcher(
+std::unique_ptr<EventMatcher> EventListenerMap::ParseEventMatcher(
DictionaryValue* filter_dict) {
- return scoped_ptr<EventMatcher>(new EventMatcher(
- make_scoped_ptr(filter_dict->DeepCopy()), MSG_ROUTING_NONE));
+ return std::unique_ptr<EventMatcher>(new EventMatcher(
+ base::WrapUnique(filter_dict->DeepCopy()), MSG_ROUTING_NONE));
}
bool EventListenerMap::RemoveListener(const EventListener* listener) {
@@ -204,7 +206,7 @@ void EventListenerMap::LoadUnfilteredLazyListeners(
for (std::set<std::string>::const_iterator it = event_names.begin();
it != event_names.end(); ++it) {
AddListener(EventListener::ForExtension(
- *it, extension_id, NULL, scoped_ptr<DictionaryValue>()));
+ *it, extension_id, NULL, std::unique_ptr<DictionaryValue>()));
}
}
@@ -221,7 +223,7 @@ void EventListenerMap::LoadFilteredLazyListeners(
if (!filter_list->GetDictionary(i, &filter))
continue;
AddListener(EventListener::ForExtension(
- it.key(), extension_id, NULL, make_scoped_ptr(filter->DeepCopy())));
+ it.key(), extension_id, NULL, base::WrapUnique(filter->DeepCopy())));
}
}
}
diff --git a/chromium/extensions/browser/event_listener_map.h b/chromium/extensions/browser/event_listener_map.h
index 0ce5f3c3ac5..fe1568edc02 100644
--- a/chromium/extensions/browser/event_listener_map.h
+++ b/chromium/extensions/browser/event_listener_map.h
@@ -6,12 +6,12 @@
#define EXTENSIONS_BROWSER_EVENT_LISTENER_MAP_H_
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/common/event_filter.h"
#include "url/gurl.h"
@@ -50,22 +50,22 @@ class EventListener {
// url: [{hostSuffix: 'google.com'}],
// tabId: 5
// }
- static scoped_ptr<EventListener> ForExtension(
+ static std::unique_ptr<EventListener> ForExtension(
const std::string& event_name,
const std::string& extension_id,
content::RenderProcessHost* process,
- scoped_ptr<base::DictionaryValue> filter);
- static scoped_ptr<EventListener> ForURL(
+ std::unique_ptr<base::DictionaryValue> filter);
+ static std::unique_ptr<EventListener> ForURL(
const std::string& event_name,
const GURL& listener_url,
content::RenderProcessHost* process,
- scoped_ptr<base::DictionaryValue> filter);
+ std::unique_ptr<base::DictionaryValue> filter);
~EventListener();
bool Equals(const EventListener* other) const;
- scoped_ptr<EventListener> Copy() const;
+ std::unique_ptr<EventListener> Copy() const;
// Returns true in the case of a lazy background page, and thus no process.
bool IsLazy() const;
@@ -90,13 +90,13 @@ class EventListener {
const std::string& extension_id,
const GURL& listener_url,
content::RenderProcessHost* process,
- scoped_ptr<base::DictionaryValue> filter);
+ std::unique_ptr<base::DictionaryValue> filter);
const std::string event_name_;
const std::string extension_id_;
const GURL listener_url_;
content::RenderProcessHost* process_;
- scoped_ptr<base::DictionaryValue> filter_;
+ std::unique_ptr<base::DictionaryValue> filter_;
EventFilter::MatcherID matcher_id_; // -1 if unset.
DISALLOW_COPY_AND_ASSIGN(EventListener);
@@ -123,7 +123,7 @@ class EventListenerMap {
// extensions::Event.
// Returns true if the listener was added (in the case that it has never been
// seen before).
- bool AddListener(scoped_ptr<EventListener> listener);
+ bool AddListener(std::unique_ptr<EventListener> listener);
// Remove a listener that .Equals() |listener|.
// Returns true if the listener was removed .
@@ -178,7 +178,7 @@ class EventListenerMap {
void CleanupListener(EventListener* listener);
bool IsFilteredEvent(const Event& event) const;
- scoped_ptr<EventMatcher> ParseEventMatcher(
+ std::unique_ptr<EventMatcher> ParseEventMatcher(
base::DictionaryValue* filter_dict);
// Listens for removals from this map.
diff --git a/chromium/extensions/browser/event_listener_map_unittest.cc b/chromium/extensions/browser/event_listener_map_unittest.cc
index 0fa17d08267..0b691cef623 100644
--- a/chromium/extensions/browser/event_listener_map_unittest.cc
+++ b/chromium/extensions/browser/event_listener_map_unittest.cc
@@ -5,6 +5,7 @@
#include "extensions/browser/event_listener_map.h"
#include "base/bind.h"
+#include "base/memory/ptr_util.h"
#include "content/public/test/mock_render_process_host.h"
#include "content/public/test/test_browser_context.h"
#include "extensions/browser/event_router.h"
@@ -25,11 +26,12 @@ const char kEvent1Name[] = "event1";
const char kEvent2Name[] = "event2";
const char kURL[] = "https://google.com/some/url";
-typedef base::Callback<scoped_ptr<EventListener>(
+typedef base::Callback<std::unique_ptr<EventListener>(
const std::string&, // event_name
content::RenderProcessHost*, // process
base::DictionaryValue* // filter (takes ownership)
- )> EventListenerConstructor;
+ )>
+ EventListenerConstructor;
class EmptyDelegate : public EventListenerMap::Delegate {
void OnListenerAdded(const EventListener* listener) override{};
@@ -44,11 +46,11 @@ class EventListenerMapTest : public testing::Test {
browser_context_(new content::TestBrowserContext),
process_(new content::MockRenderProcessHost(browser_context_.get())) {}
- scoped_ptr<DictionaryValue> CreateHostSuffixFilter(
+ std::unique_ptr<DictionaryValue> CreateHostSuffixFilter(
const std::string& suffix) {
- scoped_ptr<DictionaryValue> filter(new DictionaryValue);
- scoped_ptr<ListValue> filter_list(new ListValue);
- scoped_ptr<DictionaryValue> filter_dict(new DictionaryValue);
+ std::unique_ptr<DictionaryValue> filter(new DictionaryValue);
+ std::unique_ptr<ListValue> filter_list(new ListValue);
+ std::unique_ptr<DictionaryValue> filter_dict(new DictionaryValue);
filter_dict->Set("hostSuffix", new StringValue(suffix));
@@ -57,16 +59,16 @@ class EventListenerMapTest : public testing::Test {
return filter;
}
- scoped_ptr<Event> CreateNamedEvent(const std::string& event_name) {
+ std::unique_ptr<Event> CreateNamedEvent(const std::string& event_name) {
return CreateEvent(event_name, GURL());
}
- scoped_ptr<Event> CreateEvent(const std::string& event_name,
- const GURL& url) {
+ std::unique_ptr<Event> CreateEvent(const std::string& event_name,
+ const GURL& url) {
EventFilteringInfo info;
info.SetURL(url);
- scoped_ptr<Event> result(new Event(
- events::FOR_TEST, event_name, make_scoped_ptr(new ListValue()), NULL,
+ std::unique_ptr<Event> result(new Event(
+ events::FOR_TEST, event_name, base::WrapUnique(new ListValue()), NULL,
GURL(), EventRouter::USER_GESTURE_UNKNOWN, info));
return result;
}
@@ -80,35 +82,35 @@ class EventListenerMapTest : public testing::Test {
const EventListenerConstructor& constructor);
void TestHasListenerForEvent(const EventListenerConstructor& constructor);
- scoped_ptr<EventListenerMap::Delegate> delegate_;
- scoped_ptr<EventListenerMap> listeners_;
- scoped_ptr<content::TestBrowserContext> browser_context_;
- scoped_ptr<content::MockRenderProcessHost> process_;
+ std::unique_ptr<EventListenerMap::Delegate> delegate_;
+ std::unique_ptr<EventListenerMap> listeners_;
+ std::unique_ptr<content::TestBrowserContext> browser_context_;
+ std::unique_ptr<content::MockRenderProcessHost> process_;
};
-scoped_ptr<EventListener> CreateEventListenerForExtension(
+std::unique_ptr<EventListener> CreateEventListenerForExtension(
const std::string& extension_id,
const std::string& event_name,
content::RenderProcessHost* process,
base::DictionaryValue* filter) {
- return EventListener::ForExtension(
- event_name, extension_id, process, make_scoped_ptr(filter));
+ return EventListener::ForExtension(event_name, extension_id, process,
+ base::WrapUnique(filter));
}
-scoped_ptr<EventListener> CreateEventListenerForURL(
+std::unique_ptr<EventListener> CreateEventListenerForURL(
const GURL& listener_url,
const std::string& event_name,
content::RenderProcessHost* process,
base::DictionaryValue* filter) {
- return EventListener::ForURL(
- event_name, listener_url, process, make_scoped_ptr(filter));
+ return EventListener::ForURL(event_name, listener_url, process,
+ base::WrapUnique(filter));
}
void EventListenerMapTest::TestUnfilteredEventsGoToAllListeners(
const EventListenerConstructor& constructor) {
listeners_->AddListener(
constructor.Run(kEvent1Name, NULL, new DictionaryValue()));
- scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
+ std::unique_ptr<Event> event(CreateNamedEvent(kEvent1Name));
ASSERT_EQ(1u, listeners_->GetEventListeners(*event).size());
}
@@ -126,12 +128,10 @@ TEST_F(EventListenerMapTest, FilteredEventsGoToAllMatchingListeners) {
listeners_->AddListener(EventListener::ForExtension(
kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name,
- kExt1Id,
- NULL,
- scoped_ptr<DictionaryValue>(new DictionaryValue)));
+ kEvent1Name, kExt1Id, NULL,
+ std::unique_ptr<DictionaryValue>(new DictionaryValue)));
- scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
+ std::unique_ptr<Event> event(CreateNamedEvent(kEvent1Name));
event->filter_info.SetURL(GURL("http://www.google.com"));
std::set<const EventListener*> targets(listeners_->GetEventListeners(*event));
ASSERT_EQ(2u, targets.size());
@@ -143,7 +143,7 @@ TEST_F(EventListenerMapTest, FilteredEventsOnlyGoToMatchingListeners) {
listeners_->AddListener(EventListener::ForExtension(
kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("yahoo.com")));
- scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
+ std::unique_ptr<Event> event(CreateNamedEvent(kEvent1Name));
event->filter_info.SetURL(GURL("http://www.google.com"));
std::set<const EventListener*> targets(listeners_->GetEventListeners(*event));
ASSERT_EQ(1u, targets.size());
@@ -159,7 +159,7 @@ TEST_F(EventListenerMapTest, LazyAndUnlazyListenersGetReturned) {
process_.get(),
CreateHostSuffixFilter("google.com")));
- scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
+ std::unique_ptr<Event> event(CreateNamedEvent(kEvent1Name));
event->filter_info.SetURL(GURL("http://www.google.com"));
std::set<const EventListener*> targets(listeners_->GetEventListeners(*event));
ASSERT_EQ(2u, targets.size());
@@ -177,7 +177,7 @@ void EventListenerMapTest::TestRemovingByProcess(
listeners_->RemoveListenersForProcess(process_.get());
- scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
+ std::unique_ptr<Event> event(CreateNamedEvent(kEvent1Name));
event->filter_info.SetURL(GURL("http://www.google.com"));
ASSERT_EQ(1u, listeners_->GetEventListeners(*event).size());
}
@@ -200,13 +200,12 @@ void EventListenerMapTest::TestRemovingByListener(
process_.get(),
CreateHostSuffixFilter("google.com").release()));
- scoped_ptr<EventListener> listener(
- constructor.Run(kEvent1Name,
- process_.get(),
+ std::unique_ptr<EventListener> listener(
+ constructor.Run(kEvent1Name, process_.get(),
CreateHostSuffixFilter("google.com").release()));
listeners_->RemoveListener(listener.get());
- scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
+ std::unique_ptr<Event> event(CreateNamedEvent(kEvent1Name));
event->filter_info.SetURL(GURL("http://www.google.com"));
ASSERT_EQ(1u, listeners_->GetEventListeners(*event).size());
}
@@ -225,19 +224,21 @@ TEST_F(EventListenerMapTest, TestLazyDoubleAddIsUndoneByRemove) {
listeners_->AddListener(EventListener::ForExtension(
kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
- scoped_ptr<EventListener> listener(EventListener::ForExtension(
+ std::unique_ptr<EventListener> listener(EventListener::ForExtension(
kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
listeners_->RemoveListener(listener.get());
- scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
+ std::unique_ptr<Event> event(CreateNamedEvent(kEvent1Name));
event->filter_info.SetURL(GURL("http://www.google.com"));
std::set<const EventListener*> targets(listeners_->GetEventListeners(*event));
ASSERT_EQ(0u, targets.size());
}
TEST_F(EventListenerMapTest, HostSuffixFilterEquality) {
- scoped_ptr<DictionaryValue> filter1(CreateHostSuffixFilter("google.com"));
- scoped_ptr<DictionaryValue> filter2(CreateHostSuffixFilter("google.com"));
+ std::unique_ptr<DictionaryValue> filter1(
+ CreateHostSuffixFilter("google.com"));
+ std::unique_ptr<DictionaryValue> filter2(
+ CreateHostSuffixFilter("google.com"));
ASSERT_TRUE(filter1->Equals(filter2.get()));
}
@@ -249,7 +250,7 @@ TEST_F(EventListenerMapTest, RemoveListenersForExtension) {
listeners_->RemoveListenersForExtension(kExt1Id);
- scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
+ std::unique_ptr<Event> event(CreateNamedEvent(kEvent1Name));
event->filter_info.SetURL(GURL("http://www.google.com"));
std::set<const EventListener*> targets(listeners_->GetEventListeners(*event));
ASSERT_EQ(0u, targets.size());
@@ -276,7 +277,7 @@ void EventListenerMapTest::TestAddExistingUnfilteredListener(
bool second_add = listeners_->AddListener(
constructor.Run(kEvent1Name, NULL, new DictionaryValue()));
- scoped_ptr<EventListener> listener(
+ std::unique_ptr<EventListener> listener(
constructor.Run(kEvent1Name, NULL, new DictionaryValue()));
bool first_remove = listeners_->RemoveListener(listener.get());
bool second_remove = listeners_->RemoveListener(listener.get());
@@ -298,10 +299,12 @@ TEST_F(EventListenerMapTest, AddExistingUnfilteredListenerForURLs) {
}
TEST_F(EventListenerMapTest, RemovingRouters) {
- listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, process_.get(), scoped_ptr<DictionaryValue>()));
- listeners_->AddListener(EventListener::ForURL(
- kEvent1Name, GURL(kURL), process_.get(), scoped_ptr<DictionaryValue>()));
+ listeners_->AddListener(
+ EventListener::ForExtension(kEvent1Name, kExt1Id, process_.get(),
+ std::unique_ptr<DictionaryValue>()));
+ listeners_->AddListener(
+ EventListener::ForURL(kEvent1Name, GURL(kURL), process_.get(),
+ std::unique_ptr<DictionaryValue>()));
listeners_->RemoveListenersForProcess(process_.get());
ASSERT_FALSE(listeners_->HasListenerForEvent(kEvent1Name));
}
@@ -332,11 +335,12 @@ TEST_F(EventListenerMapTest, HasListenerForExtension) {
ASSERT_FALSE(listeners_->HasListenerForExtension(kExt1Id, kEvent1Name));
// Non-lazy listener.
- listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, process_.get(), scoped_ptr<DictionaryValue>()));
+ listeners_->AddListener(
+ EventListener::ForExtension(kEvent1Name, kExt1Id, process_.get(),
+ std::unique_ptr<DictionaryValue>()));
// Lazy listener.
listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, scoped_ptr<DictionaryValue>()));
+ kEvent1Name, kExt1Id, NULL, std::unique_ptr<DictionaryValue>()));
ASSERT_FALSE(listeners_->HasListenerForExtension(kExt1Id, kEvent2Name));
ASSERT_TRUE(listeners_->HasListenerForExtension(kExt1Id, kEvent1Name));
@@ -348,8 +352,9 @@ TEST_F(EventListenerMapTest, HasListenerForExtension) {
}
TEST_F(EventListenerMapTest, AddLazyListenersFromPreferences) {
- scoped_ptr<DictionaryValue> filter1(CreateHostSuffixFilter("google.com"));
- scoped_ptr<DictionaryValue> filter2(CreateHostSuffixFilter("yahoo.com"));
+ std::unique_ptr<DictionaryValue> filter1(
+ CreateHostSuffixFilter("google.com"));
+ std::unique_ptr<DictionaryValue> filter2(CreateHostSuffixFilter("yahoo.com"));
DictionaryValue filtered_listeners;
ListValue* filter_list = new ListValue();
@@ -360,17 +365,18 @@ TEST_F(EventListenerMapTest, AddLazyListenersFromPreferences) {
listeners_->LoadFilteredLazyListeners(kExt1Id, filtered_listeners);
- scoped_ptr<Event> event(CreateEvent(kEvent1Name,
- GURL("http://www.google.com")));
+ std::unique_ptr<Event> event(
+ CreateEvent(kEvent1Name, GURL("http://www.google.com")));
std::set<const EventListener*> targets(listeners_->GetEventListeners(*event));
ASSERT_EQ(1u, targets.size());
- scoped_ptr<EventListener> listener(EventListener::ForExtension(
+ std::unique_ptr<EventListener> listener(EventListener::ForExtension(
kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
ASSERT_TRUE((*targets.begin())->Equals(listener.get()));
}
TEST_F(EventListenerMapTest, CorruptedExtensionPrefsShouldntCrash) {
- scoped_ptr<DictionaryValue> filter1(CreateHostSuffixFilter("google.com"));
+ std::unique_ptr<DictionaryValue> filter1(
+ CreateHostSuffixFilter("google.com"));
DictionaryValue filtered_listeners;
// kEvent1Name should be associated with a list, not a dictionary.
@@ -378,8 +384,8 @@ TEST_F(EventListenerMapTest, CorruptedExtensionPrefsShouldntCrash) {
listeners_->LoadFilteredLazyListeners(kExt1Id, filtered_listeners);
- scoped_ptr<Event> event(CreateEvent(kEvent1Name,
- GURL("http://www.google.com")));
+ std::unique_ptr<Event> event(
+ CreateEvent(kEvent1Name, GURL("http://www.google.com")));
std::set<const EventListener*> targets(listeners_->GetEventListeners(*event));
ASSERT_EQ(0u, targets.size());
}
diff --git a/chromium/extensions/browser/event_router.cc b/chromium/extensions/browser/event_router.cc
index 0f56fe73906..6cc2c7b647b 100644
--- a/chromium/extensions/browser/event_router.cc
+++ b/chromium/extensions/browser/event_router.cc
@@ -13,6 +13,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/lazy_instance.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram_macros.h"
#include "base/stl_util.h"
@@ -62,7 +63,7 @@ const char kFilteredEvents[] = "filtered_events";
void NotifyEventDispatched(void* browser_context_id,
const std::string& extension_id,
const std::string& event_name,
- scoped_ptr<ListValue> args) {
+ std::unique_ptr<ListValue> args) {
// The ApiActivityMonitor can only be accessed from the UI thread.
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(
@@ -113,7 +114,7 @@ void EventRouter::DispatchExtensionMessage(IPC::Sender* ipc_sender,
UserGestureState user_gesture,
const EventFilteringInfo& info) {
NotifyEventDispatched(browser_context_id, extension_id, event_name,
- make_scoped_ptr(event_args->DeepCopy()));
+ base::WrapUnique(event_args->DeepCopy()));
// TODO(chirantan): Make event dispatch a separate IPC so that it doesn't
// piggyback off MessageInvoke, which is used for other things.
@@ -132,7 +133,7 @@ void EventRouter::DispatchExtensionMessage(IPC::Sender* ipc_sender,
// DispatchExtensionMessage does _not_ take ownership of event_args, so we
// must ensure that the destruction of args does not attempt to free it.
- scoped_ptr<base::Value> removed_event_args;
+ std::unique_ptr<base::Value> removed_event_args;
args.Remove(1, &removed_event_args);
ignore_result(removed_event_args.release());
}
@@ -154,7 +155,7 @@ void EventRouter::DispatchEventToSender(IPC::Sender* ipc_sender,
const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<ListValue> event_args,
+ std::unique_ptr<ListValue> event_args,
UserGestureState user_gesture,
const EventFilteringInfo& info) {
int event_id = g_extension_event_id.GetNext();
@@ -199,14 +200,14 @@ void EventRouter::AddEventListener(const std::string& event_name,
content::RenderProcessHost* process,
const std::string& extension_id) {
listeners_.AddListener(EventListener::ForExtension(
- event_name, extension_id, process, scoped_ptr<DictionaryValue>()));
+ event_name, extension_id, process, std::unique_ptr<DictionaryValue>()));
}
void EventRouter::RemoveEventListener(const std::string& event_name,
content::RenderProcessHost* process,
const std::string& extension_id) {
- scoped_ptr<EventListener> listener = EventListener::ForExtension(
- event_name, extension_id, process, scoped_ptr<DictionaryValue>());
+ std::unique_ptr<EventListener> listener = EventListener::ForExtension(
+ event_name, extension_id, process, std::unique_ptr<DictionaryValue>());
listeners_.RemoveListener(listener.get());
}
@@ -214,14 +215,14 @@ void EventRouter::AddEventListenerForURL(const std::string& event_name,
content::RenderProcessHost* process,
const GURL& listener_url) {
listeners_.AddListener(EventListener::ForURL(
- event_name, listener_url, process, scoped_ptr<DictionaryValue>()));
+ event_name, listener_url, process, std::unique_ptr<DictionaryValue>()));
}
void EventRouter::RemoveEventListenerForURL(const std::string& event_name,
content::RenderProcessHost* process,
const GURL& listener_url) {
- scoped_ptr<EventListener> listener = EventListener::ForURL(
- event_name, listener_url, process, scoped_ptr<DictionaryValue>());
+ std::unique_ptr<EventListener> listener = EventListener::ForURL(
+ event_name, listener_url, process, std::unique_ptr<DictionaryValue>());
listeners_.RemoveListener(listener.get());
}
@@ -289,7 +290,7 @@ void EventRouter::RenderProcessHostDestroyed(content::RenderProcessHost* host) {
void EventRouter::AddLazyEventListener(const std::string& event_name,
const std::string& extension_id) {
bool is_new = listeners_.AddListener(EventListener::ForExtension(
- event_name, extension_id, NULL, scoped_ptr<DictionaryValue>()));
+ event_name, extension_id, NULL, std::unique_ptr<DictionaryValue>()));
if (is_new) {
std::set<std::string> events = GetRegisteredEvents(extension_id);
@@ -301,8 +302,8 @@ void EventRouter::AddLazyEventListener(const std::string& event_name,
void EventRouter::RemoveLazyEventListener(const std::string& event_name,
const std::string& extension_id) {
- scoped_ptr<EventListener> listener = EventListener::ForExtension(
- event_name, extension_id, NULL, scoped_ptr<DictionaryValue>());
+ std::unique_ptr<EventListener> listener = EventListener::ForExtension(
+ event_name, extension_id, NULL, std::unique_ptr<DictionaryValue>());
bool did_exist = listeners_.RemoveListener(listener.get());
if (did_exist) {
@@ -319,17 +320,13 @@ void EventRouter::AddFilteredEventListener(const std::string& event_name,
const base::DictionaryValue& filter,
bool add_lazy_listener) {
listeners_.AddListener(EventListener::ForExtension(
- event_name,
- extension_id,
- process,
- scoped_ptr<DictionaryValue>(filter.DeepCopy())));
+ event_name, extension_id, process,
+ std::unique_ptr<DictionaryValue>(filter.DeepCopy())));
if (add_lazy_listener) {
bool added = listeners_.AddListener(EventListener::ForExtension(
- event_name,
- extension_id,
- NULL,
- scoped_ptr<DictionaryValue>(filter.DeepCopy())));
+ event_name, extension_id, NULL,
+ std::unique_ptr<DictionaryValue>(filter.DeepCopy())));
if (added)
AddFilterToEvent(event_name, extension_id, &filter);
@@ -342,11 +339,9 @@ void EventRouter::RemoveFilteredEventListener(
const std::string& extension_id,
const base::DictionaryValue& filter,
bool remove_lazy_listener) {
- scoped_ptr<EventListener> listener = EventListener::ForExtension(
- event_name,
- extension_id,
- process,
- scoped_ptr<DictionaryValue>(filter.DeepCopy()));
+ std::unique_ptr<EventListener> listener = EventListener::ForExtension(
+ event_name, extension_id, process,
+ std::unique_ptr<DictionaryValue>(filter.DeepCopy()));
listeners_.RemoveListener(listener.get());
@@ -465,18 +460,18 @@ const DictionaryValue* EventRouter::GetFilteredEvents(
return events;
}
-void EventRouter::BroadcastEvent(scoped_ptr<Event> event) {
+void EventRouter::BroadcastEvent(std::unique_ptr<Event> event) {
DispatchEventImpl(std::string(), linked_ptr<Event>(event.release()));
}
void EventRouter::DispatchEventToExtension(const std::string& extension_id,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK(!extension_id.empty());
DispatchEventImpl(extension_id, linked_ptr<Event>(event.release()));
}
void EventRouter::DispatchEventWithLazyListener(const std::string& extension_id,
- scoped_ptr<Event> event) {
+ std::unique_ptr<Event> event) {
DCHECK(!extension_id.empty());
std::string event_name = event->event_name;
bool has_listener = ExtensionHasEventListener(extension_id, event_name);
@@ -858,12 +853,12 @@ void EventRouter::OnExtensionUnloaded(content::BrowserContext* browser_context,
Event::Event(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args)
+ std::unique_ptr<base::ListValue> event_args)
: Event(histogram_value, event_name, std::move(event_args), nullptr) {}
Event::Event(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
BrowserContext* restrict_to_browser_context)
: Event(histogram_value,
event_name,
@@ -875,7 +870,7 @@ Event::Event(events::HistogramValue histogram_value,
Event::Event(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<ListValue> event_args_tmp,
+ std::unique_ptr<ListValue> event_args_tmp,
BrowserContext* restrict_to_browser_context,
const GURL& event_url,
EventRouter::UserGestureState user_gesture,
@@ -899,10 +894,10 @@ Event::Event(events::HistogramValue histogram_value,
Event::~Event() {}
Event* Event::DeepCopy() {
- Event* copy = new Event(histogram_value, event_name,
- scoped_ptr<base::ListValue>(event_args->DeepCopy()),
- restrict_to_browser_context, event_url, user_gesture,
- filter_info);
+ Event* copy = new Event(
+ histogram_value, event_name,
+ std::unique_ptr<base::ListValue>(event_args->DeepCopy()),
+ restrict_to_browser_context, event_url, user_gesture, filter_info);
copy->will_dispatch_callback = will_dispatch_callback;
return copy;
}
diff --git a/chromium/extensions/browser/event_router.h b/chromium/extensions/browser/event_router.h
index c90a335b6b1..d84385522b3 100644
--- a/chromium/extensions/browser/event_router.h
+++ b/chromium/extensions/browser/event_router.h
@@ -95,7 +95,7 @@ class EventRouter : public KeyedService,
const std::string& extension_id,
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
UserGestureState user_gesture,
const EventFilteringInfo& info);
@@ -164,8 +164,8 @@ class EventRouter : public KeyedService,
bool HasEventListener(const std::string& event_name);
// Returns true if the extension is listening to the given event.
- bool ExtensionHasEventListener(const std::string& extension_id,
- const std::string& event_name);
+ virtual bool ExtensionHasEventListener(const std::string& extension_id,
+ const std::string& event_name);
// Return or set the list of events for which the given extension has
// registered.
@@ -174,18 +174,18 @@ class EventRouter : public KeyedService,
const std::set<std::string>& events);
// Broadcasts an event to every listener registered for that event.
- virtual void BroadcastEvent(scoped_ptr<Event> event);
+ virtual void BroadcastEvent(std::unique_ptr<Event> event);
// Dispatches an event to the given extension.
virtual void DispatchEventToExtension(const std::string& extension_id,
- scoped_ptr<Event> event);
+ std::unique_ptr<Event> event);
// Dispatches |event| to the given extension as if the extension has a lazy
// listener for it. NOTE: This should be used rarely, for dispatching events
// to extensions that haven't had a chance to add their own listeners yet, eg:
// newly installed extensions.
void DispatchEventWithLazyListener(const std::string& extension_id,
- scoped_ptr<Event> event);
+ std::unique_ptr<Event> event);
// Record the Event Ack from the renderer. (One less event in-flight.)
void OnEventAck(content::BrowserContext* context,
@@ -368,7 +368,7 @@ struct Event {
std::string event_name;
// Arguments to send to the event listener.
- scoped_ptr<base::ListValue> event_args;
+ std::unique_ptr<base::ListValue> event_args;
// If non-NULL, then the event will not be sent to other BrowserContexts
// unless the extension has permission (e.g. incognito tab update -> normal
@@ -397,16 +397,16 @@ struct Event {
Event(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args);
+ std::unique_ptr<base::ListValue> event_args);
Event(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
content::BrowserContext* restrict_to_browser_context);
Event(events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> event_args,
+ std::unique_ptr<base::ListValue> event_args,
content::BrowserContext* restrict_to_browser_context,
const GURL& event_url,
EventRouter::UserGestureState user_gesture,
diff --git a/chromium/extensions/browser/event_router_unittest.cc b/chromium/extensions/browser/event_router_unittest.cc
index bcc38fbd0e7..eaaab112c63 100644
--- a/chromium/extensions/browser/event_router_unittest.cc
+++ b/chromium/extensions/browser/event_router_unittest.cc
@@ -4,13 +4,14 @@
#include "extensions/browser/event_router.h"
+#include <memory>
#include <string>
#include <utility>
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/test/histogram_tester.h"
#include "base/values.h"
#include "content/public/browser/notification_service.h"
@@ -62,28 +63,29 @@ class MockEventRouterObserver : public EventRouter::Observer {
DISALLOW_COPY_AND_ASSIGN(MockEventRouterObserver);
};
-typedef base::Callback<scoped_ptr<EventListener>(
+typedef base::Callback<std::unique_ptr<EventListener>(
const std::string&, // event_name
content::RenderProcessHost*, // process
base::DictionaryValue* // filter (takes ownership)
- )> EventListenerConstructor;
+ )>
+ EventListenerConstructor;
-scoped_ptr<EventListener> CreateEventListenerForExtension(
+std::unique_ptr<EventListener> CreateEventListenerForExtension(
const std::string& extension_id,
const std::string& event_name,
content::RenderProcessHost* process,
base::DictionaryValue* filter) {
- return EventListener::ForExtension(
- event_name, extension_id, process, make_scoped_ptr(filter));
+ return EventListener::ForExtension(event_name, extension_id, process,
+ base::WrapUnique(filter));
}
-scoped_ptr<EventListener> CreateEventListenerForURL(
+std::unique_ptr<EventListener> CreateEventListenerForURL(
const GURL& listener_url,
const std::string& event_name,
content::RenderProcessHost* process,
base::DictionaryValue* filter) {
- return EventListener::ForURL(
- event_name, listener_url, process, make_scoped_ptr(filter));
+ return EventListener::ForURL(event_name, listener_url, process,
+ base::WrapUnique(filter));
}
// Creates an extension. If |component| is true, it is created as a component
@@ -91,8 +93,8 @@ scoped_ptr<EventListener> CreateEventListenerForURL(
// background page; otherwise it is created with an event page.
scoped_refptr<Extension> CreateExtension(bool component, bool persistent) {
ExtensionBuilder builder;
- scoped_ptr<base::DictionaryValue> manifest =
- make_scoped_ptr(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> manifest =
+ base::WrapUnique(new base::DictionaryValue());
manifest->SetString("name", "foo");
manifest->SetString("version", "1.0.0");
manifest->SetInteger("manifest_version", 2);
@@ -157,7 +159,7 @@ class EventRouterTest : public ExtensionsTest {
}
private:
- scoped_ptr<content::NotificationService> notification_service_;
+ std::unique_ptr<content::NotificationService> notification_service_;
content::TestBrowserThreadBundle thread_bundle_;
base::HistogramTester histogram_tester_;
@@ -176,7 +178,7 @@ TEST_F(EventRouterTest, GetBaseEventName) {
void EventRouterTest::RunEventRouterObserverTest(
const EventListenerConstructor& constructor) {
EventRouter router(NULL, NULL);
- scoped_ptr<EventListener> listener =
+ std::unique_ptr<EventListener> listener =
constructor.Run("event_name", NULL, new base::DictionaryValue());
// Add/remove works without any observers.
@@ -212,7 +214,7 @@ void EventRouterTest::RunEventRouterObserverTest(
// Adding a listener with a sub-event notifies the main observer with
// proper details.
matching_observer.Reset();
- scoped_ptr<EventListener> sub_event_listener =
+ std::unique_ptr<EventListener> sub_event_listener =
constructor.Run("event_name/1", NULL, new base::DictionaryValue());
router.OnListenerAdded(sub_event_listener.get());
EXPECT_EQ(1, matching_observer.listener_added_count());
diff --git a/chromium/extensions/browser/extension_error_test_util.cc b/chromium/extensions/browser/extension_error_test_util.cc
index 0396d8604aa..8f42ec937c8 100644
--- a/chromium/extensions/browser/extension_error_test_util.cc
+++ b/chromium/extensions/browser/extension_error_test_util.cc
@@ -20,12 +20,12 @@ namespace {
const char kDefaultStackTrace[] = "function_name (https://url.com:1:1)";
}
-scoped_ptr<ExtensionError> CreateNewRuntimeError(
+std::unique_ptr<ExtensionError> CreateNewRuntimeError(
const std::string& extension_id,
const std::string& message,
bool from_incognito) {
StackTrace stack_trace;
- scoped_ptr<StackFrame> frame =
+ std::unique_ptr<StackFrame> frame =
StackFrame::CreateFromText(base::ASCIIToUTF16(kDefaultStackTrace));
CHECK(frame.get());
stack_trace.push_back(*frame);
@@ -35,7 +35,7 @@ scoped_ptr<ExtensionError> CreateNewRuntimeError(
url::kStandardSchemeSeparator +
extension_id);
- return scoped_ptr<ExtensionError>(
+ return std::unique_ptr<ExtensionError>(
new RuntimeError(extension_id, from_incognito, source,
base::UTF8ToUTF16(message), stack_trace,
GURL::EmptyGURL(), // no context url
@@ -44,18 +44,18 @@ scoped_ptr<ExtensionError> CreateNewRuntimeError(
0)); // Render process id
}
-scoped_ptr<ExtensionError> CreateNewRuntimeError(
- const std::string& extension_id, const std::string& message) {
+std::unique_ptr<ExtensionError> CreateNewRuntimeError(
+ const std::string& extension_id,
+ const std::string& message) {
return CreateNewRuntimeError(extension_id, message, false);
}
-scoped_ptr<ExtensionError> CreateNewManifestError(
- const std::string& extension_id, const std::string& message) {
- return scoped_ptr<ExtensionError>(
- new ManifestError(extension_id,
- base::UTF8ToUTF16(message),
- base::string16(),
- base::string16()));
+std::unique_ptr<ExtensionError> CreateNewManifestError(
+ const std::string& extension_id,
+ const std::string& message) {
+ return std::unique_ptr<ExtensionError>(
+ new ManifestError(extension_id, base::UTF8ToUTF16(message),
+ base::string16(), base::string16()));
}
} // namespace error_test_util
diff --git a/chromium/extensions/browser/extension_error_test_util.h b/chromium/extensions/browser/extension_error_test_util.h
index 6ea2da65d44..1d5e272cf2a 100644
--- a/chromium/extensions/browser/extension_error_test_util.h
+++ b/chromium/extensions/browser/extension_error_test_util.h
@@ -5,9 +5,9 @@
#ifndef EXTENSIONS_BROWSER_EXTENSION_ERROR_TEST_UTIL_H_
#define EXTENSIONS_BROWSER_EXTENSION_ERROR_TEST_UTIL_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
namespace extensions {
@@ -16,17 +16,18 @@ class ExtensionError;
namespace error_test_util {
// Create a new RuntimeError.
-scoped_ptr<ExtensionError> CreateNewRuntimeError(
+std::unique_ptr<ExtensionError> CreateNewRuntimeError(
const std::string& extension_id,
const std::string& message,
bool from_incognito);
// Create a new RuntimeError; incognito defaults to "false".
-scoped_ptr<ExtensionError> CreateNewRuntimeError(
- const std::string& extension_id, const std::string& message);
+std::unique_ptr<ExtensionError> CreateNewRuntimeError(
+ const std::string& extension_id,
+ const std::string& message);
// Create a new ManifestError.
-scoped_ptr<ExtensionError> CreateNewManifestError(
+std::unique_ptr<ExtensionError> CreateNewManifestError(
const std::string& extension_id,
const std::string& message);
diff --git a/chromium/extensions/browser/extension_event_histogram_value.h b/chromium/extensions/browser/extension_event_histogram_value.h
index 479ce7db2f4..cb2b38f2be0 100644
--- a/chromium/extensions/browser/extension_event_histogram_value.h
+++ b/chromium/extensions/browser/extension_event_histogram_value.h
@@ -153,7 +153,7 @@ enum HistogramValue {
GCM_ON_MESSAGE,
GCM_ON_MESSAGES_DELETED,
GCM_ON_SEND_ERROR,
- HANGOUTS_PRIVATE_ON_HANGOUT_REQUESTED,
+ HANGOUTS_PRIVATE_ON_HANGOUT_REQUESTED_DEPRECATED,
HID_ON_DEVICE_ADDED,
HID_ON_DEVICE_REMOVED,
HISTORY_ON_VISITED,
@@ -415,6 +415,11 @@ enum HistogramValue {
INPUT_METHOD_PRIVATE_ON_IME_MENU_ACTIVATION_CHANGED,
INPUT_METHOD_PRIVATE_ON_IME_MENU_LIST_CHANGED,
INPUT_METHOD_PRIVATE_ON_IME_MENU_ITEMS_CHANGED,
+ BLUETOOTH_LOW_ENERGY_ON_CHARACTERISTIC_READ_REQUEST,
+ BLUETOOTH_LOW_ENERGY_ON_CHARACTERISTIC_WRITE_REQUEST,
+ BLUETOOTH_LOW_ENERGY_ON_DESCRIPTOR_READ_REQUEST,
+ BLUETOOTH_LOW_ENERGY_ON_DESCRIPTOR_WRITE_REQUEST,
+ ACCESSIBILITY_PRIVATE_ON_ACCESSIBILITY_GESTURE,
// Last entry: Add new entries above, then run:
// python tools/metrics/histograms/update_extension_histograms.py
ENUM_BOUNDARY
diff --git a/chromium/extensions/browser/extension_function.cc b/chromium/extensions/browser/extension_function.cc
index b11621fa96e..fd7bae96ceb 100644
--- a/chromium/extensions/browser/extension_function.cc
+++ b/chromium/extensions/browser/extension_function.cc
@@ -8,7 +8,9 @@
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
+#include "base/metrics/histogram_macros.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
@@ -36,7 +38,7 @@ class ArgumentListResponseValue
ArgumentListResponseValue(const std::string& function_name,
const char* title,
ExtensionFunction* function,
- scoped_ptr<base::ListValue> result)
+ std::unique_ptr<base::ListValue> result)
: function_name_(function_name), title_(title) {
if (function->GetResultList()) {
DCHECK_EQ(function->GetResultList(), result.get())
@@ -67,7 +69,7 @@ class ErrorWithArgumentsResponseValue : public ArgumentListResponseValue {
ErrorWithArgumentsResponseValue(const std::string& function_name,
const char* title,
ExtensionFunction* function,
- scoped_ptr<base::ListValue> result,
+ std::unique_ptr<base::ListValue> result,
const std::string& error)
: ArgumentListResponseValue(function_name,
title,
@@ -262,12 +264,13 @@ void ExtensionFunction::SetResult(base::Value* result) {
results_->Append(result);
}
-void ExtensionFunction::SetResult(scoped_ptr<base::Value> result) {
+void ExtensionFunction::SetResult(std::unique_ptr<base::Value> result) {
results_.reset(new base::ListValue());
results_->Append(std::move(result));
}
-void ExtensionFunction::SetResultList(scoped_ptr<base::ListValue> results) {
+void ExtensionFunction::SetResultList(
+ std::unique_ptr<base::ListValue> results) {
results_ = std::move(results);
}
@@ -289,26 +292,26 @@ bool ExtensionFunction::user_gesture() const {
ExtensionFunction::ResponseValue ExtensionFunction::NoArguments() {
return ResponseValue(new ArgumentListResponseValue(
- name(), "NoArguments", this, make_scoped_ptr(new base::ListValue())));
+ name(), "NoArguments", this, base::WrapUnique(new base::ListValue())));
}
ExtensionFunction::ResponseValue ExtensionFunction::OneArgument(
base::Value* arg) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(arg);
return ResponseValue(new ArgumentListResponseValue(name(), "OneArgument",
this, std::move(args)));
}
ExtensionFunction::ResponseValue ExtensionFunction::OneArgument(
- scoped_ptr<base::Value> arg) {
+ std::unique_ptr<base::Value> arg) {
return OneArgument(arg.release());
}
ExtensionFunction::ResponseValue ExtensionFunction::TwoArguments(
base::Value* arg1,
base::Value* arg2) {
- scoped_ptr<base::ListValue> args(new base::ListValue());
+ std::unique_ptr<base::ListValue> args(new base::ListValue());
args->Append(arg1);
args->Append(arg2);
return ResponseValue(new ArgumentListResponseValue(name(), "TwoArguments",
@@ -316,7 +319,7 @@ ExtensionFunction::ResponseValue ExtensionFunction::TwoArguments(
}
ExtensionFunction::ResponseValue ExtensionFunction::ArgumentList(
- scoped_ptr<base::ListValue> args) {
+ std::unique_ptr<base::ListValue> args) {
return ResponseValue(new ArgumentListResponseValue(name(), "ArgumentList",
this, std::move(args)));
}
@@ -351,7 +354,7 @@ ExtensionFunction::ResponseValue ExtensionFunction::Error(
}
ExtensionFunction::ResponseValue ExtensionFunction::ErrorWithArguments(
- scoped_ptr<base::ListValue> args,
+ std::unique_ptr<base::ListValue> args,
const std::string& error) {
return ResponseValue(new ErrorWithArgumentsResponseValue(
name(), "ErrorWithArguments", this, std::move(args), error));
@@ -404,6 +407,20 @@ void ExtensionFunction::SendResponseImpl(bool success) {
results_.reset(new base::ListValue());
response_callback_.Run(type, *results_, GetError(), histogram_value());
+
+ // TODO(devlin): Once we have a baseline metric for how long functions take,
+ // we can create a handful of buckets and record the function name so that we
+ // can find what the fastest/slowest are. See crbug.com/608561.
+ // Note: Certain functions perform actions that are inherently slow - such as
+ // anything waiting on user action. As such, we can't always assume that a
+ // long execution time equates to a poorly-performing function.
+ if (success) {
+ UMA_HISTOGRAM_TIMES("Extensions.Functions.SucceededTotalExecutionTime",
+ timer_.Elapsed());
+ } else {
+ UMA_HISTOGRAM_TIMES("Extensions.Functions.FailedTotalExecutionTime",
+ timer_.Elapsed());
+ }
}
void ExtensionFunction::OnRespondingLater(ResponseValue value) {
diff --git a/chromium/extensions/browser/extension_function.h b/chromium/extensions/browser/extension_function.h
index cd712e3c316..0bf876410a0 100644
--- a/chromium/extensions/browser/extension_function.h
+++ b/chromium/extensions/browser/extension_function.h
@@ -8,16 +8,17 @@
#include <stddef.h>
#include <list>
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/process/process.h"
#include "base/sequenced_task_runner_helpers.h"
+#include "base/timer/elapsed_timer.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/console_message_level.h"
#include "extensions/browser/extension_function_histogram_value.h"
@@ -134,7 +135,7 @@ class ExtensionFunction
// Returns true for success, false for failure.
virtual bool Apply() = 0;
};
- typedef scoped_ptr<ResponseValueObject> ResponseValue;
+ typedef std::unique_ptr<ResponseValueObject> ResponseValue;
// The action to use when returning from RunAsync.
//
@@ -145,7 +146,7 @@ class ExtensionFunction
virtual void Execute() = 0;
};
- typedef scoped_ptr<ResponseActionObject> ResponseAction;
+ typedef std::unique_ptr<ResponseActionObject> ResponseAction;
// Helper class for tests to force all ExtensionFunction::user_gesture()
// calls to return true as long as at least one instance of this class
@@ -203,12 +204,12 @@ class ExtensionFunction
virtual void SetArgs(const base::ListValue* args);
// Sets a single Value as the results of the function.
- void SetResult(scoped_ptr<base::Value> result);
+ void SetResult(std::unique_ptr<base::Value> result);
// As above, but deprecated. TODO(estade): remove.
void SetResult(base::Value* result);
// Sets multiple Values as the results of the function.
- void SetResultList(scoped_ptr<base::ListValue> results);
+ void SetResultList(std::unique_ptr<base::ListValue> results);
// Retrieves the results of the function as a ListValue.
const base::ListValue* GetResultList() const;
@@ -300,17 +301,18 @@ class ExtensionFunction
// to this by hand.
ResponseValue OneArgument(base::Value* arg);
// Success, a single argument |arg| to pass to caller.
- ResponseValue OneArgument(scoped_ptr<base::Value> arg);
+ ResponseValue OneArgument(std::unique_ptr<base::Value> arg);
// Success, two arguments |arg1| and |arg2| to pass to caller. TAKES
// OWNERSHIP - raw pointers for convenience, since callers usually construct
// the argument to this by hand. Note that use of this function may imply you
// should be using the generated Result struct and ArgumentList.
ResponseValue TwoArguments(base::Value* arg1, base::Value* arg2);
// Success, a list of arguments |results| to pass to caller. TAKES OWNERSHIP
- // - a scoped_ptr<> for convenience, since callers usually get this from the
+ // - a std::unique_ptr<> for convenience, since callers usually get this from
+ // the
// result of a Create(...) call on the generated Results struct, for example,
// alarms::Get::Results::Create(alarm).
- ResponseValue ArgumentList(scoped_ptr<base::ListValue> results);
+ ResponseValue ArgumentList(std::unique_ptr<base::ListValue> results);
// Error. chrome.runtime.lastError.message will be set to |error|.
ResponseValue Error(const std::string& error);
// Error with formatting. Args are processed using
@@ -329,7 +331,7 @@ class ExtensionFunction
// Using this ResponseValue indicates something is wrong with the API.
// It shouldn't be possible to have both an error *and* some arguments.
// Some legacy APIs do rely on it though, like webstorePrivate.
- ResponseValue ErrorWithArguments(scoped_ptr<base::ListValue> args,
+ ResponseValue ErrorWithArguments(std::unique_ptr<base::ListValue> args,
const std::string& error);
// Bad message. A ResponseValue equivalent to EXTENSION_FUNCTION_VALIDATE(),
// so this will actually kill the renderer and not respond at all.
@@ -407,11 +409,11 @@ class ExtensionFunction
bool user_gesture_;
// The arguments to the API. Only non-null if argument were specified.
- scoped_ptr<base::ListValue> args_;
+ std::unique_ptr<base::ListValue> args_;
// The results of the API. This should be populated by the derived class
// before SendResponse() is called.
- scoped_ptr<base::ListValue> results_;
+ std::unique_ptr<base::ListValue> results_;
// Any detailed error from the API. This should be populated by the derived
// class before Run() returns.
@@ -439,6 +441,8 @@ class ExtensionFunction
int source_process_id_;
private:
+ base::ElapsedTimer timer_;
+
void OnRespondingLater(ResponseValue response);
DISALLOW_COPY_AND_ASSIGN(ExtensionFunction);
@@ -536,7 +540,7 @@ class UIThreadExtensionFunction : public ExtensionFunction {
// The RenderFrameHost we will send responses to.
content::RenderFrameHost* render_frame_host_;
- scoped_ptr<RenderFrameHostTracker> tracker_;
+ std::unique_ptr<RenderFrameHostTracker> tracker_;
DelegateForTests* delegate_;
diff --git a/chromium/extensions/browser/extension_function_dispatcher.cc b/chromium/extensions/browser/extension_function_dispatcher.cc
index 1ad91613b23..5f4d0df21cd 100644
--- a/chromium/extensions/browser/extension_function_dispatcher.cc
+++ b/chromium/extensions/browser/extension_function_dispatcher.cc
@@ -51,7 +51,7 @@ namespace {
// called. May be called from any thread.
void NotifyApiFunctionCalled(const std::string& extension_id,
const std::string& api_name,
- scoped_ptr<base::ListValue> args,
+ std::unique_ptr<base::ListValue> args,
content::BrowserContext* browser_context) {
// The ApiActivityMonitor can only be accessed from the main (UI) thread. If
// we're running on the wrong thread, re-dispatch from the main thread.
@@ -80,7 +80,7 @@ void NotifyApiFunctionCalled(const std::string& extension_id,
// this once all the extension APIs are updated to the feature system.
struct Static {
Static() : api(ExtensionAPI::CreateWithDefaultConfiguration()) {}
- scoped_ptr<ExtensionAPI> api;
+ std::unique_ptr<ExtensionAPI> api;
};
base::LazyInstance<Static> g_global_io_data = LAZY_INSTANCE_INITIALIZER;
@@ -284,7 +284,7 @@ void ExtensionFunctionDispatcher::DispatchOnIOThread(
&params.arguments,
base::TimeTicks::Now());
if (violation_error.empty()) {
- scoped_ptr<base::ListValue> args(params.arguments.DeepCopy());
+ std::unique_ptr<base::ListValue> args(params.arguments.DeepCopy());
NotifyApiFunctionCalled(extension->id(), params.name, std::move(args),
static_cast<content::BrowserContext*>(profile_id));
UMA_HISTOGRAM_SPARSE_SLOWLY("Extensions.FunctionCalls",
@@ -292,7 +292,16 @@ void ExtensionFunctionDispatcher::DispatchOnIOThread(
tracked_objects::ScopedProfile scoped_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(function->name()),
tracked_objects::ScopedProfile::ENABLED);
+ base::ElapsedTimer timer;
function->Run()->Execute();
+ // TODO(devlin): Once we have a baseline metric for how long functions take,
+ // we can create a handful of buckets and record the function name so that
+ // we can find what the fastest/slowest are.
+ // Note: Many functions execute finish asynchronously, so this time is not
+ // always a representation of total time taken. See also
+ // Extensions.Functions.TotalExecutionTime.
+ UMA_HISTOGRAM_TIMES("Extensions.Functions.SynchronousExecutionTime",
+ timer.Elapsed());
} else {
function->OnQuotaExceeded(violation_error);
}
@@ -300,8 +309,7 @@ void ExtensionFunctionDispatcher::DispatchOnIOThread(
ExtensionFunctionDispatcher::ExtensionFunctionDispatcher(
content::BrowserContext* browser_context)
- : browser_context_(browser_context) {
-}
+ : browser_context_(browser_context), delegate_(nullptr) {}
ExtensionFunctionDispatcher::~ExtensionFunctionDispatcher() {
}
@@ -392,7 +400,7 @@ void ExtensionFunctionDispatcher::DispatchWithCallbackInternal(
base::TimeTicks::Now());
if (violation_error.empty()) {
- scoped_ptr<base::ListValue> args(params.arguments.DeepCopy());
+ std::unique_ptr<base::ListValue> args(params.arguments.DeepCopy());
// See crbug.com/39178.
ExtensionsBrowserClient::Get()->PermitExternalProtocolHandler();
@@ -403,7 +411,16 @@ void ExtensionFunctionDispatcher::DispatchWithCallbackInternal(
tracked_objects::ScopedProfile scoped_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(function->name()),
tracked_objects::ScopedProfile::ENABLED);
+ base::ElapsedTimer timer;
function->Run()->Execute();
+ // TODO(devlin): Once we have a baseline metric for how long functions take,
+ // we can create a handful of buckets and record the function name so that
+ // we can find what the fastest/slowest are.
+ // Note: Many functions execute finish asynchronously, so this time is not
+ // always a representation of total time taken. See also
+ // Extensions.Functions.TotalExecutionTime.
+ UMA_HISTOGRAM_TIMES("Extensions.Functions.SynchronousExecutionTime",
+ timer.Elapsed());
} else {
function->OnQuotaExceeded(violation_error);
}
diff --git a/chromium/extensions/browser/extension_function_histogram_value.h b/chromium/extensions/browser/extension_function_histogram_value.h
index a36b774aa51..1884272d3b4 100644
--- a/chromium/extensions/browser/extension_function_histogram_value.h
+++ b/chromium/extensions/browser/extension_function_histogram_value.h
@@ -1173,6 +1173,21 @@ enum HistogramValue {
INPUT_IME_HIDEWINDOW,
INPUTMETHODPRIVATE_SHOWINPUTVIEW,
WALLPAPERPRIVATE_RECORDWALLPAPERUMA,
+ AUTOTESTPRIVATE_GETVISIBLENOTIFICATIONS,
+ WEBRTCLOGGINGPRIVATE_STARTRTCEVENTLOGGING,
+ WEBRTCLOGGINGPRIVATE_STOPRTCEVENTLOGGING,
+ PASSWORDSPRIVATE_GETSAVEDPASSWORDLIST,
+ PASSWORDSPRIVATE_GETPASSWORDEXCEPTIONLIST,
+ INPUTMETHODPRIVATE_OPENOPTIONSPAGE,
+ FEEDBACKPRIVATE_LOGSRTPROMPTRESULT,
+ BLUETOOTHLOWENERGY_CREATESERVICE,
+ BLUETOOTHLOWENERGY_CREATECHARACTERISTIC,
+ BLUETOOTHLOWENERGY_CREATEDESCRIPTOR,
+ BLUETOOTHLOWENERGY_REGISTERSERVICE,
+ BLUETOOTHLOWENERGY_UNREGISTERSERVICE,
+ BLUETOOTHLOWENERGY_SENDREQUESTRESPONSE,
+ BLUETOOTHLOWENERGY_NOTIFYCHARACTERISTICVALUECHANGED,
+ BLUETOOTHLOWENERGY_REMOVESERVICE,
// Last entry: Add new entries above, then run:
// python tools/metrics/histograms/update_extension_histograms.py
ENUM_BOUNDARY
diff --git a/chromium/extensions/browser/extension_host.h b/chromium/extensions/browser/extension_host.h
index 50ddf21b4fb..3e30c9abcf8 100644
--- a/chromium/extensions/browser/extension_host.h
+++ b/chromium/extensions/browser/extension_host.h
@@ -7,12 +7,12 @@
#include <stdint.h>
+#include <memory>
#include <set>
#include <string>
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/timer/elapsed_timer.h"
#include "content/public/browser/web_contents_delegate.h"
@@ -165,7 +165,7 @@ class ExtensionHost : public DeferredStartRenderHost,
void RecordStopLoadingUMA();
// Delegate for functionality that cannot exist in the extensions module.
- scoped_ptr<ExtensionHostDelegate> delegate_;
+ std::unique_ptr<ExtensionHostDelegate> delegate_;
// The extension that we're hosting in this view.
const Extension* extension_;
@@ -177,7 +177,7 @@ class ExtensionHost : public DeferredStartRenderHost,
content::BrowserContext* browser_context_;
// The host for our HTML content.
- scoped_ptr<content::WebContents> host_contents_;
+ std::unique_ptr<content::WebContents> host_contents_;
// A weak pointer to the current or pending RenderViewHost. We don't access
// this through the host_contents because we want to deal with the pending
@@ -213,7 +213,7 @@ class ExtensionHost : public DeferredStartRenderHost,
// Measures how long since the initial URL started loading. This timer is
// started only once the ExtensionHost has exited the ExtensionHostQueue.
- scoped_ptr<base::ElapsedTimer> load_start_;
+ std::unique_ptr<base::ElapsedTimer> load_start_;
base::ObserverList<ExtensionHostObserver> observer_list_;
base::ObserverList<DeferredStartRenderHostObserver>
diff --git a/chromium/extensions/browser/extension_icon_image_unittest.cc b/chromium/extensions/browser/extension_icon_image_unittest.cc
index dba5e05dbd0..71a3964fd64 100644
--- a/chromium/extensions/browser/extension_icon_image_unittest.cc
+++ b/chromium/extensions/browser/extension_icon_image_unittest.cc
@@ -105,8 +105,9 @@ class ExtensionIconImageTest : public ExtensionsTest,
std::string error;
JSONFileValueDeserializer deserializer(
test_file.AppendASCII("manifest.json"));
- scoped_ptr<base::DictionaryValue> valid_value = base::DictionaryValue::From(
- deserializer.Deserialize(&error_code, &error));
+ std::unique_ptr<base::DictionaryValue> valid_value =
+ base::DictionaryValue::From(
+ deserializer.Deserialize(&error_code, &error));
EXPECT_EQ(0, error_code) << error;
if (error_code != 0)
return NULL;
@@ -143,7 +144,7 @@ class ExtensionIconImageTest : public ExtensionsTest,
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
content::TestBrowserThread io_thread_;
- scoped_ptr<content::NotificationService> notification_service_;
+ std::unique_ptr<content::NotificationService> notification_service_;
DISALLOW_COPY_AND_ASSIGN(ExtensionIconImageTest);
};
@@ -472,13 +473,9 @@ TEST_F(ExtensionIconImageTest, IconImageDestruction) {
TestImageLoader::LoadAndGetExtensionBitmap(extension.get(), "16.png", 16);
ASSERT_FALSE(bitmap_16.empty());
- scoped_ptr<IconImage> image(
- new IconImage(browser_context(),
- extension.get(),
- IconsInfo::GetIcons(extension.get()),
- 16,
- default_icon,
- this));
+ std::unique_ptr<IconImage> image(new IconImage(
+ browser_context(), extension.get(), IconsInfo::GetIcons(extension.get()),
+ 16, default_icon, this));
// Load an image representation.
gfx::ImageSkiaRep representation =
@@ -518,13 +515,9 @@ TEST_F(ExtensionIconImageTest, ImageCachesNewRepresentations) {
CreateExtension("extension_icon_image", Manifest::INVALID_LOCATION));
ASSERT_TRUE(extension.get() != NULL);
gfx::ImageSkia default_icon = GetDefaultIcon();
- scoped_ptr<IconImage> icon_image(
- new IconImage(browser_context(),
- extension.get(),
- IconsInfo::GetIcons(extension.get()),
- 16,
- default_icon,
- this));
+ std::unique_ptr<IconImage> icon_image(new IconImage(
+ browser_context(), extension.get(), IconsInfo::GetIcons(extension.get()),
+ 16, default_icon, this));
// Load an image representation.
gfx::ImageSkiaRep representation =
diff --git a/chromium/extensions/browser/extension_message_filter.h b/chromium/extensions/browser/extension_message_filter.h
index 65900d13848..d804d8f01ae 100644
--- a/chromium/extensions/browser/extension_message_filter.h
+++ b/chromium/extensions/browser/extension_message_filter.h
@@ -86,7 +86,8 @@ class ExtensionMessageFilter : public content::BrowserMessageFilter {
const int render_process_id_;
- scoped_ptr<KeyedServiceShutdownNotifier::Subscription> shutdown_notifier_;
+ std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
+ shutdown_notifier_;
// Only access from the UI thread.
content::BrowserContext* browser_context_;
diff --git a/chromium/extensions/browser/extension_pref_value_map.cc b/chromium/extensions/browser/extension_pref_value_map.cc
index bb1fde5dd61..4b00bf8bb0d 100644
--- a/chromium/extensions/browser/extension_pref_value_map.cc
+++ b/chromium/extensions/browser/extension_pref_value_map.cc
@@ -4,6 +4,7 @@
#include "extensions/browser/extension_pref_value_map.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "components/prefs/pref_value_map.h"
@@ -50,7 +51,7 @@ void ExtensionPrefValueMap::SetExtensionPref(const std::string& ext_id,
base::Value* value) {
PrefValueMap* prefs = GetExtensionPrefValueMap(ext_id, scope);
- if (prefs->SetValue(key, make_scoped_ptr(value)))
+ if (prefs->SetValue(key, base::WrapUnique(value)))
NotifyPrefValueChanged(key);
}
@@ -120,7 +121,7 @@ void ExtensionPrefValueMap::RegisterExtension(const std::string& ext_id,
bool is_enabled,
bool is_incognito_enabled) {
if (entries_.find(ext_id) == entries_.end()) {
- entries_[ext_id] = make_scoped_ptr(new ExtensionEntry);
+ entries_[ext_id] = base::WrapUnique(new ExtensionEntry);
// Only update the install time if the extension is newly installed.
entries_[ext_id]->install_time = install_time;
diff --git a/chromium/extensions/browser/extension_pref_value_map.h b/chromium/extensions/browser/extension_pref_value_map.h
index aed71c5c590..d13609162a6 100644
--- a/chromium/extensions/browser/extension_pref_value_map.h
+++ b/chromium/extensions/browser/extension_pref_value_map.h
@@ -6,11 +6,11 @@
#define EXTENSIONS_BROWSER_EXTENSION_PREF_VALUE_MAP_H_
#include <map>
+#include <memory>
#include <set>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "components/keyed_service/core/keyed_service.h"
#include "extensions/browser/extension_prefs_scope.h"
@@ -164,7 +164,8 @@ class ExtensionPrefValueMap : public KeyedService {
private:
struct ExtensionEntry;
- typedef std::map<std::string, scoped_ptr<ExtensionEntry>> ExtensionEntryMap;
+ typedef std::map<std::string, std::unique_ptr<ExtensionEntry>>
+ ExtensionEntryMap;
const PrefValueMap* GetExtensionPrefValueMap(
const std::string& ext_id,
diff --git a/chromium/extensions/browser/extension_pref_value_map_unittest.cc b/chromium/extensions/browser/extension_pref_value_map_unittest.cc
index 984448ba63b..c2f1fdd4b62 100644
--- a/chromium/extensions/browser/extension_pref_value_map_unittest.cc
+++ b/chromium/extensions/browser/extension_pref_value_map_unittest.cc
@@ -2,14 +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/extension_pref_value_map.h"
+
#include <stdint.h>
+#include <memory>
+
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "components/prefs/pref_store_observer_mock.h"
-#include "extensions/browser/extension_pref_value_map.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromium/extensions/browser/extension_prefs.cc b/chromium/extensions/browser/extension_prefs.cc
index df21c374979..5e77c0c250c 100644
--- a/chromium/extensions/browser/extension_prefs.cc
+++ b/chromium/extensions/browser/extension_prefs.cc
@@ -10,7 +10,10 @@
#include <iterator>
#include <utility>
+#include "base/debug/crash_logging.h"
+#include "base/debug/dump_without_crashing.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
@@ -309,8 +312,15 @@ T* ExtensionPrefs::ScopedUpdate<T, type_enum_value>::Create() {
// It would be nice to CHECK that this doesn't happen, but since prefs can
// get into a mangled state, we can't really do that. Instead, handle it
// gracefully (by overwriting whatever was previously there).
+ // TODO(devlin): It's unclear if there's anything we'll ever be able to do
+ // here (corrupted prefs are sometimes a fact of life), but the debug info
+ // might be useful. Remove the dumps after we analyze them.
if (key_value->GetType() != type_enum_value) {
NOTREACHED();
+ base::debug::SetCrashKeyValue(
+ "existing_extension_pref_value_type",
+ base::IntToString(static_cast<int>(key_value->GetType())));
+ base::debug::DumpWithoutCrashing();
value_as_t = new T();
extension->SetWithoutPathExpansion(key_, value_as_t);
} else {
@@ -341,7 +351,7 @@ ExtensionPrefs* ExtensionPrefs::Create(
return ExtensionPrefs::Create(browser_context, prefs, root_dir,
extension_pref_value_map, extensions_disabled,
early_observers,
- make_scoped_ptr(new TimeProvider()));
+ base::WrapUnique(new TimeProvider()));
}
// static
@@ -352,7 +362,7 @@ ExtensionPrefs* ExtensionPrefs::Create(
ExtensionPrefValueMap* extension_pref_value_map,
bool extensions_disabled,
const std::vector<ExtensionPrefsObserver*>& early_observers,
- scoped_ptr<TimeProvider> time_provider) {
+ std::unique_ptr<TimeProvider> time_provider) {
return new ExtensionPrefs(browser_context, pref_service, root_dir,
extension_pref_value_map, std::move(time_provider),
extensions_disabled, early_observers);
@@ -558,7 +568,7 @@ bool ExtensionPrefs::ReadPrefAsBooleanAndReturn(
return ReadPrefAsBoolean(extension_id, pref_key, &out_value) && out_value;
}
-scoped_ptr<const PermissionSet> ExtensionPrefs::ReadPrefAsPermissionSet(
+std::unique_ptr<const PermissionSet> ExtensionPrefs::ReadPrefAsPermissionSet(
const std::string& extension_id,
const std::string& pref_key) const {
if (!GetExtensionPref(extension_id))
@@ -599,8 +609,8 @@ scoped_ptr<const PermissionSet> ExtensionPrefs::ReadPrefAsPermissionSet(
extension_id, JoinPrefs(pref_key, kPrefScriptableHosts),
&scriptable_hosts, UserScript::ValidUserScriptSchemes());
- return make_scoped_ptr(new PermissionSet(apis, manifest_permissions,
- explicit_hosts, scriptable_hosts));
+ return base::WrapUnique(new PermissionSet(apis, manifest_permissions,
+ explicit_hosts, scriptable_hosts));
}
// Set the API or Manifest permissions.
@@ -616,7 +626,7 @@ static base::ListValue* CreatePermissionList(const T& permissions) {
base::ListValue* values = new base::ListValue();
for (typename T::const_iterator i = permissions.begin();
i != permissions.end(); ++i) {
- scoped_ptr<base::Value> detail(i->ToValue());
+ std::unique_ptr<base::Value> detail(i->ToValue());
if (detail) {
base::DictionaryValue* tmp = new base::DictionaryValue();
tmp->Set(i->name(), detail.release());
@@ -946,7 +956,7 @@ void ExtensionPrefs::SetActiveBit(const std::string& extension_id,
new base::FundamentalValue(active));
}
-scoped_ptr<const PermissionSet> ExtensionPrefs::GetGrantedPermissions(
+std::unique_ptr<const PermissionSet> ExtensionPrefs::GetGrantedPermissions(
const std::string& extension_id) const {
CHECK(crx_file::id_util::IdIsValid(extension_id));
return ReadPrefAsPermissionSet(extension_id, kPrefGrantedPermissions);
@@ -955,8 +965,9 @@ scoped_ptr<const PermissionSet> ExtensionPrefs::GetGrantedPermissions(
void ExtensionPrefs::AddGrantedPermissions(const std::string& extension_id,
const PermissionSet& permissions) {
CHECK(crx_file::id_util::IdIsValid(extension_id));
- scoped_ptr<const PermissionSet> granted = GetGrantedPermissions(extension_id);
- scoped_ptr<const PermissionSet> union_set;
+ std::unique_ptr<const PermissionSet> granted =
+ GetGrantedPermissions(extension_id);
+ std::unique_ptr<const PermissionSet> union_set;
if (granted)
union_set = PermissionSet::CreateUnion(permissions, *granted);
// The new granted permissions are the union of the already granted
@@ -978,7 +989,7 @@ void ExtensionPrefs::RemoveGrantedPermissions(
permissions));
}
-scoped_ptr<const PermissionSet> ExtensionPrefs::GetActivePermissions(
+std::unique_ptr<const PermissionSet> ExtensionPrefs::GetActivePermissions(
const std::string& extension_id) const {
CHECK(crx_file::id_util::IdIsValid(extension_id));
return ReadPrefAsPermissionSet(extension_id, kPrefActivePermissions);
@@ -1194,12 +1205,12 @@ void ExtensionPrefs::UpdateManifest(const Extension* extension) {
}
}
-scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledInfoHelper(
+std::unique_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledInfoHelper(
const std::string& extension_id,
const base::DictionaryValue* extension) const {
int location_value;
if (!extension->GetInteger(kPrefLocation, &location_value))
- return scoped_ptr<ExtensionInfo>();
+ return std::unique_ptr<ExtensionInfo>();
Manifest::Location location = static_cast<Manifest::Location>(location_value);
if (location == Manifest::COMPONENT) {
@@ -1208,7 +1219,7 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledInfoHelper(
// ComponentLoader) and shouldn't be populated into the result of
// GetInstalledExtensionsInfo, otherwise InstalledLoader would also want to
// load them.
- return scoped_ptr<ExtensionInfo>();
+ return std::unique_ptr<ExtensionInfo>();
}
// Only the following extension types have data saved in the preferences.
@@ -1216,7 +1227,7 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledInfoHelper(
!Manifest::IsUnpackedLocation(location) &&
!Manifest::IsExternalLocation(location)) {
NOTREACHED();
- return scoped_ptr<ExtensionInfo>();
+ return std::unique_ptr<ExtensionInfo>();
}
const base::DictionaryValue* manifest = NULL;
@@ -1228,38 +1239,38 @@ scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledInfoHelper(
base::FilePath::StringType path;
if (!extension->GetString(kPrefPath, &path))
- return scoped_ptr<ExtensionInfo>();
+ return std::unique_ptr<ExtensionInfo>();
// Make path absolute. Most (but not all) extension types have relative paths.
if (!base::FilePath(path).IsAbsolute())
path = install_directory_.Append(path).value();
- return scoped_ptr<ExtensionInfo>(new ExtensionInfo(
+ return std::unique_ptr<ExtensionInfo>(new ExtensionInfo(
manifest, extension_id, base::FilePath(path), location));
}
-scoped_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledExtensionInfo(
+std::unique_ptr<ExtensionInfo> ExtensionPrefs::GetInstalledExtensionInfo(
const std::string& extension_id) const {
const base::DictionaryValue* ext = NULL;
const base::DictionaryValue* extensions =
prefs_->GetDictionary(pref_names::kExtensions);
if (!extensions ||
!extensions->GetDictionaryWithoutPathExpansion(extension_id, &ext))
- return scoped_ptr<ExtensionInfo>();
+ return std::unique_ptr<ExtensionInfo>();
int state_value;
if (ext->GetInteger(kPrefState, &state_value) &&
state_value == Extension::EXTERNAL_EXTENSION_UNINSTALLED) {
LOG(WARNING) << "External extension with id " << extension_id
<< " has been uninstalled by the user";
- return scoped_ptr<ExtensionInfo>();
+ return std::unique_ptr<ExtensionInfo>();
}
return GetInstalledInfoHelper(extension_id, ext);
}
-scoped_ptr<ExtensionPrefs::ExtensionsInfo>
+std::unique_ptr<ExtensionPrefs::ExtensionsInfo>
ExtensionPrefs::GetInstalledExtensionsInfo() const {
- scoped_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo);
+ std::unique_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo);
const base::DictionaryValue* extensions =
prefs_->GetDictionary(pref_names::kExtensions);
@@ -1268,7 +1279,7 @@ ExtensionPrefs::GetInstalledExtensionsInfo() const {
if (!crx_file::id_util::IdIsValid(extension_id.key()))
continue;
- scoped_ptr<ExtensionInfo> info =
+ std::unique_ptr<ExtensionInfo> info =
GetInstalledExtensionInfo(extension_id.key());
if (info)
extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release()));
@@ -1277,9 +1288,9 @@ ExtensionPrefs::GetInstalledExtensionsInfo() const {
return extensions_info;
}
-scoped_ptr<ExtensionPrefs::ExtensionsInfo>
+std::unique_ptr<ExtensionPrefs::ExtensionsInfo>
ExtensionPrefs::GetUninstalledExtensionsInfo() const {
- scoped_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo);
+ std::unique_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo);
const base::DictionaryValue* extensions =
prefs_->GetDictionary(pref_names::kExtensions);
@@ -1291,7 +1302,7 @@ ExtensionPrefs::GetUninstalledExtensionsInfo() const {
!extension_id.value().GetAsDictionary(&ext))
continue;
- scoped_ptr<ExtensionInfo> info =
+ std::unique_ptr<ExtensionInfo> info =
GetInstalledInfoHelper(extension_id.key(), ext);
if (info)
extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release()));
@@ -1379,16 +1390,16 @@ bool ExtensionPrefs::FinishDelayedInstallInfo(
return true;
}
-scoped_ptr<ExtensionInfo> ExtensionPrefs::GetDelayedInstallInfo(
+std::unique_ptr<ExtensionInfo> ExtensionPrefs::GetDelayedInstallInfo(
const std::string& extension_id) const {
const base::DictionaryValue* extension_prefs =
GetExtensionPref(extension_id);
if (!extension_prefs)
- return scoped_ptr<ExtensionInfo>();
+ return std::unique_ptr<ExtensionInfo>();
const base::DictionaryValue* ext = NULL;
if (!extension_prefs->GetDictionary(kDelayedInstallInfo, &ext))
- return scoped_ptr<ExtensionInfo>();
+ return std::unique_ptr<ExtensionInfo>();
return GetInstalledInfoHelper(extension_id, ext);
}
@@ -1411,9 +1422,9 @@ ExtensionPrefs::DelayReason ExtensionPrefs::GetDelayedInstallReason(
return static_cast<DelayReason>(delay_reason);
}
-scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs::
- GetAllDelayedInstallInfo() const {
- scoped_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo);
+std::unique_ptr<ExtensionPrefs::ExtensionsInfo>
+ExtensionPrefs::GetAllDelayedInstallInfo() const {
+ std::unique_ptr<ExtensionsInfo> extensions_info(new ExtensionsInfo);
const base::DictionaryValue* extensions =
prefs_->GetDictionary(pref_names::kExtensions);
@@ -1422,7 +1433,8 @@ scoped_ptr<ExtensionPrefs::ExtensionsInfo> ExtensionPrefs::
if (!crx_file::id_util::IdIsValid(extension_id.key()))
continue;
- scoped_ptr<ExtensionInfo> info = GetDelayedInstallInfo(extension_id.key());
+ std::unique_ptr<ExtensionInfo> info =
+ GetDelayedInstallInfo(extension_id.key());
if (info)
extensions_info->push_back(linked_ptr<ExtensionInfo>(info.release()));
}
@@ -1572,7 +1584,7 @@ void ExtensionPrefs::ClearLastLaunchTimes() {
void ExtensionPrefs::GetExtensions(ExtensionIdList* out) const {
CHECK(out);
- scoped_ptr<ExtensionsInfo> extensions_info(GetInstalledExtensionsInfo());
+ std::unique_ptr<ExtensionsInfo> extensions_info(GetInstalledExtensionsInfo());
for (size_t i = 0; i < extensions_info->size(); ++i) {
ExtensionInfo* info = extensions_info->at(i).get();
@@ -1667,7 +1679,7 @@ const base::DictionaryValue* ExtensionPrefs::GetGeometryCache(
void ExtensionPrefs::SetGeometryCache(
const std::string& extension_id,
- scoped_ptr<base::DictionaryValue> cache) {
+ std::unique_ptr<base::DictionaryValue> cache) {
UpdateExtensionPref(extension_id, kPrefGeometryCache, cache.release());
}
@@ -1728,7 +1740,7 @@ ExtensionPrefs::ExtensionPrefs(
PrefService* prefs,
const base::FilePath& root_dir,
ExtensionPrefValueMap* extension_pref_value_map,
- scoped_ptr<TimeProvider> time_provider,
+ std::unique_ptr<TimeProvider> time_provider,
bool extensions_disabled,
const std::vector<ExtensionPrefsObserver*>& early_observers)
: browser_context_(browser_context),
diff --git a/chromium/extensions/browser/extension_prefs.h b/chromium/extensions/browser/extension_prefs.h
index 80b5e371677..bae2126e755 100644
--- a/chromium/extensions/browser/extension_prefs.h
+++ b/chromium/extensions/browser/extension_prefs.h
@@ -5,13 +5,13 @@
#ifndef EXTENSIONS_BROWSER_EXTENSION_PREFS_H_
#define EXTENSIONS_BROWSER_EXTENSION_PREFS_H_
+#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/time/time.h"
#include "base/values.h"
@@ -72,6 +72,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
DELAY_REASON_GC = 1,
DELAY_REASON_WAIT_FOR_IDLE = 2,
DELAY_REASON_WAIT_FOR_IMPORTS = 3,
+ DELAY_REASON_WAIT_FOR_OS_UPDATE = 4,
};
// Creates base::Time classes. The default implementation is just to return
@@ -145,7 +146,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
ExtensionPrefValueMap* extension_pref_value_map,
bool extensions_disabled,
const std::vector<ExtensionPrefsObserver*>& early_observers,
- scoped_ptr<TimeProvider> time_provider);
+ std::unique_ptr<TimeProvider> time_provider);
~ExtensionPrefs() override;
@@ -355,7 +356,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
// Returns the granted permission set for the extension with |extension_id|,
// and NULL if no preferences were found for |extension_id|.
// This passes ownership of the returned set to the caller.
- scoped_ptr<const PermissionSet> GetGrantedPermissions(
+ std::unique_ptr<const PermissionSet> GetGrantedPermissions(
const std::string& extension_id) const;
// Adds |permissions| to the granted permissions set for the extension with
@@ -371,7 +372,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
// Gets the active permission set for the specified extension. This may
// differ from the permissions in the manifest due to the optional
// permissions API. This passes ownership of the set to the caller.
- scoped_ptr<const PermissionSet> GetActivePermissions(
+ std::unique_ptr<const PermissionSet> GetActivePermissions(
const std::string& extension_id) const;
// Sets the active |permissions| for the extension with |extension_id|.
@@ -412,15 +413,15 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
// version directory and the location. Blacklisted extensions won't be saved
// and neither will external extensions the user has explicitly uninstalled.
// Caller takes ownership of returned structure.
- scoped_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const;
+ std::unique_ptr<ExtensionsInfo> GetInstalledExtensionsInfo() const;
// Same as above, but only includes external extensions the user has
// explicitly uninstalled.
- scoped_ptr<ExtensionsInfo> GetUninstalledExtensionsInfo() const;
+ std::unique_ptr<ExtensionsInfo> GetUninstalledExtensionsInfo() const;
// Returns the ExtensionInfo from the prefs for the given extension. If the
// extension is not present, NULL is returned.
- scoped_ptr<ExtensionInfo> GetInstalledExtensionInfo(
+ std::unique_ptr<ExtensionInfo> GetInstalledExtensionInfo(
const std::string& extension_id) const;
// We've downloaded an updated .crx file for the extension, but are waiting
@@ -443,14 +444,14 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
// Returns the ExtensionInfo from the prefs for delayed install information
// for |extension_id|, if we have any. Otherwise returns NULL.
- scoped_ptr<ExtensionInfo> GetDelayedInstallInfo(
+ std::unique_ptr<ExtensionInfo> GetDelayedInstallInfo(
const std::string& extension_id) const;
DelayReason GetDelayedInstallReason(const std::string& extension_id) const;
// Returns information about all the extensions that have delayed install
// information.
- scoped_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const;
+ std::unique_ptr<ExtensionsInfo> GetAllDelayedInstallInfo() const;
// Returns true if the user repositioned the app on the app launcher via drag
// and drop.
@@ -521,7 +522,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
const base::DictionaryValue* GetGeometryCache(
const std::string& extension_id) const;
void SetGeometryCache(const std::string& extension_id,
- scoped_ptr<base::DictionaryValue> cache);
+ std::unique_ptr<base::DictionaryValue> cache);
// Used for verification of installed extension ids. For the Set method, pass
// null to remove the preference.
@@ -561,7 +562,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
PrefService* prefs,
const base::FilePath& root_dir,
ExtensionPrefValueMap* extension_pref_value_map,
- scoped_ptr<TimeProvider> time_provider,
+ std::unique_ptr<TimeProvider> time_provider,
bool extensions_disabled,
const std::vector<ExtensionPrefsObserver*>& early_observers);
@@ -576,7 +577,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
// Helper function used by GetInstalledExtensionInfo() and
// GetDelayedInstallInfo() to construct an ExtensionInfo from the provided
// |extension| dictionary.
- scoped_ptr<ExtensionInfo> GetInstalledInfoHelper(
+ std::unique_ptr<ExtensionInfo> GetInstalledInfoHelper(
const std::string& extension_id,
const base::DictionaryValue* extension) const;
@@ -600,7 +601,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
// Interprets |pref_key| in |extension_id|'s preferences as an
// PermissionSet, and passes ownership of the set to the caller.
- scoped_ptr<const PermissionSet> ReadPrefAsPermissionSet(
+ std::unique_ptr<const PermissionSet> ReadPrefAsPermissionSet(
const std::string& extension_id,
const std::string& pref_key) const;
@@ -681,7 +682,7 @@ class ExtensionPrefs : public ExtensionScopedPrefs, public KeyedService {
// Weak pointer, owned by BrowserContext.
ExtensionPrefValueMap* extension_pref_value_map_;
- scoped_ptr<TimeProvider> time_provider_;
+ std::unique_ptr<TimeProvider> time_provider_;
bool extensions_disabled_;
diff --git a/chromium/extensions/browser/extension_prefs_factory.cc b/chromium/extensions/browser/extension_prefs_factory.cc
index 888d9bd4f9f..1c1df4de49b 100644
--- a/chromium/extensions/browser/extension_prefs_factory.cc
+++ b/chromium/extensions/browser/extension_prefs_factory.cc
@@ -32,7 +32,7 @@ ExtensionPrefsFactory* ExtensionPrefsFactory::GetInstance() {
void ExtensionPrefsFactory::SetInstanceForTesting(
content::BrowserContext* context,
- scoped_ptr<ExtensionPrefs> prefs) {
+ std::unique_ptr<ExtensionPrefs> prefs) {
Disassociate(context);
Associate(context, std::move(prefs));
}
diff --git a/chromium/extensions/browser/extension_prefs_factory.h b/chromium/extensions/browser/extension_prefs_factory.h
index 3ddc2b96399..f53278142aa 100644
--- a/chromium/extensions/browser/extension_prefs_factory.h
+++ b/chromium/extensions/browser/extension_prefs_factory.h
@@ -5,7 +5,8 @@
#ifndef EXTENSIONS_BROWSER_EXTENSION_PREFS_FACTORY_H_
#define EXTENSIONS_BROWSER_EXTENSION_PREFS_FACTORY_H_
-#include "base/memory/scoped_ptr.h"
+#include <memory>
+
#include "base/memory/singleton.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
@@ -20,7 +21,7 @@ class ExtensionPrefsFactory : public BrowserContextKeyedServiceFactory {
static ExtensionPrefsFactory* GetInstance();
void SetInstanceForTesting(content::BrowserContext* context,
- scoped_ptr<ExtensionPrefs> prefs);
+ std::unique_ptr<ExtensionPrefs> prefs);
private:
friend struct base::DefaultSingletonTraits<ExtensionPrefsFactory>;
diff --git a/chromium/extensions/browser/extension_protocols.cc b/chromium/extensions/browser/extension_protocols.cc
index 2dbbf31b9dd..c97f172607a 100644
--- a/chromium/extensions/browser/extension_protocols.cc
+++ b/chromium/extensions/browser/extension_protocols.cc
@@ -18,6 +18,7 @@
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h"
@@ -282,7 +283,7 @@ class URLRequestExtensionJob : public net::URLRequestFileJob {
scoped_refptr<ContentVerifyJob> verify_job_;
- scoped_ptr<base::ElapsedTimer> request_timer_;
+ std::unique_ptr<base::ElapsedTimer> request_timer_;
// The position we seeked to in the file.
int64_t seek_position_;
@@ -575,10 +576,10 @@ net::HttpResponseHeaders* BuildHttpHeaders(
return new net::HttpResponseHeaders(raw_headers);
}
-scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
CreateExtensionProtocolHandler(bool is_incognito,
extensions::InfoMap* extension_info_map) {
- return make_scoped_ptr(
+ return base::WrapUnique(
new ExtensionProtocolHandler(is_incognito, extension_info_map));
}
diff --git a/chromium/extensions/browser/extension_protocols.h b/chromium/extensions/browser/extension_protocols.h
index 190b50fca2b..aff38b1caaa 100644
--- a/chromium/extensions/browser/extension_protocols.h
+++ b/chromium/extensions/browser/extension_protocols.h
@@ -5,9 +5,9 @@
#ifndef EXTENSIONS_BROWSER_EXTENSION_PROTOCOLS_H_
#define EXTENSIONS_BROWSER_EXTENSION_PROTOCOLS_H_
+#include <memory>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "net/url_request/url_request_job_factory.h"
namespace base {
@@ -32,7 +32,7 @@ net::HttpResponseHeaders* BuildHttpHeaders(
// Creates the handlers for the chrome-extension:// scheme. Pass true for
// |is_incognito| only for incognito profiles and not for Chrome OS guest mode
// profiles.
-scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>
+std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler>
CreateExtensionProtocolHandler(bool is_incognito, InfoMap* extension_info_map);
} // namespace extensions
diff --git a/chromium/extensions/browser/extension_registry.cc b/chromium/extensions/browser/extension_registry.cc
index 49c499a005b..7054673ab34 100644
--- a/chromium/extensions/browser/extension_registry.cc
+++ b/chromium/extensions/browser/extension_registry.cc
@@ -19,14 +19,14 @@ ExtensionRegistry* ExtensionRegistry::Get(content::BrowserContext* context) {
return ExtensionRegistryFactory::GetForBrowserContext(context);
}
-scoped_ptr<ExtensionSet> ExtensionRegistry::GenerateInstalledExtensionsSet()
- const {
+std::unique_ptr<ExtensionSet>
+ExtensionRegistry::GenerateInstalledExtensionsSet() const {
return GenerateInstalledExtensionsSet(EVERYTHING);
}
-scoped_ptr<ExtensionSet> ExtensionRegistry::GenerateInstalledExtensionsSet(
+std::unique_ptr<ExtensionSet> ExtensionRegistry::GenerateInstalledExtensionsSet(
int include_mask) const {
- scoped_ptr<ExtensionSet> installed_extensions(new ExtensionSet);
+ std::unique_ptr<ExtensionSet> installed_extensions(new ExtensionSet);
if (include_mask & IncludeFlag::ENABLED)
installed_extensions->InsertAll(enabled_extensions_);
if (include_mask & IncludeFlag::DISABLED)
diff --git a/chromium/extensions/browser/extension_registry.h b/chromium/extensions/browser/extension_registry.h
index 405d07261e6..09c8a70ab4b 100644
--- a/chromium/extensions/browser/extension_registry.h
+++ b/chromium/extensions/browser/extension_registry.h
@@ -70,7 +70,7 @@ class ExtensionRegistry : public KeyedService {
// Returns the set of all installed extensions, regardless of state (enabled,
// disabled, etc). Equivalent to GenerateInstalledExtensionSet(EVERYTHING).
- scoped_ptr<ExtensionSet> GenerateInstalledExtensionsSet() const;
+ std::unique_ptr<ExtensionSet> GenerateInstalledExtensionsSet() const;
// Returns a set of all extensions in the subsets specified by |include_mask|.
// * enabled_extensions() --> ExtensionRegistry::ENABLED
@@ -78,7 +78,7 @@ class ExtensionRegistry : public KeyedService {
// * terminated_extensions() --> ExtensionRegistry::TERMINATED
// * blacklisted_extensions() --> ExtensionRegistry::BLACKLISTED
// * blocked_extensions() --> ExtensionRegistry::BLOCKED
- scoped_ptr<ExtensionSet> GenerateInstalledExtensionsSet(
+ std::unique_ptr<ExtensionSet> GenerateInstalledExtensionsSet(
int include_mask) const;
// The usual observer interface.
diff --git a/chromium/extensions/browser/extension_system.h b/chromium/extensions/browser/extension_system.h
index 5382d3f0c39..b318e964385 100644
--- a/chromium/extensions/browser/extension_system.h
+++ b/chromium/extensions/browser/extension_system.h
@@ -125,7 +125,7 @@ class ExtensionSystem : public KeyedService {
// Get a set of extensions that depend on the given extension.
// TODO(elijahtaylor): Move SharedModuleService out of chrome/browser
// so it can be retrieved from ExtensionSystem directly.
- virtual scoped_ptr<ExtensionSet> GetDependentExtensions(
+ virtual std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) = 0;
// Install an updated version of |extension_id| with the version given in
diff --git a/chromium/extensions/browser/extension_throttle_entry.cc b/chromium/extensions/browser/extension_throttle_entry.cc
index 577ac55d661..e81a7330d22 100644
--- a/chromium/extensions/browser/extension_throttle_entry.cc
+++ b/chromium/extensions/browser/extension_throttle_entry.cc
@@ -46,12 +46,12 @@ const int ExtensionThrottleEntry::kDefaultMaximumBackoffMs = 15 * 60 * 1000;
const int ExtensionThrottleEntry::kDefaultEntryLifetimeMs = 2 * 60 * 1000;
// Returns NetLog parameters when a request is rejected by throttling.
-scoped_ptr<base::Value> NetLogRejectedRequestCallback(
+std::unique_ptr<base::Value> NetLogRejectedRequestCallback(
const std::string* url_id,
int num_failures,
const base::TimeDelta& release_after,
net::NetLogCaptureMode /* capture_mode */) {
- scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
dict->SetString("url", *url_id);
dict->SetInteger("num_failures", num_failures);
dict->SetInteger("release_after_ms",
diff --git a/chromium/extensions/browser/extension_throttle_manager.cc b/chromium/extensions/browser/extension_throttle_manager.cc
index 16d9501b015..449999029b5 100644
--- a/chromium/extensions/browser/extension_throttle_manager.cc
+++ b/chromium/extensions/browser/extension_throttle_manager.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/strings/string_util.h"
@@ -54,13 +55,13 @@ ExtensionThrottleManager::~ExtensionThrottleManager() {
url_entries_.clear();
}
-scoped_ptr<content::ResourceThrottle>
+std::unique_ptr<content::ResourceThrottle>
ExtensionThrottleManager::MaybeCreateThrottle(const net::URLRequest* request) {
if (request->first_party_for_cookies().scheme() !=
extensions::kExtensionScheme) {
return nullptr;
}
- return make_scoped_ptr(
+ return base::WrapUnique(
new extensions::ExtensionRequestLimitingThrottle(request, this));
}
@@ -118,7 +119,7 @@ ExtensionThrottleManager::RegisterRequestUrl(const GURL& url) {
}
void ExtensionThrottleManager::SetBackoffPolicyForTests(
- scoped_ptr<net::BackoffEntry::Policy> policy) {
+ std::unique_ptr<net::BackoffEntry::Policy> policy) {
backoff_policy_for_tests_ = std::move(policy);
}
diff --git a/chromium/extensions/browser/extension_throttle_manager.h b/chromium/extensions/browser/extension_throttle_manager.h
index 5a5b2845c52..14c37baf4c0 100644
--- a/chromium/extensions/browser/extension_throttle_manager.h
+++ b/chromium/extensions/browser/extension_throttle_manager.h
@@ -6,11 +6,11 @@
#define EXTENSIONS_BROWSER_EXTENSION_THROTTLE_MANAGER_H_
#include <map>
+#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "base/threading/platform_thread.h"
#include "extensions/browser/extension_throttle_entry.h"
@@ -49,7 +49,7 @@ class ExtensionThrottleManager
// Creates a content::ResourceThrottle for |request| to prevent extensions
// from requesting a URL too often, if such a throttle is needed.
- scoped_ptr<content::ResourceThrottle> MaybeCreateThrottle(
+ std::unique_ptr<content::ResourceThrottle> MaybeCreateThrottle(
const net::URLRequest* request);
// TODO(xunjieli): Remove this method and replace with
@@ -64,7 +64,8 @@ class ExtensionThrottleManager
scoped_refptr<ExtensionThrottleEntryInterface> RegisterRequestUrl(
const GURL& url);
- void SetBackoffPolicyForTests(scoped_ptr<net::BackoffEntry::Policy> policy);
+ void SetBackoffPolicyForTests(
+ std::unique_ptr<net::BackoffEntry::Policy> policy);
// Registers a new entry in this service and overrides the existing entry (if
// any) for the URL. The service will hold a reference to the entry.
@@ -175,7 +176,7 @@ class ExtensionThrottleManager
bool ignore_user_gesture_load_flag_for_tests_;
// This is NULL when it is not set for tests.
- scoped_ptr<net::BackoffEntry::Policy> backoff_policy_for_tests_;
+ std::unique_ptr<net::BackoffEntry::Policy> backoff_policy_for_tests_;
DISALLOW_COPY_AND_ASSIGN(ExtensionThrottleManager);
};
diff --git a/chromium/extensions/browser/extension_throttle_simulation_unittest.cc b/chromium/extensions/browser/extension_throttle_simulation_unittest.cc
index d81ceed3b60..9b415e239d7 100644
--- a/chromium/extensions/browser/extension_throttle_simulation_unittest.cc
+++ b/chromium/extensions/browser/extension_throttle_simulation_unittest.cc
@@ -16,11 +16,12 @@
#include <cmath>
#include <limits>
+#include <memory>
#include <vector>
#include "base/environment.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/rand_util.h"
#include "base/time/time.h"
@@ -54,7 +55,7 @@ void VerboseOut(const char* format, ...) {
static bool should_print = false;
if (!have_checked_environment) {
have_checked_environment = true;
- scoped_ptr<base::Environment> env(base::Environment::Create());
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
if (env->HasVar(kShowSimulationVariableName))
should_print = true;
}
@@ -222,7 +223,7 @@ class Server : public DiscreteTimeSimulation::Actor {
if (num_ticks % ticks_per_column)
++num_columns;
DCHECK_LE(num_columns, terminal_width);
- scoped_ptr<int[]> columns(new int[num_columns]);
+ std::unique_ptr<int[]> columns(new int[num_columns]);
for (int tx = 0; tx < num_ticks; ++tx) {
int cx = tx / ticks_per_column;
if (tx % ticks_per_column == 0)
@@ -293,7 +294,7 @@ class Server : public DiscreteTimeSimulation::Actor {
std::vector<int> requests_per_tick_;
TestURLRequestContext context_;
- scoped_ptr<URLRequest> mock_request_;
+ std::unique_ptr<URLRequest> mock_request_;
DISALLOW_COPY_AND_ASSIGN(Server);
};
@@ -489,7 +490,7 @@ void SimulateAttack(Server* server,
const size_t kNumClients = 50;
DiscreteTimeSimulation simulation;
ExtensionThrottleManager manager;
- std::vector<scoped_ptr<Requester>> requesters;
+ std::vector<std::unique_ptr<Requester>> requesters;
for (size_t i = 0; i < kNumAttackers; ++i) {
// Use a tiny time_between_requests so the attackers will ping the
// server at every tick of the simulation.
@@ -502,7 +503,7 @@ void SimulateAttack(Server* server,
new Requester(throttler_entry.get(), TimeDelta::FromMilliseconds(1),
server, attacker_results);
attacker->SetStartupJitter(TimeDelta::FromSeconds(120));
- requesters.push_back(make_scoped_ptr(attacker));
+ requesters.push_back(base::WrapUnique(attacker));
simulation.AddActor(attacker);
}
for (size_t i = 0; i < kNumClients; ++i) {
@@ -517,7 +518,7 @@ void SimulateAttack(Server* server,
client_results);
client->SetStartupJitter(TimeDelta::FromSeconds(120));
client->SetRequestJitter(TimeDelta::FromMinutes(1));
- requesters.push_back(make_scoped_ptr(client));
+ requesters.push_back(base::WrapUnique(client));
simulation.AddActor(client);
}
simulation.AddActor(server);
diff --git a/chromium/extensions/browser/extension_throttle_unittest.cc b/chromium/extensions/browser/extension_throttle_unittest.cc
index e894ee68367..34ae8234cd1 100644
--- a/chromium/extensions/browser/extension_throttle_unittest.cc
+++ b/chromium/extensions/browser/extension_throttle_unittest.cc
@@ -2,8 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/pickle.h"
#include "base/stl_util.h"
@@ -176,7 +177,7 @@ class ExtensionThrottleEntryTest : public testing::Test {
base::MessageLoopForIO message_loop_;
TestURLRequestContext context_;
- scoped_ptr<URLRequest> request_;
+ std::unique_ptr<URLRequest> request_;
};
void ExtensionThrottleEntryTest::SetUp() {
@@ -357,7 +358,7 @@ class ExtensionThrottleManagerTest : public testing::Test {
base::MessageLoopForIO message_loop_;
// context_ must be declared before request_.
TestURLRequestContext context_;
- scoped_ptr<URLRequest> request_;
+ std::unique_ptr<URLRequest> request_;
};
TEST_F(ExtensionThrottleManagerTest, IsUrlStandardised) {
diff --git a/chromium/extensions/browser/extension_user_script_loader.cc b/chromium/extensions/browser/extension_user_script_loader.cc
index 3b3f10cea83..c4be84388a4 100644
--- a/chromium/extensions/browser/extension_user_script_loader.cc
+++ b/chromium/extensions/browser/extension_user_script_loader.cc
@@ -129,7 +129,7 @@ void LoadUserScripts(UserScriptList* user_scripts,
for (UserScript& script : *user_scripts) {
if (added_script_ids.count(script.id()) == 0)
continue;
- scoped_ptr<SubstitutionMap> localization_messages(
+ std::unique_ptr<SubstitutionMap> localization_messages(
GetLocalizationMessages(hosts_info, script.host_id()));
for (UserScript::File& script_file : script.js_scripts()) {
if (script_file.GetContent().empty())
@@ -144,14 +144,14 @@ void LoadUserScripts(UserScriptList* user_scripts,
}
void LoadScriptsOnFileThread(
- scoped_ptr<UserScriptList> user_scripts,
+ std::unique_ptr<UserScriptList> user_scripts,
const ExtensionUserScriptLoader::HostsInfo& hosts_info,
const std::set<int>& added_script_ids,
const scoped_refptr<ContentVerifier>& verifier,
UserScriptLoader::LoadScriptsCallback callback) {
DCHECK(user_scripts.get());
LoadUserScripts(user_scripts.get(), hosts_info, added_script_ids, verifier);
- scoped_ptr<base::SharedMemory> memory =
+ std::unique_ptr<base::SharedMemory> memory =
UserScriptLoader::Serialize(*user_scripts);
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
@@ -196,7 +196,7 @@ void ExtensionUserScriptLoader::LoadScriptsForTest(
}
void ExtensionUserScriptLoader::LoadScripts(
- scoped_ptr<UserScriptList> user_scripts,
+ std::unique_ptr<UserScriptList> user_scripts,
const std::set<HostID>& changed_hosts,
const std::set<int>& added_script_ids,
LoadScriptsCallback callback) {
diff --git a/chromium/extensions/browser/extension_user_script_loader.h b/chromium/extensions/browser/extension_user_script_loader.h
index ff785fcc6ba..05c9d184032 100644
--- a/chromium/extensions/browser/extension_user_script_loader.h
+++ b/chromium/extensions/browser/extension_user_script_loader.h
@@ -40,7 +40,7 @@ class ExtensionUserScriptLoader : public UserScriptLoader,
private:
// UserScriptLoader:
- void LoadScripts(scoped_ptr<UserScriptList> user_scripts,
+ void LoadScripts(std::unique_ptr<UserScriptList> user_scripts,
const std::set<HostID>& changed_hosts,
const std::set<int>& added_script_ids,
LoadScriptsCallback callback) override;
diff --git a/chromium/extensions/browser/extension_web_contents_observer.h b/chromium/extensions/browser/extension_web_contents_observer.h
index 5b86dc08eba..2c15333c47d 100644
--- a/chromium/extensions/browser/extension_web_contents_observer.h
+++ b/chromium/extensions/browser/extension_web_contents_observer.h
@@ -56,6 +56,15 @@ class ExtensionWebContentsObserver
ExtensionFunctionDispatcher* dispatcher() { return &dispatcher_; }
+ // Returns the extension associated with the given |render_frame_host|, or
+ // null if there is none.
+ // If |verify_url| is false, only the SiteInstance is taken into account.
+ // If |verify_url| is true, the frame's last committed URL is also used to
+ // improve the classification of the frame.
+ const Extension* GetExtensionFromFrame(
+ content::RenderFrameHost* render_frame_host,
+ bool verify_url) const;
+
protected:
explicit ExtensionWebContentsObserver(content::WebContents* web_contents);
~ExtensionWebContentsObserver() override;
@@ -99,15 +108,6 @@ class ExtensionWebContentsObserver
std::string GetExtensionIdFromFrame(
content::RenderFrameHost* render_frame_host) const;
- // Returns the extension associated with the given |render_frame_host|, or
- // null if there is none.
- // If |verify_url| is false, only the SiteInstance is taken into account.
- // If |verify_url| is true, the frame's last committed URL is also used to
- // improve the classification of the frame.
- const Extension* GetExtensionFromFrame(
- content::RenderFrameHost* render_frame_host,
- bool verify_url) const;
-
// TODO(devlin): Remove these once callers are updated to use the FromFrame
// equivalents.
// Returns the extension or app associated with a render view host. Returns
diff --git a/chromium/extensions/browser/extension_zoom_request_client.cc b/chromium/extensions/browser/extension_zoom_request_client.cc
index ce8b45ce4ac..c462a2a7f51 100644
--- a/chromium/extensions/browser/extension_zoom_request_client.cc
+++ b/chromium/extensions/browser/extension_zoom_request_client.cc
@@ -5,6 +5,7 @@
#include "extensions/browser/extension_zoom_request_client.h"
#include "extensions/common/features/behavior_feature.h"
+#include "extensions/common/features/feature.h"
#include "extensions/common/features/feature_provider.h"
namespace extensions {
@@ -15,10 +16,9 @@ ExtensionZoomRequestClient::ExtensionZoomRequestClient(
}
bool ExtensionZoomRequestClient::ShouldSuppressBubble() const {
- return FeatureProvider::GetBehaviorFeature(
- BehaviorFeature::kZoomWithoutBubble)
- ->IsAvailableToExtension(extension())
- .is_available();
+ const Feature* feature =
+ FeatureProvider::GetBehaviorFeature(BehaviorFeature::kZoomWithoutBubble);
+ return feature && feature->IsAvailableToExtension(extension()).is_available();
}
ExtensionZoomRequestClient::~ExtensionZoomRequestClient() {
diff --git a/chromium/extensions/browser/extension_zoom_request_client.h b/chromium/extensions/browser/extension_zoom_request_client.h
index 380b6da6b4f..c34820c37bb 100644
--- a/chromium/extensions/browser/extension_zoom_request_client.h
+++ b/chromium/extensions/browser/extension_zoom_request_client.h
@@ -5,8 +5,9 @@
#ifndef EXTENSIONS_BROWSER_EXTENSION_ZOOM_REQUEST_CLIENT_H_
#define EXTENSIONS_BROWSER_EXTENSION_ZOOM_REQUEST_CLIENT_H_
+#include <memory>
+
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/ui/zoom/zoom_controller.h"
#include "extensions/common/extension.h"
diff --git a/chromium/extensions/browser/extensions_browser_client.cc b/chromium/extensions/browser/extensions_browser_client.cc
index 5a917879f90..690f5b14c8e 100644
--- a/chromium/extensions/browser/extensions_browser_client.cc
+++ b/chromium/extensions/browser/extensions_browser_client.cc
@@ -29,8 +29,9 @@ ExtensionsBrowserClient::CreateExtensionApiFrameIdMapHelper(
return nullptr;
}
-void ExtensionsBrowserClient::ReportError(content::BrowserContext* context,
- scoped_ptr<ExtensionError> error) {
+void ExtensionsBrowserClient::ReportError(
+ content::BrowserContext* context,
+ std::unique_ptr<ExtensionError> error) {
LOG(ERROR) << error->GetDebugString();
}
diff --git a/chromium/extensions/browser/extensions_browser_client.h b/chromium/extensions/browser/extensions_browser_client.h
index c8dd9ee4a15..03e3e081406 100644
--- a/chromium/extensions/browser/extensions_browser_client.h
+++ b/chromium/extensions/browser/extensions_browser_client.h
@@ -10,7 +10,6 @@
#include <vector>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "build/build_config.h"
#include "extensions/browser/extension_event_histogram_value.h"
#include "extensions/browser/extension_prefs_observer.h"
@@ -158,7 +157,8 @@ class ExtensionsBrowserClient {
virtual ProcessManagerDelegate* GetProcessManagerDelegate() const = 0;
// Creates a new ExtensionHostDelegate instance.
- virtual scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() = 0;
+ virtual std::unique_ptr<ExtensionHostDelegate>
+ CreateExtensionHostDelegate() = 0;
// Returns true if the client version has updated since the last run. Called
// once each time the extensions system is loaded per browser_context. The
@@ -196,7 +196,7 @@ class ExtensionsBrowserClient {
// Creates a RuntimeAPIDelegate responsible for handling extensions
// management-related events such as update and installation on behalf of the
// core runtime API implementation.
- virtual scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
+ virtual std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
content::BrowserContext* context) const = 0;
// Returns the manager of resource bundles used in extensions. Returns NULL if
@@ -206,9 +206,10 @@ class ExtensionsBrowserClient {
// Propagate a event to all the renderers in every browser context. The
// implementation must be safe to call from any thread.
- virtual void BroadcastEventToRenderers(events::HistogramValue histogram_value,
- const std::string& event_name,
- scoped_ptr<base::ListValue> args) = 0;
+ virtual void BroadcastEventToRenderers(
+ events::HistogramValue histogram_value,
+ const std::string& event_name,
+ std::unique_ptr<base::ListValue> args) = 0;
// Returns the embedder's net::NetLog.
virtual net::NetLog* GetNetLog() = 0;
@@ -227,7 +228,7 @@ class ExtensionsBrowserClient {
// Embedders can override this function to handle extension errors.
virtual void ReportError(content::BrowserContext* context,
- scoped_ptr<ExtensionError> error);
+ std::unique_ptr<ExtensionError> error);
// Returns the ExtensionWebContentsObserver for the given |web_contents|.
virtual ExtensionWebContentsObserver* GetExtensionWebContentsObserver(
diff --git a/chromium/extensions/browser/extensions_test.cc b/chromium/extensions/browser/extensions_test.cc
index c6962ed0566..bb37b3aa5aa 100644
--- a/chromium/extensions/browser/extensions_test.cc
+++ b/chromium/extensions/browser/extensions_test.cc
@@ -55,6 +55,8 @@ void ExtensionsTest::TearDown() {
// cleaned up before the factories are destroyed.
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
browser_context_.get());
+ extensions_browser_client_.reset();
+ browser_context_.reset();
}
} // namespace extensions
diff --git a/chromium/extensions/browser/extensions_test.h b/chromium/extensions/browser/extensions_test.h
index e930421a1e1..f4462e2681c 100644
--- a/chromium/extensions/browser/extensions_test.h
+++ b/chromium/extensions/browser/extensions_test.h
@@ -5,9 +5,10 @@
#ifndef EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_
#define EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_
+#include <memory>
+
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "content/public/test/test_renderer_host.h"
#include "extensions/browser/mock_extension_system.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -52,11 +53,11 @@ class ExtensionsTest : public testing::Test {
private:
// TODO(yoz): Add a NotificationService here; it's used widely enough.
- scoped_ptr<content::ContentClient> content_client_;
- scoped_ptr<content::ContentUtilityClient> content_utility_client_;
- scoped_ptr<content::ContentBrowserClient> content_browser_client_;
- scoped_ptr<content::BrowserContext> browser_context_;
- scoped_ptr<TestExtensionsBrowserClient> extensions_browser_client_;
+ std::unique_ptr<content::ContentClient> content_client_;
+ std::unique_ptr<content::ContentUtilityClient> content_utility_client_;
+ std::unique_ptr<content::ContentBrowserClient> content_browser_client_;
+ std::unique_ptr<content::BrowserContext> browser_context_;
+ std::unique_ptr<TestExtensionsBrowserClient> extensions_browser_client_;
// The existence of this object enables tests via
// RenderViewHostTester.
diff --git a/chromium/extensions/browser/external_install_info.cc b/chromium/extensions/browser/external_install_info.cc
index e6da3fa8a2c..d37c0f38d14 100644
--- a/chromium/extensions/browser/external_install_info.cc
+++ b/chromium/extensions/browser/external_install_info.cc
@@ -18,7 +18,7 @@ ExternalInstallInfo::ExternalInstallInfo(const std::string& extension_id,
ExternalInstallInfoFile::ExternalInstallInfoFile(
const std::string& extension_id,
- scoped_ptr<base::Version> version,
+ std::unique_ptr<base::Version> version,
const base::FilePath& path,
Manifest::Location crx_location,
int creation_flags,
@@ -35,7 +35,7 @@ ExternalInstallInfoFile::~ExternalInstallInfoFile() {}
ExternalInstallInfoUpdateUrl::ExternalInstallInfoUpdateUrl(
const std::string& extension_id,
const std::string& install_parameter,
- scoped_ptr<GURL> update_url,
+ std::unique_ptr<GURL> update_url,
Manifest::Location download_location,
int creation_flags,
bool mark_acknowledged)
diff --git a/chromium/extensions/browser/external_install_info.h b/chromium/extensions/browser/external_install_info.h
index 72a19e8b9c9..19124d7531b 100644
--- a/chromium/extensions/browser/external_install_info.h
+++ b/chromium/extensions/browser/external_install_info.h
@@ -35,7 +35,7 @@ struct ExternalInstallInfo {
struct ExternalInstallInfoFile : public ExternalInstallInfo {
ExternalInstallInfoFile(const std::string& extension_id,
- scoped_ptr<base::Version> version,
+ std::unique_ptr<base::Version> version,
const base::FilePath& path,
Manifest::Location crx_location,
int creation_flags,
@@ -43,7 +43,7 @@ struct ExternalInstallInfoFile : public ExternalInstallInfo {
bool install_immediately);
~ExternalInstallInfoFile() override;
- scoped_ptr<base::Version> version;
+ std::unique_ptr<base::Version> version;
base::FilePath path;
Manifest::Location crx_location;
bool install_immediately;
@@ -52,14 +52,14 @@ struct ExternalInstallInfoFile : public ExternalInstallInfo {
struct ExternalInstallInfoUpdateUrl : public ExternalInstallInfo {
ExternalInstallInfoUpdateUrl(const std::string& extension_id,
const std::string& install_parameter,
- scoped_ptr<GURL> update_url,
+ std::unique_ptr<GURL> update_url,
Manifest::Location download_location,
int creation_flags,
bool mark_acknowledged);
~ExternalInstallInfoUpdateUrl() override;
std::string install_parameter;
- scoped_ptr<GURL> update_url;
+ std::unique_ptr<GURL> update_url;
Manifest::Location download_location;
};
diff --git a/chromium/extensions/browser/external_provider_interface.h b/chromium/extensions/browser/external_provider_interface.h
index 19102c045e2..727efdfb848 100644
--- a/chromium/extensions/browser/external_provider_interface.h
+++ b/chromium/extensions/browser/external_provider_interface.h
@@ -89,7 +89,7 @@ class ExternalProviderInterface {
virtual bool GetExtensionDetails(
const std::string& id,
Manifest::Location* location,
- scoped_ptr<base::Version>* version) const = 0;
+ std::unique_ptr<base::Version>* version) const = 0;
// Determines if this provider had loaded the list of external extensions
// from its source.
diff --git a/chromium/extensions/browser/guest_view/app_view/app_view_apitest.cc b/chromium/extensions/browser/guest_view/app_view/app_view_apitest.cc
index ab6323174ca..5360dd5179c 100644
--- a/chromium/extensions/browser/guest_view/app_view/app_view_apitest.cc
+++ b/chromium/extensions/browser/guest_view/app_view/app_view_apitest.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 "base/command_line.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "components/guest_view/browser/guest_view_manager.h"
#include "components/guest_view/browser/guest_view_manager_factory.h"
#include "components/guest_view/browser/test_guest_view_manager.h"
+#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
@@ -23,6 +25,7 @@
#include "extensions/shell/test/shell_test.h"
#include "extensions/test/extension_test_message_listener.h"
#include "net/base/filename_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
using guest_view::GuestViewManager;
using guest_view::TestGuestViewManager;
@@ -89,7 +92,8 @@ class MockExtensionsAPIClient : public extensions::ShellExtensionsAPIClient {
namespace extensions {
-class AppViewTest : public AppShellTest {
+class AppViewTest : public AppShellTest,
+ public testing::WithParamInterface<bool> {
protected:
AppViewTest() { GuestViewManager::set_factory_for_testing(&factory_); }
@@ -141,20 +145,29 @@ class AppViewTest : public AppShellTest {
ASSERT_TRUE(done_listener.WaitUntilSatisfied());
}
- protected:
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ AppShellTest::SetUpCommandLine(command_line);
+
+ bool use_cross_process_frames_for_guests = GetParam();
+ if (use_cross_process_frames_for_guests)
+ command_line->AppendSwitch(switches::kUseCrossProcessFramesForGuests);
+ }
+
content::WebContents* embedder_web_contents_;
TestGuestViewManagerFactory factory_;
};
+INSTANTIATE_TEST_CASE_P(AppViewTests, AppViewTest, testing::Bool());
+
// Tests that <appview> correctly processes parameters passed on connect.
-IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewGoodDataShouldSucceed) {
+IN_PROC_BROWSER_TEST_P(AppViewTest, TestAppViewGoodDataShouldSucceed) {
RunTest("testAppViewGoodDataShouldSucceed",
"app_view/apitest",
"app_view/apitest/skeleton");
}
// Tests that <appview> can handle media permission requests.
-IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewMediaRequest) {
+IN_PROC_BROWSER_TEST_P(AppViewTest, TestAppViewMediaRequest) {
static_cast<ShellExtensionsBrowserClient*>(ExtensionsBrowserClient::Get())
->SetAPIClientForTest(nullptr);
static_cast<ShellExtensionsBrowserClient*>(ExtensionsBrowserClient::Get())
@@ -169,14 +182,14 @@ IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewMediaRequest) {
// Tests that <appview> correctly processes parameters passed on connect.
// This test should fail to connect because the embedded app (skeleton) will
// refuse the data passed by the embedder app and deny the request.
-IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewRefusedDataShouldFail) {
+IN_PROC_BROWSER_TEST_P(AppViewTest, TestAppViewRefusedDataShouldFail) {
RunTest("testAppViewRefusedDataShouldFail",
"app_view/apitest",
"app_view/apitest/skeleton");
}
// Tests that <appview> is able to navigate to another installed app.
-IN_PROC_BROWSER_TEST_F(AppViewTest, TestAppViewWithUndefinedDataShouldSucceed) {
+IN_PROC_BROWSER_TEST_P(AppViewTest, TestAppViewWithUndefinedDataShouldSucceed) {
RunTest("testAppViewWithUndefinedDataShouldSucceed",
"app_view/apitest",
"app_view/apitest/skeleton");
diff --git a/chromium/extensions/browser/guest_view/app_view/app_view_guest.cc b/chromium/extensions/browser/guest_view/app_view/app_view_guest.cc
index d5a4e858b3f..dd5243c7044 100644
--- a/chromium/extensions/browser/guest_view/app_view/app_view_guest.cc
+++ b/chromium/extensions/browser/guest_view/app_view/app_view_guest.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
#include "components/guest_view/browser/guest_view_manager.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/renderer_preferences.h"
@@ -200,13 +201,11 @@ void AppViewGuest::CreateWebContents(
LazyBackgroundTaskQueue* queue =
LazyBackgroundTaskQueue::Get(browser_context());
if (queue->ShouldEnqueueTask(browser_context(), guest_extension)) {
- queue->AddPendingTask(browser_context(),
- guest_extension->id(),
- base::Bind(
- &AppViewGuest::LaunchAppAndFireEvent,
- weak_ptr_factory_.GetWeakPtr(),
- base::Passed(make_scoped_ptr(data->DeepCopy())),
- callback));
+ queue->AddPendingTask(
+ browser_context(), guest_extension->id(),
+ base::Bind(&AppViewGuest::LaunchAppAndFireEvent,
+ weak_ptr_factory_.GetWeakPtr(),
+ base::Passed(base::WrapUnique(data->DeepCopy())), callback));
return;
}
@@ -214,7 +213,7 @@ void AppViewGuest::CreateWebContents(
ExtensionHost* host =
process_manager->GetBackgroundHostForExtension(guest_extension->id());
DCHECK(host);
- LaunchAppAndFireEvent(make_scoped_ptr(data->DeepCopy()), callback, host);
+ LaunchAppAndFireEvent(base::WrapUnique(data->DeepCopy()), callback, host);
}
void AppViewGuest::DidInitialize(const base::DictionaryValue& create_params) {
@@ -255,7 +254,7 @@ void AppViewGuest::CompleteCreateWebContents(
}
void AppViewGuest::LaunchAppAndFireEvent(
- scoped_ptr<base::DictionaryValue> data,
+ std::unique_ptr<base::DictionaryValue> data,
const WebContentsCreatedCallback& callback,
ExtensionHost* extension_host) {
bool has_event_listener = EventRouter::Get(browser_context())
@@ -267,7 +266,8 @@ void AppViewGuest::LaunchAppAndFireEvent(
return;
}
- scoped_ptr<base::DictionaryValue> embed_request(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> embed_request(
+ new base::DictionaryValue());
embed_request->SetInteger(appview::kGuestInstanceID, guest_instance_id());
embed_request->SetString(appview::kEmbedderID, owner_host());
embed_request->Set(appview::kData, data.release());
diff --git a/chromium/extensions/browser/guest_view/app_view/app_view_guest.h b/chromium/extensions/browser/guest_view/app_view/app_view_guest.h
index 20bfdd166da..d1e44dccff3 100644
--- a/chromium/extensions/browser/guest_view/app_view/app_view_guest.h
+++ b/chromium/extensions/browser/guest_view/app_view/app_view_guest.h
@@ -72,14 +72,14 @@ class AppViewGuest : public guest_view::GuestView<AppViewGuest> {
const Extension* guest_extension,
const WebContentsCreatedCallback& callback);
- void LaunchAppAndFireEvent(scoped_ptr<base::DictionaryValue> data,
+ void LaunchAppAndFireEvent(std::unique_ptr<base::DictionaryValue> data,
const WebContentsCreatedCallback& callback,
ExtensionHost* extension_host);
GURL url_;
std::string guest_extension_id_;
- scoped_ptr<AppViewGuestDelegate> app_view_guest_delegate_;
- scoped_ptr<AppDelegate> app_delegate_;
+ std::unique_ptr<AppViewGuestDelegate> app_view_guest_delegate_;
+ std::unique_ptr<AppDelegate> app_delegate_;
// This is used to ensure pending tasks will not fire after this object is
// destroyed.
diff --git a/chromium/extensions/browser/guest_view/extension_options/extension_options_guest.cc b/chromium/extensions/browser/guest_view/extension_options/extension_options_guest.cc
index 57eb9c2f905..eb8eb4dedd2 100644
--- a/chromium/extensions/browser/guest_view/extension_options/extension_options_guest.cc
+++ b/chromium/extensions/browser/guest_view/extension_options/extension_options_guest.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "components/crx_file/id_util.h"
#include "components/guest_view/browser/guest_view_event.h"
@@ -126,8 +127,8 @@ void ExtensionOptionsGuest::DidInitialize(
}
void ExtensionOptionsGuest::GuestViewDidStopLoading() {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- DispatchEventToView(make_scoped_ptr(new GuestViewEvent(
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ DispatchEventToView(base::WrapUnique(new GuestViewEvent(
extension_options_internal::OnLoad::kEventName, std::move(args))));
}
@@ -148,7 +149,7 @@ void ExtensionOptionsGuest::OnPreferredSizeChanged(const gfx::Size& pref_size) {
// Convert the size from physical pixels to logical pixels.
options.width = PhysicalPixelsToLogicalPixels(pref_size.width());
options.height = PhysicalPixelsToLogicalPixels(pref_size.height());
- DispatchEventToView(make_scoped_ptr(new GuestViewEvent(
+ DispatchEventToView(base::WrapUnique(new GuestViewEvent(
extension_options_internal::OnPreferredSizeChanged::kEventName,
options.ToValue())));
}
@@ -180,9 +181,9 @@ WebContents* ExtensionOptionsGuest::OpenURLFromTab(
}
void ExtensionOptionsGuest::CloseContents(WebContents* source) {
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(extension_options_internal::OnClose::kEventName,
- make_scoped_ptr(new base::DictionaryValue()))));
+ base::WrapUnique(new base::DictionaryValue()))));
}
bool ExtensionOptionsGuest::HandleContextMenu(
diff --git a/chromium/extensions/browser/guest_view/extension_options/extension_options_guest.h b/chromium/extensions/browser/guest_view/extension_options/extension_options_guest.h
index b81fe414624..e0309f75e2f 100644
--- a/chromium/extensions/browser/guest_view/extension_options/extension_options_guest.h
+++ b/chromium/extensions/browser/guest_view/extension_options/extension_options_guest.h
@@ -62,7 +62,7 @@ class ExtensionOptionsGuest
void DidNavigateMainFrame(const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) final;
- scoped_ptr<extensions::ExtensionOptionsGuestDelegate>
+ std::unique_ptr<extensions::ExtensionOptionsGuestDelegate>
extension_options_guest_delegate_;
GURL options_page_;
diff --git a/chromium/extensions/browser/guest_view/extension_view/extension_view_guest.cc b/chromium/extensions/browser/guest_view/extension_view/extension_view_guest.cc
index 0c961df1f19..73cfc9d7256 100644
--- a/chromium/extensions/browser/guest_view/extension_view/extension_view_guest.cc
+++ b/chromium/extensions/browser/guest_view/extension_view/extension_view_guest.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "components/crx_file/id_util.h"
#include "components/guest_view/browser/guest_view_event.h"
#include "content/public/browser/render_process_host.h"
@@ -125,9 +126,9 @@ void ExtensionViewGuest::DidCommitProvisionalLoadForFrame(
url_ = url;
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetString(guest_view::kUrl, url_.spec());
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(extensionview::kEventLoadCommit, std::move(args))));
}
diff --git a/chromium/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc b/chromium/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc
index ec44ed2d595..8c73d37391d 100644
--- a/chromium/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc
+++ b/chromium/extensions/browser/guest_view/extensions_guest_view_manager_delegate.cc
@@ -39,12 +39,12 @@ ExtensionsGuestViewManagerDelegate::~ExtensionsGuestViewManagerDelegate() {
void ExtensionsGuestViewManagerDelegate::DispatchEvent(
const std::string& event_name,
- scoped_ptr<base::DictionaryValue> args,
+ std::unique_ptr<base::DictionaryValue> args,
GuestViewBase* guest,
int instance_id) {
EventFilteringInfo info;
info.SetInstanceID(instance_id);
- scoped_ptr<base::ListValue> event_args(new base::ListValue());
+ std::unique_ptr<base::ListValue> event_args(new base::ListValue());
event_args->Append(args.release());
// GetEventHistogramValue maps guest view event names to their histogram
@@ -67,7 +67,8 @@ bool ExtensionsGuestViewManagerDelegate::IsGuestAvailableToContext(
GuestViewBase* guest) {
const Feature* feature =
FeatureProvider::GetAPIFeature(guest->GetAPINamespace());
- CHECK(feature);
+ if (!feature)
+ return false;
ProcessMap* process_map = ProcessMap::Get(context_);
CHECK(process_map);
diff --git a/chromium/extensions/browser/guest_view/extensions_guest_view_manager_delegate.h b/chromium/extensions/browser/guest_view/extensions_guest_view_manager_delegate.h
index 8a2d649cf73..8bbdf1d38da 100644
--- a/chromium/extensions/browser/guest_view/extensions_guest_view_manager_delegate.h
+++ b/chromium/extensions/browser/guest_view/extensions_guest_view_manager_delegate.h
@@ -23,7 +23,7 @@ class ExtensionsGuestViewManagerDelegate
// GuestViewManagerDelegate implementation.
void DispatchEvent(const std::string& event_name,
- scoped_ptr<base::DictionaryValue> args,
+ std::unique_ptr<base::DictionaryValue> args,
guest_view::GuestViewBase* guest,
int instance_id) override;
bool IsGuestAvailableToContext(guest_view::GuestViewBase* guest) override;
diff --git a/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc b/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc
index b0b8feb6bef..0ba5b8bdbb4 100644
--- a/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc
+++ b/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.cc
@@ -4,6 +4,7 @@
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.h"
+#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
@@ -109,10 +110,11 @@ MimeHandlerStreamManager* MimeHandlerStreamManager::Get(
return MimeHandlerStreamManagerFactory::GetInstance()->Get(context);
}
-void MimeHandlerStreamManager::AddStream(const std::string& view_id,
- scoped_ptr<StreamContainer> stream,
- int render_process_id,
- int render_frame_id) {
+void MimeHandlerStreamManager::AddStream(
+ const std::string& view_id,
+ std::unique_ptr<StreamContainer> stream,
+ int render_process_id,
+ int render_frame_id) {
streams_by_extension_id_[stream->extension_id()].insert(view_id);
auto result = streams_.insert(
std::make_pair(view_id, make_linked_ptr(stream.release())));
@@ -121,14 +123,14 @@ void MimeHandlerStreamManager::AddStream(const std::string& view_id,
new EmbedderObserver(this, render_process_id, render_frame_id, view_id));
}
-scoped_ptr<StreamContainer> MimeHandlerStreamManager::ReleaseStream(
+std::unique_ptr<StreamContainer> MimeHandlerStreamManager::ReleaseStream(
const std::string& view_id) {
auto stream = streams_.find(view_id);
if (stream == streams_.end())
return nullptr;
- scoped_ptr<StreamContainer> result =
- make_scoped_ptr(stream->second.release());
+ std::unique_ptr<StreamContainer> result =
+ base::WrapUnique(stream->second.release());
streams_by_extension_id_[result->extension_id()].erase(view_id);
streams_.erase(stream);
embedder_observers_.erase(view_id);
diff --git a/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.h b/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.h
index 5e46ac31054..3f9670117c1 100644
--- a/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.h
+++ b/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_stream_manager.h
@@ -36,11 +36,11 @@ class MimeHandlerStreamManager : public KeyedService,
static MimeHandlerStreamManager* Get(content::BrowserContext* context);
void AddStream(const std::string& view_id,
- scoped_ptr<StreamContainer> stream,
+ std::unique_ptr<StreamContainer> stream,
int render_process_id,
int render_frame_id);
- scoped_ptr<StreamContainer> ReleaseStream(const std::string& view_id);
+ std::unique_ptr<StreamContainer> ReleaseStream(const std::string& view_id);
// ExtensionRegistryObserver override.
void OnExtensionUnloaded(content::BrowserContext* browser_context,
diff --git a/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc b/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
index 27297f33a6e..ec15087dcc9 100644
--- a/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
+++ b/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
@@ -36,7 +36,7 @@ using guest_view::GuestViewBase;
namespace extensions {
-StreamContainer::StreamContainer(scoped_ptr<content::StreamInfo> stream,
+StreamContainer::StreamContainer(std::unique_ptr<content::StreamInfo> stream,
int tab_id,
bool embedded,
const GURL& handler_url,
diff --git a/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h b/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
index 4618d9f86fa..ef91c244b33 100644
--- a/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
+++ b/chromium/extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
@@ -22,7 +22,7 @@ class MimeHandlerViewGuestDelegate;
// MimeHandler to handle a resource stream.
class StreamContainer {
public:
- StreamContainer(scoped_ptr<content::StreamInfo> stream,
+ StreamContainer(std::unique_ptr<content::StreamInfo> stream,
int tab_id,
bool embedded,
const GURL& handler_url,
@@ -41,7 +41,7 @@ class StreamContainer {
std::string extension_id() const { return extension_id_; }
private:
- const scoped_ptr<content::StreamInfo> stream_;
+ const std::unique_ptr<content::StreamInfo> stream_;
const bool embedded_;
const int tab_id_;
const GURL handler_url_;
@@ -94,8 +94,8 @@ class MimeHandlerViewGuest :
std::string view_id() const { return view_id_; }
base::WeakPtr<StreamContainer> GetStream() const;
- scoped_ptr<MimeHandlerViewGuestDelegate> delegate_;
- scoped_ptr<StreamContainer> stream_;
+ std::unique_ptr<MimeHandlerViewGuestDelegate> delegate_;
+ std::unique_ptr<StreamContainer> stream_;
std::string view_id_;
DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuest);
diff --git a/chromium/extensions/browser/guest_view/mime_handler_view/test_mime_handler_view_guest.cc b/chromium/extensions/browser/guest_view/mime_handler_view/test_mime_handler_view_guest.cc
index ce68bdb589f..d15d1c038c0 100644
--- a/chromium/extensions/browser/guest_view/mime_handler_view/test_mime_handler_view_guest.cc
+++ b/chromium/extensions/browser/guest_view/mime_handler_view/test_mime_handler_view_guest.cc
@@ -43,7 +43,7 @@ void TestMimeHandlerViewGuest::CreateWebContents(
if (delay_) {
auto delta = base::TimeDelta::FromMilliseconds(
delay_);
- scoped_ptr<base::DictionaryValue> params(create_params.DeepCopy());
+ std::unique_ptr<base::DictionaryValue> params(create_params.DeepCopy());
content::BrowserThread::PostDelayedTask(
content::BrowserThread::UI,
FROM_HERE,
@@ -68,7 +68,7 @@ void TestMimeHandlerViewGuest::DidAttachToEmbedder() {
}
void TestMimeHandlerViewGuest::CallBaseCreateWebContents(
- scoped_ptr<base::DictionaryValue> create_params,
+ std::unique_ptr<base::DictionaryValue> create_params,
const WebContentsCreatedCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
MimeHandlerViewGuest::CreateWebContents(*create_params.get(), callback);
diff --git a/chromium/extensions/browser/guest_view/mime_handler_view/test_mime_handler_view_guest.h b/chromium/extensions/browser/guest_view/mime_handler_view/test_mime_handler_view_guest.h
index aac62c11724..0db76f49195 100644
--- a/chromium/extensions/browser/guest_view/mime_handler_view/test_mime_handler_view_guest.h
+++ b/chromium/extensions/browser/guest_view/mime_handler_view/test_mime_handler_view_guest.h
@@ -42,7 +42,7 @@ class TestMimeHandlerViewGuest : public MimeHandlerViewGuest {
// Used to call MimeHandlerViewGuest::CreateWebContents using a scoped_ptr for
// |create_params|.
void CallBaseCreateWebContents(
- scoped_ptr<base::DictionaryValue> create_params,
+ std::unique_ptr<base::DictionaryValue> create_params,
const WebContentsCreatedCallback& callback);
// A value in milliseconds that the next creation of a guest's WebContents
diff --git a/chromium/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.cc b/chromium/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.cc
index 9c2b738d07e..69319de38e6 100644
--- a/chromium/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.cc
+++ b/chromium/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.cc
@@ -5,6 +5,7 @@
#include "extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/storage_partition.h"
#include "content/public/common/url_fetcher.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_fetcher.h"
@@ -26,7 +27,9 @@ WebUIURLFetcher::~WebUIURLFetcher() {
void WebUIURLFetcher::Start() {
fetcher_ = net::URLFetcher::Create(url_, net::URLFetcher::GET, this);
- fetcher_->SetRequestContext(context_->GetRequestContext());
+ fetcher_->SetRequestContext(
+ content::BrowserContext::GetDefaultStoragePartition(context_)->
+ GetURLRequestContext());
fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES);
content::AssociateURLFetcherWithRenderFrame(
diff --git a/chromium/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h b/chromium/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h
index 8124fc63779..b8bc7173e5b 100644
--- a/chromium/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h
+++ b/chromium/extensions/browser/guest_view/web_view/web_ui/web_ui_url_fetcher.h
@@ -5,9 +5,10 @@
#ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_UI_URL_FETCHER_H
#define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_UI_URL_FETCHER_H
+#include <memory>
+
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "url/gurl.h"
@@ -48,7 +49,7 @@ class WebUIURLFetcher : public net::URLFetcherDelegate {
int render_view_id_;
GURL url_;
WebUILoadFileCallback callback_;
- scoped_ptr<net::URLFetcher> fetcher_;
+ std::unique_ptr<net::URLFetcher> fetcher_;
DISALLOW_COPY_AND_ASSIGN(WebUIURLFetcher);
};
diff --git a/chromium/extensions/browser/guest_view/web_view/web_view_apitest.cc b/chromium/extensions/browser/guest_view/web_view/web_view_apitest.cc
index 89bbf05e017..babdbf5597c 100644
--- a/chromium/extensions/browser/guest_view/web_view/web_view_apitest.cc
+++ b/chromium/extensions/browser/guest_view/web_view/web_view_apitest.cc
@@ -37,7 +37,7 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
-#include "ui/gfx/switches.h"
+#include "ui/display/display_switches.h"
using guest_view::GuestViewManager;
using guest_view::TestGuestViewManager;
@@ -55,20 +55,20 @@ const char kIsolateExtensions[] = "isolateExtensions";
// Handles |request| by serving a redirect response if the |User-Agent| is
// foobar.
-static scoped_ptr<net::test_server::HttpResponse> UserAgentResponseHandler(
+static std::unique_ptr<net::test_server::HttpResponse> UserAgentResponseHandler(
const std::string& path,
const GURL& redirect_target,
const net::test_server::HttpRequest& request) {
if (!base::StartsWith(path, request.relative_url,
base::CompareCase::SENSITIVE))
- return scoped_ptr<net::test_server::HttpResponse>();
+ return std::unique_ptr<net::test_server::HttpResponse>();
auto it = request.headers.find("User-Agent");
EXPECT_TRUE(it != request.headers.end());
if (!base::StartsWith("foobar", it->second, base::CompareCase::SENSITIVE))
- return scoped_ptr<net::test_server::HttpResponse>();
+ return std::unique_ptr<net::test_server::HttpResponse>();
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse);
http_response->set_code(net::HTTP_MOVED_PERMANENTLY);
http_response->AddCustomHeader("Location", redirect_target.spec());
@@ -100,15 +100,15 @@ class WebContentsHiddenObserver : public content::WebContentsObserver {
};
// Handles |request| by serving a redirect response.
-scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler(
+std::unique_ptr<net::test_server::HttpResponse> RedirectResponseHandler(
const std::string& path,
const GURL& redirect_target,
const net::test_server::HttpRequest& request) {
if (!base::StartsWith(path, request.relative_url,
base::CompareCase::SENSITIVE))
- return scoped_ptr<net::test_server::HttpResponse>();
+ return std::unique_ptr<net::test_server::HttpResponse>();
- scoped_ptr<net::test_server::BasicHttpResponse> http_response(
+ std::unique_ptr<net::test_server::BasicHttpResponse> http_response(
new net::test_server::BasicHttpResponse);
http_response->set_code(net::HTTP_MOVED_PERMANENTLY);
http_response->AddCustomHeader("Location", redirect_target.spec());
@@ -116,16 +116,16 @@ scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler(
}
// Handles |request| by serving an empty response.
-scoped_ptr<net::test_server::HttpResponse> EmptyResponseHandler(
+std::unique_ptr<net::test_server::HttpResponse> EmptyResponseHandler(
const std::string& path,
const net::test_server::HttpRequest& request) {
if (base::StartsWith(path, request.relative_url,
base::CompareCase::SENSITIVE)) {
- return scoped_ptr<net::test_server::HttpResponse>(
+ return std::unique_ptr<net::test_server::HttpResponse>(
new net::test_server::RawHttpResponse("", ""));
}
- return scoped_ptr<net::test_server::HttpResponse>();
+ return std::unique_ptr<net::test_server::HttpResponse>();
}
} // namespace
@@ -269,7 +269,7 @@ TestGuestViewManager* WebViewAPITest::GetGuestViewManager() {
void WebViewAPITest::SendMessageToGuestAndWait(
const std::string& message,
const std::string& wait_message) {
- scoped_ptr<ExtensionTestMessageListener> listener;
+ std::unique_ptr<ExtensionTestMessageListener> listener;
if (!wait_message.empty())
listener.reset(new ExtensionTestMessageListener(wait_message, false));
diff --git a/chromium/extensions/browser/guest_view/web_view/web_view_find_helper.cc b/chromium/extensions/browser/guest_view/web_view/web_view_find_helper.cc
index f9a315f68f3..c7339e1eda9 100644
--- a/chromium/extensions/browser/guest_view/web_view/web_view_find_helper.cc
+++ b/chromium/extensions/browser/guest_view/web_view/web_view_find_helper.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "components/guest_view/browser/guest_view_event.h"
#include "extensions/browser/api/guest_view/web_view/web_view_internal_api.h"
#include "extensions/browser/guest_view/web_view/web_view_constants.h"
@@ -35,12 +36,12 @@ void WebViewFindHelper::CancelAllFindSessions() {
void WebViewFindHelper::DispatchFindUpdateEvent(bool canceled,
bool final_update) {
DCHECK(find_update_event_.get());
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
find_update_event_->PrepareResults(args.get());
args->SetBoolean(webview::kFindCanceled, canceled);
args->SetBoolean(webview::kFindFinalUpdate, final_update);
DCHECK(webview_guest_);
- webview_guest_->DispatchEventToView(make_scoped_ptr(
+ webview_guest_->DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventFindReply, std::move(args))));
}
@@ -157,13 +158,13 @@ void WebViewFindHelper::FindReply(int request_id,
DCHECK(current_find_session_);
WebViewFindHelper::FindInfo* find_info = find_iterator->second.get();
-
// Handle canceled find requests.
if (!find_info->options()->findNext &&
find_info_map_.begin()->first < request_id) {
DCHECK_NE(current_find_session_->request_id(),
find_info_map_.begin()->first);
- DispatchFindUpdateEvent(true /* canceled */, true /* final_update */);
+ if (find_update_event_)
+ DispatchFindUpdateEvent(true /* canceled */, true /* final_update */);
EndFindSession(find_info_map_.begin()->first, true /* canceled */);
}
diff --git a/chromium/extensions/browser/guest_view/web_view/web_view_find_helper.h b/chromium/extensions/browser/guest_view/web_view/web_view_find_helper.h
index df93c0c139f..f8940f22875 100644
--- a/chromium/extensions/browser/guest_view/web_view/web_view_find_helper.h
+++ b/chromium/extensions/browser/guest_view/web_view/web_view_find_helper.h
@@ -6,11 +6,11 @@
#define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_FIND_HELPER_H_
#include <map>
+#include <memory>
#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "content/public/browser/web_contents.h"
@@ -175,7 +175,7 @@ class WebViewFindHelper {
int current_find_request_id_;
// Stores aggregated find results and other info for the |findupdate| event.
- scoped_ptr<FindUpdateEvent> find_update_event_;
+ std::unique_ptr<FindUpdateEvent> find_update_event_;
// Pointer to the first request of the current find session. find_info_map_
// retains ownership.
diff --git a/chromium/extensions/browser/guest_view/web_view/web_view_guest.cc b/chromium/extensions/browser/guest_view/web_view/web_view_guest.cc
index 70336af302e..3da0024b090 100644
--- a/chromium/extensions/browser/guest_view/web_view/web_view_guest.cc
+++ b/chromium/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -8,6 +8,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -369,9 +370,9 @@ void WebViewGuest::DidAttachToEmbedder() {
}
void WebViewGuest::DidDropLink(const GURL& url) {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetString(guest_view::kUrl, url.spec());
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventDropLink, std::move(args))));
}
@@ -425,8 +426,8 @@ void WebViewGuest::ClearDataInternal(base::Time remove_since,
}
void WebViewGuest::GuestViewDidStopLoading() {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- DispatchEventToView(make_scoped_ptr(
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventLoadStop, std::move(args))));
}
@@ -476,12 +477,12 @@ void WebViewGuest::GuestReady() {
void WebViewGuest::GuestSizeChangedDueToAutoSize(const gfx::Size& old_size,
const gfx::Size& new_size) {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetInteger(webview::kOldHeight, old_size.height());
args->SetInteger(webview::kOldWidth, old_size.width());
args->SetInteger(webview::kNewHeight, new_size.height());
args->SetInteger(webview::kNewWidth, new_size.width());
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventSizeChanged, std::move(args))));
}
@@ -494,10 +495,10 @@ void WebViewGuest::GuestZoomChanged(double old_zoom_level,
// Dispatch the zoomchange event.
double old_zoom_factor = ConvertZoomLevelToZoomFactor(old_zoom_level);
double new_zoom_factor = ConvertZoomLevelToZoomFactor(new_zoom_level);
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetDouble(webview::kOldZoomFactor, old_zoom_factor);
args->SetDouble(webview::kNewZoomFactor, new_zoom_factor);
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventZoomChange, std::move(args))));
}
@@ -511,20 +512,20 @@ bool WebViewGuest::AddMessageToConsole(WebContents* source,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
// Log levels are from base/logging.h: LogSeverity.
args->SetInteger(webview::kLevel, level);
args->SetString(webview::kMessage, message);
args->SetInteger(webview::kLine, line_no);
args->SetString(webview::kSourceId, source_id);
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventConsoleMessage, std::move(args))));
return true;
}
void WebViewGuest::CloseContents(WebContents* source) {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- DispatchEventToView(make_scoped_ptr(
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventClose, std::move(args))));
}
@@ -572,10 +573,10 @@ bool WebViewGuest::PreHandleGestureEvent(WebContents* source,
}
void WebViewGuest::LoadProgressChanged(WebContents* source, double progress) {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetString(guest_view::kUrl, web_contents()->GetURL().spec());
args->SetDouble(webview::kProgress, progress);
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventLoadProgress, std::move(args))));
}
@@ -583,12 +584,12 @@ void WebViewGuest::LoadAbort(bool is_top_level,
const GURL& url,
int error_code,
const std::string& error_type) {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetBoolean(guest_view::kIsTopLevel, is_top_level);
args->SetString(guest_view::kUrl, url.possibly_invalid_spec());
args->SetInteger(guest_view::kCode, error_code);
args->SetString(guest_view::kReason, error_type);
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventLoadAbort, std::move(args))));
}
@@ -637,18 +638,18 @@ void WebViewGuest::NewGuestWebViewCallback(const content::OpenURLParams& params,
// TODO(fsamuel): Find a reliable way to test the 'responsive' and
// 'unresponsive' events.
void WebViewGuest::RendererResponsive(WebContents* source) {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetInteger(webview::kProcessId,
web_contents()->GetRenderProcessHost()->GetID());
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventResponsive, std::move(args))));
}
void WebViewGuest::RendererUnresponsive(WebContents* source) {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetInteger(webview::kProcessId,
web_contents()->GetRenderProcessHost()->GetID());
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventUnresponsive, std::move(args))));
}
@@ -801,7 +802,7 @@ void WebViewGuest::DidCommitProvisionalLoadForFrame(
pending_zoom_factor_ = 0.0;
}
}
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetString(guest_view::kUrl, src_.spec());
args->SetBoolean(guest_view::kIsTopLevel, !render_frame_host->GetParent());
args->SetString(webview::kInternalBaseURLForDataURL,
@@ -816,7 +817,7 @@ void WebViewGuest::DidCommitProvisionalLoadForFrame(
web_contents()->GetController().GetEntryCount());
args->SetInteger(webview::kInternalProcessId,
web_contents()->GetRenderProcessHost()->GetID());
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventLoadCommit, std::move(args))));
find_helper_.CancelAllFindSessions();
@@ -841,10 +842,10 @@ void WebViewGuest::DidStartProvisionalLoadForFrame(
const GURL& validated_url,
bool is_error_page,
bool is_iframe_srcdoc) {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetString(guest_view::kUrl, validated_url.spec());
args->SetBoolean(guest_view::kIsTopLevel, !render_frame_host->GetParent());
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventLoadStart, std::move(args))));
}
@@ -852,11 +853,11 @@ void WebViewGuest::RenderProcessGone(base::TerminationStatus status) {
// Cancel all find sessions in progress.
find_helper_.CancelAllFindSessions();
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetInteger(webview::kProcessId,
web_contents()->GetRenderProcessHost()->GetID());
args->SetString(webview::kReason, TerminationStatusToString(status));
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventExit, std::move(args))));
}
@@ -882,26 +883,26 @@ void WebViewGuest::FrameNameChanged(RenderFrameHost* render_frame_host,
void WebViewGuest::ReportFrameNameChange(const std::string& name) {
name_ = name;
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetString(webview::kName, name);
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventFrameNameChanged, std::move(args))));
}
void WebViewGuest::LoadHandlerCalled() {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- DispatchEventToView(make_scoped_ptr(
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventContentLoad, std::move(args))));
}
void WebViewGuest::LoadRedirect(const GURL& old_url,
const GURL& new_url,
bool is_top_level) {
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->SetBoolean(guest_view::kIsTopLevel, is_top_level);
args->SetString(webview::kNewURL, new_url.spec());
args->SetString(webview::kOldURL, old_url.spec());
- DispatchEventToView(make_scoped_ptr(
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventLoadRedirect, std::move(args))));
}
@@ -1494,8 +1495,8 @@ void WebViewGuest::SetFullscreenState(bool is_fullscreen) {
if (was_fullscreen && GuestMadeEmbedderFullscreen()) {
// Dispatch a message so we can call document.webkitCancelFullscreen()
// on the embedder.
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
- DispatchEventToView(make_scoped_ptr(
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventExitFullscreen, std::move(args))));
}
// Since we changed fullscreen state, sending a Resize message ensures that
diff --git a/chromium/extensions/browser/guest_view/web_view/web_view_guest.h b/chromium/extensions/browser/guest_view/web_view/web_view_guest.h
index d1baac5b64c..88d0f103d3c 100644
--- a/chromium/extensions/browser/guest_view/web_view/web_view_guest.h
+++ b/chromium/extensions/browser/guest_view/web_view/web_view_guest.h
@@ -24,7 +24,7 @@
namespace blink {
struct WebFindOptions;
-} // nanespace blink
+} // namespace blink
namespace content {
struct GlobalRequestID;
@@ -328,7 +328,7 @@ class WebViewGuest : public guest_view::GuestView<WebViewGuest>,
WebViewFindHelper find_helper_;
base::ObserverList<ScriptExecutionObserver> script_observers_;
- scoped_ptr<ScriptExecutor> script_executor_;
+ std::unique_ptr<ScriptExecutor> script_executor_;
content::NotificationRegistrar notification_registrar_;
@@ -348,9 +348,9 @@ class WebViewGuest : public guest_view::GuestView<WebViewGuest>,
JavaScriptDialogHelper javascript_dialog_helper_;
// Handles permission requests.
- scoped_ptr<WebViewPermissionHelper> web_view_permission_helper_;
+ std::unique_ptr<WebViewPermissionHelper> web_view_permission_helper_;
- scoped_ptr<WebViewGuestDelegate> web_view_guest_delegate_;
+ std::unique_ptr<WebViewGuestDelegate> web_view_guest_delegate_;
// Tracks the name, and target URL of the new window. Once the first
// navigation commits, we no longer track this information.
diff --git a/chromium/extensions/browser/guest_view/web_view/web_view_media_access_apitest.cc b/chromium/extensions/browser/guest_view/web_view/web_view_media_access_apitest.cc
index dcf41907cc1..1a0cc806005 100644
--- a/chromium/extensions/browser/guest_view/web_view/web_view_media_access_apitest.cc
+++ b/chromium/extensions/browser/guest_view/web_view/web_view_media_access_apitest.cc
@@ -95,7 +95,7 @@ class WebViewMediaAccessAPITest : public WebViewAPITest {
IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllow) {
LaunchApp("web_view/media_access/allow");
- scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
+ std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
embedder_web_contents_->SetDelegate(mock.get());
RunTest("testAllow");
@@ -105,7 +105,7 @@ IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllow) {
IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowAndThenDeny) {
LaunchApp("web_view/media_access/allow");
- scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
+ std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
embedder_web_contents_->SetDelegate(mock.get());
RunTest("testAllowAndThenDeny");
@@ -115,7 +115,7 @@ IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowAndThenDeny) {
IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowAsync) {
LaunchApp("web_view/media_access/allow");
- scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
+ std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
embedder_web_contents_->SetDelegate(mock.get());
RunTest("testAllowAsync");
@@ -125,7 +125,7 @@ IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowAsync) {
IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowTwice) {
LaunchApp("web_view/media_access/allow");
- scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
+ std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
embedder_web_contents_->SetDelegate(mock.get());
RunTest("testAllowTwice");
@@ -135,7 +135,7 @@ IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestAllowTwice) {
IN_PROC_BROWSER_TEST_F(WebViewMediaAccessAPITest, TestCheck) {
LaunchApp("web_view/media_access/check");
- scoped_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
+ std::unique_ptr<MockWebContentsDelegate> mock(new MockWebContentsDelegate());
embedder_web_contents_->SetDelegate(mock.get());
RunTest("testCheck");
diff --git a/chromium/extensions/browser/guest_view/web_view/web_view_permission_helper.cc b/chromium/extensions/browser/guest_view/web_view/web_view_permission_helper.cc
index 822f1312f5c..28142410974 100644
--- a/chromium/extensions/browser/guest_view/web_view/web_view_permission_helper.cc
+++ b/chromium/extensions/browser/guest_view/web_view/web_view_permission_helper.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/memory/ptr_util.h"
#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"
@@ -230,14 +231,14 @@ void WebViewPermissionHelper::OnMediaPermissionResponse(
if (!allow) {
callback.Run(content::MediaStreamDevices(),
content::MEDIA_DEVICE_PERMISSION_DENIED,
- scoped_ptr<content::MediaStreamUI>());
+ std::unique_ptr<content::MediaStreamUI>());
return;
}
if (!web_view_guest()->attached() ||
!web_view_guest()->embedder_web_contents()->GetDelegate()) {
callback.Run(content::MediaStreamDevices(),
content::MEDIA_DEVICE_INVALID_STATE,
- scoped_ptr<content::MediaStreamUI>());
+ std::unique_ptr<content::MediaStreamUI>());
return;
}
@@ -328,24 +329,24 @@ int WebViewPermissionHelper::RequestPermission(
int request_id = next_permission_request_id_++;
pending_permission_requests_[request_id] =
PermissionResponseInfo(callback, permission_type, allowed_by_default);
- scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue());
args->Set(webview::kRequestInfo, request_info.DeepCopy());
args->SetInteger(webview::kRequestId, request_id);
switch (permission_type) {
case WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW: {
- web_view_guest_->DispatchEventToView(make_scoped_ptr(
+ web_view_guest_->DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventNewWindow, std::move(args))));
break;
}
case WEB_VIEW_PERMISSION_TYPE_JAVASCRIPT_DIALOG: {
- web_view_guest_->DispatchEventToView(make_scoped_ptr(
+ web_view_guest_->DispatchEventToView(base::WrapUnique(
new GuestViewEvent(webview::kEventDialog, std::move(args))));
break;
}
default: {
args->SetString(webview::kPermission,
PermissionTypeToString(permission_type));
- web_view_guest_->DispatchEventToView(make_scoped_ptr(new GuestViewEvent(
+ web_view_guest_->DispatchEventToView(base::WrapUnique(new GuestViewEvent(
webview::kEventPermissionRequest, std::move(args))));
break;
}
diff --git a/chromium/extensions/browser/guest_view/web_view/web_view_permission_helper.h b/chromium/extensions/browser/guest_view/web_view/web_view_permission_helper.h
index f5d037ddc43..a23623ae4fd 100644
--- a/chromium/extensions/browser/guest_view/web_view/web_view_permission_helper.h
+++ b/chromium/extensions/browser/guest_view/web_view/web_view_permission_helper.h
@@ -153,7 +153,7 @@ class WebViewPermissionHelper
WebViewPermissionHelper::RequestMap pending_permission_requests_;
- scoped_ptr<WebViewPermissionHelperDelegate>
+ std::unique_ptr<WebViewPermissionHelperDelegate>
web_view_permission_helper_delegate_;
WebViewGuest* const web_view_guest_;
diff --git a/chromium/extensions/browser/image_loader_unittest.cc b/chromium/extensions/browser/image_loader_unittest.cc
index 06c48d02d2d..f87aa4da1cc 100644
--- a/chromium/extensions/browser/image_loader_unittest.cc
+++ b/chromium/extensions/browser/image_loader_unittest.cc
@@ -86,8 +86,9 @@ class ImageLoaderTest : public ExtensionsTest {
std::string error;
JSONFileValueDeserializer deserializer(
extension_dir.AppendASCII("manifest.json"));
- scoped_ptr<base::DictionaryValue> valid_value = base::DictionaryValue::From(
- deserializer.Deserialize(&error_code, &error));
+ std::unique_ptr<base::DictionaryValue> valid_value =
+ base::DictionaryValue::From(
+ deserializer.Deserialize(&error_code, &error));
EXPECT_EQ(0, error_code) << error;
if (error_code != 0)
return NULL;
@@ -116,7 +117,7 @@ class ImageLoaderTest : public ExtensionsTest {
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
content::TestBrowserThread io_thread_;
- scoped_ptr<NotificationService> notification_service_;
+ std::unique_ptr<NotificationService> notification_service_;
};
// Tests loading an image works correctly.
diff --git a/chromium/extensions/browser/info_map.h b/chromium/extensions/browser/info_map.h
index c540cef6549..2deafec5e82 100644
--- a/chromium/extensions/browser/info_map.h
+++ b/chromium/extensions/browser/info_map.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_INFO_MAP_H_
#define EXTENSIONS_BROWSER_INFO_MAP_H_
+#include <memory>
#include <string>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "extensions/browser/process_map.h"
#include "extensions/browser/quota_service.h"
@@ -114,7 +114,7 @@ class InfoMap : public base::RefCountedThreadSafe<InfoMap> {
// Used by dispatchers to limit API quota for individual extensions.
// The QuotaService is not thread safe. We need to create and destroy it on
// the IO thread.
- scoped_ptr<QuotaService> quota_service_;
+ std::unique_ptr<QuotaService> quota_service_;
// Assignment of extensions to renderer processes.
extensions::ProcessMap process_map_;
diff --git a/chromium/extensions/browser/lazy_background_task_queue_unittest.cc b/chromium/extensions/browser/lazy_background_task_queue_unittest.cc
index 02ec3bbedd3..c464c5b1b5c 100644
--- a/chromium/extensions/browser/lazy_background_task_queue_unittest.cc
+++ b/chromium/extensions/browser/lazy_background_task_queue_unittest.cc
@@ -4,9 +4,11 @@
#include "extensions/browser/lazy_background_task_queue.h"
+#include <memory>
+
#include "base/bind.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
+#include "base/memory/ptr_util.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/pref_registry/testing_pref_service_syncable.h"
#include "components/prefs/testing_pref_service.h"
@@ -55,8 +57,9 @@ class TestProcessManager : public ProcessManager {
DISALLOW_COPY_AND_ASSIGN(TestProcessManager);
};
-scoped_ptr<KeyedService> CreateTestProcessManager(BrowserContext* context) {
- return make_scoped_ptr(new TestProcessManager(context));
+std::unique_ptr<KeyedService> CreateTestProcessManager(
+ BrowserContext* context) {
+ return base::WrapUnique(new TestProcessManager(context));
}
} // namespace
@@ -119,7 +122,7 @@ class LazyBackgroundTaskQueueTest : public ExtensionsTest {
}
private:
- scoped_ptr<content::NotificationService> notification_service_;
+ std::unique_ptr<content::NotificationService> notification_service_;
user_prefs::TestingPrefServiceSyncable testing_pref_service_;
diff --git a/chromium/extensions/browser/load_monitoring_extension_host_queue.cc b/chromium/extensions/browser/load_monitoring_extension_host_queue.cc
index 47e8557abc1..0e9a9b1092e 100644
--- a/chromium/extensions/browser/load_monitoring_extension_host_queue.cc
+++ b/chromium/extensions/browser/load_monitoring_extension_host_queue.cc
@@ -19,7 +19,7 @@
namespace extensions {
LoadMonitoringExtensionHostQueue::LoadMonitoringExtensionHostQueue(
- scoped_ptr<ExtensionHostQueue> delegate,
+ std::unique_ptr<ExtensionHostQueue> delegate,
base::TimeDelta monitor_time,
const FinishedCallback& finished_callback)
: delegate_(std::move(delegate)),
@@ -33,7 +33,7 @@ LoadMonitoringExtensionHostQueue::LoadMonitoringExtensionHostQueue(
weak_ptr_factory_(this) {}
LoadMonitoringExtensionHostQueue::LoadMonitoringExtensionHostQueue(
- scoped_ptr<ExtensionHostQueue> delegate)
+ std::unique_ptr<ExtensionHostQueue> delegate)
: LoadMonitoringExtensionHostQueue(std::move(delegate),
base::TimeDelta::FromMinutes(1),
FinishedCallback()) {}
diff --git a/chromium/extensions/browser/load_monitoring_extension_host_queue.h b/chromium/extensions/browser/load_monitoring_extension_host_queue.h
index 661e80fe6ca..64b9ee3a618 100644
--- a/chromium/extensions/browser/load_monitoring_extension_host_queue.h
+++ b/chromium/extensions/browser/load_monitoring_extension_host_queue.h
@@ -7,11 +7,11 @@
#include <stddef.h>
+#include <memory>
#include <set>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "base/time/time.h"
@@ -34,7 +34,7 @@ class LoadMonitoringExtensionHostQueue
size_t, // max_awaiting_loading
size_t // max_active_loading
)>;
- LoadMonitoringExtensionHostQueue(scoped_ptr<ExtensionHostQueue> delegate,
+ LoadMonitoringExtensionHostQueue(std::unique_ptr<ExtensionHostQueue> delegate,
base::TimeDelta monitor_time,
const FinishedCallback& finished_callback);
@@ -43,7 +43,7 @@ class LoadMonitoringExtensionHostQueue
// Monitoring will not start until the first Add()ed
// DeferredStartRenderHost starts loading, or StartMonitoring() is called.
explicit LoadMonitoringExtensionHostQueue(
- scoped_ptr<ExtensionHostQueue> delegate);
+ std::unique_ptr<ExtensionHostQueue> delegate);
~LoadMonitoringExtensionHostQueue() override;
@@ -79,7 +79,7 @@ class LoadMonitoringExtensionHostQueue
void FinishMonitoring();
// Delegate actually loading DeferredStartRenderHosts to another queue.
- scoped_ptr<ExtensionHostQueue> delegate_;
+ std::unique_ptr<ExtensionHostQueue> delegate_;
// The amount of time to monitor for. By default this is 1 minute, but it can
// be overriden by tests.
diff --git a/chromium/extensions/browser/load_monitoring_extension_host_queue_unittest.cc b/chromium/extensions/browser/load_monitoring_extension_host_queue_unittest.cc
index b5ba4468696..a36bdfa5ef1 100644
--- a/chromium/extensions/browser/load_monitoring_extension_host_queue_unittest.cc
+++ b/chromium/extensions/browser/load_monitoring_extension_host_queue_unittest.cc
@@ -2,17 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "extensions/browser/load_monitoring_extension_host_queue.h"
+
#include <stddef.h>
#include <limits>
#include <vector>
#include "base/bind.h"
+#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "extensions/browser/deferred_start_render_host.h"
#include "extensions/browser/extensions_test.h"
-#include "extensions/browser/load_monitoring_extension_host_queue.h"
#include "extensions/browser/serial_extension_host_queue.h"
namespace extensions {
@@ -58,7 +60,7 @@ class LoadMonitoringExtensionHostQueueTest : public ExtensionsTest {
void SetUp() override {
queue_.reset(new LoadMonitoringExtensionHostQueue(
// Use a SerialExtensionHostQueue because it's simple.
- scoped_ptr<ExtensionHostQueue>(new SerialExtensionHostQueue()),
+ std::unique_ptr<ExtensionHostQueue>(new SerialExtensionHostQueue()),
base::TimeDelta(), // no delay, easier to test
base::Bind(&LoadMonitoringExtensionHostQueueTest::Finished,
base::Unretained(this))));
@@ -68,7 +70,7 @@ class LoadMonitoringExtensionHostQueueTest : public ExtensionsTest {
// Creates a new DeferredStartRenderHost. Ownership is held by this class,
// not passed to caller.
StubDeferredStartRenderHost* CreateHost() {
- stubs_.push_back(make_scoped_ptr(new StubDeferredStartRenderHost()));
+ stubs_.push_back(base::WrapUnique(new StubDeferredStartRenderHost()));
return stubs_.back().get();
}
@@ -100,8 +102,8 @@ class LoadMonitoringExtensionHostQueueTest : public ExtensionsTest {
}
content::TestBrowserThreadBundle thread_bundle_;
- scoped_ptr<LoadMonitoringExtensionHostQueue> queue_;
- std::vector<scoped_ptr<StubDeferredStartRenderHost>> stubs_;
+ std::unique_ptr<LoadMonitoringExtensionHostQueue> queue_;
+ std::vector<std::unique_ptr<StubDeferredStartRenderHost>> stubs_;
// Set after the queue has finished monitoring.
bool finished_;
diff --git a/chromium/extensions/browser/mock_extension_system.cc b/chromium/extensions/browser/mock_extension_system.cc
index 6658832e744..621fe93a711 100644
--- a/chromium/extensions/browser/mock_extension_system.cc
+++ b/chromium/extensions/browser/mock_extension_system.cc
@@ -71,9 +71,9 @@ ContentVerifier* MockExtensionSystem::content_verifier() {
return nullptr;
}
-scoped_ptr<ExtensionSet> MockExtensionSystem::GetDependentExtensions(
+std::unique_ptr<ExtensionSet> MockExtensionSystem::GetDependentExtensions(
const Extension* extension) {
- return scoped_ptr<ExtensionSet>();
+ return std::unique_ptr<ExtensionSet>();
}
void MockExtensionSystem::InstallUpdate(const std::string& extension_id,
diff --git a/chromium/extensions/browser/mock_extension_system.h b/chromium/extensions/browser/mock_extension_system.h
index b926baad84b..c8748dfb661 100644
--- a/chromium/extensions/browser/mock_extension_system.h
+++ b/chromium/extensions/browser/mock_extension_system.h
@@ -41,7 +41,7 @@ class MockExtensionSystem : public ExtensionSystem {
AppSorting* app_sorting() override;
const OneShotEvent& ready() const override;
ContentVerifier* content_verifier() override;
- scoped_ptr<ExtensionSet> GetDependentExtensions(
+ std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) override;
void InstallUpdate(const std::string& extension_id,
const base::FilePath& temp_dir) override;
diff --git a/chromium/extensions/browser/mojo/DEPS b/chromium/extensions/browser/mojo/DEPS
index 2273ad20a57..df73043fafe 100644
--- a/chromium/extensions/browser/mojo/DEPS
+++ b/chromium/extensions/browser/mojo/DEPS
@@ -1,4 +1,3 @@
include_rules = [
- "+mojo/message_pump",
- "+mojo/shell/public/interfaces",
+ "+services/shell/public/interfaces",
]
diff --git a/chromium/extensions/browser/mojo/keep_alive_impl_unittest.cc b/chromium/extensions/browser/mojo/keep_alive_impl_unittest.cc
index 5d640e055d3..4a6732d5727 100644
--- a/chromium/extensions/browser/mojo/keep_alive_impl_unittest.cc
+++ b/chromium/extensions/browser/mojo/keep_alive_impl_unittest.cc
@@ -72,8 +72,8 @@ class KeepAliveTest : public ExtensionsTest {
}
private:
- scoped_ptr<base::MessageLoop> message_loop_;
- scoped_ptr<content::NotificationService> notification_service_;
+ std::unique_ptr<base::MessageLoop> message_loop_;
+ std::unique_ptr<content::NotificationService> notification_service_;
scoped_refptr<const Extension> extension_;
DISALLOW_COPY_AND_ASSIGN(KeepAliveTest);
diff --git a/chromium/extensions/browser/mojo/service_registration.cc b/chromium/extensions/browser/mojo/service_registration.cc
index c6367f070f9..d6091eafcdb 100644
--- a/chromium/extensions/browser/mojo/service_registration.cc
+++ b/chromium/extensions/browser/mojo/service_registration.cc
@@ -22,6 +22,7 @@
#include "extensions/common/switches.h"
#if defined(ENABLE_WIFI_DISPLAY)
+#include "extensions/browser/api/display_source/wifi_display/wifi_display_media_service_impl.h"
#include "extensions/browser/api/display_source/wifi_display/wifi_display_session_service_impl.h"
#endif
@@ -65,6 +66,8 @@ void RegisterServicesForFrame(content::RenderFrameHost* render_frame_host,
service_registry->AddService(
base::Bind(WiFiDisplaySessionServiceImpl::BindToRequest,
render_frame_host->GetProcess()->GetBrowserContext()));
+ service_registry->AddService(
+ base::Bind(WiFiDisplayMediaServiceImpl::BindToRequest));
}
#endif
}
diff --git a/chromium/extensions/browser/mojo/stash_backend.cc b/chromium/extensions/browser/mojo/stash_backend.cc
index 8d3eb40dbee..8104c4d09a5 100644
--- a/chromium/extensions/browser/mojo/stash_backend.cc
+++ b/chromium/extensions/browser/mojo/stash_backend.cc
@@ -11,8 +11,9 @@
#include "base/bind.h"
#include "base/macros.h"
-#include "mojo/message_pump/handle_watcher.h"
+#include "base/memory/ptr_util.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/public/cpp/system/watcher.h"
namespace extensions {
namespace {
@@ -84,7 +85,7 @@ class StashBackend::StashEntry {
void OnHandleReady(MojoResult result);
// The waiters that are waiting for handles to be readable.
- std::vector<scoped_ptr<mojo::common::HandleWatcher>> waiters_;
+ std::vector<std::unique_ptr<mojo::Watcher>> waiters_;
StashedObjectPtr stashed_object_;
@@ -104,7 +105,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_.push_back(base::WrapUnique(new StashEntry(
std::move(stashed_objects[i]),
has_notified_ ? base::Closure()
: base::Bind(&StashBackend::OnHandleReady,
@@ -144,10 +145,9 @@ StashBackend::StashEntry::StashEntry(StashedObjectPtr stashed_object,
return;
for (size_t i = 0; i < stashed_object_->stashed_handles.size(); i++) {
- scoped_ptr<mojo::common::HandleWatcher> watcher(
- new mojo::common::HandleWatcher());
+ std::unique_ptr<mojo::Watcher> watcher(new mojo::Watcher);
watcher->Start(stashed_object_->stashed_handles[i].get(),
- MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE,
+ MOJO_HANDLE_SIGNAL_READABLE,
base::Bind(&StashBackend::StashEntry::OnHandleReady,
base::Unretained(this)));
waiters_.push_back(std::move(watcher));
diff --git a/chromium/extensions/browser/mojo/stash_backend.h b/chromium/extensions/browser/mojo/stash_backend.h
index f374e00f957..a6d2515c2ff 100644
--- a/chromium/extensions/browser/mojo/stash_backend.h
+++ b/chromium/extensions/browser/mojo/stash_backend.h
@@ -39,7 +39,7 @@ class StashBackend {
void OnHandleReady();
// The objects that have been stashed.
- std::vector<scoped_ptr<StashEntry>> stashed_objects_;
+ std::vector<std::unique_ptr<StashEntry>> stashed_objects_;
// The callback to call when a handle is readable.
const base::Closure on_handle_readable_;
diff --git a/chromium/extensions/browser/mojo/stash_backend_unittest.cc b/chromium/extensions/browser/mojo/stash_backend_unittest.cc
index cf69f98c43b..48991011825 100644
--- a/chromium/extensions/browser/mojo/stash_backend_unittest.cc
+++ b/chromium/extensions/browser/mojo/stash_backend_unittest.cc
@@ -12,7 +12,7 @@
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
-#include "mojo/shell/public/interfaces/interface_provider.mojom.h"
+#include "services/shell/public/interfaces/interface_provider.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace extensions {
@@ -95,7 +95,7 @@ class StashServiceTest : public testing::Test {
protected:
base::MessageLoop message_loop_;
base::Closure stop_run_loop_;
- scoped_ptr<StashBackend> stash_backend_;
+ std::unique_ptr<StashBackend> stash_backend_;
Event expected_event_;
bool expecting_error_;
mojo::InterfacePtr<StashService> stash_service_;
@@ -191,7 +191,7 @@ TEST_F(StashServiceTest, NotifyOnReadableHandle) {
stashed_object->id = "test type";
stashed_object->data.push_back(0);
stashed_object->monitor_handles = true;
- mojo::shell::mojom::InterfaceProviderPtr service_provider;
+ shell::mojom::InterfaceProviderPtr service_provider;
// Stash the ServiceProvider request. When we make a call on
// |service_provider|, the stashed handle will become readable.
diff --git a/chromium/extensions/browser/process_manager_unittest.cc b/chromium/extensions/browser/process_manager_unittest.cc
index e5336c6736c..aa6b108365b 100644
--- a/chromium/extensions/browser/process_manager_unittest.cc
+++ b/chromium/extensions/browser/process_manager_unittest.cc
@@ -90,7 +90,7 @@ class ProcessManagerTest : public ExtensionsTest {
}
private:
- scoped_ptr<content::NotificationService> notification_service_;
+ std::unique_ptr<content::NotificationService> notification_service_;
TestBrowserContextIncognito incognito_context_;
ExtensionRegistry extension_registry_; // Shared between BrowserContexts.
TestProcessManagerDelegate process_manager_delegate_;
@@ -101,7 +101,7 @@ class ProcessManagerTest : public ExtensionsTest {
// Test that notification registration works properly.
TEST_F(ProcessManagerTest, ExtensionNotificationRegistration) {
// Test for a normal context ProcessManager.
- scoped_ptr<ProcessManager> manager1(ProcessManager::CreateForTesting(
+ std::unique_ptr<ProcessManager> manager1(ProcessManager::CreateForTesting(
original_context(), extension_registry()));
EXPECT_EQ(original_context(), manager1->browser_context());
@@ -116,10 +116,9 @@ TEST_F(ProcessManagerTest, ExtensionNotificationRegistration) {
original_context()));
// Test for an incognito context ProcessManager.
- scoped_ptr<ProcessManager> manager2(
- ProcessManager::CreateIncognitoForTesting(incognito_context(),
- original_context(),
- extension_registry()));
+ std::unique_ptr<ProcessManager> manager2(
+ ProcessManager::CreateIncognitoForTesting(
+ incognito_context(), original_context(), extension_registry()));
EXPECT_EQ(incognito_context(), manager2->browser_context());
EXPECT_EQ(0u, manager2->background_hosts().size());
@@ -143,7 +142,7 @@ TEST_F(ProcessManagerTest, ExtensionNotificationRegistration) {
// because ExtensionHost is tightly coupled to WebContents and can't be
// constructed in unit tests.
TEST_F(ProcessManagerTest, CreateBackgroundHostsOnExtensionsReady) {
- scoped_ptr<ProcessManager> manager(ProcessManager::CreateForTesting(
+ std::unique_ptr<ProcessManager> manager(ProcessManager::CreateForTesting(
original_context(), extension_registry()));
ASSERT_FALSE(manager->startup_background_hosts_created_for_test());
@@ -158,7 +157,7 @@ TEST_F(ProcessManagerTest, CreateBackgroundHostsOnExtensionsReady) {
// Test that startup background hosts can be created explicitly before the
// extension system is ready (this is the normal pattern in Chrome).
TEST_F(ProcessManagerTest, CreateBackgroundHostsExplicitly) {
- scoped_ptr<ProcessManager> manager(ProcessManager::CreateForTesting(
+ std::unique_ptr<ProcessManager> manager(ProcessManager::CreateForTesting(
original_context(), extension_registry()));
ASSERT_FALSE(manager->startup_background_hosts_created_for_test());
@@ -171,7 +170,7 @@ TEST_F(ProcessManagerTest, CreateBackgroundHostsExplicitly) {
// Test that the embedder can defer background host creation. Chrome does this
// when the profile is created asynchronously, which may take a while.
TEST_F(ProcessManagerTest, CreateBackgroundHostsDeferred) {
- scoped_ptr<ProcessManager> manager(ProcessManager::CreateForTesting(
+ std::unique_ptr<ProcessManager> manager(ProcessManager::CreateForTesting(
original_context(), extension_registry()));
ASSERT_FALSE(manager->startup_background_hosts_created_for_test());
@@ -196,7 +195,7 @@ TEST_F(ProcessManagerTest, CreateBackgroundHostsDeferred) {
// Test that the embedder can disallow background host creation.
// Chrome OS does this in guest mode.
TEST_F(ProcessManagerTest, IsBackgroundHostAllowed) {
- scoped_ptr<ProcessManager> manager(ProcessManager::CreateForTesting(
+ std::unique_ptr<ProcessManager> manager(ProcessManager::CreateForTesting(
original_context(), extension_registry()));
ASSERT_FALSE(manager->startup_background_hosts_created_for_test());
@@ -218,13 +217,13 @@ TEST_F(ProcessManagerTest, IsBackgroundHostAllowed) {
TEST_F(ProcessManagerTest, ProcessGrouping) {
// Extensions in different browser contexts should always be different
// SiteInstances.
- scoped_ptr<ProcessManager> manager1(ProcessManager::CreateForTesting(
+ std::unique_ptr<ProcessManager> manager1(ProcessManager::CreateForTesting(
original_context(), extension_registry()));
// NOTE: This context is not associated with the TestExtensionsBrowserClient.
// That's OK because we're not testing regular vs. incognito behavior.
TestBrowserContext another_context;
ExtensionRegistry another_registry(&another_context);
- scoped_ptr<ProcessManager> manager2(
+ std::unique_ptr<ProcessManager> manager2(
ProcessManager::CreateForTesting(&another_context, &another_registry));
// Extensions with common origins ("scheme://id/") should be grouped in the
diff --git a/chromium/extensions/browser/quota_service.h b/chromium/extensions/browser/quota_service.h
index b4079ded513..2ff8a1fab45 100644
--- a/chromium/extensions/browser/quota_service.h
+++ b/chromium/extensions/browser/quota_service.h
@@ -18,12 +18,12 @@
#include <list>
#include <map>
+#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "base/containers/hash_tables.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -192,7 +192,7 @@ class QuotaLimitHeuristic {
const Config config_;
// The mapper used in Map. Cannot be NULL.
- scoped_ptr<BucketMapper> bucket_mapper_;
+ std::unique_ptr<BucketMapper> bucket_mapper_;
// The name of the heuristic for formatting error messages.
std::string name_;
diff --git a/chromium/extensions/browser/quota_service_unittest.cc b/chromium/extensions/browser/quota_service_unittest.cc
index a70e7f2cbe0..dd73849be11 100644
--- a/chromium/extensions/browser/quota_service_unittest.cc
+++ b/chromium/extensions/browser/quota_service_unittest.cc
@@ -30,7 +30,6 @@ namespace {
const char kGenericName[] = "name";
const Config kFrozenConfig = {0, TimeDelta::FromDays(0)};
const Config k2PerMinute = {2, TimeDelta::FromMinutes(1)};
-const Config k20PerHour = {20, TimeDelta::FromHours(1)};
const TimeTicks kStartTime = TimeTicks();
const TimeTicks k1MinuteAfterStart = kStartTime + TimeDelta::FromMinutes(1);
@@ -121,7 +120,7 @@ class QuotaServiceTest : public testing::Test {
std::string extension_a_;
std::string extension_b_;
std::string extension_c_;
- scoped_ptr<QuotaService> service_;
+ std::unique_ptr<QuotaService> service_;
base::MessageLoop loop_;
content::TestBrowserThread ui_thread_;
};
diff --git a/chromium/extensions/browser/sandboxed_unpacker.cc b/chromium/extensions/browser/sandboxed_unpacker.cc
index ab84c2adbd9..e0ae0286a29 100644
--- a/chromium/extensions/browser/sandboxed_unpacker.cc
+++ b/chromium/extensions/browser/sandboxed_unpacker.cc
@@ -431,7 +431,7 @@ void SandboxedUnpacker::OnUnpackExtensionSucceeded(
got_response_ = true;
utility_wrapper_ = nullptr;
- scoped_ptr<base::DictionaryValue> final_manifest(
+ std::unique_ptr<base::DictionaryValue> final_manifest(
RewriteManifestFile(manifest));
if (!final_manifest)
return;
@@ -683,7 +683,7 @@ base::DictionaryValue* SandboxedUnpacker::RewriteManifestFile(
// the original manifest. We do this to ensure the manifest doesn't contain an
// exploitable bug that could be used to compromise the browser.
DCHECK(!public_key_.empty());
- scoped_ptr<base::DictionaryValue> final_manifest(manifest.DeepCopy());
+ std::unique_ptr<base::DictionaryValue> final_manifest(manifest.DeepCopy());
final_manifest->SetString(manifest_keys::kPublicKey, public_key_);
std::string manifest_json;
diff --git a/chromium/extensions/browser/sandboxed_unpacker_unittest.cc b/chromium/extensions/browser/sandboxed_unpacker_unittest.cc
index a66b2fa5423..0e3bf9e7a33 100644
--- a/chromium/extensions/browser/sandboxed_unpacker_unittest.cc
+++ b/chromium/extensions/browser/sandboxed_unpacker_unittest.cc
@@ -10,7 +10,7 @@
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "components/crx_file/id_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
@@ -131,8 +131,8 @@ class SandboxedUnpackerTest : public ExtensionsTest {
base::ScopedTempDir extensions_dir_;
MockSandboxedUnpackerClient* client_;
scoped_refptr<SandboxedUnpacker> sandboxed_unpacker_;
- scoped_ptr<content::TestBrowserThreadBundle> browser_threads_;
- scoped_ptr<content::InProcessUtilityThreadHelper>
+ std::unique_ptr<content::TestBrowserThreadBundle> browser_threads_;
+ std::unique_ptr<content::InProcessUtilityThreadHelper>
in_process_utility_thread_helper_;
};
diff --git a/chromium/extensions/browser/state_store.cc b/chromium/extensions/browser/state_store.cc
index 2c8c9f9f1c8..ae67f895806 100644
--- a/chromium/extensions/browser/state_store.cc
+++ b/chromium/extensions/browser/state_store.cc
@@ -111,7 +111,7 @@ void StateStore::GetExtensionValue(const std::string& extension_id,
void StateStore::SetExtensionValue(const std::string& extension_id,
const std::string& key,
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
task_queue_->InvokeWhenReady(
base::Bind(&ValueStoreFrontend::Set, base::Unretained(store_.get()),
GetFullKey(extension_id, key), base::Passed(&value)));
diff --git a/chromium/extensions/browser/state_store.h b/chromium/extensions/browser/state_store.h
index 5cc0037cdb5..2ad313c3b5d 100644
--- a/chromium/extensions/browser/state_store.h
+++ b/chromium/extensions/browser/state_store.h
@@ -39,7 +39,8 @@ class StateStore : public base::SupportsWeakPtr<StateStore>,
ValueStoreFrontend::BackendType backend_type,
bool deferred_load);
// This variant is useful for testing (using a mock ValueStore).
- StateStore(content::BrowserContext* context, scoped_ptr<ValueStore> store);
+ StateStore(content::BrowserContext* context,
+ std::unique_ptr<ValueStore> store);
~StateStore() override;
// Requests that the state store to be initialized after its usual delay. Can
@@ -60,7 +61,7 @@ class StateStore : public base::SupportsWeakPtr<StateStore>,
// Sets a value for a given extension and key.
void SetExtensionValue(const std::string& extension_id,
const std::string& key,
- scoped_ptr<base::Value> value);
+ std::unique_ptr<base::Value> value);
// Removes a value for a given extension and key.
void RemoveExtensionValue(const std::string& extension_id,
@@ -96,14 +97,14 @@ class StateStore : public base::SupportsWeakPtr<StateStore>,
const std::string& old_name) override;
// The store that holds our key/values.
- scoped_ptr<ValueStoreFrontend> store_;
+ std::unique_ptr<ValueStoreFrontend> store_;
// List of all known keys. They will be cleared for each extension when it is
// (un)installed.
std::set<std::string> registered_keys_;
// Keeps track of tasks we have delayed while starting up.
- scoped_ptr<DelayedTaskQueue> task_queue_;
+ std::unique_ptr<DelayedTaskQueue> task_queue_;
content::NotificationRegistrar registrar_;
diff --git a/chromium/extensions/browser/test_extension_registry_observer.cc b/chromium/extensions/browser/test_extension_registry_observer.cc
index ab53b7a437a..ebdf1a85508 100644
--- a/chromium/extensions/browser/test_extension_registry_observer.cc
+++ b/chromium/extensions/browser/test_extension_registry_observer.cc
@@ -105,7 +105,7 @@ void TestExtensionRegistryObserver::OnExtensionUnloaded(
}
const Extension* TestExtensionRegistryObserver::Wait(
- scoped_ptr<Waiter>* waiter) {
+ std::unique_ptr<Waiter>* waiter) {
waiter->get()->Wait();
const Extension* extension = waiter->get()->extension();
// Reset the waiter for future uses.
diff --git a/chromium/extensions/browser/test_extension_registry_observer.h b/chromium/extensions/browser/test_extension_registry_observer.h
index ce0a3f86e41..30074979f91 100644
--- a/chromium/extensions/browser/test_extension_registry_observer.h
+++ b/chromium/extensions/browser/test_extension_registry_observer.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_TEST_EXTENSION_REGISTRY_OBSERVER_H_
#define EXTENSIONS_BROWSER_TEST_EXTENSION_REGISTRY_OBSERVER_H_
+#include <memory>
#include <string>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/scoped_observer.h"
#include "extensions/browser/extension_registry_observer.h"
@@ -49,12 +49,12 @@ class TestExtensionRegistryObserver : public ExtensionRegistryObserver {
const Extension* extension,
UnloadedExtensionInfo::Reason reason) override;
- const Extension* Wait(scoped_ptr<Waiter>* waiter);
+ const Extension* Wait(std::unique_ptr<Waiter>* waiter);
- scoped_ptr<Waiter> will_be_installed_waiter_;
- scoped_ptr<Waiter> uninstalled_waiter_;
- scoped_ptr<Waiter> loaded_waiter_;
- scoped_ptr<Waiter> unloaded_waiter_;
+ std::unique_ptr<Waiter> will_be_installed_waiter_;
+ std::unique_ptr<Waiter> uninstalled_waiter_;
+ std::unique_ptr<Waiter> loaded_waiter_;
+ std::unique_ptr<Waiter> unloaded_waiter_;
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
extension_registry_observer_;
diff --git a/chromium/extensions/browser/test_extensions_browser_client.cc b/chromium/extensions/browser/test_extensions_browser_client.cc
index 7ba4dfac65c..293d1feb164 100644
--- a/chromium/extensions/browser/test_extensions_browser_client.cc
+++ b/chromium/extensions/browser/test_extensions_browser_client.cc
@@ -134,9 +134,9 @@ ProcessManagerDelegate* TestExtensionsBrowserClient::GetProcessManagerDelegate()
return process_manager_delegate_;
}
-scoped_ptr<ExtensionHostDelegate>
+std::unique_ptr<ExtensionHostDelegate>
TestExtensionsBrowserClient::CreateExtensionHostDelegate() {
- return scoped_ptr<ExtensionHostDelegate>();
+ return std::unique_ptr<ExtensionHostDelegate>();
}
bool TestExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) {
@@ -171,10 +171,10 @@ void TestExtensionsBrowserClient::RegisterMojoServices(
const Extension* extension) const {
}
-scoped_ptr<RuntimeAPIDelegate>
+std::unique_ptr<RuntimeAPIDelegate>
TestExtensionsBrowserClient::CreateRuntimeAPIDelegate(
content::BrowserContext* context) const {
- return scoped_ptr<RuntimeAPIDelegate>(new TestRuntimeAPIDelegate());
+ return std::unique_ptr<RuntimeAPIDelegate>(new TestRuntimeAPIDelegate());
}
const ComponentExtensionResourceManager*
@@ -185,7 +185,7 @@ TestExtensionsBrowserClient::GetComponentExtensionResourceManager() {
void TestExtensionsBrowserClient::BroadcastEventToRenderers(
events::HistogramValue histogram_value,
const std::string& event_name,
- scoped_ptr<base::ListValue> args) {}
+ std::unique_ptr<base::ListValue> args) {}
net::NetLog* TestExtensionsBrowserClient::GetNetLog() {
return NULL;
diff --git a/chromium/extensions/browser/test_extensions_browser_client.h b/chromium/extensions/browser/test_extensions_browser_client.h
index 2b0dafb0b7d..e66fe98910e 100644
--- a/chromium/extensions/browser/test_extensions_browser_client.h
+++ b/chromium/extensions/browser/test_extensions_browser_client.h
@@ -35,7 +35,7 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
void set_extension_system_factory(ExtensionSystemProvider* factory) {
extension_system_factory_ = factory;
}
- void set_extension_cache(scoped_ptr<ExtensionCache> extension_cache) {
+ void set_extension_cache(std::unique_ptr<ExtensionCache> extension_cache) {
extension_cache_ = std::move(extension_cache);
}
@@ -85,7 +85,7 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
content::BrowserContext* context,
std::vector<ExtensionPrefsObserver*>* observers) const override;
ProcessManagerDelegate* GetProcessManagerDelegate() const override;
- scoped_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override;
+ std::unique_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override;
bool DidVersionUpdate(content::BrowserContext* context) override;
void PermitExternalProtocolHandler() override;
bool IsRunningInForcedAppMode() override;
@@ -97,13 +97,14 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
ExtensionFunctionRegistry* registry) const override;
void RegisterMojoServices(content::RenderFrameHost* render_frame_host,
const Extension* extension) const override;
- scoped_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
+ std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
content::BrowserContext* context) const override;
const ComponentExtensionResourceManager*
GetComponentExtensionResourceManager() override;
- void BroadcastEventToRenderers(events::HistogramValue histogram_value,
- const std::string& event_name,
- scoped_ptr<base::ListValue> args) override;
+ void BroadcastEventToRenderers(
+ events::HistogramValue histogram_value,
+ const std::string& event_name,
+ std::unique_ptr<base::ListValue> args) override;
net::NetLog* GetNetLog() override;
ExtensionCache* GetExtensionCache() override;
bool IsBackgroundUpdateAllowed() override;
@@ -123,7 +124,7 @@ class TestExtensionsBrowserClient : public ExtensionsBrowserClient {
// Not owned, defaults to NULL.
ExtensionSystemProvider* extension_system_factory_;
- scoped_ptr<ExtensionCache> extension_cache_;
+ std::unique_ptr<ExtensionCache> extension_cache_;
base::Callback<update_client::UpdateClient*(void)> update_client_factory_;
diff --git a/chromium/extensions/browser/updater/extension_downloader.cc b/chromium/extensions/browser/updater/extension_downloader.cc
index 116ef7abb15..66cc2ee2ddf 100644
--- a/chromium/extensions/browser/updater/extension_downloader.cc
+++ b/chromium/extensions/browser/updater/extension_downloader.cc
@@ -27,6 +27,7 @@
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/notification_types.h"
#include "extensions/browser/updater/extension_cache.h"
+#include "extensions/browser/updater/extension_downloader_test_delegate.h"
#include "extensions/browser/updater/request_queue_impl.h"
#include "extensions/browser/updater/safe_manifest_parser.h"
#include "extensions/common/extension_urls.h"
@@ -90,6 +91,8 @@ const char kTokenServiceConsumerId[] = "extension_downloader";
const char kWebstoreOAuth2Scope[] =
"https://www.googleapis.com/auth/chromewebstore.readonly";
+ExtensionDownloaderTestDelegate* g_test_delegate = nullptr;
+
#define RETRY_HISTOGRAM(name, retry_count, url) \
if ((url).DomainIs(kGoogleDotCom)) { \
UMA_HISTOGRAM_CUSTOM_COUNTS("Extensions." name "RetryCountGoogleUrl", \
@@ -190,7 +193,6 @@ ExtensionDownloader::ExtensionDownloader(
base::Bind(&ExtensionDownloader::CreateExtensionFetcher,
base::Unretained(this))),
extension_cache_(NULL),
- enable_extra_update_metrics_(false),
weak_ptr_factory_(this) {
DCHECK(delegate_);
DCHECK(request_context_.get());
@@ -252,7 +254,7 @@ void ExtensionDownloader::DoStartAllPending() {
++it) {
std::vector<linked_ptr<ManifestFetchData>>& list = it->second;
for (size_t i = 0; i < list.size(); ++i) {
- StartUpdateCheck(scoped_ptr<ManifestFetchData>(list[i].release()));
+ StartUpdateCheck(std::unique_ptr<ManifestFetchData>(list[i].release()));
}
}
fetches_preparing_.clear();
@@ -265,7 +267,7 @@ void ExtensionDownloader::StartBlacklistUpdate(
// Note: it is very important that we use the https version of the update
// url here to avoid DNS hijacking of the blacklist, which is not validated
// by a public key signature like .crx files are.
- scoped_ptr<ManifestFetchData> blacklist_fetch(CreateManifestFetchData(
+ std::unique_ptr<ManifestFetchData> blacklist_fetch(CreateManifestFetchData(
extension_urls::GetWebstoreUpdateUrl(), request_id));
DCHECK(blacklist_fetch->base_url().SchemeIsCryptographic());
blacklist_fetch->AddExtension(kBlacklistAppID, version, &ping_data,
@@ -274,10 +276,16 @@ void ExtensionDownloader::StartBlacklistUpdate(
}
void ExtensionDownloader::SetWebstoreIdentityProvider(
- scoped_ptr<IdentityProvider> identity_provider) {
+ std::unique_ptr<IdentityProvider> identity_provider) {
identity_provider_.swap(identity_provider);
}
+// static
+void ExtensionDownloader::set_test_delegate(
+ ExtensionDownloaderTestDelegate* delegate) {
+ g_test_delegate = delegate;
+}
+
bool ExtensionDownloader::AddExtensionData(const std::string& id,
const Version& version,
Manifest::Type extension_type,
@@ -334,53 +342,42 @@ bool ExtensionDownloader::AddExtensionData(const std::string& id,
break;
}
- std::vector<GURL> update_urls;
- update_urls.push_back(update_url);
- // If metrics are enabled, also add to ManifestFetchData for the
- // webstore update URL.
- if (!extension_urls::IsWebstoreUpdateUrl(update_url) &&
- enable_extra_update_metrics_) {
- update_urls.push_back(extension_urls::GetWebstoreUpdateUrl());
- }
-
- for (size_t i = 0; i < update_urls.size(); ++i) {
- DCHECK(!update_urls[i].is_empty());
- DCHECK(update_urls[i].is_valid());
-
- std::string install_source =
- i == 0 ? kDefaultInstallSource : kNotFromWebstoreInstallSource;
-
- ManifestFetchData::PingData ping_data;
- ManifestFetchData::PingData* optional_ping_data = NULL;
- if (delegate_->GetPingDataForExtension(id, &ping_data))
- optional_ping_data = &ping_data;
-
- // Find or create a ManifestFetchData to add this extension to.
- bool added = false;
- FetchMap::iterator existing_iter =
- fetches_preparing_.find(std::make_pair(request_id, update_urls[i]));
- if (existing_iter != fetches_preparing_.end() &&
- !existing_iter->second.empty()) {
- // Try to add to the ManifestFetchData at the end of the list.
- ManifestFetchData* existing_fetch = existing_iter->second.back().get();
- if (existing_fetch->AddExtension(id, version.GetString(),
- optional_ping_data, update_url_data,
- install_source)) {
- added = true;
- }
- }
- if (!added) {
- // Otherwise add a new element to the list, if the list doesn't exist or
- // if its last element is already full.
- linked_ptr<ManifestFetchData> fetch(
- CreateManifestFetchData(update_urls[i], request_id));
- fetches_preparing_[std::make_pair(request_id, update_urls[i])].push_back(
- fetch);
- added = fetch->AddExtension(id, version.GetString(), optional_ping_data,
- update_url_data, install_source);
- DCHECK(added);
+ DCHECK(!update_url.is_empty());
+ DCHECK(update_url.is_valid());
+
+ std::string install_source = extension_urls::IsWebstoreUpdateUrl(update_url)
+ ? kDefaultInstallSource
+ : kNotFromWebstoreInstallSource;
+
+ ManifestFetchData::PingData ping_data;
+ ManifestFetchData::PingData* optional_ping_data = NULL;
+ if (delegate_->GetPingDataForExtension(id, &ping_data))
+ optional_ping_data = &ping_data;
+
+ // Find or create a ManifestFetchData to add this extension to.
+ bool added = false;
+ FetchMap::iterator existing_iter =
+ fetches_preparing_.find(std::make_pair(request_id, update_url));
+ if (existing_iter != fetches_preparing_.end() &&
+ !existing_iter->second.empty()) {
+ // Try to add to the ManifestFetchData at the end of the list.
+ ManifestFetchData* existing_fetch = existing_iter->second.back().get();
+ if (existing_fetch->AddExtension(id, version.GetString(),
+ optional_ping_data, update_url_data,
+ install_source)) {
+ added = true;
}
}
+ if (!added) {
+ // Otherwise add a new element to the list, if the list doesn't exist or
+ // if its last element is already full.
+ linked_ptr<ManifestFetchData> fetch(
+ CreateManifestFetchData(update_url, request_id));
+ fetches_preparing_[std::make_pair(request_id, update_url)].push_back(fetch);
+ added = fetch->AddExtension(id, version.GetString(), optional_ping_data,
+ update_url_data, install_source);
+ DCHECK(added);
+ }
return true;
}
@@ -404,7 +401,12 @@ void ExtensionDownloader::ReportStats() const {
}
void ExtensionDownloader::StartUpdateCheck(
- scoped_ptr<ManifestFetchData> fetch_data) {
+ std::unique_ptr<ManifestFetchData> fetch_data) {
+ if (g_test_delegate) {
+ g_test_delegate->StartUpdateCheck(this, delegate_, std::move(fetch_data));
+ return;
+ }
+
const std::set<std::string>& id_set(fetch_data->extension_ids());
if (!ExtensionsBrowserClient::Get()->IsBackgroundUpdateAllowed()) {
@@ -569,7 +571,7 @@ void ExtensionDownloader::HandleManifestResults(
crx_url = crx_url.ReplaceComponents(replacements);
}
}
- scoped_ptr<ExtensionFetch> fetch(
+ std::unique_ptr<ExtensionFetch> fetch(
new ExtensionFetch(update->extension_id, crx_url, update->package_hash,
update->version, fetch_data->request_ids()));
FetchUpdatedExtension(std::move(fetch));
@@ -656,7 +658,7 @@ void ExtensionDownloader::DetermineUpdates(
// Begins (or queues up) download of an updated extension.
void ExtensionDownloader::FetchUpdatedExtension(
- scoped_ptr<ExtensionFetch> fetch_data) {
+ std::unique_ptr<ExtensionFetch> fetch_data) {
if (!fetch_data->url.is_valid()) {
// TODO(asargent): This can sometimes be invalid. See crbug.com/130881.
DLOG(WARNING) << "Invalid URL: '" << fetch_data->url.possibly_invalid_spec()
@@ -697,7 +699,7 @@ void ExtensionDownloader::FetchUpdatedExtension(
}
void ExtensionDownloader::NotifyDelegateDownloadFinished(
- scoped_ptr<ExtensionFetch> fetch_data,
+ std::unique_ptr<ExtensionFetch> fetch_data,
bool from_cache,
const base::FilePath& crx_path,
bool file_ownership_passed) {
@@ -719,7 +721,7 @@ void ExtensionDownloader::NotifyDelegateDownloadFinished(
}
void ExtensionDownloader::CacheInstallDone(
- scoped_ptr<ExtensionFetch> fetch_data,
+ std::unique_ptr<ExtensionFetch> fetch_data,
bool should_download) {
ping_results_.erase(fetch_data->id);
if (should_download) {
@@ -789,7 +791,7 @@ void ExtensionDownloader::OnCRXFetchComplete(
base::FilePath crx_path;
// Take ownership of the file at |crx_path|.
CHECK(source->GetResponseAsFilePath(true, &crx_path));
- scoped_ptr<ExtensionFetch> fetch_data =
+ std::unique_ptr<ExtensionFetch> fetch_data =
extensions_queue_.reset_active_request();
if (extension_cache_) {
const std::string& version = fetch_data->version;
diff --git a/chromium/extensions/browser/updater/extension_downloader.h b/chromium/extensions/browser/updater/extension_downloader.h
index 81b9134ed0f..b73a92c7185 100644
--- a/chromium/extensions/browser/updater/extension_downloader.h
+++ b/chromium/extensions/browser/updater/extension_downloader.h
@@ -7,6 +7,7 @@
#include <deque>
#include <map>
+#include <memory>
#include <set>
#include <string>
#include <utility>
@@ -15,7 +16,6 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/version.h"
#include "extensions/browser/updater/extension_downloader_delegate.h"
@@ -46,6 +46,7 @@ struct UpdateDetails {
};
class ExtensionCache;
+class ExtensionDownloaderTestDelegate;
class ExtensionUpdaterTest;
// A class that checks for updates of a given list of extensions, and downloads
@@ -57,8 +58,9 @@ class ExtensionDownloader : public net::URLFetcherDelegate,
public:
// A closure which constructs a new ExtensionDownloader to be owned by the
// caller.
- typedef base::Callback<scoped_ptr<ExtensionDownloader>(
- ExtensionDownloaderDelegate* delegate)> Factory;
+ typedef base::Callback<std::unique_ptr<ExtensionDownloader>(
+ ExtensionDownloaderDelegate* delegate)>
+ Factory;
// |delegate| is stored as a raw pointer and must outlive the
// ExtensionDownloader.
@@ -96,7 +98,7 @@ class ExtensionDownloader : public net::URLFetcherDelegate,
// Sets an IdentityProvider to be used for OAuth2 authentication on protected
// Webstore downloads.
void SetWebstoreIdentityProvider(
- scoped_ptr<IdentityProvider> identity_provider);
+ std::unique_ptr<IdentityProvider> identity_provider);
void set_brand_code(const std::string& brand_code) {
brand_code_ = brand_code;
@@ -110,9 +112,9 @@ class ExtensionDownloader : public net::URLFetcherDelegate,
ping_enabled_domain_ = domain;
}
- void set_enable_extra_update_metrics(bool enable) {
- enable_extra_update_metrics_ = enable;
- }
+ // Sets a test delegate to use by any instances of this class. The |delegate|
+ // should outlive all instances.
+ static void set_test_delegate(ExtensionDownloaderTestDelegate* delegate);
// These are needed for unit testing, to help identify the correct mock
// URLFetcher objects.
@@ -188,7 +190,7 @@ class ExtensionDownloader : public net::URLFetcherDelegate,
void ReportStats() const;
// Begins an update check.
- void StartUpdateCheck(scoped_ptr<ManifestFetchData> fetch_data);
+ void StartUpdateCheck(std::unique_ptr<ManifestFetchData> fetch_data);
// Called by RequestQueue when a new manifest fetch request is started.
void CreateManifestFetcher();
@@ -215,7 +217,7 @@ class ExtensionDownloader : public net::URLFetcherDelegate,
std::vector<int>* result);
// Begins (or queues up) download of an updated extension.
- void FetchUpdatedExtension(scoped_ptr<ExtensionFetch> fetch_data);
+ void FetchUpdatedExtension(std::unique_ptr<ExtensionFetch> fetch_data);
// Called by RequestQueue when a new extension fetch request is started.
void CreateExtensionFetcher();
@@ -242,14 +244,16 @@ class ExtensionDownloader : public net::URLFetcherDelegate,
void DoStartAllPending();
// Notify delegate and remove ping results.
- void NotifyDelegateDownloadFinished(scoped_ptr<ExtensionFetch> fetch_data,
- bool from_cache,
- const base::FilePath& crx_path,
- bool file_ownership_passed);
+ void NotifyDelegateDownloadFinished(
+ std::unique_ptr<ExtensionFetch> fetch_data,
+ bool from_cache,
+ const base::FilePath& crx_path,
+ bool file_ownership_passed);
// Cached extension installation completed. If it was not successful, we will
// try to download it from the web store using already fetched manifest.
- void CacheInstallDone(scoped_ptr<ExtensionFetch> fetch_data, bool installed);
+ void CacheInstallDone(std::unique_ptr<ExtensionFetch> fetch_data,
+ bool installed);
// Potentially updates an ExtensionFetch's authentication state and returns
// |true| if the fetch should be retried. Returns |false| if the failure was
@@ -287,8 +291,8 @@ class ExtensionDownloader : public net::URLFetcherDelegate,
FetchMap fetches_preparing_;
// Outstanding url fetch requests for manifests and updates.
- scoped_ptr<net::URLFetcher> manifest_fetcher_;
- scoped_ptr<net::URLFetcher> extension_fetcher_;
+ std::unique_ptr<net::URLFetcher> manifest_fetcher_;
+ std::unique_ptr<net::URLFetcher> extension_fetcher_;
// Pending manifests and extensions to be fetched when the appropriate fetcher
// is available.
@@ -303,14 +307,14 @@ class ExtensionDownloader : public net::URLFetcherDelegate,
// An IdentityProvider which may be used for authentication on protected
// download requests. May be NULL.
- scoped_ptr<IdentityProvider> identity_provider_;
+ std::unique_ptr<IdentityProvider> identity_provider_;
// A Webstore download-scoped access token for the |identity_provider_|'s
// active account, if any.
std::string access_token_;
// A pending token fetch request.
- scoped_ptr<OAuth2TokenService::Request> access_token_request_;
+ std::unique_ptr<OAuth2TokenService::Request> access_token_request_;
// Brand code to include with manifest fetch queries if sending ping data.
std::string brand_code_;
@@ -322,10 +326,6 @@ class ExtensionDownloader : public net::URLFetcherDelegate,
// to update URLs which match this domain. Defaults to empty (no domain).
std::string ping_enabled_domain_;
- // Indicates whether or not extra metrics should be included with ping data.
- // Defaults to |false|.
- bool enable_extra_update_metrics_;
-
// Used to create WeakPtrs to |this|.
base::WeakPtrFactory<ExtensionDownloader> weak_ptr_factory_;
diff --git a/chromium/extensions/browser/updater/extension_downloader_test_delegate.h b/chromium/extensions/browser/updater/extension_downloader_test_delegate.h
new file mode 100644
index 00000000000..64714d6f4d2
--- /dev/null
+++ b/chromium/extensions/browser/updater/extension_downloader_test_delegate.h
@@ -0,0 +1,32 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_TEST_DELEGATE_H_
+#define EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_TEST_DELEGATE_H_
+
+#include <memory>
+
+namespace extensions {
+
+class ExtensionDownloader;
+class ExtensionDownloaderDelegate;
+class ManifestFetchData;
+
+// A class for intercepting the work of checking for / downloading extension
+// updates.
+class ExtensionDownloaderTestDelegate {
+ public:
+ // This method gets called when an update check is being started for an
+ // extension. Normally implementors should eventually call either
+ // OnExtensionDownloadFailed or OnExtensionDownloadFinished on
+ // |delegate|.
+ virtual void StartUpdateCheck(
+ ExtensionDownloader* downloader,
+ ExtensionDownloaderDelegate* delegate,
+ std::unique_ptr<ManifestFetchData> fetch_data) = 0;
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_UPDATER_EXTENSION_DOWNLOADER_TEST_DELEGATE_H_
diff --git a/chromium/extensions/browser/updater/request_queue.h b/chromium/extensions/browser/updater/request_queue.h
index cce1a93de1c..1b9c5a45a65 100644
--- a/chromium/extensions/browser/updater/request_queue.h
+++ b/chromium/extensions/browser/updater/request_queue.h
@@ -8,11 +8,11 @@
#include <stddef.h>
#include <deque>
+#include <memory>
#include <utility>
#include "base/callback.h"
#include "base/memory/linked_ptr.h"
-#include "base/memory/scoped_ptr.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "net/base/backoff_entry.h"
@@ -51,11 +51,11 @@ class RequestQueue {
int active_request_failure_count();
// Signals RequestQueue that processing of the current request has completed.
- scoped_ptr<T> reset_active_request();
+ std::unique_ptr<T> reset_active_request();
// Add the given request to the queue, and starts the next request if no
// request is currently being processed.
- void ScheduleRequest(scoped_ptr<T> request);
+ void ScheduleRequest(std::unique_ptr<T> request);
bool empty() const;
size_t size() const;
@@ -93,8 +93,8 @@ class RequestQueue {
static bool CompareRequests(const Request& a, const Request& b);
// Pushes a request with a given backoff entry onto the queue.
- void PushImpl(scoped_ptr<T> request,
- scoped_ptr<net::BackoffEntry> backoff_entry);
+ void PushImpl(std::unique_ptr<T> request,
+ std::unique_ptr<net::BackoffEntry> backoff_entry);
// The backoff policy used to determine backoff delays.
const net::BackoffEntry::Policy* backoff_policy_;
@@ -107,8 +107,8 @@ class RequestQueue {
std::deque<Request> pending_requests_;
// Active request and its associated backoff entry.
- scoped_ptr<T> active_request_;
- scoped_ptr<net::BackoffEntry> active_backoff_entry_;
+ std::unique_ptr<T> active_request_;
+ std::unique_ptr<net::BackoffEntry> active_backoff_entry_;
// Timer to schedule calls to StartNextRequest, if the first pending request
// hasn't passed its release time yet.
diff --git a/chromium/extensions/browser/updater/request_queue_impl.h b/chromium/extensions/browser/updater/request_queue_impl.h
index 24adca6a658..53276398382 100644
--- a/chromium/extensions/browser/updater/request_queue_impl.h
+++ b/chromium/extensions/browser/updater/request_queue_impl.h
@@ -42,21 +42,22 @@ int RequestQueue<T>::active_request_failure_count() {
}
template <typename T>
-scoped_ptr<T> RequestQueue<T>::reset_active_request() {
+std::unique_ptr<T> RequestQueue<T>::reset_active_request() {
active_backoff_entry_.reset();
return std::move(active_request_);
}
template <typename T>
-void RequestQueue<T>::ScheduleRequest(scoped_ptr<T> request) {
- PushImpl(std::move(request), scoped_ptr<net::BackoffEntry>(
+void RequestQueue<T>::ScheduleRequest(std::unique_ptr<T> request) {
+ PushImpl(std::move(request), std::unique_ptr<net::BackoffEntry>(
new net::BackoffEntry(backoff_policy_)));
StartNextRequest();
}
template <typename T>
-void RequestQueue<T>::PushImpl(scoped_ptr<T> request,
- scoped_ptr<net::BackoffEntry> backoff_entry) {
+void RequestQueue<T>::PushImpl(
+ std::unique_ptr<T> request,
+ std::unique_ptr<net::BackoffEntry> backoff_entry) {
pending_requests_.push_back(
Request(backoff_entry.release(), request.release()));
std::push_heap(
diff --git a/chromium/extensions/browser/updater/safe_manifest_parser.h b/chromium/extensions/browser/updater/safe_manifest_parser.h
index b6559834f7e..3f852fe68a5 100644
--- a/chromium/extensions/browser/updater/safe_manifest_parser.h
+++ b/chromium/extensions/browser/updater/safe_manifest_parser.h
@@ -5,11 +5,11 @@
#ifndef EXTENSIONS_BROWSER_UPDATER_SAFE_MANIFEST_PARSER_H_
#define EXTENSIONS_BROWSER_UPDATER_SAFE_MANIFEST_PARSER_H_
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "content/public/browser/utility_process_host_client.h"
#include "extensions/browser/updater/manifest_fetch_data.h"
#include "extensions/common/update_manifest.h"
diff --git a/chromium/extensions/browser/updater/update_service.h b/chromium/extensions/browser/updater/update_service.h
index 992f55ec4ca..c4c4d77ca3d 100644
--- a/chromium/extensions/browser/updater/update_service.h
+++ b/chromium/extensions/browser/updater/update_service.h
@@ -5,12 +5,12 @@
#ifndef EXTENSIONS_BROWSER_UPDATER_UPDATE_SERVICE_H_
#define EXTENSIONS_BROWSER_UPDATER_UPDATE_SERVICE_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "components/keyed_service/core/keyed_service.h"
namespace base {
diff --git a/chromium/extensions/browser/updater/update_service_unittest.cc b/chromium/extensions/browser/updater/update_service_unittest.cc
index eb8213ad6dd..83f42d6c92b 100644
--- a/chromium/extensions/browser/updater/update_service_unittest.cc
+++ b/chromium/extensions/browser/updater/update_service_unittest.cc
@@ -195,7 +195,7 @@ class UpdateServiceTest : public ExtensionsTest {
private:
UpdateService* update_service_;
scoped_refptr<FakeUpdateClient> update_client_;
- scoped_ptr<content::TestBrowserThreadBundle> browser_threads_;
+ std::unique_ptr<content::TestBrowserThreadBundle> browser_threads_;
MockExtensionSystemFactory<FakeExtensionSystem>
fake_extension_system_factory_;
};
@@ -261,7 +261,7 @@ TEST_F(UpdateServiceTest, BasicUpdateOperations) {
// Test the install callback.
base::ScopedTempDir new_version_dir;
ASSERT_TRUE(new_version_dir.CreateUniqueTempDir());
- scoped_ptr<base::DictionaryValue> new_manifest(
+ std::unique_ptr<base::DictionaryValue> new_manifest(
extension1->manifest()->value()->DeepCopy());
new_manifest->SetString("version", "2.0");
diff --git a/chromium/extensions/browser/user_script_loader.cc b/chromium/extensions/browser/user_script_loader.cc
index 91af052718e..b230c4a0bf6 100644
--- a/chromium/extensions/browser/user_script_loader.cc
+++ b/chromium/extensions/browser/user_script_loader.cc
@@ -10,6 +10,7 @@
#include <string>
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/version.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
@@ -276,7 +277,7 @@ void UserScriptLoader::StartLoad() {
}
// static
-scoped_ptr<base::SharedMemory> UserScriptLoader::Serialize(
+std::unique_ptr<base::SharedMemory> UserScriptLoader::Serialize(
const UserScriptList& scripts) {
base::Pickle pickle;
pickle.WriteUInt32(scripts.size());
@@ -304,10 +305,10 @@ scoped_ptr<base::SharedMemory> UserScriptLoader::Serialize(
options.size = pickle.size();
options.share_read_only = true;
if (!shared_memory.Create(options))
- return scoped_ptr<base::SharedMemory>();
+ return std::unique_ptr<base::SharedMemory>();
if (!shared_memory.Map(pickle.size()))
- return scoped_ptr<base::SharedMemory>();
+ return std::unique_ptr<base::SharedMemory>();
// Copy the pickle to shared memory.
memcpy(shared_memory.memory(), pickle.data(), pickle.size());
@@ -315,10 +316,10 @@ scoped_ptr<base::SharedMemory> UserScriptLoader::Serialize(
base::SharedMemoryHandle readonly_handle;
if (!shared_memory.ShareReadOnlyToProcess(base::GetCurrentProcessHandle(),
&readonly_handle))
- return scoped_ptr<base::SharedMemory>();
+ return std::unique_ptr<base::SharedMemory>();
- return make_scoped_ptr(new base::SharedMemory(readonly_handle,
- /*read_only=*/true));
+ return base::WrapUnique(new base::SharedMemory(readonly_handle,
+ /*read_only=*/true));
}
void UserScriptLoader::AddObserver(Observer* observer) {
@@ -337,8 +338,8 @@ void UserScriptLoader::SetReady(bool ready) {
}
void UserScriptLoader::OnScriptsLoaded(
- scoped_ptr<UserScriptList> user_scripts,
- scoped_ptr<base::SharedMemory> shared_memory) {
+ std::unique_ptr<UserScriptList> user_scripts,
+ std::unique_ptr<base::SharedMemory> shared_memory) {
user_scripts_.reset(user_scripts.release());
if (pending_load_) {
// While we were loading, there were further changes. Don't bother
diff --git a/chromium/extensions/browser/user_script_loader.h b/chromium/extensions/browser/user_script_loader.h
index ff6772aa9b0..daab8a769f8 100644
--- a/chromium/extensions/browser/user_script_loader.h
+++ b/chromium/extensions/browser/user_script_loader.h
@@ -6,11 +6,11 @@
#define EXTENSIONS_BROWSER_USER_SCRIPT_LOADER_H_
#include <map>
+#include <memory>
#include <set>
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
@@ -41,8 +41,8 @@ namespace extensions {
class UserScriptLoader : public content::NotificationObserver {
public:
using LoadScriptsCallback =
- base::Callback<void(scoped_ptr<UserScriptList>,
- scoped_ptr<base::SharedMemory>)>;
+ base::Callback<void(std::unique_ptr<UserScriptList>,
+ std::unique_ptr<base::SharedMemory>)>;
class Observer {
public:
virtual void OnScriptsLoaded(UserScriptLoader* loader) = 0;
@@ -83,7 +83,7 @@ class UserScriptLoader : public content::NotificationObserver {
bool scripts_ready() const { return shared_memory_.get() != NULL; }
// Pickle user scripts and return pointer to the shared memory.
- static scoped_ptr<base::SharedMemory> Serialize(
+ static std::unique_ptr<base::SharedMemory> Serialize(
const extensions::UserScriptList& scripts);
// Adds or removes observers.
@@ -92,7 +92,7 @@ class UserScriptLoader : public content::NotificationObserver {
protected:
// Allows the derived classes have different ways to load user scripts.
- virtual void LoadScripts(scoped_ptr<UserScriptList> user_scripts,
+ virtual void LoadScripts(std::unique_ptr<UserScriptList> user_scripts,
const std::set<HostID>& changed_hosts,
const std::set<int>& added_script_ids,
LoadScriptsCallback callback) = 0;
@@ -119,8 +119,8 @@ class UserScriptLoader : public content::NotificationObserver {
void AttemptLoad();
// Called once we have finished loading the scripts on the file thread.
- void OnScriptsLoaded(scoped_ptr<UserScriptList> user_scripts,
- scoped_ptr<base::SharedMemory> shared_memory);
+ void OnScriptsLoaded(std::unique_ptr<UserScriptList> user_scripts,
+ std::unique_ptr<base::SharedMemory> shared_memory);
// Sends the renderer process a new set of user scripts. If
// |changed_hosts| is not empty, this signals that only the scripts from
@@ -139,10 +139,10 @@ class UserScriptLoader : public content::NotificationObserver {
content::NotificationRegistrar registrar_;
// Contains the scripts that were found the last time scripts were updated.
- scoped_ptr<base::SharedMemory> shared_memory_;
+ std::unique_ptr<base::SharedMemory> shared_memory_;
// List of scripts from currently-installed extensions we should load.
- scoped_ptr<UserScriptList> user_scripts_;
+ std::unique_ptr<UserScriptList> user_scripts_;
// The mutually-exclusive sets of scripts that were added or removed since the
// last script load.
diff --git a/chromium/extensions/browser/value_store/lazy_leveldb.cc b/chromium/extensions/browser/value_store/lazy_leveldb.cc
index 6061bd32b1b..8176b8395f2 100644
--- a/chromium/extensions/browser/value_store/lazy_leveldb.cc
+++ b/chromium/extensions/browser/value_store/lazy_leveldb.cc
@@ -6,6 +6,7 @@
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "content/public/browser/browser_thread.h"
#include "third_party/leveldatabase/env_chromium.h"
@@ -90,7 +91,7 @@ LazyLevelDb::~LazyLevelDb() {
}
ValueStore::Status LazyLevelDb::Read(const std::string& key,
- scoped_ptr<base::Value>* value) {
+ std::unique_ptr<base::Value>* value) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(value);
@@ -106,7 +107,8 @@ ValueStore::Status LazyLevelDb::Read(const std::string& key,
if (!s.ok())
return ToValueStoreError(s);
- scoped_ptr<base::Value> val = base::JSONReader().ReadToValue(value_as_json);
+ std::unique_ptr<base::Value> val =
+ base::JSONReader().ReadToValue(value_as_json);
if (!val)
return ValueStore::Status(ValueStore::CORRUPTION, FixCorruption(&key),
kInvalidJson);
@@ -274,10 +276,10 @@ bool LazyLevelDb::DeleteDbFile() {
ValueStore::Status LazyLevelDb::CreateIterator(
const leveldb::ReadOptions& read_options,
- scoped_ptr<leveldb::Iterator>* iterator) {
+ std::unique_ptr<leveldb::Iterator>* iterator) {
ValueStore::Status status = EnsureDbIsOpen();
if (!status.ok())
return status;
- *iterator = make_scoped_ptr(db_->NewIterator(read_options));
+ *iterator = base::WrapUnique(db_->NewIterator(read_options));
return ValueStore::Status();
}
diff --git a/chromium/extensions/browser/value_store/lazy_leveldb.h b/chromium/extensions/browser/value_store/lazy_leveldb.h
index 4fb93a63d71..551a6ea23fd 100644
--- a/chromium/extensions/browser/value_store/lazy_leveldb.h
+++ b/chromium/extensions/browser/value_store/lazy_leveldb.h
@@ -5,11 +5,11 @@
#ifndef EXTENSIONS_BROWSER_VALUE_STORE_LAZY_LEVELDB_H_
#define EXTENSIONS_BROWSER_VALUE_STORE_LAZY_LEVELDB_H_
+#include <memory>
#include <string>
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram_base.h"
#include "extensions/browser/value_store/value_store.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
@@ -26,8 +26,9 @@ class LazyLevelDb {
public:
// Creates a new database iterator. This iterator *must* be deleted before
// this database is closed.
- ValueStore::Status CreateIterator(const leveldb::ReadOptions& read_options,
- scoped_ptr<leveldb::Iterator>* iterator);
+ ValueStore::Status CreateIterator(
+ const leveldb::ReadOptions& read_options,
+ std::unique_ptr<leveldb::Iterator>* iterator);
// Converts a leveldb::Status to a ValueStore::Status. Will also sanitize path
// to eliminate user data path.
@@ -53,7 +54,7 @@ class LazyLevelDb {
// be returned and value will be unchanged. Caller must ensure the database is
// open before calling this method.
ValueStore::Status Read(const std::string& key,
- scoped_ptr<base::Value>* value);
+ std::unique_ptr<base::Value>* value);
// Opens the underlying database if not yet open. If the open fails due to
// corruption will attempt to repair the database. Failing that, will attempt
@@ -75,7 +76,7 @@ class LazyLevelDb {
ValueStore::BackingStoreRestoreStatus restore_status) const;
// The leveldb to which this class reads/writes.
- scoped_ptr<leveldb::DB> db_;
+ std::unique_ptr<leveldb::DB> db_;
// The path to the underlying leveldb.
const base::FilePath db_path_;
// The options to be used when this database is lazily opened.
diff --git a/chromium/extensions/browser/value_store/legacy_value_store_factory.cc b/chromium/extensions/browser/value_store/legacy_value_store_factory.cc
index bafb93ee2a3..d4f054532b9 100644
--- a/chromium/extensions/browser/value_store/legacy_value_store_factory.cc
+++ b/chromium/extensions/browser/value_store/legacy_value_store_factory.cc
@@ -8,6 +8,7 @@
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
+#include "base/memory/ptr_util.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/value_store/leveldb_value_store.h"
#include "extensions/common/constants.h"
@@ -167,24 +168,24 @@ bool LegacyValueStoreFactory::StateDBExists() const {
return ValidDBExists(GetStateDBPath());
}
-scoped_ptr<ValueStore> LegacyValueStoreFactory::CreateRulesStore() {
- return make_scoped_ptr(
+std::unique_ptr<ValueStore> LegacyValueStoreFactory::CreateRulesStore() {
+ return base::WrapUnique(
new LeveldbValueStore(kRulesDatabaseUMAClientName, GetRulesDBPath()));
}
-scoped_ptr<ValueStore> LegacyValueStoreFactory::CreateStateStore() {
- return make_scoped_ptr(
+std::unique_ptr<ValueStore> LegacyValueStoreFactory::CreateStateStore() {
+ return base::WrapUnique(
new LeveldbValueStore(kStateDatabaseUMAClientName, GetStateDBPath()));
}
-scoped_ptr<ValueStore> LegacyValueStoreFactory::CreateSettingsStore(
+std::unique_ptr<ValueStore> LegacyValueStoreFactory::CreateSettingsStore(
settings_namespace::Namespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) {
const ModelSettings* settings_root =
GetSettingsRoot(settings_namespace).GetModel(model_type);
DCHECK(settings_root != nullptr);
- return make_scoped_ptr(new LeveldbValueStore(
+ return base::WrapUnique(new LeveldbValueStore(
kSettingsDatabaseUMAClientName, settings_root->GetDBPath(extension_id)));
}
diff --git a/chromium/extensions/browser/value_store/legacy_value_store_factory.h b/chromium/extensions/browser/value_store/legacy_value_store_factory.h
index 65db0275a71..59517543b6b 100644
--- a/chromium/extensions/browser/value_store/legacy_value_store_factory.h
+++ b/chromium/extensions/browser/value_store/legacy_value_store_factory.h
@@ -5,12 +5,12 @@
#ifndef EXTENSIONS_BROWSER_VALUE_STORE_LEGACY_VALUE_STORE_FACTORY_H_
#define EXTENSIONS_BROWSER_VALUE_STORE_LEGACY_VALUE_STORE_FACTORY_H_
+#include <memory>
#include <set>
#include <string>
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/value_store/value_store.h"
#include "extensions/browser/value_store/value_store_factory.h"
#include "extensions/common/extension.h"
@@ -28,9 +28,9 @@ class LegacyValueStoreFactory : public ValueStoreFactory {
bool StateDBExists() const;
// ValueStoreFactory:
- scoped_ptr<ValueStore> CreateRulesStore() override;
- scoped_ptr<ValueStore> CreateStateStore() override;
- scoped_ptr<ValueStore> CreateSettingsStore(
+ std::unique_ptr<ValueStore> CreateRulesStore() override;
+ std::unique_ptr<ValueStore> CreateStateStore() override;
+ std::unique_ptr<ValueStore> CreateSettingsStore(
settings_namespace::Namespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) override;
@@ -82,8 +82,8 @@ class LegacyValueStoreFactory : public ValueStoreFactory {
ModelSettings* GetModel(ModelType model_type);
private:
- scoped_ptr<ModelSettings> extensions_;
- scoped_ptr<ModelSettings> apps_;
+ std::unique_ptr<ModelSettings> extensions_;
+ std::unique_ptr<ModelSettings> apps_;
DISALLOW_COPY_AND_ASSIGN(SettingsRoot);
};
diff --git a/chromium/extensions/browser/value_store/leveldb_scoped_database.cc b/chromium/extensions/browser/value_store/leveldb_scoped_database.cc
index 2fb8a9b77ea..a66e53aa3d2 100644
--- a/chromium/extensions/browser/value_store/leveldb_scoped_database.cc
+++ b/chromium/extensions/browser/value_store/leveldb_scoped_database.cc
@@ -49,9 +49,10 @@ LeveldbScopedDatabase::LeveldbScopedDatabase(const std::string& uma_client_name,
LeveldbScopedDatabase::~LeveldbScopedDatabase() {}
-ValueStore::Status LeveldbScopedDatabase::Read(const std::string& scope,
- const std::string& key,
- scoped_ptr<base::Value>* value) {
+ValueStore::Status LeveldbScopedDatabase::Read(
+ const std::string& scope,
+ const std::string& key,
+ std::unique_ptr<base::Value>* value) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
ValueStore::Status status = EnsureDbIsOpen();
@@ -76,16 +77,16 @@ ValueStore::Status LeveldbScopedDatabase::Read(const std::string& scope,
if (!CreateKey(scope, "", &prefix))
return ValueStore::Status(ValueStore::OTHER_ERROR, kInvalidScope);
- scoped_ptr<leveldb::Iterator> it(db()->NewIterator(read_options()));
+ std::unique_ptr<leveldb::Iterator> it(db()->NewIterator(read_options()));
base::JSONReader json_reader;
- scoped_ptr<base::DictionaryValue> settings(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> settings(new base::DictionaryValue());
for (it->Seek(prefix); it->Valid() && it->key().starts_with(prefix);
it->Next()) {
leveldb::Slice descoped_key(it->key());
descoped_key.remove_prefix(prefix.size());
- scoped_ptr<base::Value> value = json_reader.Read(
+ std::unique_ptr<base::Value> value = json_reader.Read(
base::StringPiece(it->value().data(), it->value().size()));
if (!value) {
return ValueStore::Status(ValueStore::CORRUPTION,
diff --git a/chromium/extensions/browser/value_store/leveldb_scoped_database.h b/chromium/extensions/browser/value_store/leveldb_scoped_database.h
index ef52f1d7769..46f59943ff4 100644
--- a/chromium/extensions/browser/value_store/leveldb_scoped_database.h
+++ b/chromium/extensions/browser/value_store/leveldb_scoped_database.h
@@ -46,7 +46,7 @@ class LeveldbScopedDatabase
// Reads a single |value| from the database for the specified |key|.
ValueStore::Status Read(const std::string& scope,
const std::string& key,
- scoped_ptr<base::Value>* value);
+ std::unique_ptr<base::Value>* value);
// Reads all |values| from the database stored within the specified |scope|.
ValueStore::Status Read(const std::string& scope,
diff --git a/chromium/extensions/browser/value_store/leveldb_scoped_database_unittest.cc b/chromium/extensions/browser/value_store/leveldb_scoped_database_unittest.cc
index 738802bfc98..21cbdbc0fd5 100644
--- a/chromium/extensions/browser/value_store/leveldb_scoped_database_unittest.cc
+++ b/chromium/extensions/browser/value_store/leveldb_scoped_database_unittest.cc
@@ -41,7 +41,7 @@ class LeveldbScopedDatabaseUnitTest : public testing::Test {
values->clear();
leveldb::ReadOptions read_options;
read_options.verify_checksums = true;
- scoped_ptr<leveldb::Iterator> iterator;
+ std::unique_ptr<leveldb::Iterator> iterator;
ValueStore::Status status = db_->CreateIterator(read_options, &iterator);
if (!status.ok())
return status;
@@ -159,7 +159,7 @@ TEST_F(LeveldbScopedDatabaseUnitTest, TestEmptyValue) {
values.SetString("s1_key1", "");
EXPECT_TRUE(db_->Write("scope1", values).ok());
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
ASSERT_TRUE(db_->Read("scope1", "s1_key1", &value).ok());
std::string str;
EXPECT_TRUE(value->GetAsString(&str));
@@ -171,7 +171,7 @@ TEST_F(LeveldbScopedDatabaseUnitTest, TestValueContainingDelimiter) {
values.SetString("s1_key1", "with:delimiter");
EXPECT_TRUE(db_->Write("scope1", values).ok());
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
ASSERT_TRUE(db_->Read("scope1", "s1_key1", &value).ok());
std::string str;
EXPECT_TRUE(value->GetAsString(&str));
diff --git a/chromium/extensions/browser/value_store/leveldb_value_store.cc b/chromium/extensions/browser/value_store/leveldb_value_store.cc
index a65aa8b85b9..6610652e3e7 100644
--- a/chromium/extensions/browser/value_store/leveldb_value_store.cc
+++ b/chromium/extensions/browser/value_store/leveldb_value_store.cc
@@ -17,7 +17,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/sys_string_conversions.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/process_memory_dump.h"
#include "content/public/browser/browser_thread.h"
@@ -79,10 +79,10 @@ ValueStore::ReadResult LeveldbValueStore::Get(
if (!status.ok())
return MakeReadResult(status);
- scoped_ptr<base::DictionaryValue> settings(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> settings(new base::DictionaryValue());
for (const std::string& key : keys) {
- scoped_ptr<base::Value> setting;
+ std::unique_ptr<base::Value> setting;
status.Merge(Read(key, &setting));
if (!status.ok())
return MakeReadResult(status);
@@ -101,12 +101,12 @@ ValueStore::ReadResult LeveldbValueStore::Get() {
return MakeReadResult(status);
base::JSONReader json_reader;
- scoped_ptr<base::DictionaryValue> settings(new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> settings(new base::DictionaryValue());
- scoped_ptr<leveldb::Iterator> it(db()->NewIterator(read_options()));
+ std::unique_ptr<leveldb::Iterator> it(db()->NewIterator(read_options()));
for (it->SeekToFirst(); it->Valid(); it->Next()) {
std::string key = it->key().ToString();
- scoped_ptr<base::Value> value =
+ std::unique_ptr<base::Value> value =
json_reader.Read(StringPiece(it->value().data(), it->value().size()));
if (!value) {
return MakeReadResult(
@@ -135,7 +135,7 @@ ValueStore::WriteResult LeveldbValueStore::Set(WriteOptions options,
return MakeWriteResult(status);
leveldb::WriteBatch batch;
- scoped_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
+ std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
status.Merge(AddToBatch(options, key, value, &batch, changes.get()));
if (!status.ok())
return MakeWriteResult(status);
@@ -155,7 +155,7 @@ ValueStore::WriteResult LeveldbValueStore::Set(
return MakeWriteResult(status);
leveldb::WriteBatch batch;
- scoped_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
+ std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
for (base::DictionaryValue::Iterator it(settings);
!it.IsAtEnd(); it.Advance()) {
@@ -184,16 +184,16 @@ ValueStore::WriteResult LeveldbValueStore::Remove(
return MakeWriteResult(status);
leveldb::WriteBatch batch;
- scoped_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
+ std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
for (const std::string& key : keys) {
- scoped_ptr<base::Value> old_value;
+ std::unique_ptr<base::Value> old_value;
status.Merge(Read(key, &old_value));
if (!status.ok())
return MakeWriteResult(status);
if (old_value) {
- changes->push_back(ValueStoreChange(key, old_value.release(), NULL));
+ changes->push_back(ValueStoreChange(key, std::move(old_value), nullptr));
batch.Delete(key);
}
}
@@ -209,7 +209,7 @@ ValueStore::WriteResult LeveldbValueStore::Remove(
ValueStore::WriteResult LeveldbValueStore::Clear() {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
- scoped_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
+ std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
ReadResult read_result = Get();
if (!read_result->status().ok())
@@ -218,9 +218,10 @@ ValueStore::WriteResult LeveldbValueStore::Clear() {
base::DictionaryValue& whole_db = read_result->settings();
while (!whole_db.empty()) {
std::string next_key = base::DictionaryValue::Iterator(whole_db).key();
- scoped_ptr<base::Value> next_value;
+ std::unique_ptr<base::Value> next_value;
whole_db.RemoveWithoutPathExpansion(next_key, &next_value);
- changes->push_back(ValueStoreChange(next_key, next_value.release(), NULL));
+ changes->push_back(
+ ValueStoreChange(next_key, std::move(next_value), nullptr));
}
DeleteDbFile();
@@ -274,13 +275,13 @@ ValueStore::Status LeveldbValueStore::AddToBatch(
bool write_new_value = true;
if (!(options & NO_GENERATE_CHANGES)) {
- scoped_ptr<base::Value> old_value;
+ std::unique_ptr<base::Value> old_value;
Status status = Read(key, &old_value);
if (!status.ok())
return status;
if (!old_value || !old_value->Equals(&value)) {
changes->push_back(
- ValueStoreChange(key, old_value.release(), value.DeepCopy()));
+ ValueStoreChange(key, std::move(old_value), value.CreateDeepCopy()));
} else {
write_new_value = false;
}
diff --git a/chromium/extensions/browser/value_store/leveldb_value_store.h b/chromium/extensions/browser/value_store/leveldb_value_store.h
index 41e91a3c3fc..a9f5b59d009 100644
--- a/chromium/extensions/browser/value_store/leveldb_value_store.h
+++ b/chromium/extensions/browser/value_store/leveldb_value_store.h
@@ -7,13 +7,13 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <vector>
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/trace_event/memory_dump_provider.h"
#include "extensions/browser/value_store/lazy_leveldb.h"
#include "extensions/browser/value_store/value_store.h"
diff --git a/chromium/extensions/browser/value_store/leveldb_value_store_unittest.cc b/chromium/extensions/browser/value_store/leveldb_value_store_unittest.cc
index cf532240417..b8b76c1d027 100644
--- a/chromium/extensions/browser/value_store/leveldb_value_store_unittest.cc
+++ b/chromium/extensions/browser/value_store/leveldb_value_store_unittest.cc
@@ -63,7 +63,7 @@ class LeveldbValueStoreUnitTest : public testing::Test {
const base::FilePath& database_path() { return database_dir_.path(); }
private:
- scoped_ptr<LeveldbValueStore> store_;
+ std::unique_ptr<LeveldbValueStore> store_;
base::ScopedTempDir database_dir_;
content::TestBrowserThreadBundle thread_bundle_;
@@ -75,7 +75,7 @@ TEST_F(LeveldbValueStoreUnitTest, RestoreKeyTest) {
const char kValue[] = "value";
// Insert a valid pair.
- scoped_ptr<base::Value> value(new base::StringValue(kValue));
+ std::unique_ptr<base::Value> value(new base::StringValue(kValue));
ASSERT_TRUE(store()
->Set(ValueStore::DEFAULTS, kNotCorruptKey, *value)
->status().ok());
@@ -117,7 +117,7 @@ TEST_F(LeveldbValueStoreUnitTest, RestoreDoesMinimumNecessary) {
const char kCorruptValue[] = "[{(.*+\"\'\\";
// Insert a collection of non-corrupted pairs.
- scoped_ptr<base::Value> value(new base::StringValue(kValue));
+ std::unique_ptr<base::Value> value(new base::StringValue(kValue));
for (size_t i = 0; i < kNotCorruptKeysSize; ++i) {
ASSERT_TRUE(store()
->Set(ValueStore::DEFAULTS, kNotCorruptKeys[i], *value)
@@ -163,7 +163,7 @@ TEST_F(LeveldbValueStoreUnitTest, RestoreFullDatabase) {
const char kValue[] = "value";
// Generate a database.
- scoped_ptr<base::Value> value(new base::StringValue(kValue));
+ std::unique_ptr<base::Value> value(new base::StringValue(kValue));
for (size_t i = 0; i < kNotCorruptKeysSize; ++i) {
ASSERT_TRUE(store()
->Set(ValueStore::DEFAULTS, kNotCorruptKeys[i], *value)
diff --git a/chromium/extensions/browser/value_store/test_value_store_factory.cc b/chromium/extensions/browser/value_store/test_value_store_factory.cc
index f5135dfa16c..de75f953882 100644
--- a/chromium/extensions/browser/value_store/test_value_store_factory.cc
+++ b/chromium/extensions/browser/value_store/test_value_store_factory.cc
@@ -4,6 +4,7 @@
#include "extensions/browser/value_store/test_value_store_factory.h"
+#include "base/memory/ptr_util.h"
#include "extensions/browser/value_store/leveldb_value_store.h"
#include "extensions/browser/value_store/testing_value_store.h"
@@ -101,15 +102,15 @@ TestValueStoreFactory::TestValueStoreFactory(const base::FilePath& db_path)
TestValueStoreFactory::~TestValueStoreFactory() {}
-scoped_ptr<ValueStore> TestValueStoreFactory::CreateRulesStore() {
+std::unique_ptr<ValueStore> TestValueStoreFactory::CreateRulesStore() {
if (db_path_.empty())
last_created_store_ = new TestingValueStore();
else
last_created_store_ = new LeveldbValueStore(kUMAClientName, db_path_);
- return make_scoped_ptr(last_created_store_);
+ return base::WrapUnique(last_created_store_);
}
-scoped_ptr<ValueStore> TestValueStoreFactory::CreateStateStore() {
+std::unique_ptr<ValueStore> TestValueStoreFactory::CreateStateStore() {
return CreateRulesStore();
}
@@ -129,11 +130,11 @@ TestValueStoreFactory::StorageHelper& TestValueStoreFactory::GetStorageHelper(
return local_helper_;
}
-scoped_ptr<ValueStore> TestValueStoreFactory::CreateSettingsStore(
+std::unique_ptr<ValueStore> TestValueStoreFactory::CreateSettingsStore(
SettingsNamespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) {
- scoped_ptr<ValueStore> settings_store(CreateRulesStore());
+ std::unique_ptr<ValueStore> settings_store(CreateRulesStore());
// Note: This factory is purposely keeping the raw pointers to each ValueStore
// created. Tests using TestValueStoreFactory must be careful to keep
// those ValueStore's alive for the duration of their test.
diff --git a/chromium/extensions/browser/value_store/test_value_store_factory.h b/chromium/extensions/browser/value_store/test_value_store_factory.h
index 86fbee77c8a..28cd1ddc9b0 100644
--- a/chromium/extensions/browser/value_store/test_value_store_factory.h
+++ b/chromium/extensions/browser/value_store/test_value_store_factory.h
@@ -6,9 +6,9 @@
#define EXTENSIONS_BROWSER_VALUE_STORE_TEST_VALUE_STORE_FACTORY_H_
#include <map>
+#include <memory>
#include <set>
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/value_store/value_store_factory.h"
#include "extensions/common/extension.h"
@@ -25,9 +25,9 @@ class TestValueStoreFactory : public ValueStoreFactory {
explicit TestValueStoreFactory(const base::FilePath& db_path);
// ValueStoreFactory
- scoped_ptr<ValueStore> CreateRulesStore() override;
- scoped_ptr<ValueStore> CreateStateStore() override;
- scoped_ptr<ValueStore> CreateSettingsStore(
+ std::unique_ptr<ValueStore> CreateRulesStore() override;
+ std::unique_ptr<ValueStore> CreateStateStore() override;
+ std::unique_ptr<ValueStore> CreateSettingsStore(
settings_namespace::Namespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) override;
diff --git a/chromium/extensions/browser/value_store/testing_value_store.cc b/chromium/extensions/browser/value_store/testing_value_store.cc
index fee2aa0f096..039d6c8bbde 100644
--- a/chromium/extensions/browser/value_store/testing_value_store.cc
+++ b/chromium/extensions/browser/value_store/testing_value_store.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
namespace {
@@ -56,23 +57,23 @@ ValueStore::ReadResult TestingValueStore::Get(
it != keys.end(); ++it) {
base::Value* value = NULL;
if (storage_.GetWithoutPathExpansion(*it, &value)) {
- settings->SetWithoutPathExpansion(*it, value->DeepCopy());
+ settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy());
}
}
- return MakeReadResult(make_scoped_ptr(settings), status_);
+ return MakeReadResult(base::WrapUnique(settings), status_);
}
ValueStore::ReadResult TestingValueStore::Get() {
read_count_++;
if (!status_.ok())
return MakeReadResult(status_);
- return MakeReadResult(make_scoped_ptr(storage_.DeepCopy()), status_);
+ return MakeReadResult(storage_.CreateDeepCopy(), status_);
}
ValueStore::WriteResult TestingValueStore::Set(
WriteOptions options, const std::string& key, const base::Value& value) {
base::DictionaryValue settings;
- settings.SetWithoutPathExpansion(key, value.DeepCopy());
+ settings.SetWithoutPathExpansion(key, value.CreateDeepCopy());
return Set(options, settings);
}
@@ -82,18 +83,16 @@ ValueStore::WriteResult TestingValueStore::Set(
if (!status_.ok())
return MakeWriteResult(status_);
- scoped_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
+ std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
for (base::DictionaryValue::Iterator it(settings);
!it.IsAtEnd(); it.Advance()) {
base::Value* old_value = NULL;
if (!storage_.GetWithoutPathExpansion(it.key(), &old_value) ||
!old_value->Equals(&it.value())) {
- changes->push_back(
- ValueStoreChange(
- it.key(),
- old_value ? old_value->DeepCopy() : old_value,
- it.value().DeepCopy()));
- storage_.SetWithoutPathExpansion(it.key(), it.value().DeepCopy());
+ changes->push_back(ValueStoreChange(
+ it.key(), old_value ? old_value->CreateDeepCopy() : nullptr,
+ it.value().CreateDeepCopy()));
+ storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
}
}
return MakeWriteResult(std::move(changes), status_);
@@ -109,12 +108,12 @@ ValueStore::WriteResult TestingValueStore::Remove(
if (!status_.ok())
return MakeWriteResult(status_);
- scoped_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
+ std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
for (std::vector<std::string>::const_iterator it = keys.begin();
it != keys.end(); ++it) {
- scoped_ptr<base::Value> old_value;
+ std::unique_ptr<base::Value> old_value;
if (storage_.RemoveWithoutPathExpansion(*it, &old_value)) {
- changes->push_back(ValueStoreChange(*it, old_value.release(), NULL));
+ changes->push_back(ValueStoreChange(*it, std::move(old_value), nullptr));
}
}
return MakeWriteResult(std::move(changes), status_);
diff --git a/chromium/extensions/browser/value_store/value_store.cc b/chromium/extensions/browser/value_store/value_store.cc
index c198f105566..aa1588b7eab 100644
--- a/chromium/extensions/browser/value_store/value_store.cc
+++ b/chromium/extensions/browser/value_store/value_store.cc
@@ -34,7 +34,7 @@ void ValueStore::Status::Merge(const Status& status) {
// Implementation of ReadResultType.
ValueStore::ReadResultType::ReadResultType(
- scoped_ptr<base::DictionaryValue> settings,
+ std::unique_ptr<base::DictionaryValue> settings,
const Status& status)
: settings_(std::move(settings)), status_(status) {
CHECK(settings_);
@@ -48,7 +48,7 @@ ValueStore::ReadResultType::~ReadResultType() {}
// Implementation of WriteResultType.
ValueStore::WriteResultType::WriteResultType(
- scoped_ptr<ValueStoreChangeList> changes,
+ std::unique_ptr<ValueStoreChangeList> changes,
const Status& status)
: changes_(std::move(changes)), status_(status) {
CHECK(changes_);
diff --git a/chromium/extensions/browser/value_store/value_store.h b/chromium/extensions/browser/value_store/value_store.h
index b6aa0bab5d7..2e9d1506b70 100644
--- a/chromium/extensions/browser/value_store/value_store.h
+++ b/chromium/extensions/browser/value_store/value_store.h
@@ -7,12 +7,12 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "extensions/browser/value_store/value_store_change.h"
@@ -88,7 +88,7 @@ class ValueStore {
// The result of a read operation (Get).
class ReadResultType {
public:
- ReadResultType(scoped_ptr<base::DictionaryValue> settings,
+ ReadResultType(std::unique_ptr<base::DictionaryValue> settings,
const Status& status);
explicit ReadResultType(const Status& status);
~ReadResultType();
@@ -99,24 +99,24 @@ class ValueStore {
//
// Must only be called if there is no error.
base::DictionaryValue& settings() { return *settings_; }
- scoped_ptr<base::DictionaryValue> PassSettings() {
+ std::unique_ptr<base::DictionaryValue> PassSettings() {
return std::move(settings_);
}
const Status& status() const { return status_; }
private:
- scoped_ptr<base::DictionaryValue> settings_;
+ std::unique_ptr<base::DictionaryValue> settings_;
Status status_;
DISALLOW_COPY_AND_ASSIGN(ReadResultType);
};
- typedef scoped_ptr<ReadResultType> ReadResult;
+ typedef std::unique_ptr<ReadResultType> ReadResult;
// The result of a write operation (Set/Remove/Clear).
class WriteResultType {
public:
- WriteResultType(scoped_ptr<ValueStoreChangeList> changes,
+ WriteResultType(std::unique_ptr<ValueStoreChangeList> changes,
const Status& status);
explicit WriteResultType(const Status& status);
~WriteResultType();
@@ -125,19 +125,19 @@ 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() {
+ std::unique_ptr<ValueStoreChangeList> PassChanges() {
return std::move(changes_);
}
const Status& status() const { return status_; }
private:
- scoped_ptr<ValueStoreChangeList> changes_;
+ std::unique_ptr<ValueStoreChangeList> changes_;
Status status_;
DISALLOW_COPY_AND_ASSIGN(WriteResultType);
};
- typedef scoped_ptr<WriteResultType> WriteResult;
+ typedef std::unique_ptr<WriteResultType> WriteResult;
// Options for write operations.
enum WriteOptionsValues {
@@ -156,7 +156,8 @@ class ValueStore {
// Helpers for making a Read/WriteResult.
template <typename T>
- static ReadResult MakeReadResult(scoped_ptr<T> arg, const Status& status) {
+ static ReadResult MakeReadResult(std::unique_ptr<T> arg,
+ const Status& status) {
return ReadResult(new ReadResultType(std::move(arg), status));
}
static ReadResult MakeReadResult(const Status& status) {
@@ -164,7 +165,8 @@ class ValueStore {
}
template <typename T>
- static WriteResult MakeWriteResult(scoped_ptr<T> arg, const Status& status) {
+ static WriteResult MakeWriteResult(std::unique_ptr<T> arg,
+ const Status& status) {
return WriteResult(new WriteResultType(std::move(arg), status));
}
static WriteResult MakeWriteResult(const Status& status) {
diff --git a/chromium/extensions/browser/value_store/value_store_change.cc b/chromium/extensions/browser/value_store/value_store_change.cc
index 3bbad592d06..423eb065ade 100644
--- a/chromium/extensions/browser/value_store/value_store_change.cc
+++ b/chromium/extensions/browser/value_store/value_store_change.cc
@@ -4,8 +4,11 @@
#include "extensions/browser/value_store/value_store_change.h"
+#include <utility>
+
#include "base/json/json_writer.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
// static
std::string ValueStoreChange::ToJson(
@@ -27,9 +30,10 @@ std::string ValueStoreChange::ToJson(
return json;
}
-ValueStoreChange::ValueStoreChange(
- const std::string& key, base::Value* old_value, base::Value* new_value)
- : inner_(new Inner(key, old_value, new_value)) {}
+ValueStoreChange::ValueStoreChange(const std::string& key,
+ std::unique_ptr<base::Value> old_value,
+ std::unique_ptr<base::Value> new_value)
+ : inner_(new Inner(key, std::move(old_value), std::move(new_value))) {}
ValueStoreChange::ValueStoreChange(const ValueStoreChange& other) = default;
@@ -50,8 +54,11 @@ const base::Value* ValueStoreChange::new_value() const {
return inner_->new_value_.get();
}
-ValueStoreChange::Inner::Inner(
- const std::string& key, base::Value* old_value, base::Value* new_value)
- : key_(key), old_value_(old_value), new_value_(new_value) {}
+ValueStoreChange::Inner::Inner(const std::string& key,
+ std::unique_ptr<base::Value> old_value,
+ std::unique_ptr<base::Value> new_value)
+ : key_(key),
+ old_value_(std::move(old_value)),
+ new_value_(std::move(new_value)) {}
ValueStoreChange::Inner::~Inner() {}
diff --git a/chromium/extensions/browser/value_store/value_store_change.h b/chromium/extensions/browser/value_store/value_store_change.h
index a5e6bf5b818..8645b574566 100644
--- a/chromium/extensions/browser/value_store/value_store_change.h
+++ b/chromium/extensions/browser/value_store/value_store_change.h
@@ -5,11 +5,11 @@
#ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_CHANGE_H_
#define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_CHANGE_H_
+#include <memory>
#include <string>
#include <vector>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/values.h"
class ValueStoreChange;
@@ -22,9 +22,9 @@ class ValueStoreChange {
// { "foo": { "key": "foo", "oldValue": "bar", "newValue": "baz" } }
static std::string ToJson(const ValueStoreChangeList& changes);
- // Ownership of |old_value| and |new_value| taken.
- ValueStoreChange(
- const std::string& key, base::Value* old_value, base::Value* new_value);
+ ValueStoreChange(const std::string& key,
+ std::unique_ptr<base::Value> old_value,
+ std::unique_ptr<base::Value> new_value);
ValueStoreChange(const ValueStoreChange& other);
@@ -44,12 +44,13 @@ class ValueStoreChange {
private:
class Inner : public base::RefCountedThreadSafe<Inner> {
public:
- Inner(
- const std::string& key, base::Value* old_value, base::Value* new_value);
+ Inner(const std::string& key,
+ std::unique_ptr<base::Value> old_value,
+ std::unique_ptr<base::Value> new_value);
const std::string key_;
- const scoped_ptr<base::Value> old_value_;
- const scoped_ptr<base::Value> new_value_;
+ const std::unique_ptr<base::Value> old_value_;
+ const std::unique_ptr<base::Value> new_value_;
private:
friend class base::RefCountedThreadSafe<Inner>;
diff --git a/chromium/extensions/browser/value_store/value_store_change_unittest.cc b/chromium/extensions/browser/value_store/value_store_change_unittest.cc
index 895f1ac71ee..1d92a8a2d32 100644
--- a/chromium/extensions/browser/value_store/value_store_change_unittest.cc
+++ b/chromium/extensions/browser/value_store/value_store_change_unittest.cc
@@ -5,6 +5,7 @@
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/values.h"
#include "extensions/browser/value_store/value_store_change.h"
#include "extensions/common/value_builder.h"
@@ -18,46 +19,48 @@ using extensions::ListBuilder;
namespace {
TEST(ValueStoreChangeTest, NullOldValue) {
- ValueStoreChange change("key", NULL, new base::StringValue("value"));
+ ValueStoreChange change("key", nullptr,
+ base::WrapUnique(new base::StringValue("value")));
EXPECT_EQ("key", change.key());
EXPECT_EQ(NULL, change.old_value());
{
- scoped_ptr<base::Value> expected(new base::StringValue("value"));
- EXPECT_TRUE(change.new_value()->Equals(expected.get()));
+ base::StringValue expected("value");
+ EXPECT_TRUE(change.new_value()->Equals(&expected));
}
}
TEST(ValueStoreChangeTest, NullNewValue) {
- ValueStoreChange change("key", new base::StringValue("value"), NULL);
+ ValueStoreChange change(
+ "key", base::WrapUnique(new base::StringValue("value")), nullptr);
EXPECT_EQ("key", change.key());
{
- scoped_ptr<base::Value> expected(new base::StringValue("value"));
- EXPECT_TRUE(change.old_value()->Equals(expected.get()));
+ base::StringValue expected("value");
+ EXPECT_TRUE(change.old_value()->Equals(&expected));
}
EXPECT_EQ(NULL, change.new_value());
}
TEST(ValueStoreChangeTest, NonNullValues) {
ValueStoreChange change("key",
- new base::StringValue("old_value"),
- new base::StringValue("new_value"));
+ base::WrapUnique(new base::StringValue("old_value")),
+ base::WrapUnique(new base::StringValue("new_value")));
EXPECT_EQ("key", change.key());
{
- scoped_ptr<base::Value> expected(new base::StringValue("old_value"));
- EXPECT_TRUE(change.old_value()->Equals(expected.get()));
+ base::StringValue expected("old_value");
+ EXPECT_TRUE(change.old_value()->Equals(&expected));
}
{
- scoped_ptr<base::Value> expected(new base::StringValue("new_value"));
- EXPECT_TRUE(change.new_value()->Equals(expected.get()));
+ base::StringValue expected("new_value");
+ EXPECT_TRUE(change.new_value()->Equals(&expected));
}
}
TEST(ValueStoreChangeTest, ToJson) {
// Create a mildly complicated structure that has dots in it.
- scoped_ptr<base::DictionaryValue> value =
+ std::unique_ptr<base::DictionaryValue> value =
DictionaryBuilder()
.Set("key", "value")
.Set("key.with.dots", "value.with.dots")
@@ -66,20 +69,20 @@ TEST(ValueStoreChangeTest, ToJson) {
.Build();
ValueStoreChangeList change_list;
- change_list.push_back(
- ValueStoreChange("key", value->DeepCopy(), value->DeepCopy()));
- change_list.push_back(
- ValueStoreChange("key.with.dots", value->DeepCopy(), value->DeepCopy()));
+ change_list.push_back(ValueStoreChange("key", value->CreateDeepCopy(),
+ value->CreateDeepCopy()));
+ change_list.push_back(ValueStoreChange(
+ "key.with.dots", value->CreateDeepCopy(), value->CreateDeepCopy()));
std::string json = ValueStoreChange::ToJson(change_list);
- scoped_ptr<base::Value> from_json(base::JSONReader::Read(json));
+ std::unique_ptr<base::Value> from_json(base::JSONReader::Read(json));
ASSERT_TRUE(from_json.get());
DictionaryBuilder v1(*value);
DictionaryBuilder v2(*value);
DictionaryBuilder v3(*value);
DictionaryBuilder v4(*value);
- scoped_ptr<base::DictionaryValue> expected_from_json =
+ std::unique_ptr<base::DictionaryValue> expected_from_json =
DictionaryBuilder()
.Set("key", DictionaryBuilder()
.Set("oldValue", v1.Build())
diff --git a/chromium/extensions/browser/value_store/value_store_factory.h b/chromium/extensions/browser/value_store/value_store_factory.h
index ec43547e880..58a73e92ed9 100644
--- a/chromium/extensions/browser/value_store/value_store_factory.h
+++ b/chromium/extensions/browser/value_store/value_store_factory.h
@@ -5,10 +5,10 @@
#ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_H_
#define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_H_
+#include <memory>
#include <set>
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/api/storage/settings_namespace.h"
#include "extensions/common/extension.h"
@@ -27,14 +27,14 @@ class ValueStoreFactory : public base::RefCountedThreadSafe<ValueStoreFactory> {
enum class ModelType { APP, EXTENSION };
// Create a |ValueStore| to contain rules data.
- virtual scoped_ptr<ValueStore> CreateRulesStore() = 0;
+ virtual std::unique_ptr<ValueStore> CreateRulesStore() = 0;
// Create a |ValueStore| to contain state data.
- virtual scoped_ptr<ValueStore> CreateStateStore() = 0;
+ virtual std::unique_ptr<ValueStore> CreateStateStore() = 0;
// Create a |ValueStore| to contain settings data for a specific extension
// namespace and model type.
- virtual scoped_ptr<ValueStore> CreateSettingsStore(
+ virtual std::unique_ptr<ValueStore> CreateSettingsStore(
settings_namespace::Namespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) = 0;
diff --git a/chromium/extensions/browser/value_store/value_store_factory_impl.cc b/chromium/extensions/browser/value_store/value_store_factory_impl.cc
index 27324fd2bd5..3689421bdf9 100644
--- a/chromium/extensions/browser/value_store/value_store_factory_impl.cc
+++ b/chromium/extensions/browser/value_store/value_store_factory_impl.cc
@@ -15,15 +15,15 @@ ValueStoreFactoryImpl::ValueStoreFactoryImpl(const base::FilePath& profile_path)
ValueStoreFactoryImpl::~ValueStoreFactoryImpl() = default;
-scoped_ptr<ValueStore> ValueStoreFactoryImpl::CreateRulesStore() {
+std::unique_ptr<ValueStore> ValueStoreFactoryImpl::CreateRulesStore() {
return legacy_factory_->CreateRulesStore();
}
-scoped_ptr<ValueStore> ValueStoreFactoryImpl::CreateStateStore() {
+std::unique_ptr<ValueStore> ValueStoreFactoryImpl::CreateStateStore() {
return legacy_factory_->CreateStateStore();
}
-scoped_ptr<ValueStore> ValueStoreFactoryImpl::CreateSettingsStore(
+std::unique_ptr<ValueStore> ValueStoreFactoryImpl::CreateSettingsStore(
SettingsNamespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) {
diff --git a/chromium/extensions/browser/value_store/value_store_factory_impl.h b/chromium/extensions/browser/value_store/value_store_factory_impl.h
index d0a0677ec97..193e8450ae2 100644
--- a/chromium/extensions/browser/value_store/value_store_factory_impl.h
+++ b/chromium/extensions/browser/value_store/value_store_factory_impl.h
@@ -5,12 +5,12 @@
#ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_
#define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FACTORY_IMPL_H_
+#include <memory>
#include <set>
#include <string>
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/value_store/value_store.h"
#include "extensions/browser/value_store/value_store_factory.h"
#include "extensions/common/extension.h"
@@ -26,9 +26,9 @@ class ValueStoreFactoryImpl : public ValueStoreFactory {
explicit ValueStoreFactoryImpl(const base::FilePath& profile_path);
// ValueStoreFactory
- scoped_ptr<ValueStore> CreateRulesStore() override;
- scoped_ptr<ValueStore> CreateStateStore() override;
- scoped_ptr<ValueStore> CreateSettingsStore(
+ std::unique_ptr<ValueStore> CreateRulesStore() override;
+ std::unique_ptr<ValueStore> CreateStateStore() override;
+ std::unique_ptr<ValueStore> CreateSettingsStore(
settings_namespace::Namespace settings_namespace,
ModelType model_type,
const ExtensionId& extension_id) override;
diff --git a/chromium/extensions/browser/value_store/value_store_frontend.cc b/chromium/extensions/browser/value_store/value_store_frontend.cc
index b3912d6febb..ccd50403706 100644
--- a/chromium/extensions/browser/value_store/value_store_frontend.cc
+++ b/chromium/extensions/browser/value_store/value_store_frontend.cc
@@ -32,7 +32,7 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> {
// Extract the value from the ReadResult and pass ownership of it to the
// callback.
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
if (result->status().ok()) {
result->settings().RemoveWithoutPathExpansion(key, &value);
} else {
@@ -45,7 +45,7 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> {
this, callback, base::Passed(&value)));
}
- void Set(const std::string& key, scoped_ptr<base::Value> value) {
+ void Set(const std::string& key, std::unique_ptr<base::Value> value) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
LazyInit();
// We don't need the old value, so skip generating changes.
@@ -88,7 +88,7 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> {
}
void RunCallback(const ValueStoreFrontend::ReadCallback& callback,
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
callback.Run(std::move(value));
}
@@ -100,7 +100,7 @@ class ValueStoreFrontend::Backend : public base::RefCountedThreadSafe<Backend> {
// The actual ValueStore that handles persisting the data to disk. Used
// exclusively on the FILE thread.
- scoped_ptr<ValueStore> storage_;
+ std::unique_ptr<ValueStore> storage_;
base::FilePath db_path_;
@@ -126,7 +126,7 @@ void ValueStoreFrontend::Get(const std::string& key,
}
void ValueStoreFrontend::Set(const std::string& key,
- scoped_ptr<base::Value> value) {
+ std::unique_ptr<base::Value> value) {
DCHECK(CalledOnValidThread());
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
diff --git a/chromium/extensions/browser/value_store/value_store_frontend.h b/chromium/extensions/browser/value_store/value_store_frontend.h
index 55253fb4218..47cab846a83 100644
--- a/chromium/extensions/browser/value_store/value_store_frontend.h
+++ b/chromium/extensions/browser/value_store/value_store_frontend.h
@@ -5,12 +5,12 @@
#ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_
#define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "base/values.h"
@@ -32,7 +32,7 @@ class ValueStoreFrontend
// The kind of extensions data stored in a backend.
enum class BackendType { RULES, STATE };
- typedef base::Callback<void(scoped_ptr<base::Value>)> ReadCallback;
+ typedef base::Callback<void(std::unique_ptr<base::Value>)> ReadCallback;
ValueStoreFrontend(
const scoped_refptr<extensions::ValueStoreFactory>& store_factory,
@@ -44,7 +44,7 @@ class ValueStoreFrontend
void Get(const std::string& key, const ReadCallback& callback);
// Sets a value with the given key.
- void Set(const std::string& key, scoped_ptr<base::Value> value);
+ void Set(const std::string& key, std::unique_ptr<base::Value> value);
// Removes the value with the given key.
void Remove(const std::string& key);
diff --git a/chromium/extensions/browser/value_store/value_store_frontend_unittest.cc b/chromium/extensions/browser/value_store/value_store_frontend_unittest.cc
index 21f95b6153e..f6a2ffaef0e 100644
--- a/chromium/extensions/browser/value_store/value_store_frontend_unittest.cc
+++ b/chromium/extensions/browser/value_store/value_store_frontend_unittest.cc
@@ -4,11 +4,11 @@
#include "extensions/browser/value_store/value_store_frontend.h"
+#include <memory>
#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"
@@ -50,7 +50,7 @@ class ValueStoreFrontendTest : public testing::Test {
factory_, ValueStoreFrontend::BackendType::RULES));
}
- bool Get(const std::string& key, scoped_ptr<base::Value>* output) {
+ bool Get(const std::string& key, std::unique_ptr<base::Value>* output) {
storage_->Get(key, base::Bind(&ValueStoreFrontendTest::GetAndWait,
base::Unretained(this), output));
base::MessageLoop::current()->Run(); // wait for GetAndWait
@@ -58,14 +58,14 @@ class ValueStoreFrontendTest : public testing::Test {
}
protected:
- void GetAndWait(scoped_ptr<base::Value>* output,
- scoped_ptr<base::Value> result) {
+ void GetAndWait(std::unique_ptr<base::Value>* output,
+ std::unique_ptr<base::Value> result) {
*output = std::move(result);
base::MessageLoop::current()->QuitWhenIdle();
}
scoped_refptr<extensions::TestValueStoreFactory> factory_;
- scoped_ptr<ValueStoreFrontend> storage_;
+ std::unique_ptr<ValueStoreFrontend> storage_;
base::ScopedTempDir temp_dir_;
base::FilePath db_path_;
base::MessageLoop message_loop_;
@@ -74,7 +74,7 @@ class ValueStoreFrontendTest : public testing::Test {
};
TEST_F(ValueStoreFrontendTest, GetExistingData) {
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
ASSERT_FALSE(Get("key0", &value));
// Test existing keys in the DB.
@@ -94,14 +94,16 @@ TEST_F(ValueStoreFrontendTest, GetExistingData) {
}
TEST_F(ValueStoreFrontendTest, ChangesPersistAfterReload) {
- storage_->Set("key0", scoped_ptr<base::Value>(new base::FundamentalValue(0)));
- storage_->Set("key1", scoped_ptr<base::Value>(new base::StringValue("new1")));
+ storage_->Set("key0",
+ std::unique_ptr<base::Value>(new base::FundamentalValue(0)));
+ storage_->Set("key1",
+ std::unique_ptr<base::Value>(new base::StringValue("new1")));
storage_->Remove("key2");
// Reload the DB and test our changes.
ResetStorage();
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
{
ASSERT_TRUE(Get("key0", &value));
int result;
diff --git a/chromium/extensions/browser/value_store/value_store_unittest.cc b/chromium/extensions/browser/value_store/value_store_unittest.cc
index 8c5f7aec06c..a6858b2aec1 100644
--- a/chromium/extensions/browser/value_store/value_store_unittest.cc
+++ b/chromium/extensions/browser/value_store/value_store_unittest.cc
@@ -4,6 +4,8 @@
#include "extensions/browser/value_store/value_store_unittest.h"
+#include <utility>
+
#include "base/json/json_writer.h"
#include "base/memory/linked_ptr.h"
#include "base/values.h"
@@ -156,13 +158,13 @@ ValueStoreTest::ValueStoreTest()
set13_.insert(list13_.begin(), list13_.end());
set123_.insert(list123_.begin(), list123_.end());
- dict1_->Set(key1_, val1_->DeepCopy());
- dict3_->Set(key3_, val3_->DeepCopy());
- dict12_->Set(key1_, val1_->DeepCopy());
- dict12_->Set(key2_, val2_->DeepCopy());
- dict123_->Set(key1_, val1_->DeepCopy());
- dict123_->Set(key2_, val2_->DeepCopy());
- dict123_->Set(key3_, val3_->DeepCopy());
+ dict1_->Set(key1_, val1_->CreateDeepCopy());
+ dict3_->Set(key3_, val3_->CreateDeepCopy());
+ dict12_->Set(key1_, val1_->CreateDeepCopy());
+ dict12_->Set(key2_, val2_->CreateDeepCopy());
+ dict123_->Set(key1_, val1_->CreateDeepCopy());
+ dict123_->Set(key2_, val2_->CreateDeepCopy());
+ dict123_->Set(key3_, val3_->CreateDeepCopy());
}
ValueStoreTest::~ValueStoreTest() {}
@@ -187,7 +189,8 @@ TEST_P(ValueStoreTest, GetWhenEmpty) {
TEST_P(ValueStoreTest, GetWithSingleValue) {
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key1_, NULL, val1_->DeepCopy()));
+ changes.push_back(
+ ValueStoreChange(key1_, nullptr, val1_->CreateDeepCopy()));
EXPECT_PRED_FORMAT2(ChangesEq,
changes, storage_->Set(DEFAULTS, key1_, *val1_));
}
@@ -203,8 +206,10 @@ TEST_P(ValueStoreTest, GetWithSingleValue) {
TEST_P(ValueStoreTest, GetWithMultipleValues) {
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key1_, NULL, val1_->DeepCopy()));
- changes.push_back(ValueStoreChange(key2_, NULL, val2_->DeepCopy()));
+ changes.push_back(
+ ValueStoreChange(key1_, nullptr, val1_->CreateDeepCopy()));
+ changes.push_back(
+ ValueStoreChange(key2_, nullptr, val2_->CreateDeepCopy()));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Set(DEFAULTS, *dict12_));
}
@@ -228,7 +233,8 @@ TEST_P(ValueStoreTest, RemoveWithSingleValue) {
storage_->Set(DEFAULTS, *dict1_);
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key1_, val1_->DeepCopy(), NULL));
+ changes.push_back(
+ ValueStoreChange(key1_, val1_->CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Remove(key1_));
}
@@ -243,7 +249,8 @@ TEST_P(ValueStoreTest, RemoveWithMultipleValues) {
storage_->Set(DEFAULTS, *dict123_);
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key3_, val3_->DeepCopy(), NULL));
+ changes.push_back(
+ ValueStoreChange(key3_, val3_->CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Remove(key3_));
}
@@ -258,8 +265,10 @@ TEST_P(ValueStoreTest, RemoveWithMultipleValues) {
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key1_, val1_->DeepCopy(), NULL));
- changes.push_back(ValueStoreChange(key2_, val2_->DeepCopy(), NULL));
+ changes.push_back(
+ ValueStoreChange(key1_, val1_->CreateDeepCopy(), nullptr));
+ changes.push_back(
+ ValueStoreChange(key2_, val2_->CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Remove(list12_));
}
@@ -277,9 +286,10 @@ TEST_P(ValueStoreTest, SetWhenOverwriting) {
storage_->Set(DEFAULTS, key1_, *val2_);
{
ValueStoreChangeList changes;
+ changes.push_back(ValueStoreChange(key1_, val2_->CreateDeepCopy(),
+ val1_->CreateDeepCopy()));
changes.push_back(
- ValueStoreChange(key1_, val2_->DeepCopy(), val1_->DeepCopy()));
- changes.push_back(ValueStoreChange(key2_, NULL, val2_->DeepCopy()));
+ ValueStoreChange(key2_, nullptr, val2_->CreateDeepCopy()));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Set(DEFAULTS, *dict12_));
}
@@ -306,8 +316,10 @@ TEST_P(ValueStoreTest, ClearWhenNotEmpty) {
storage_->Set(DEFAULTS, *dict12_);
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key1_, val1_->DeepCopy(), NULL));
- changes.push_back(ValueStoreChange(key2_, val2_->DeepCopy(), NULL));
+ changes.push_back(
+ ValueStoreChange(key1_, val1_->CreateDeepCopy(), nullptr));
+ changes.push_back(
+ ValueStoreChange(key2_, val2_->CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Clear());
}
@@ -325,14 +337,14 @@ TEST_P(ValueStoreTest, DotsInKeyNames) {
std::vector<std::string> dot_list;
dot_list.push_back(dot_key);
base::DictionaryValue dot_dict;
- dot_dict.SetWithoutPathExpansion(dot_key, dot_value.DeepCopy());
+ dot_dict.SetWithoutPathExpansion(dot_key, dot_value.CreateDeepCopy());
EXPECT_PRED_FORMAT2(SettingsEq, *empty_dict_, storage_->Get(dot_key));
{
ValueStoreChangeList changes;
changes.push_back(
- ValueStoreChange(dot_key, NULL, dot_value.DeepCopy()));
+ ValueStoreChange(dot_key, nullptr, dot_value.CreateDeepCopy()));
EXPECT_PRED_FORMAT2(ChangesEq,
changes, storage_->Set(DEFAULTS, dot_key, dot_value));
}
@@ -344,7 +356,7 @@ TEST_P(ValueStoreTest, DotsInKeyNames) {
{
ValueStoreChangeList changes;
changes.push_back(
- ValueStoreChange(dot_key, dot_value.DeepCopy(), NULL));
+ ValueStoreChange(dot_key, dot_value.CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Remove(dot_key));
}
EXPECT_PRED_FORMAT2(ChangesEq,
@@ -352,7 +364,7 @@ TEST_P(ValueStoreTest, DotsInKeyNames) {
{
ValueStoreChangeList changes;
changes.push_back(
- ValueStoreChange(dot_key, NULL, dot_value.DeepCopy()));
+ ValueStoreChange(dot_key, nullptr, dot_value.CreateDeepCopy()));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Set(DEFAULTS, dot_dict));
}
@@ -362,7 +374,7 @@ TEST_P(ValueStoreTest, DotsInKeyNames) {
{
ValueStoreChangeList changes;
changes.push_back(
- ValueStoreChange(dot_key, dot_value.DeepCopy(), NULL));
+ ValueStoreChange(dot_key, dot_value.CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Remove(dot_list));
}
@@ -372,16 +384,16 @@ TEST_P(ValueStoreTest, DotsInKeyNames) {
TEST_P(ValueStoreTest, DotsInKeyNamesWithDicts) {
base::DictionaryValue outer_dict;
- base::DictionaryValue* inner_dict = new base::DictionaryValue();
- outer_dict.Set("foo", inner_dict);
- inner_dict->SetString("bar", "baz");
+ base::DictionaryValue inner_dict;
+ inner_dict.SetString("bar", "baz");
+ outer_dict.Set("foo", inner_dict.CreateDeepCopy());
{
ValueStoreChangeList changes;
changes.push_back(
- ValueStoreChange("foo", NULL, inner_dict->DeepCopy()));
- EXPECT_PRED_FORMAT2(ChangesEq,
- changes, storage_->Set(DEFAULTS, outer_dict));
+ ValueStoreChange("foo", nullptr, inner_dict.CreateDeepCopy()));
+ EXPECT_PRED_FORMAT2(ChangesEq, changes,
+ storage_->Set(DEFAULTS, outer_dict));
}
EXPECT_PRED_FORMAT2(SettingsEq, outer_dict, storage_->Get("foo"));
@@ -401,63 +413,72 @@ TEST_P(ValueStoreTest, ComplexChangedKeysScenarios) {
ValueStoreChangeList(), storage_->Set(DEFAULTS, key1_, *val1_));
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(
- key1_, val1_->DeepCopy(), val2_->DeepCopy()));
+ changes.push_back(ValueStoreChange(key1_, val1_->CreateDeepCopy(),
+ val2_->CreateDeepCopy()));
EXPECT_PRED_FORMAT2(ChangesEq,
changes, storage_->Set(DEFAULTS, key1_, *val2_));
}
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key1_, val2_->DeepCopy(), NULL));
+ changes.push_back(
+ ValueStoreChange(key1_, val2_->CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Remove(key1_));
EXPECT_PRED_FORMAT2(ChangesEq,
ValueStoreChangeList(), storage_->Remove(key1_));
}
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key1_, NULL, val1_->DeepCopy()));
+ changes.push_back(
+ ValueStoreChange(key1_, nullptr, val1_->CreateDeepCopy()));
EXPECT_PRED_FORMAT2(ChangesEq,
changes, storage_->Set(DEFAULTS, key1_, *val1_));
}
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key1_, val1_->DeepCopy(), NULL));
+ changes.push_back(
+ ValueStoreChange(key1_, val1_->CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Clear());
EXPECT_PRED_FORMAT2(ChangesEq, ValueStoreChangeList(), storage_->Clear());
}
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key1_, NULL, val1_->DeepCopy()));
- changes.push_back(ValueStoreChange(key2_, NULL, val2_->DeepCopy()));
+ changes.push_back(
+ ValueStoreChange(key1_, nullptr, val1_->CreateDeepCopy()));
+ changes.push_back(
+ ValueStoreChange(key2_, nullptr, val2_->CreateDeepCopy()));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Set(DEFAULTS, *dict12_));
EXPECT_PRED_FORMAT2(ChangesEq,
ValueStoreChangeList(), storage_->Set(DEFAULTS, *dict12_));
}
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key3_, NULL, val3_->DeepCopy()));
+ changes.push_back(
+ ValueStoreChange(key3_, nullptr, val3_->CreateDeepCopy()));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Set(DEFAULTS, *dict123_));
}
{
base::DictionaryValue to_set;
- to_set.Set(key1_, val2_->DeepCopy());
- to_set.Set(key2_, val2_->DeepCopy());
- to_set.Set("asdf", val1_->DeepCopy());
- to_set.Set("qwerty", val3_->DeepCopy());
+ to_set.Set(key1_, val2_->CreateDeepCopy());
+ to_set.Set(key2_, val2_->CreateDeepCopy());
+ to_set.Set("asdf", val1_->CreateDeepCopy());
+ to_set.Set("qwerty", val3_->CreateDeepCopy());
ValueStoreChangeList changes;
+ changes.push_back(ValueStoreChange(key1_, val1_->CreateDeepCopy(),
+ val2_->CreateDeepCopy()));
changes.push_back(
- ValueStoreChange(key1_, val1_->DeepCopy(), val2_->DeepCopy()));
- changes.push_back(ValueStoreChange("asdf", NULL, val1_->DeepCopy()));
+ ValueStoreChange("asdf", nullptr, val1_->CreateDeepCopy()));
changes.push_back(
- ValueStoreChange("qwerty", NULL, val3_->DeepCopy()));
+ ValueStoreChange("qwerty", nullptr, val3_->CreateDeepCopy()));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Set(DEFAULTS, to_set));
}
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key1_, val2_->DeepCopy(), NULL));
- changes.push_back(ValueStoreChange(key2_, val2_->DeepCopy(), NULL));
+ changes.push_back(
+ ValueStoreChange(key1_, val2_->CreateDeepCopy(), nullptr));
+ changes.push_back(
+ ValueStoreChange(key2_, val2_->CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Remove(list12_));
}
{
@@ -466,14 +487,16 @@ TEST_P(ValueStoreTest, ComplexChangedKeysScenarios) {
to_remove.push_back("asdf");
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange("asdf", val1_->DeepCopy(), NULL));
+ changes.push_back(
+ ValueStoreChange("asdf", val1_->CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Remove(to_remove));
}
{
ValueStoreChangeList changes;
- changes.push_back(ValueStoreChange(key3_, val3_->DeepCopy(), NULL));
changes.push_back(
- ValueStoreChange("qwerty", val3_->DeepCopy(), NULL));
+ ValueStoreChange(key3_, val3_->CreateDeepCopy(), nullptr));
+ changes.push_back(
+ ValueStoreChange("qwerty", val3_->CreateDeepCopy(), nullptr));
EXPECT_PRED_FORMAT2(ChangesEq, changes, storage_->Clear());
EXPECT_PRED_FORMAT2(ChangesEq, ValueStoreChangeList(), storage_->Clear());
}
diff --git a/chromium/extensions/browser/value_store/value_store_unittest.h b/chromium/extensions/browser/value_store/value_store_unittest.h
index f50e6902570..d433ab9cc9c 100644
--- a/chromium/extensions/browser/value_store/value_store_unittest.h
+++ b/chromium/extensions/browser/value_store/value_store_unittest.h
@@ -5,9 +5,10 @@
#ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_UNITTEST_H_
#define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_UNITTEST_H_
+#include <memory>
+
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "content/public/test/test_browser_thread.h"
#include "extensions/browser/value_store/value_store.h"
@@ -28,15 +29,15 @@ class ValueStoreTest : public testing::TestWithParam<ValueStoreTestParam> {
void TearDown() override;
protected:
- scoped_ptr<ValueStore> storage_;
+ std::unique_ptr<ValueStore> storage_;
std::string key1_;
std::string key2_;
std::string key3_;
- scoped_ptr<base::Value> val1_;
- scoped_ptr<base::Value> val2_;
- scoped_ptr<base::Value> val3_;
+ std::unique_ptr<base::Value> val1_;
+ std::unique_ptr<base::Value> val2_;
+ std::unique_ptr<base::Value> val3_;
std::vector<std::string> empty_list_;
std::vector<std::string> list1_;
@@ -54,11 +55,11 @@ class ValueStoreTest : public testing::TestWithParam<ValueStoreTestParam> {
std::set<std::string> set13_;
std::set<std::string> set123_;
- scoped_ptr<base::DictionaryValue> empty_dict_;
- scoped_ptr<base::DictionaryValue> dict1_;
- scoped_ptr<base::DictionaryValue> dict3_;
- scoped_ptr<base::DictionaryValue> dict12_;
- scoped_ptr<base::DictionaryValue> dict123_;
+ std::unique_ptr<base::DictionaryValue> empty_dict_;
+ std::unique_ptr<base::DictionaryValue> dict1_;
+ std::unique_ptr<base::DictionaryValue> dict3_;
+ std::unique_ptr<base::DictionaryValue> dict12_;
+ std::unique_ptr<base::DictionaryValue> dict123_;
private:
base::ScopedTempDir temp_dir_;
diff --git a/chromium/extensions/browser/verified_contents.cc b/chromium/extensions/browser/verified_contents.cc
index fc2471dc79a..6abca5ee7b9 100644
--- a/chromium/extensions/browser/verified_contents.cc
+++ b/chromium/extensions/browser/verified_contents.cc
@@ -96,7 +96,7 @@ bool VerifiedContents::InitFrom(const base::FilePath& path,
if (!GetPayload(path, &payload, ignore_invalid_signature))
return false;
- scoped_ptr<base::Value> value(base::JSONReader::Read(payload));
+ std::unique_ptr<base::Value> value(base::JSONReader::Read(payload));
if (!value.get() || !value->IsType(Value::TYPE_DICTIONARY))
return false;
DictionaryValue* dictionary = static_cast<DictionaryValue*>(value.get());
@@ -235,7 +235,7 @@ bool VerifiedContents::GetPayload(const base::FilePath& path,
std::string contents;
if (!base::ReadFileToString(path, &contents))
return false;
- scoped_ptr<base::Value> value(base::JSONReader::Read(contents));
+ std::unique_ptr<base::Value> value(base::JSONReader::Read(contents));
if (!value.get() || !value->IsType(Value::TYPE_LIST))
return false;
ListValue* top_list = static_cast<ListValue*>(value.get());
diff --git a/chromium/extensions/browser/web_ui_user_script_loader.cc b/chromium/extensions/browser/web_ui_user_script_loader.cc
index 6954f25188e..a16c7f70a89 100644
--- a/chromium/extensions/browser/web_ui_user_script_loader.cc
+++ b/chromium/extensions/browser/web_ui_user_script_loader.cc
@@ -16,9 +16,9 @@
namespace {
void SerializeOnFileThread(
- scoped_ptr<extensions::UserScriptList> user_scripts,
+ std::unique_ptr<extensions::UserScriptList> user_scripts,
extensions::UserScriptLoader::LoadScriptsCallback callback) {
- scoped_ptr<base::SharedMemory> memory =
+ std::unique_ptr<base::SharedMemory> memory =
extensions::UserScriptLoader::Serialize(*user_scripts);
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
@@ -61,7 +61,7 @@ void WebUIUserScriptLoader::AddScripts(
}
void WebUIUserScriptLoader::LoadScripts(
- scoped_ptr<extensions::UserScriptList> user_scripts,
+ std::unique_ptr<extensions::UserScriptList> user_scripts,
const std::set<HostID>& changed_hosts,
const std::set<int>& added_script_ids,
LoadScriptsCallback callback) {
@@ -114,7 +114,7 @@ void WebUIUserScriptLoader::CreateWebUIURLFetchers(
// The WebUIUserScriptLoader owns these WebUIURLFetchers. Once the
// loader is destroyed, all the fetchers will be destroyed. Therefore,
// we are sure it is safe to use base::Unretained(this) here.
- scoped_ptr<WebUIURLFetcher> fetcher(new WebUIURLFetcher(
+ std::unique_ptr<WebUIURLFetcher> fetcher(new WebUIURLFetcher(
browser_context, render_process_id, render_view_id, file.url(),
base::Bind(&WebUIUserScriptLoader::OnSingleWebUIURLFetchComplete,
base::Unretained(this), &file)));
diff --git a/chromium/extensions/browser/web_ui_user_script_loader.h b/chromium/extensions/browser/web_ui_user_script_loader.h
index f0e3c905435..fa75e19afa4 100644
--- a/chromium/extensions/browser/web_ui_user_script_loader.h
+++ b/chromium/extensions/browser/web_ui_user_script_loader.h
@@ -7,11 +7,11 @@
#include <stddef.h>
+#include <memory>
#include <vector>
#include "base/callback.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "extensions/browser/user_script_loader.h"
class WebUIURLFetcher;
@@ -35,7 +35,7 @@ class WebUIUserScriptLoader : public extensions::UserScriptLoader {
void AddScripts(const std::set<extensions::UserScript>& scripts,
int render_process_id,
int render_view_id) override;
- void LoadScripts(scoped_ptr<extensions::UserScriptList> user_scripts,
+ void LoadScripts(std::unique_ptr<extensions::UserScriptList> user_scripts,
const std::set<HostID>& changed_hosts,
const std::set<int>& added_script_ids,
LoadScriptsCallback callback) override;
@@ -64,11 +64,11 @@ class WebUIUserScriptLoader : public extensions::UserScriptLoader {
size_t complete_fetchers_;
// Caches |user_scripts_| from UserScriptLoader when loading.
- scoped_ptr<extensions::UserScriptList> user_scripts_cache_;
+ std::unique_ptr<extensions::UserScriptList> user_scripts_cache_;
LoadScriptsCallback scripts_loaded_callback_;
- std::vector<scoped_ptr<WebUIURLFetcher>> fetchers_;
+ std::vector<std::unique_ptr<WebUIURLFetcher>> fetchers_;
DISALLOW_COPY_AND_ASSIGN(WebUIUserScriptLoader);
};