From 4af48586364b625a8bfce51b10aa4a76109a9108 Mon Sep 17 00:00:00 2001 From: dcheng Date: Mon, 18 Apr 2016 17:29:35 -0700 Subject: [PATCH] Convert //chrome/browser from scoped_ptr to std::unique_ptr BUG=554298 Review URL: https://codereview.chromium.org/1902583002 Cr-Commit-Position: refs/heads/master@{#388093} --- chrome/browser/after_startup_task_utils.cc | 13 +- .../after_startup_task_utils_unittest.cc | 3 +- chrome/browser/app_controller_mac.h | 16 +- chrome/browser/app_icon_win.cc | 2 +- chrome/browser/app_icon_win.h | 4 +- .../autocomplete_classifier_factory.cc | 11 +- .../autocomplete_classifier_factory.h | 5 +- .../chrome_autocomplete_provider_client.cc | 5 +- .../chrome_autocomplete_provider_client.h | 2 +- ...yword_extensions_delegate_impl_unittest.cc | 3 +- .../autocomplete/search_provider_unittest.cc | 9 +- .../autocomplete/shortcuts_backend_factory.cc | 6 +- .../background_application_list_model.cc | 2 +- ...kground_application_list_model_unittest.cc | 12 +- .../browser/background/background_contents.h | 6 +- .../background_contents_service_unittest.cc | 21 +-- .../background/background_mode_manager.cc | 4 +- .../background/background_mode_manager.h | 6 +- .../background_mode_manager_unittest.cc | 27 +-- ...ackground_sync_controller_impl_unittest.cc | 4 +- .../browser/banners/app_banner_data_fetcher.h | 5 +- .../app_banner_data_fetcher_browsertest.cc | 6 +- .../banners/app_banner_data_fetcher_desktop.h | 2 +- .../app_banner_infobar_delegate_desktop.cc | 5 +- .../app_banner_infobar_delegate_desktop.h | 3 +- chrome/browser/banners/app_banner_manager.h | 3 +- .../banners/app_banner_settings_helper.cc | 25 +-- .../browser/bitmap_fetcher/bitmap_fetcher.h | 5 +- .../bitmap_fetcher_browsertest.cc | 2 +- .../bitmap_fetcher/bitmap_fetcher_service.cc | 12 +- .../bitmap_fetcher/bitmap_fetcher_service.h | 11 +- .../bitmap_fetcher_service_unittest.cc | 10 +- .../browser/bookmarks/bookmark_html_writer.cc | 9 +- .../browser/bookmarks/bookmark_html_writer.h | 2 +- .../bookmarks/bookmark_model_factory.cc | 3 +- .../managed_bookmark_service_factory.cc | 5 +- .../managed_bookmark_service_factory.h | 3 +- .../managed_bookmark_service_unittest.cc | 19 ++- .../browser/browser_about_handler_unittest.cc | 13 +- chrome/browser/browser_process.h | 4 +- chrome/browser/browser_process_impl.cc | 24 ++- chrome/browser/browser_process_impl.h | 72 ++++---- .../browser/browser_process_impl_unittest.cc | 11 +- .../browser_process_platform_part_base.cc | 4 +- .../browser_process_platform_part_base.h | 7 +- .../browser_process_platform_part_chromeos.cc | 6 +- .../browser_process_platform_part_chromeos.h | 25 +-- .../browser_process_platform_part_mac.h | 3 +- chrome/browser/browser_shutdown.cc | 2 +- .../browser/browsing_data/autofill_counter.cc | 4 +- .../autofill_counter_browsertest.cc | 4 +- .../browsing_data_channel_id_helper.cc | 3 +- ...rowsing_data_channel_id_helper_unittest.cc | 16 +- .../browsing_data_cookie_helper.cc | 4 +- .../browsing_data_cookie_helper_unittest.cc | 4 +- .../browsing_data/browsing_data_counter.cc | 7 +- .../browsing_data/browsing_data_counter.h | 4 +- .../browsing_data_file_system_helper.cc | 2 +- ...owsing_data_file_system_helper_unittest.cc | 4 +- .../browsing_data/browsing_data_remover.cc | 2 +- .../browsing_data/browsing_data_remover.h | 12 +- .../browsing_data_remover_browsertest.cc | 2 +- .../browsing_data_remover_unittest.cc | 30 ++-- .../cache_counter_browsertest.cc | 4 +- .../browsing_data/cookies_tree_model.cc | 3 +- .../browsing_data/cookies_tree_model.h | 2 +- .../cookies_tree_model_unittest.cc | 21 +-- .../browser/browsing_data/history_counter.cc | 8 +- .../browser/browsing_data/history_counter.h | 2 +- .../history_counter_browsertest.cc | 8 +- .../mock_browsing_data_channel_id_helper.cc | 2 +- .../mock_browsing_data_cookie_helper.cc | 2 +- .../passwords_counter_browsertest.cc | 4 +- ...istrable_domain_filter_builder_unittest.cc | 4 +- chrome/browser/caps/generate_state_json.cc | 2 +- .../captive_portal_browsertest.cc | 9 +- .../captive_portal/captive_portal_service.h | 5 +- .../captive_portal_service_unittest.cc | 8 +- .../captive_portal_tab_helper.h | 7 +- .../captive_portal_tab_helper_unittest.cc | 5 +- .../captive_portal_tab_reloader_unittest.cc | 2 +- chrome/browser/certificate_manager_model.cc | 2 +- chrome/browser/certificate_manager_model.h | 4 +- chrome/browser/character_encoding.cc | 8 +- ...chrome_browser_application_mac_unittest.mm | 8 +- chrome/browser/chrome_browser_main.cc | 17 +- chrome/browser/chrome_browser_main.h | 25 +-- chrome/browser/chrome_browser_main_android.h | 4 +- .../chrome_browser_main_extra_parts_exo.cc | 6 +- .../chrome_browser_main_extra_parts_exo.h | 9 +- chrome/browser/chrome_browser_main_win.cc | 6 +- chrome/browser/chrome_browser_main_win.h | 2 +- .../browser/chrome_content_browser_client.cc | 24 ++- .../browser/chrome_content_browser_client.h | 8 +- .../chrome_content_browser_client_unittest.cc | 2 +- chrome/browser/chrome_device_client.h | 7 +- .../browser/chrome_elf_init_unittest_win.cc | 5 +- .../chrome_net_benchmarking_message_filter.cc | 3 +- .../chrome_quota_permission_context.cc | 2 +- .../browser/chrome_webusb_browser_client.cc | 11 +- .../extensions/wallpaper_private_api.cc | 2 +- .../component_updater/caps_installer_win.cc | 10 +- .../cld_component_installer.cc | 4 +- .../cld_component_installer.h | 2 +- .../cld_component_installer_unittest.cc | 5 +- .../component_installers_unittest.cc | 6 +- ...ponent_patcher_operation_out_of_process.cc | 6 +- .../ev_whitelist_component_installer.cc | 4 +- .../ev_whitelist_component_installer.h | 2 +- .../pnacl_component_installer.cc | 10 +- .../pnacl_component_installer.h | 2 +- .../recovery_component_installer.cc | 8 +- .../sth_set_component_installer.cc | 10 +- .../sth_set_component_installer.h | 10 +- .../sth_set_component_installer_unittest.cc | 6 +- .../supervised_user_whitelist_installer.cc | 12 +- .../supervised_user_whitelist_installer.h | 4 +- ...vised_user_whitelist_installer_unittest.cc | 13 +- .../sw_reporter_installer_win.cc | 10 +- .../widevine_cdm_component_installer.cc | 22 +-- .../chrome_content_settings_client.cc | 4 +- .../chrome_content_settings_client.h | 6 +- ...tent_settings_default_provider_unittest.cc | 9 +- ...nt_settings_internal_extension_provider.cc | 4 +- ...ent_settings_internal_extension_provider.h | 6 +- ...gs_origin_identifier_value_map_unittest.cc | 9 +- ...ntent_settings_policy_provider_unittest.cc | 22 +-- ...content_settings_pref_provider_unittest.cc | 26 +-- .../content_settings_supervised_provider.cc | 4 +- .../content_settings_supervised_provider.h | 7 +- ...t_settings_supervised_provider_unittest.cc | 16 +- .../host_content_settings_map_factory.cc | 2 +- .../host_content_settings_map_unittest.cc | 12 +- .../local_shared_objects_container.cc | 5 +- .../local_shared_objects_container.h | 5 +- .../tab_specific_content_settings.h | 6 +- .../tab_specific_content_settings_unittest.cc | 7 +- .../copresence/chrome_whispernet_client.cc | 12 +- .../copresence/chrome_whispernet_client.h | 2 +- .../chrome_whispernet_client_browsertest.cc | 22 +-- chrome/browser/crash_recovery_browsertest.cc | 6 +- .../protocol_handler_registry.cc | 11 +- .../protocol_handler_registry.h | 10 +- .../protocol_handler_registry_browsertest.cc | 6 +- .../protocol_handler_registry_unittest.cc | 22 +-- .../data_saver/data_saver_browsertest.cc | 6 +- chrome/browser/data_usage/tab_id_annotator.cc | 6 +- chrome/browser/data_usage/tab_id_annotator.h | 5 +- .../data_usage/tab_id_annotator_unittest.cc | 22 ++- chrome/browser/data_usage/tab_id_provider.cc | 4 +- .../data_usage/tab_id_provider_unittest.cc | 5 +- .../diagnostics/diagnostics_controller.cc | 2 +- .../diagnostics/diagnostics_controller.h | 5 +- .../diagnostics_controller_unittest.cc | 7 +- .../diagnostics/diagnostics_model_unittest.cc | 5 +- .../browser/diagnostics/diagnostics_writer.h | 5 +- .../browser/diagnostics/recon_diagnostics.cc | 6 +- .../dom_distiller_service_factory.cc | 24 +-- .../dom_distiller_service_factory.h | 8 +- ...dom_distiller_viewer_source_browsertest.cc | 19 ++- .../lazy_dom_distiller_service.cc | 18 +- .../lazy_dom_distiller_service.h | 25 +-- chrome/browser/dom_distiller/profile_utils.cc | 4 +- chrome/browser/dom_distiller/tab_utils.cc | 16 +- .../dom_distiller/tab_utils_browsertest.cc | 4 +- .../site_engagement_eviction_policy.h | 2 +- ...ite_engagement_eviction_policy_unittest.cc | 8 +- .../engagement/site_engagement_helper.cc | 2 +- .../engagement/site_engagement_helper.h | 4 +- .../site_engagement_helper_unittest.cc | 17 +- .../engagement/site_engagement_service.cc | 42 ++--- .../engagement/site_engagement_service.h | 4 +- .../site_engagement_service_unittest.cc | 30 ++-- chrome/browser/enumerate_modules_model_win.cc | 11 +- chrome/browser/errorpage_browsertest.cc | 21 ++- .../webrtc_event_log_apitest.cc | 21 ++- .../webrtc_logging_private_api.cc | 4 +- .../content_favicon_driver_browsertest.cc | 2 +- .../favicon/favicon_service_factory.cc | 8 +- .../log_sources/chrome_internal_log_source.cc | 2 +- .../log_sources/memory_details_log_source.cc | 2 +- .../system_logs/system_logs_fetcher_base.h | 6 +- chrome/browser/file_select_helper.cc | 34 ++-- chrome/browser/file_select_helper.h | 23 +-- chrome/browser/first_run/first_run.cc | 7 +- .../first_run/first_run_browsertest.cc | 4 +- .../geolocation/geolocation_browsertest.cc | 2 +- .../geolocation_infobar_delegate_android.cc | 4 +- .../geolocation_permission_context_android.cc | 2 +- .../geolocation_permission_context_android.h | 8 +- ...geolocation_permission_context_unittest.cc | 15 +- .../geolocation_settings_state_unittest.cc | 4 +- .../google/google_url_tracker_factory.cc | 2 +- chrome/browser/gpu/three_d_api_observer.cc | 4 +- .../chrome_app_view_guest_delegate.cc | 2 +- ...chrome_extension_options_guest_delegate.cc | 2 +- ...chrome_mime_handler_view_guest_delegate.cc | 2 +- .../chrome_web_view_guest_delegate.cc | 11 +- .../web_view/chrome_web_view_guest_delegate.h | 8 +- chrome/browser/icon_loader.h | 7 +- chrome/browser/icon_loader_win.cc | 4 +- chrome/browser/icon_manager.cc | 2 +- chrome/browser/image_decoder.h | 1 - chrome/browser/image_decoder_browsertest.cc | 2 +- .../importer/external_process_importer_host.h | 8 +- .../importer/firefox_profile_lock_unittest.cc | 14 +- chrome/browser/infobars/infobar_service.h | 6 +- .../browser/infobars/infobars_browsertest.cc | 2 +- .../insecure_content_infobar_delegate.cc | 7 +- .../install_verification/win/module_list.cc | 4 +- .../install_verification/win/module_list.h | 6 +- .../win/module_list_unittest.cc | 8 +- .../interests/android/interests_service.cc | 8 +- .../interests/android/interests_service.h | 7 +- chrome/browser/interests/interests_fetcher.cc | 18 +- chrome/browser/interests/interests_fetcher.h | 16 +- .../interests/interests_fetcher_unittest.cc | 6 +- chrome/browser/internal_auth.cc | 13 +- .../interstitials/chrome_metrics_helper.h | 4 +- chrome/browser/intranet_redirect_detector.cc | 2 +- .../profile_invalidation_provider_factory.cc | 12 +- chrome/browser/io_thread.cc | 26 +-- chrome/browser/io_thread.h | 70 ++++---- chrome/browser/io_thread_unittest.cc | 4 +- chrome/browser/jumplist_win.h | 4 +- .../browser/lifetime/application_lifetime.cc | 3 +- .../browser_close_manager_browsertest.cc | 6 +- .../lifetime/keep_alive_registry_unittest.cc | 7 +- chrome/browser/locale_tests_browsertest.cc | 2 +- chrome/browser/logging_chrome_unittest.cc | 7 +- chrome/browser/memory/tab_manager.h | 6 +- .../browser/memory/tab_manager_browsertest.cc | 2 +- .../tab_manager_web_contents_data_unittest.cc | 6 +- chrome/browser/memory_details.cc | 2 +- chrome/browser/memory_details_android.cc | 4 +- chrome/browser/memory_details_linux.cc | 4 +- chrome/browser/memory_details_mac.cc | 4 +- chrome/browser/memory_details_win.cc | 5 +- .../mod_pagespeed_metrics_unittest.cc | 6 +- .../nacl_host/nacl_infobar_delegate.cc | 2 +- .../test/gdb_debug_stub_browsertest.cc | 2 +- .../browser/nacl_host/test/mock_nacl_gdb.cc | 4 +- .../nacl_host/test/nacl_gdb_browsertest.cc | 2 +- .../extension_welcome_notification.cc | 4 +- .../extension_welcome_notification.h | 8 +- ...extension_welcome_notification_unittest.cc | 21 ++- ...tification_blocker_chromeos_browsertest.cc | 4 +- ..._notification_blocker_chromeos_unittest.cc | 8 +- .../message_center_notification_manager.cc | 22 +-- .../message_center_notification_manager.h | 11 +- .../message_center_notifications_unittest.cc | 10 +- .../message_center_settings_controller.cc | 23 ++- .../message_center_settings_controller.h | 8 +- ...age_center_settings_controller_unittest.cc | 4 +- chrome/browser/notifications/notification.h | 2 +- .../notifications/notification_browsertest.cc | 2 +- .../notification_conversion_helper.cc | 16 +- ...notification_conversion_helper_unittest.cc | 16 +- .../notification_object_proxy.cc | 2 +- .../notifications/notification_object_proxy.h | 6 +- .../notification_permission_context.cc | 6 +- ...otification_permission_infobar_delegate.cc | 2 +- .../notification_ui_manager_desktop.cc | 4 +- .../notifications/notifier_state_tracker.cc | 6 +- ...atform_notification_service_browsertest.cc | 6 +- .../platform_notification_service_impl.cc | 2 +- .../platform_notification_service_impl.h | 7 +- .../platform_notification_service_unittest.cc | 9 +- .../ntp_snippets_service_factory.cc | 3 +- .../ntp_snippets_service_factory.h | 3 +- ...rts_page_load_metrics_observer_unittest.cc | 4 +- .../core_page_load_metrics_observer.cc | 2 +- ...ore_page_load_metrics_observer_unittest.cc | 4 +- ...ite_page_load_metrics_observer_unittest.cc | 4 +- ...gws_page_load_metrics_observer_unittest.cc | 6 +- ...page_load_metrics_observer_test_harness.cc | 11 +- .../page_load_metrics_initialize.cc | 15 +- .../browser/pepper_broker_infobar_delegate.cc | 8 +- .../browser/pepper_flash_settings_manager.cc | 2 +- .../performance_monitor.cc | 4 +- .../performance_monitor/performance_monitor.h | 4 +- .../permissions/chooser_context_base.cc | 35 ++-- .../permissions/chooser_context_base.h | 12 +- .../chooser_context_base_unittest.cc | 8 +- .../permissions/permission_context_base.cc | 2 +- .../permissions/permission_context_base.h | 7 +- .../permission_context_base_unittest.cc | 2 +- .../browser/permissions/permission_manager.h | 2 +- .../permissions/permission_uma_util.cc | 2 +- ...mission_update_infobar_delegate_android.cc | 8 +- chrome/browser/platform_util_unittest.cc | 9 +- ...ome_content_browser_client_plugins_part.cc | 2 +- chrome/browser/plugins/plugin_finder.cc | 10 +- chrome/browser/plugins/plugin_finder.h | 13 +- .../browser/plugins/plugin_finder_unittest.cc | 6 +- .../plugins/plugin_info_message_filter.cc | 25 ++- .../plugins/plugin_info_message_filter.h | 17 +- .../plugins/plugin_infobar_delegates.cc | 16 +- .../plugins/plugin_infobar_delegates.h | 8 +- chrome/browser/plugins/plugin_installer.cc | 2 +- .../plugins/plugin_installer_unittest.cc | 20 ++- chrome/browser/plugins/plugin_metadata.cc | 5 +- chrome/browser/plugins/plugin_metadata.h | 4 +- chrome/browser/plugins/plugin_observer.cc | 12 +- chrome/browser/plugins/plugin_observer.h | 3 +- .../plugins/plugin_power_saver_browsertest.cc | 4 +- chrome/browser/plugins/plugin_prefs.cc | 15 +- .../browser/power/process_power_collector.cc | 9 +- .../browser/power/process_power_collector.h | 4 +- .../power/process_power_collector_unittest.cc | 22 +-- .../autocomplete_action_predictor.cc | 2 +- .../autocomplete_action_predictor.h | 4 +- ...omplete_action_predictor_table_unittest.cc | 2 +- .../autocomplete_action_predictor_unittest.cc | 4 +- .../browser/predictors/predictor_database.cc | 2 +- .../resource_prefetch_common_unittest.cc | 16 +- .../predictors/resource_prefetch_predictor.cc | 26 ++- .../predictors/resource_prefetch_predictor.h | 14 +- ...urce_prefetch_predictor_tables_unittest.cc | 2 +- .../resource_prefetch_predictor_unittest.cc | 10 +- .../browser/predictors/resource_prefetcher.cc | 2 +- .../browser/predictors/resource_prefetcher.h | 6 +- .../predictors/resource_prefetcher_manager.cc | 6 +- .../predictors/resource_prefetcher_manager.h | 9 +- .../resource_prefetcher_unittest.cc | 11 +- .../browser/prefetch/prefetch_browsertest.cc | 14 +- .../prefs/chrome_pref_service_factory.cc | 33 ++-- .../prefs/chrome_pref_service_factory.h | 7 +- .../prefs/chrome_pref_service_unittest.cc | 3 +- .../browser/prefs/command_line_pref_store.cc | 22 +-- .../command_line_pref_store_proxy_unittest.cc | 2 +- ...nd_line_pref_store_ssl_manager_unittest.cc | 4 +- .../prefs/pref_functional_browsertest.cc | 10 +- chrome/browser/prefs/pref_metrics_service.h | 4 +- .../browser/prefs/pref_service_browsertest.cc | 2 +- .../prefs/profile_pref_store_manager.cc | 43 ++--- .../prefs/profile_pref_store_manager.h | 4 +- .../profile_pref_store_manager_unittest.cc | 17 +- chrome/browser/prefs/proxy_policy_unittest.cc | 14 +- .../prefs/session_startup_pref_unittest.cc | 2 +- ...ynced_pref_change_registrar_browsertest.cc | 12 +- .../prefs/tracked/pref_hash_browsertest.cc | 18 +- .../external_prerender_handler_android.h | 5 +- .../prerender/prerender_browsertest.cc | 83 ++++----- chrome/browser/prerender/prerender_contents.h | 8 +- .../prerender/prerender_history_unittest.cc | 8 +- .../prerender/prerender_link_manager.cc | 8 +- .../prerender/prerender_link_manager.h | 2 +- chrome/browser/prerender/prerender_manager.cc | 6 +- chrome/browser/prerender/prerender_manager.h | 10 +- .../prerender/prerender_message_filter.h | 3 +- .../prerender_resource_throttle_unittest.cc | 17 +- .../browser/prerender/prerender_tab_helper.h | 3 +- .../browser/prerender/prerender_unittest.cc | 18 +- .../browser/process_singleton_browsertest.cc | 2 +- .../process_singleton_posix_unittest.cc | 16 +- .../browser/process_singleton_win_unittest.cc | 5 +- .../brandcode_config_fetcher.h | 8 +- .../brandcoded_default_settings.cc | 12 +- .../brandcoded_default_settings.h | 10 +- .../profile_resetter/profile_resetter.cc | 6 +- .../profile_resetter/profile_resetter.h | 8 +- .../profile_resetter_test_base.cc | 4 +- .../profile_resetter_test_base.h | 2 +- .../profile_resetter_unittest.cc | 60 +++---- .../resettable_settings_snapshot.cc | 8 +- .../resettable_settings_snapshot.h | 6 +- ...triggered_profile_resetter_win_unittest.cc | 5 +- .../push_messaging_browsertest.cc | 4 +- .../push_messaging_service_factory.cc | 5 +- .../push_messaging_service_impl.h | 6 +- .../push_messaging_service_observer.cc | 5 +- .../push_messaging_service_observer.h | 4 +- .../push_messaging_service_unittest.cc | 3 +- chrome/browser/referrer_policy_browsertest.cc | 4 +- .../context_menu_content_type_unittest.cc | 33 ++-- .../mock_render_view_context_menu.h | 4 +- .../render_view_context_menu.cc | 4 +- .../render_view_context_menu.h | 9 +- .../render_view_context_menu_browsertest.cc | 59 ++++--- .../render_view_context_menu_unittest.cc | 32 ++-- .../spelling_menu_observer.cc | 2 +- .../spelling_menu_observer.h | 4 +- .../spelling_menu_observer_browsertest.cc | 4 +- ...ng_options_submenu_observer_browsertest.cc | 7 +- .../chrome_extension_message_filter.cc | 9 +- ...ome_render_widget_host_view_mac_delegate.h | 6 +- ...hrome_resource_dispatcher_host_delegate.cc | 19 ++- ...chrome_resource_dispatcher_host_delegate.h | 4 +- ...ce_dispatcher_host_delegate_browsertest.cc | 8 +- .../chrome_browser_pepper_host_factory.cc | 23 +-- .../render_process_host_chrome_browsertest.cc | 2 +- .../safe_browsing_resource_throttle.cc | 15 +- .../browser/rlz/chrome_rlz_tracker_delegate.h | 2 +- .../chrome_rlz_tracker_delegate_unittest.cc | 9 +- .../browser/safe_json_parser_browsertest.cc | 11 +- .../search/hotword_installer_browsertest.cc | 8 +- chrome/browser/search/hotword_service.h | 4 +- .../search/hotword_service_unittest.cc | 21 +-- .../browser/search/iframe_source_unittest.cc | 22 ++- chrome/browser/search/instant_service.h | 10 +- .../search/instant_service_unittest.cc | 9 +- chrome/browser/search/instant_unittest_base.h | 2 +- .../browser/search/local_files_ntp_source.cc | 3 +- chrome/browser/search/local_ntp_source.cc | 7 +- chrome/browser/search/search_unittest.cc | 2 +- .../image_fetcher_impl_browsertest.cc | 5 +- .../suggestions_service_factory.cc | 17 +- .../search/suggestions/suggestions_source.cc | 2 +- chrome/browser/search/thumbnail_source.h | 4 +- .../search/thumbnail_source_unittest.cc | 2 +- .../service_process_control.cc | 8 +- .../service_process/service_process_control.h | 10 +- .../services/gcm/fake_gcm_profile_service.cc | 5 +- .../services/gcm/fake_gcm_profile_service.h | 4 +- .../gcm/gcm_profile_service_factory.cc | 7 +- .../gcm/gcm_profile_service_unittest.cc | 18 +- .../instance_id/instance_id_profile_service.h | 5 +- .../instance_id_profile_service_factory.cc | 3 +- .../better_session_restore_browsertest.cc | 8 +- ...persistent_tab_restore_service_unittest.cc | 15 +- ...tore_on_startup_policy_handler_unittest.cc | 7 +- chrome/browser/sessions/session_restore.cc | 4 +- chrome/browser/sessions/session_restore.h | 2 +- .../sessions/session_restore_android.cc | 2 +- .../sessions/session_restore_browsertest.cc | 14 +- .../session_restore_stats_collector.cc | 2 +- .../session_restore_stats_collector.h | 8 +- ...ession_restore_stats_collector_unittest.cc | 10 +- .../sessions/session_restore_test_helper.h | 3 +- chrome/browser/sessions/session_service.cc | 2 +- chrome/browser/sessions/session_service.h | 4 +- .../sessions/session_service_factory.h | 2 +- .../sessions/session_service_test_helper.h | 4 +- .../sessions/session_service_unittest.cc | 8 +- chrome/browser/sessions/tab_loader.cc | 3 +- chrome/browser/sessions/tab_loader.h | 4 +- .../browser/sessions/tab_loader_delegate.cc | 4 +- chrome/browser/sessions/tab_loader_delegate.h | 5 +- .../sessions/tab_restore_service_factory.cc | 2 +- chrome/browser/shell_integration_linux.cc | 13 +- chrome/browser/shell_integration_win.cc | 5 +- .../signin/account_reconcilor_unittest.cc | 21 ++- .../signin/account_tracker_service_factory.cc | 3 +- .../signin/chrome_proximity_auth_client.cc | 9 +- .../signin/chrome_proximity_auth_client.h | 4 +- chrome/browser/signin/chrome_signin_client.cc | 6 +- chrome/browser/signin/chrome_signin_client.h | 8 +- .../signin/chrome_signin_client_unittest.cc | 10 +- ...atus_metrics_provider_delegate_unittest.cc | 4 +- chrome/browser/signin/cross_device_promo.h | 2 +- .../signin/cross_device_promo_unittest.cc | 7 +- .../browser/signin/easy_unlock_app_manager.cc | 8 +- .../browser/signin/easy_unlock_app_manager.h | 4 +- .../easy_unlock_app_manager_unittest.cc | 25 +-- .../signin/easy_unlock_auth_attempt.cc | 4 +- .../easy_unlock_auth_attempt_unittest.cc | 12 +- ...nlock_screenlock_state_handler_unittest.cc | 6 +- chrome/browser/signin/easy_unlock_service.cc | 2 +- chrome/browser/signin/easy_unlock_service.h | 16 +- .../signin/easy_unlock_service_regular.cc | 20 ++- .../signin/easy_unlock_service_regular.h | 17 +- .../easy_unlock_service_signin_chromeos.h | 4 +- .../easy_unlock_service_unittest_chromeos.cc | 25 +-- .../fake_account_fetcher_service_builder.cc | 4 +- .../fake_account_fetcher_service_builder.h | 5 +- .../fake_gaia_cookie_manager_service.cc | 5 +- .../signin/fake_gaia_cookie_manager_service.h | 5 +- ...ke_profile_oauth2_token_service_builder.cc | 8 +- ...ake_profile_oauth2_token_service_builder.h | 6 +- .../signin/fake_signin_manager_builder.cc | 4 +- .../signin/fake_signin_manager_builder.h | 5 +- chrome/browser/signin/local_auth.cc | 10 +- ..._oauth2_token_service_delegate_unittest.cc | 15 +- .../oauth2_token_service_delegate_android.cc | 4 +- .../oauth2_token_service_delegate_android.h | 3 +- .../signin_error_notifier_ash_unittest.cc | 9 +- .../signin/signin_global_error_unittest.cc | 10 +- .../browser/signin/signin_manager_unittest.cc | 13 +- .../browser/signin/signin_tracker_factory.cc | 7 +- .../browser/signin/signin_tracker_factory.h | 5 +- .../browser/signin/signin_tracker_unittest.cc | 4 +- .../signin/test_signin_client_builder.cc | 5 +- .../signin/test_signin_client_builder.h | 4 +- chrome/browser/site_details_browsertest.cc | 6 +- .../extension_api/tts_engine_extension_api.cc | 20 +-- .../speech/extension_api/tts_extension_api.cc | 10 +- .../speech/speech_recognition_browsertest.cc | 4 +- chrome/browser/speech/tts_controller.h | 4 +- chrome/browser/speech/tts_controller_impl.h | 2 +- chrome/browser/speech/tts_linux.cc | 5 +- chrome/browser/speech/tts_message_filter.cc | 2 +- chrome/browser/ssl/bad_clock_blocking_page.cc | 7 +- chrome/browser/ssl/bad_clock_blocking_page.h | 10 +- .../ssl/captive_portal_blocking_page.cc | 4 +- .../ssl/captive_portal_blocking_page.h | 6 +- ...aptive_portal_blocking_page_browsertest.cc | 12 +- chrome/browser/ssl/cert_report_helper.cc | 4 +- chrome/browser/ssl/cert_report_helper.h | 6 +- .../browser/ssl/cert_verifier_browser_test.h | 5 +- .../ssl/certificate_reporting_test_utils.cc | 20 ++- .../ssl/certificate_reporting_test_utils.h | 2 +- .../browser/ssl/chrome_expect_ct_reporter.cc | 23 +-- .../browser/ssl/chrome_expect_ct_reporter.h | 5 +- .../ssl/chrome_expect_ct_reporter_unittest.cc | 2 +- .../ssl/chrome_security_state_model_client.h | 5 +- ...curity_state_model_client_browser_tests.cc | 2 +- .../ssl/chrome_ssl_host_state_delegate.cc | 10 +- .../ssl/chrome_ssl_host_state_delegate.h | 7 +- .../chrome_ssl_host_state_delegate_factory.cc | 5 +- .../chrome_ssl_host_state_delegate_test.cc | 12 +- .../ssl/common_name_mismatch_handler.h | 5 +- chrome/browser/ssl/ssl_add_certificate.cc | 2 +- chrome/browser/ssl/ssl_blocking_page.cc | 22 +-- chrome/browser/ssl/ssl_blocking_page.h | 10 +- chrome/browser/ssl/ssl_browser_tests.cc | 11 +- .../browser/ssl/ssl_client_auth_observer.cc | 2 +- chrome/browser/ssl/ssl_client_auth_observer.h | 7 +- .../ssl/ssl_client_auth_requestor_mock.cc | 5 +- .../ssl/ssl_client_auth_requestor_mock.h | 5 +- .../ssl/ssl_client_certificate_selector.h | 5 +- .../ssl_client_certificate_selector_test.cc | 4 +- .../ssl_client_certificate_selector_test.h | 5 +- chrome/browser/ssl/ssl_error_handler.cc | 17 +- chrome/browser/ssl/ssl_error_handler.h | 8 +- .../browser/ssl/ssl_error_handler_unittest.cc | 2 +- .../desktop_notification_balloon.h | 3 +- chrome/browser/status_icons/status_icon.cc | 5 +- chrome/browser/status_icons/status_icon.h | 7 +- .../status_icon_menu_model_unittest.cc | 2 +- .../arc/arc_process_task_provider.cc | 2 +- .../providers/arc/arc_process_task_provider.h | 4 +- .../providers/child_process_task.h | 5 +- .../providers/child_process_task_provider.cc | 7 +- .../providers/child_process_task_provider.h | 5 +- .../providers/web_contents/extension_task.h | 5 +- .../providers/web_contents/renderer_task.h | 5 +- .../sampling/task_group_sampler.h | 5 +- .../sampling/task_manager_impl.h | 2 +- .../task_management/task_manager_interface.h | 7 +- .../task_management/test_task_manager.cc | 4 +- .../task_manager/background_information.cc | 6 +- .../task_manager/background_information.h | 2 +- .../child_process_resource_provider.cc | 2 +- .../task_manager/extension_information.cc | 6 +- .../task_manager/extension_information.h | 2 +- .../browser/task_manager/guest_information.cc | 6 +- .../browser/task_manager/guest_information.h | 2 +- .../browser/task_manager/panel_information.cc | 6 +- .../browser/task_manager/panel_information.h | 2 +- .../task_manager/printing_information.cc | 4 +- .../task_manager/printing_information.h | 2 +- .../browser/task_manager/renderer_resource.h | 5 +- .../task_manager/tab_contents_information.cc | 5 +- .../task_manager/tab_contents_information.h | 2 +- chrome/browser/task_manager/task_manager.cc | 30 ++-- chrome/browser/task_manager/task_manager.h | 6 +- .../task_manager/web_contents_information.h | 5 +- .../web_contents_resource_provider.cc | 6 +- .../web_contents_resource_provider.h | 6 +- .../task_profiler_data_serializer.cc | 12 +- chrome/browser/themes/browser_theme_pack.cc | 6 +- chrome/browser/themes/browser_theme_pack.h | 4 +- .../themes/browser_theme_pack_unittest.cc | 12 +- chrome/browser/themes/theme_properties.cc | 3 +- chrome/browser/themes/theme_service.cc | 2 +- chrome/browser/themes/theme_service.h | 6 +- chrome/browser/themes/theme_service_win.h | 2 +- .../browser/themes/theme_syncable_service.cc | 4 +- .../browser/themes/theme_syncable_service.h | 11 +- .../themes/theme_syncable_service_unittest.cc | 157 +++++++++--------- .../thumbnails/content_analysis_unittest.cc | 2 +- .../tracing/background_tracing_field_trial.cc | 6 +- .../tracing/chrome_tracing_delegate.cc | 6 +- .../browser/tracing/chrome_tracing_delegate.h | 5 +- .../chrome_tracing_delegate_browsertest.cc | 9 +- .../browser/tracing/crash_service_uploader.cc | 8 +- .../browser/tracing/crash_service_uploader.h | 21 +-- chrome/browser/tracing/navigation_tracing.cc | 9 +- .../translate/chrome_translate_client.cc | 8 +- .../translate/chrome_translate_client.h | 13 +- chrome/browser/translate/cld_data_harness.cc | 15 +- chrome/browser/translate/cld_data_harness.h | 13 +- .../translate/cld_data_harness_factory.cc | 2 +- .../translate/cld_data_harness_factory.h | 5 +- .../translate_manager_browsertest.cc | 7 +- ...slate_manager_render_view_host_unittest.cc | 38 ++--- .../launcher/chrome_mash_shelf_controller.cc | 3 +- .../launcher/chrome_mash_shelf_controller.h | 4 +- .../launcher_context_menu_unittest.cc | 3 +- .../passwords/password_manager_presenter.cc | 7 +- .../views/settings_api_bubble_helper_views.cc | 10 +- .../sync/one_click_signin_dialog_view.cc | 4 +- .../views/sync/one_click_signin_dialog_view.h | 9 +- .../one_click_signin_dialog_view_unittest.cc | 5 +- ...olbar_actions_bar_bubble_views_unittest.cc | 3 +- .../webui/options/password_manager_handler.cc | 4 +- .../webui/options/password_manager_handler.h | 4 +- .../password_manager_handler_unittest.cc | 19 ++- .../settings_manage_profile_handler.cc | 4 +- .../settings_manage_profile_handler.h | 4 +- chrome/browser/upgrade_detector_impl.cc | 2 +- chrome/browser/usb/usb_chooser_context.cc | 22 ++- chrome/browser/usb/usb_chooser_context.h | 6 +- .../usb/usb_chooser_context_unittest.cc | 28 ++-- chrome/browser/usb/usb_tab_helper.cc | 11 +- chrome/browser/usb/usb_tab_helper.h | 2 +- chrome/browser/usb/web_usb_chooser_service.cc | 2 +- .../update_shortcut_worker_win.h | 2 +- chrome/browser/web_applications/web_app.cc | 24 +-- chrome/browser/web_applications/web_app.h | 24 +-- .../web_applications/web_app_chromeos.cc | 6 +- .../browser/web_applications/web_app_linux.cc | 8 +- chrome/browser/web_applications/web_app_mac.h | 4 +- .../browser/web_applications/web_app_mac.mm | 36 ++-- .../web_applications/web_app_mac_unittest.mm | 9 +- .../web_applications/web_app_unittest.cc | 5 +- .../browser/web_applications/web_app_win.cc | 15 +- chrome/browser/web_applications/web_app_win.h | 2 +- 619 files changed, 2813 insertions(+), 2565 deletions(-) diff --git a/chrome/browser/after_startup_task_utils.cc b/chrome/browser/after_startup_task_utils.cc index dac77d0aca0248..f61fec8c450333 100644 --- a/chrome/browser/after_startup_task_utils.cc +++ b/chrome/browser/after_startup_task_utils.cc @@ -4,11 +4,12 @@ #include "chrome/browser/after_startup_task_utils.h" +#include #include #include "base/lazy_instance.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/process/process_info.h" #include "base/rand_util.h" @@ -57,13 +58,13 @@ bool IsBrowserStartupComplete() { return g_startup_complete_flag.Get().IsSet(); } -void RunTask(scoped_ptr queued_task) { +void RunTask(std::unique_ptr queued_task) { // We're careful to delete the caller's |task| on the target runner's thread. DCHECK(queued_task->task_runner->RunsTasksOnCurrentThread()); queued_task->task.Run(); } -void ScheduleTask(scoped_ptr queued_task) { +void ScheduleTask(std::unique_ptr queued_task) { // Spread their execution over a brief time. const int kMinDelaySec = 0; const int kMaxDelaySec = 10; @@ -74,7 +75,7 @@ void ScheduleTask(scoped_ptr queued_task) { base::TimeDelta::FromSeconds(base::RandInt(kMinDelaySec, kMaxDelaySec))); } -void QueueTask(scoped_ptr queued_task) { +void QueueTask(std::unique_ptr queued_task) { if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, @@ -106,7 +107,7 @@ void SetBrowserStartupIsComplete() { g_after_startup_tasks.Get().size()); g_startup_complete_flag.Get().Set(); for (AfterStartupTask* queued_task : g_after_startup_tasks.Get()) - ScheduleTask(make_scoped_ptr(queued_task)); + ScheduleTask(base::WrapUnique(queued_task)); g_after_startup_tasks.Get().clear(); // The shrink_to_fit() method is not available for all of our build targets. @@ -206,7 +207,7 @@ void AfterStartupTaskUtils::PostTask( return; } - scoped_ptr queued_task( + std::unique_ptr queued_task( new AfterStartupTask(from_here, task_runner, task)); QueueTask(std::move(queued_task)); } diff --git a/chrome/browser/after_startup_task_utils_unittest.cc b/chrome/browser/after_startup_task_utils_unittest.cc index 5d51db4c07a475..a480782b4c9f82 100644 --- a/chrome/browser/after_startup_task_utils_unittest.cc +++ b/chrome/browser/after_startup_task_utils_unittest.cc @@ -4,10 +4,11 @@ #include "chrome/browser/after_startup_task_utils.h" +#include + #include "base/bind.h" #include "base/bind_helpers.h" #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 "base/task_runner_util.h" diff --git a/chrome/browser/app_controller_mac.h b/chrome/browser/app_controller_mac.h index cdcd3845656b5a..80d2f384478b96 100644 --- a/chrome/browser/app_controller_mac.h +++ b/chrome/browser/app_controller_mac.h @@ -8,11 +8,12 @@ #if defined(__OBJC__) #import + +#include #include #include "base/files/file_path.h" #include "base/mac/scoped_nsobject.h" -#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/time/time.h" #include "components/prefs/pref_change_registrar.h" @@ -43,7 +44,7 @@ class WorkAreaWatcherObserver; NSApplicationDelegate> { @private // Manages the state of the command menu items. - scoped_ptr menuState_; + std::unique_ptr menuState_; // The profile last used by a Browser. It is this profile that was used to // build the user-data specific main menu items. @@ -51,7 +52,8 @@ class WorkAreaWatcherObserver; // The ProfileObserver observes the ProfileAttrbutesStorage and gets notified // when a profile has been deleted. - scoped_ptr profileAttributesStorageObserver_; + std::unique_ptr + profileAttributesStorageObserver_; // Management of the bookmark menu which spans across all windows // (and Browser*s). |profileBookmarkMenuBridgeMap_| is a cache that owns one @@ -61,7 +63,7 @@ class WorkAreaWatcherObserver; BookmarkMenuBridge* bookmarkMenuBridge_; std::map profileBookmarkMenuBridgeMap_; - scoped_ptr historyMenuBridge_; + std::unique_ptr historyMenuBridge_; // Controller that manages main menu items for packaged apps. base::scoped_nsobject appShimMenuController_; @@ -93,7 +95,7 @@ class WorkAreaWatcherObserver; // Observers that listen to the work area changes. base::ObserverList workAreaChangeObservers_; - scoped_ptr profilePrefRegistrar_; + std::unique_ptr profilePrefRegistrar_; PrefChangeRegistrar localPrefRegistrar_; // Displays a notification when quitting while apps are running. @@ -103,14 +105,14 @@ class WorkAreaWatcherObserver; base::scoped_nsobject handoffManager_; // Observes changes to the active URL. - scoped_ptr + std::unique_ptr handoff_active_url_observer_bridge_; // This will be true after receiving a NSWorkspaceWillPowerOffNotification. BOOL isPoweringOff_; // Request to keep the browser alive during that object's lifetime. - scoped_ptr keep_alive_; + std::unique_ptr keep_alive_; } @property(readonly, nonatomic) BOOL startupComplete; diff --git a/chrome/browser/app_icon_win.cc b/chrome/browser/app_icon_win.cc index 33b66f4aebb96f..9c3e7d69dca680 100644 --- a/chrome/browser/app_icon_win.cc +++ b/chrome/browser/app_icon_win.cc @@ -58,7 +58,7 @@ gfx::Size GetSmallAppIconSize() { GetSystemMetrics(SM_CYSMICON)); } -scoped_ptr GetAppIconImageFamily() { +std::unique_ptr GetAppIconImageFamily() { const int icon_id = GetAppIconResourceId(); // Get the icon from chrome.dll (not chrome.exe, which has different resource // IDs). If chrome.dll is not loaded, we are probably in a unit test, so fall diff --git a/chrome/browser/app_icon_win.h b/chrome/browser/app_icon_win.h index c3e6308e6e5973..9be98c57dd62be 100644 --- a/chrome/browser/app_icon_win.h +++ b/chrome/browser/app_icon_win.h @@ -7,7 +7,7 @@ #include -#include "base/memory/scoped_ptr.h" +#include namespace gfx { class ImageFamily; @@ -24,6 +24,6 @@ gfx::Size GetSmallAppIconSize(); // Retrieve the application icon for the current process. This returns all of // the different sizes of the icon as an ImageFamily. -scoped_ptr GetAppIconImageFamily(); +std::unique_ptr GetAppIconImageFamily(); #endif // CHROME_BROWSER_APP_ICON_WIN_H_ diff --git a/chrome/browser/autocomplete/autocomplete_classifier_factory.cc b/chrome/browser/autocomplete/autocomplete_classifier_factory.cc index 35cab6f5a4ab41..0ffd0b96552733 100644 --- a/chrome/browser/autocomplete/autocomplete_classifier_factory.cc +++ b/chrome/browser/autocomplete/autocomplete_classifier_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" @@ -33,14 +34,14 @@ AutocompleteClassifierFactory* AutocompleteClassifierFactory::GetInstance() { } // static -scoped_ptr AutocompleteClassifierFactory::BuildInstanceFor( +std::unique_ptr AutocompleteClassifierFactory::BuildInstanceFor( content::BrowserContext* context) { Profile* profile = static_cast(context); - return make_scoped_ptr(new AutocompleteClassifier( - make_scoped_ptr(new AutocompleteController( - make_scoped_ptr(new ChromeAutocompleteProviderClient(profile)), NULL, + return base::WrapUnique(new AutocompleteClassifier( + base::WrapUnique(new AutocompleteController( + base::WrapUnique(new ChromeAutocompleteProviderClient(profile)), NULL, AutocompleteClassifier::kDefaultOmniboxProviders)), - scoped_ptr( + std::unique_ptr( new ChromeAutocompleteSchemeClassifier(profile)))); } diff --git a/chrome/browser/autocomplete/autocomplete_classifier_factory.h b/chrome/browser/autocomplete/autocomplete_classifier_factory.h index 1bfc755c70abbd..6d9ccc27fa1374 100644 --- a/chrome/browser/autocomplete/autocomplete_classifier_factory.h +++ b/chrome/browser/autocomplete/autocomplete_classifier_factory.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CLASSIFIER_FACTORY_H_ #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CLASSIFIER_FACTORY_H_ +#include + #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" @@ -22,7 +23,7 @@ class AutocompleteClassifierFactory : public BrowserContextKeyedServiceFactory { static AutocompleteClassifierFactory* GetInstance(); - static scoped_ptr BuildInstanceFor( + static std::unique_ptr BuildInstanceFor( content::BrowserContext* context); private: diff --git a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc index 113c3dddc6e06f..a0b1ac5a8ef278 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc +++ b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc @@ -7,6 +7,7 @@ #include #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" @@ -137,11 +138,11 @@ ChromeAutocompleteProviderClient::GetShortcutsBackendIfExists() { return ShortcutsBackendFactory::GetForProfileIfExists(profile_); } -scoped_ptr +std::unique_ptr ChromeAutocompleteProviderClient::GetKeywordExtensionsDelegate( KeywordProvider* keyword_provider) { #if defined(ENABLE_EXTENSIONS) - return make_scoped_ptr( + return base::WrapUnique( new KeywordExtensionsDelegateImpl(profile_, keyword_provider)); #else return nullptr; diff --git a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h index 1c97706390d527..618a585c0b8bbf 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h +++ b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h @@ -32,7 +32,7 @@ class ChromeAutocompleteProviderClient : public AutocompleteProviderClient { const SearchTermsData& GetSearchTermsData() const override; scoped_refptr GetShortcutsBackend() override; scoped_refptr GetShortcutsBackendIfExists() override; - scoped_ptr GetKeywordExtensionsDelegate( + std::unique_ptr GetKeywordExtensionsDelegate( KeywordProvider* keyword_provider) override; std::string GetAcceptLanguages() const override; std::string GetEmbedderRepresentationOfAboutScheme() override; diff --git a/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc b/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc index 4ffae48af093d9..27a0881d116047 100644 --- a/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc +++ b/chrome/browser/autocomplete/keyword_extensions_delegate_impl_unittest.cc @@ -83,7 +83,8 @@ void KeywordExtensionsDelegateImplTest::SetUp() { } void KeywordExtensionsDelegateImplTest::RunTest(bool incognito) { - scoped_ptr empty_model(new TemplateURLService(NULL, 0)); + std::unique_ptr empty_model( + new TemplateURLService(NULL, 0)); MockAutocompleteProviderClient client; client.set_template_url_service(std::move(empty_model)); scoped_refptr keyword_provider = diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc index bd1f56b655f899..d5b9a86675df5a 100644 --- a/chrome/browser/autocomplete/search_provider_unittest.cc +++ b/chrome/browser/autocomplete/search_provider_unittest.cc @@ -10,6 +10,7 @@ #include "base/command_line.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/metrics/field_trial.h" #include "base/run_loop.h" #include "base/strings/string16.h" @@ -167,7 +168,7 @@ class SearchProviderTest : public testing::Test, protected: // Needed for AutocompleteFieldTrial::ActivateStaticTrials(); - scoped_ptr field_trial_list_; + std::unique_ptr field_trial_list_; // Default values used for testing. static const std::string kNotApplicable; @@ -257,7 +258,7 @@ class SearchProviderTest : public testing::Test, net::TestURLFetcherFactory test_factory_; TestingProfile profile_; - scoped_ptr client_; + std::unique_ptr client_; scoped_refptr provider_; // If non-NULL, OnProviderUpdate quits the current |run_loop_|. @@ -1090,8 +1091,8 @@ TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) { profile_.BlockUntilHistoryProcessesPendingRequests(); AutocompleteController controller( - make_scoped_ptr(new ChromeAutocompleteProviderClient(&profile_)), nullptr, - AutocompleteProvider::TYPE_SEARCH); + base::WrapUnique(new ChromeAutocompleteProviderClient(&profile_)), + nullptr, AutocompleteProvider::TYPE_SEARCH); controller.Start(AutocompleteInput( ASCIIToUTF16("k t"), base::string16::npos, std::string(), GURL(), metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, diff --git a/chrome/browser/autocomplete/shortcuts_backend_factory.cc b/chrome/browser/autocomplete/shortcuts_backend_factory.cc index c39588b4019d0f..4ccf9321ee229e 100644 --- a/chrome/browser/autocomplete/shortcuts_backend_factory.cc +++ b/chrome/browser/autocomplete/shortcuts_backend_factory.cc @@ -4,7 +4,9 @@ #include "chrome/browser/autocomplete/shortcuts_backend_factory.h" -#include "base/memory/scoped_ptr.h" +#include + +#include "base/memory/ptr_util.h" #include "chrome/browser/autocomplete/shortcuts_extensions_manager.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/profiles/profile.h" @@ -90,7 +92,7 @@ scoped_refptr ShortcutsBackendFactory::CreateShortcutsBackend( bool suppress_db) { scoped_refptr backend(new ShortcutsBackend( TemplateURLServiceFactory::GetForProfile(profile), - make_scoped_ptr(new UIThreadSearchTermsData(profile)), + base::WrapUnique(new UIThreadSearchTermsData(profile)), HistoryServiceFactory::GetForProfile(profile, ServiceAccessType::EXPLICIT_ACCESS), content::BrowserThread::GetMessageLoopProxyForThread( diff --git a/chrome/browser/background/background_application_list_model.cc b/chrome/browser/background/background_application_list_model.cc index 91dacd680671ec..60cd674584768e 100644 --- a/chrome/browser/background/background_application_list_model.cc +++ b/chrome/browser/background/background_application_list_model.cc @@ -74,7 +74,7 @@ class BackgroundApplicationListModel::Application void RequestIcon(extension_misc::ExtensionIcons size); const Extension* extension_; - scoped_ptr icon_; + std::unique_ptr icon_; BackgroundApplicationListModel* model_; }; diff --git a/chrome/browser/background/background_application_list_model_unittest.cc b/chrome/browser/background/background_application_list_model_unittest.cc index 29e68d599dce63..9aababcba8ecad 100644 --- a/chrome/browser/background/background_application_list_model_unittest.cc +++ b/chrome/browser/background/background_application_list_model_unittest.cc @@ -4,16 +4,16 @@ // TODO(rickcam): Bug 73183: Add unit tests for image loading +#include "chrome/browser/background/background_application_list_model.h" + #include #include +#include #include -#include "chrome/browser/background/background_application_list_model.h" - #include "base/command_line.h" #include "base/files/file_path.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/stl_util.h" #include "build/build_config.h" @@ -150,7 +150,7 @@ TEST_F(BackgroundApplicationListModelTest, MAYBE_ExplicitTest) { InitializeAndLoadEmptyExtensionService(); ASSERT_TRUE(service()->is_ready()); ASSERT_TRUE(registry()->enabled_extensions().is_empty()); - scoped_ptr model( + std::unique_ptr model( new BackgroundApplicationListModel(profile_.get())); ASSERT_EQ(0U, model->size()); @@ -222,7 +222,7 @@ TEST_F(BackgroundApplicationListModelTest, AddRemovePermissionsTest) { InitializeAndLoadEmptyExtensionService(); ASSERT_TRUE(service()->is_ready()); ASSERT_TRUE(registry()->enabled_extensions().is_empty()); - scoped_ptr model( + std::unique_ptr model( new BackgroundApplicationListModel(profile_.get())); ASSERT_EQ(0U, model->size()); @@ -378,7 +378,7 @@ TEST_F(BackgroundApplicationListModelTest, RandomTest) { InitializeAndLoadEmptyExtensionService(); ASSERT_TRUE(service()->is_ready()); ASSERT_TRUE(registry()->enabled_extensions().is_empty()); - scoped_ptr model( + std::unique_ptr model( new BackgroundApplicationListModel(profile_.get())); ASSERT_EQ(0U, model->size()); diff --git a/chrome/browser/background/background_contents.h b/chrome/browser/background/background_contents.h index 3e62e90193ab89..08c740de59f6ca 100644 --- a/chrome/browser/background/background_contents.h +++ b/chrome/browser/background/background_contents.h @@ -7,10 +7,10 @@ #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -109,10 +109,10 @@ class BackgroundContents : public extensions::DeferredStartRenderHost, Delegate* delegate_; // Delegate for choosing an ExtensionHostQueue. - scoped_ptr extension_host_delegate_; + std::unique_ptr extension_host_delegate_; Profile* profile_; - scoped_ptr web_contents_; + std::unique_ptr web_contents_; content::NotificationRegistrar registrar_; base::ObserverList deferred_start_render_host_observer_list_; diff --git a/chrome/browser/background/background_contents_service_unittest.cc b/chrome/browser/background/background_contents_service_unittest.cc index fe0cc7bc696676..7aba4a9dae9b51 100644 --- a/chrome/browser/background/background_contents_service_unittest.cc +++ b/chrome/browser/background/background_contents_service_unittest.cc @@ -2,16 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/background/background_contents_service.h" + +#include #include #include "base/command_line.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/browser/background/background_contents.h" -#include "chrome/browser/background/background_contents_service.h" #include "chrome/browser/background/background_contents_service_factory.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/ui/browser_list.h" @@ -69,7 +70,7 @@ class BackgroundContentsServiceTest : public testing::Test { } content::TestBrowserThreadBundle thread_bundle_; - scoped_ptr command_line_; + std::unique_ptr command_line_; }; class MockBackgroundContents : public BackgroundContents { @@ -221,7 +222,7 @@ class BackgroundContentsServiceNotificationTest } private: - scoped_ptr profile_manager_; + std::unique_ptr profile_manager_; DISALLOW_COPY_AND_ASSIGN(BackgroundContentsServiceNotificationTest); }; @@ -253,7 +254,7 @@ TEST_F(BackgroundContentsServiceTest, BackgroundContentsUrlAdded) { GURL url("http://a/"); GURL url2("http://a/"); { - scoped_ptr contents( + std::unique_ptr contents( new MockBackgroundContents(&profile)); EXPECT_EQ(0U, GetPrefs(&profile)->size()); contents->SendOpenedNotification(&service); @@ -300,8 +301,8 @@ TEST_F(BackgroundContentsServiceTest, RestartBackgroundContents) { GURL url("http://a/"); { - scoped_ptr contents(new MockBackgroundContents( - &profile, "appid")); + std::unique_ptr contents( + new MockBackgroundContents(&profile, "appid")); contents->SendOpenedNotification(&service); contents->Navigate(url); EXPECT_EQ(1U, GetPrefs(&profile)->size()); @@ -313,8 +314,8 @@ TEST_F(BackgroundContentsServiceTest, RestartBackgroundContents) { { // Reopen the BackgroundContents to the same URL, we should not register the // URL again. - scoped_ptr contents(new MockBackgroundContents( - &profile, "appid")); + std::unique_ptr contents( + new MockBackgroundContents(&profile, "appid")); contents->SendOpenedNotification(&service); contents->Navigate(url); EXPECT_EQ(1U, GetPrefs(&profile)->size()); @@ -334,7 +335,7 @@ TEST_F(BackgroundContentsServiceTest, TestApplicationIDLinkage) { service.GetAppBackgroundContents(base::ASCIIToUTF16("appid"))); MockBackgroundContents* contents = new MockBackgroundContents(&profile, "appid"); - scoped_ptr contents2( + std::unique_ptr contents2( new MockBackgroundContents(&profile, "appid2")); contents->SendOpenedNotification(&service); EXPECT_EQ(contents, service.GetAppBackgroundContents(contents->appid())); diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc index fcd2c6721759ca..94589426fada83 100644 --- a/chrome/browser/background/background_mode_manager.cc +++ b/chrome/browser/background/background_mode_manager.cc @@ -884,7 +884,7 @@ gfx::ImageSkia GetStatusTrayIcon() { // the ImageFamily abstraction. Note: We could just use the LoadImage function // from the Windows API, but that does a *terrible* job scaling images. // Therefore, we fetch the images and do our own high-quality scaling. - scoped_ptr family = GetAppIconImageFamily(); + std::unique_ptr family = GetAppIconImageFamily(); DCHECK(family); if (!family) return gfx::ImageSkia(); @@ -940,7 +940,7 @@ void BackgroundModeManager::UpdateStatusTrayIconContextMenu() { command_id_handler_vector_.clear(); submenus.clear(); - scoped_ptr menu(new StatusIconMenuModel(this)); + std::unique_ptr menu(new StatusIconMenuModel(this)); menu->AddItem(IDC_ABOUT, l10n_util::GetStringUTF16(IDS_ABOUT)); menu->AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); menu->AddSeparator(ui::NORMAL_SEPARATOR); diff --git a/chrome/browser/background/background_mode_manager.h b/chrome/browser/background/background_mode_manager.h index 5878c0ac4e1d90..986863df5d5bf0 100644 --- a/chrome/browser/background/background_mode_manager.h +++ b/chrome/browser/background/background_mode_manager.h @@ -152,7 +152,7 @@ class BackgroundModeManager ~BackgroundModeData() override; // The cached list of BackgroundApplications. - scoped_ptr applications_; + std::unique_ptr applications_; // Overrides from StatusIconMenuModel::Delegate implementation. void ExecuteCommand(int command_id, int event_flags) override; @@ -420,12 +420,12 @@ class BackgroundModeManager // Background mode does not always keep Chrome alive. When it does, it is // using this scoped object. - scoped_ptr keep_alive_; + std::unique_ptr keep_alive_; // Set when we are keeping chrome running during the startup process - this // is required when running with the --no-startup-window flag, as otherwise // chrome would immediately exit due to having no open windows. - scoped_ptr keep_alive_for_startup_; + std::unique_ptr keep_alive_for_startup_; // Set to true when Chrome is running with the --keep-alive-for-test flag // (used for testing background mode without having to install a background diff --git a/chrome/browser/background/background_mode_manager_unittest.cc b/chrome/browser/background/background_mode_manager_unittest.cc index b1af033d069689..eae39289957d91 100644 --- a/chrome/browser/background/background_mode_manager_unittest.cc +++ b/chrome/browser/background/background_mode_manager_unittest.cc @@ -2,20 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/background/background_mode_manager.h" + #include +#include #include #include "base/bind.h" #include "base/command_line.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/test/test_simple_task_runner.h" #include "base/thread_task_runner_handle.h" #include "build/build_config.h" -#include "chrome/browser/background/background_mode_manager.h" #include "chrome/browser/background/background_trigger.h" #include "chrome/browser/browser_shutdown.h" #include "chrome/browser/extensions/extension_function_test_utils.h" @@ -58,8 +59,8 @@ using testing::StrictMock; namespace { -scoped_ptr CreateTestingProfileManager() { - scoped_ptr profile_manager( +std::unique_ptr CreateTestingProfileManager() { + std::unique_ptr profile_manager( new TestingProfileManager(TestingBrowserProcess::GetGlobal())); EXPECT_TRUE(profile_manager->SetUp()); return profile_manager; @@ -207,9 +208,9 @@ class BackgroundModeManagerTest : public testing::Test { protected: content::TestBrowserThreadBundle thread_bundle_; - scoped_ptr command_line_; + std::unique_ptr command_line_; - scoped_ptr profile_manager_; + std::unique_ptr profile_manager_; // Test profile used by all tests - this is owned by profile_manager_. TestingProfile* profile_; @@ -286,7 +287,7 @@ class BackgroundModeManagerWithExtensionsTest : public testing::Test { extensions::Manifest::Location location, const std::string& data, const std::string& id) { - scoped_ptr parsed_manifest( + std::unique_ptr parsed_manifest( extensions::api_test_utils::ParseDictionary(data)); return extensions::api_test_utils::CreateExtension( location, parsed_manifest.get(), id); @@ -301,11 +302,11 @@ class BackgroundModeManagerWithExtensionsTest : public testing::Test { return false; } - scoped_ptr manager_; + std::unique_ptr manager_; - scoped_ptr command_line_; + std::unique_ptr command_line_; - scoped_ptr profile_manager_; + std::unique_ptr profile_manager_; // Test profile used by all tests - this is owned by profile_manager_. TestingProfile* profile_; @@ -317,7 +318,7 @@ class BackgroundModeManagerWithExtensionsTest : public testing::Test { // tearing down our thread bundle before we've had chance to clean // everything up. Keeping Chrome alive prevents this. // We aren't interested in if the keep alive works correctly in this test. - scoped_ptr test_keep_alive_; + std::unique_ptr test_keep_alive_; #if defined(OS_CHROMEOS) // ChromeOS needs extra services to run in the following order. @@ -708,8 +709,8 @@ TEST_F(BackgroundModeManagerWithExtensionsTest, BackgroundMenuGeneration) { service->AddExtension(regular_extension_with_options.get()); Mock::VerifyAndClearExpectations(manager_.get()); - scoped_ptr menu(new StatusIconMenuModel(NULL)); - scoped_ptr submenu(new StatusIconMenuModel(NULL)); + std::unique_ptr menu(new StatusIconMenuModel(NULL)); + std::unique_ptr submenu(new StatusIconMenuModel(NULL)); BackgroundModeManager::BackgroundModeData* bmd = manager_->GetBackgroundModeData(profile_); bmd->BuildProfileMenu(submenu.get(), menu.get()); diff --git a/chrome/browser/background_sync/background_sync_controller_impl_unittest.cc b/chrome/browser/background_sync/background_sync_controller_impl_unittest.cc index 99507fa8c3a0fb..93d1b780536590 100644 --- a/chrome/browser/background_sync/background_sync_controller_impl_unittest.cc +++ b/chrome/browser/background_sync/background_sync_controller_impl_unittest.cc @@ -66,8 +66,8 @@ class BackgroundSyncControllerImplTest : public testing::Test { content::TestBrowserThreadBundle thread_bundle_; TestingProfile profile_; rappor::TestRapporService rappor_service_; - scoped_ptr controller_; - scoped_ptr field_trial_list_; + std::unique_ptr controller_; + std::unique_ptr field_trial_list_; DISALLOW_COPY_AND_ASSIGN(BackgroundSyncControllerImplTest); }; diff --git a/chrome/browser/banners/app_banner_data_fetcher.h b/chrome/browser/banners/app_banner_data_fetcher.h index 194bf0b7f53f4b..e07d839c480019 100644 --- a/chrome/browser/banners/app_banner_data_fetcher.h +++ b/chrome/browser/banners/app_banner_data_fetcher.h @@ -5,9 +5,10 @@ #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ #define CHROME_BROWSER_BANNERS_APP_BANNER_DATA_FETCHER_H_ +#include + #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/time/time.h" @@ -191,7 +192,7 @@ class AppBannerDataFetcher : public base::RefCountedThreadSafe< const bool is_debug_mode_; ui::PageTransition transition_type_; int event_request_id_; - scoped_ptr app_icon_; + std::unique_ptr app_icon_; std::string referrer_; GURL validated_url_; diff --git a/chrome/browser/banners/app_banner_data_fetcher_browsertest.cc b/chrome/browser/banners/app_banner_data_fetcher_browsertest.cc index 57d3883947333c..1e6d329259fc98 100644 --- a/chrome/browser/banners/app_banner_data_fetcher_browsertest.cc +++ b/chrome/browser/banners/app_banner_data_fetcher_browsertest.cc @@ -55,7 +55,7 @@ class TestObserver : public AppBannerDataFetcher::Observer { private: AppBannerDataFetcher* fetcher_; base::Closure quit_closure_; - scoped_ptr will_show_; + std::unique_ptr will_show_; }; class AppBannerDataFetcherBrowserTest : public InProcessBrowserTest, @@ -102,8 +102,8 @@ class AppBannerDataFetcherBrowserTest : public InProcessBrowserTest, base::HistogramTester histograms; base::RunLoop run_loop; quit_closure_ = run_loop.QuitClosure(); - scoped_ptr observer(new TestObserver(fetcher.get(), - run_loop.QuitClosure())); + std::unique_ptr observer( + new TestObserver(fetcher.get(), run_loop.QuitClosure())); fetcher->Start(url, transition); run_loop.Run(); diff --git a/chrome/browser/banners/app_banner_data_fetcher_desktop.h b/chrome/browser/banners/app_banner_data_fetcher_desktop.h index 3bef84aefd2eb5..fe05ad35670bbc 100644 --- a/chrome/browser/banners/app_banner_data_fetcher_desktop.h +++ b/chrome/browser/banners/app_banner_data_fetcher_desktop.h @@ -42,7 +42,7 @@ class AppBannerDataFetcherDesktop : public AppBannerDataFetcher { const base::string16& title, const std::string& referrer) override; - scoped_ptr bookmark_app_helper_; + std::unique_ptr bookmark_app_helper_; DISALLOW_COPY_AND_ASSIGN(AppBannerDataFetcherDesktop); }; diff --git a/chrome/browser/banners/app_banner_infobar_delegate_desktop.cc b/chrome/browser/banners/app_banner_infobar_delegate_desktop.cc index 604f8ab9a89367..62f6cf1b441ea2 100644 --- a/chrome/browser/banners/app_banner_infobar_delegate_desktop.cc +++ b/chrome/browser/banners/app_banner_infobar_delegate_desktop.cc @@ -49,8 +49,9 @@ infobars::InfoBar* AppBannerInfoBarDelegateDesktop::Create( InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents); return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( - scoped_ptr(new AppBannerInfoBarDelegateDesktop( - fetcher, web_manifest, bookmark_app_helper, event_request_id)))); + std::unique_ptr( + new AppBannerInfoBarDelegateDesktop( + fetcher, web_manifest, bookmark_app_helper, event_request_id)))); } infobars::InfoBarDelegate::Type diff --git a/chrome/browser/banners/app_banner_infobar_delegate_desktop.h b/chrome/browser/banners/app_banner_infobar_delegate_desktop.h index d0a4cfc7e296c7..bf4fc21ea4bd4e 100644 --- a/chrome/browser/banners/app_banner_infobar_delegate_desktop.h +++ b/chrome/browser/banners/app_banner_infobar_delegate_desktop.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_INFOBAR_DELEGATE_DESKTOP_H_ #define CHROME_BROWSER_BANNERS_APP_BANNER_INFOBAR_DELEGATE_DESKTOP_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "components/infobars/core/confirm_infobar_delegate.h" #include "content/public/common/manifest.h" diff --git a/chrome/browser/banners/app_banner_manager.h b/chrome/browser/banners/app_banner_manager.h index efcf332d9233d5..f29c0bdbe89d58 100644 --- a/chrome/browser/banners/app_banner_manager.h +++ b/chrome/browser/banners/app_banner_manager.h @@ -5,9 +5,10 @@ #ifndef CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ #define CHROME_BROWSER_BANNERS_APP_BANNER_MANAGER_H_ +#include + #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/banners/app_banner_data_fetcher.h" #include "content/public/browser/web_contents_observer.h" diff --git a/chrome/browser/banners/app_banner_settings_helper.cc b/chrome/browser/banners/app_banner_settings_helper.cc index 824ff63a3fc795..0e0f24bf79a45e 100644 --- a/chrome/browser/banners/app_banner_settings_helper.cc +++ b/chrome/browser/banners/app_banner_settings_helper.cc @@ -5,11 +5,13 @@ #include "chrome/browser/banners/app_banner_settings_helper.h" #include + #include #include #include #include "base/command_line.h" +#include "base/memory/ptr_util.h" #include "base/metrics/field_trial.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -88,18 +90,18 @@ unsigned int gMinimumMinutesBetweenVisits = kNumberOfMinutesInADay; // Total engagement score required before a banner will actually be triggered. double gTotalEngagementToTrigger = kDefaultTotalEngagementToTrigger; -scoped_ptr GetOriginDict( +std::unique_ptr GetOriginDict( HostContentSettingsMap* settings, const GURL& origin_url) { if (!settings) - return make_scoped_ptr(new base::DictionaryValue()); + return base::WrapUnique(new base::DictionaryValue()); - scoped_ptr dict = + std::unique_ptr dict = base::DictionaryValue::From(settings->GetWebsiteSetting( origin_url, origin_url, CONTENT_SETTINGS_TYPE_APP_BANNER, std::string(), NULL)); if (!dict) - return make_scoped_ptr(new base::DictionaryValue()); + return base::WrapUnique(new base::DictionaryValue()); return dict; } @@ -111,7 +113,8 @@ base::DictionaryValue* GetAppDict(base::DictionaryValue* origin_dict, // Don't allow more than kMaxAppsPerSite dictionaries. if (origin_dict->size() < kMaxAppsPerSite) { app_dict = new base::DictionaryValue(); - origin_dict->SetWithoutPathExpansion(key_name, make_scoped_ptr(app_dict)); + origin_dict->SetWithoutPathExpansion(key_name, + base::WrapUnique(app_dict)); } } @@ -268,7 +271,7 @@ void AppBannerSettingsHelper::RecordBannerEvent( HostContentSettingsMap* settings = HostContentSettingsMapFactory::GetForProfile(profile); - scoped_ptr origin_dict = + std::unique_ptr origin_dict = GetOriginDict(settings, origin_url); if (!origin_dict) return; @@ -309,7 +312,7 @@ void AppBannerSettingsHelper::RecordBannerCouldShowEvent( HostContentSettingsMap* settings = HostContentSettingsMapFactory::GetForProfile(profile); - scoped_ptr origin_dict = + std::unique_ptr origin_dict = GetOriginDict(settings, origin_url); if (!origin_dict) return; @@ -325,7 +328,7 @@ void AppBannerSettingsHelper::RecordBannerCouldShowEvent( base::ListValue* could_show_list = nullptr; if (!app_dict->GetList(event_key, &could_show_list)) { could_show_list = new base::ListValue(); - app_dict->Set(event_key, make_scoped_ptr(could_show_list)); + app_dict->Set(event_key, base::WrapUnique(could_show_list)); } // Trim any items that are older than we should care about. For comparisons @@ -371,7 +374,7 @@ void AppBannerSettingsHelper::RecordBannerCouldShowEvent( // Dates are stored in their raw form (i.e. not local dates) to be resilient // to time zone changes. - scoped_ptr value(new base::DictionaryValue()); + std::unique_ptr value(new base::DictionaryValue()); value->SetDouble(kBannerTimeKey, time.ToInternalValue()); value->SetDouble(kBannerEngagementKey, engagement); could_show_list->Append(std::move(value)); @@ -457,7 +460,7 @@ AppBannerSettingsHelper::GetCouldShowBannerEvents( Profile::FromBrowserContext(web_contents->GetBrowserContext()); HostContentSettingsMap* settings = HostContentSettingsMapFactory::GetForProfile(profile); - scoped_ptr origin_dict = + std::unique_ptr origin_dict = GetOriginDict(settings, origin_url); if (!origin_dict) @@ -503,7 +506,7 @@ base::Time AppBannerSettingsHelper::GetSingleBannerEvent( Profile::FromBrowserContext(web_contents->GetBrowserContext()); HostContentSettingsMap* settings = HostContentSettingsMapFactory::GetForProfile(profile); - scoped_ptr origin_dict = + std::unique_ptr origin_dict = GetOriginDict(settings, origin_url); if (!origin_dict) diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher.h b/chrome/browser/bitmap_fetcher/bitmap_fetcher.h index 3e928c00189c7c..38542767056ee7 100644 --- a/chrome/browser/bitmap_fetcher/bitmap_fetcher.h +++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ #define CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" #include "chrome/browser/image_decoder.h" #include "net/url_request/url_fetcher_delegate.h" @@ -69,7 +70,7 @@ class BitmapFetcher : public net::URLFetcherDelegate, // Alerts the delegate that a failure occurred. void ReportFailure(); - scoped_ptr url_fetcher_; + std::unique_ptr url_fetcher_; const GURL url_; BitmapFetcherDelegate* const delegate_; diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher_browsertest.cc b/chrome/browser/bitmap_fetcher/bitmap_fetcher_browsertest.cc index 27b322d1e987a8..d4f121120d402d 100644 --- a/chrome/browser/bitmap_fetcher/bitmap_fetcher_browsertest.cc +++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher_browsertest.cc @@ -80,7 +80,7 @@ class BitmapFetcherBrowserTest : public InProcessBrowserTest { protected: net::URLFetcherImplFactory url_fetcher_impl_factory_; - scoped_ptr url_fetcher_factory_; + std::unique_ptr url_fetcher_factory_; }; // WARNING: These tests work with --single_process, but not diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc index 42fb70641366b7..f1a2f9a77b4eda 100644 --- a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc +++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc @@ -37,7 +37,7 @@ class BitmapFetcherRequest { private: const BitmapFetcherService::RequestId request_id_; - scoped_ptr observer_; + std::unique_ptr observer_; const chrome::BitmapFetcher* fetcher_; DISALLOW_COPY_AND_ASSIGN(BitmapFetcherRequest); @@ -89,7 +89,7 @@ BitmapFetcherService::RequestId BitmapFetcherService::RequestImage( if (current_request_id_ == REQUEST_ID_INVALID) ++current_request_id_; int request_id = current_request_id_; - scoped_ptr request( + std::unique_ptr request( new BitmapFetcherRequest(request_id, observer)); // Reject invalid URLs. @@ -123,9 +123,9 @@ void BitmapFetcherService::Prefetch(const GURL& url) { EnsureFetcherForUrl(url); } -scoped_ptr BitmapFetcherService::CreateFetcher( +std::unique_ptr BitmapFetcherService::CreateFetcher( const GURL& url) { - scoped_ptr new_fetcher( + std::unique_ptr new_fetcher( new chrome::BitmapFetcher(url, this)); new_fetcher->Init( @@ -144,7 +144,7 @@ const chrome::BitmapFetcher* BitmapFetcherService::EnsureFetcherForUrl( if (fetcher) return fetcher; - scoped_ptr new_fetcher = CreateFetcher(url); + std::unique_ptr new_fetcher = CreateFetcher(url); active_fetchers_.push_back(std::move(new_fetcher)); return active_fetchers_.back().get(); } @@ -186,7 +186,7 @@ void BitmapFetcherService::OnFetchComplete(const GURL& url, } if (bitmap && !bitmap->isNull()) { - scoped_ptr entry(new CacheEntry); + std::unique_ptr entry(new CacheEntry); entry->bitmap.reset(new SkBitmap(*bitmap)); cache_.Put(fetcher->url(), std::move(entry)); } diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h index f9c596257be305..4df69f24ad0106 100644 --- a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h +++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h @@ -4,11 +4,12 @@ #ifndef CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_SERVICE_H_ #define CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_SERVICE_H_ +#include + #include "base/compiler_specific.h" #include "base/containers/mru_cache.h" #include "base/containers/scoped_ptr_hash_map.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" #include "components/keyed_service/core/keyed_service.h" @@ -64,7 +65,7 @@ class BitmapFetcherService : public KeyedService, protected: // Create a bitmap fetcher for the given |url| and start it. Virtual method // so tests can override this for different behavior. - virtual scoped_ptr CreateFetcher(const GURL& url); + virtual std::unique_ptr CreateFetcher(const GURL& url); private: friend class BitmapFetcherServiceTest; @@ -84,7 +85,7 @@ class BitmapFetcherService : public KeyedService, void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override; // Currently active image fetchers. - std::vector> active_fetchers_; + std::vector> active_fetchers_; // Currently active requests. ScopedVector requests_; @@ -94,9 +95,9 @@ class BitmapFetcherService : public KeyedService, CacheEntry(); ~CacheEntry(); - scoped_ptr bitmap; + std::unique_ptr bitmap; }; - base::MRUCache> cache_; + base::MRUCache> cache_; // Current request ID to be used. int current_request_id_; diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc index 7ba9458f235bfa..74c1906b162e4e 100644 --- a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc +++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc @@ -7,6 +7,7 @@ #include #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/test_browser_thread_bundle.h" @@ -45,8 +46,9 @@ class TestService : public BitmapFetcherService { // Create a fetcher, but don't start downloading. That allows side-stepping // the decode step, which requires a utility process. - scoped_ptr CreateFetcher(const GURL& url) override { - return make_scoped_ptr(new chrome::BitmapFetcher(url, this)); + std::unique_ptr CreateFetcher( + const GURL& url) override { + return base::WrapUnique(new chrome::BitmapFetcher(url, this)); } }; @@ -69,7 +71,7 @@ class BitmapFetcherServiceTest : public testing::Test, const ScopedVector& requests() const { return service_->requests_; } - const std::vector>& active_fetchers() + const std::vector>& active_fetchers() const { return service_->active_fetchers_; } @@ -106,7 +108,7 @@ class BitmapFetcherServiceTest : public testing::Test, } protected: - scoped_ptr service_; + std::unique_ptr service_; int images_changed_; int requests_finished_; diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc index 34bd5c62ddaec4..efcf3654cb4d7c 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -7,13 +7,14 @@ #include #include +#include + #include "base/base64.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" #include "base/files/file.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -366,19 +367,19 @@ class Writer : public base::RefCountedThreadSafe { // The BookmarkModel as a base::Value. This value was generated from the // BookmarkCodec. - scoped_ptr bookmarks_; + std::unique_ptr bookmarks_; // Path we're writing to. base::FilePath path_; // Map that stores favicon per URL. - scoped_ptr favicons_map_; + std::unique_ptr favicons_map_; // Observer to be notified on finish. BookmarksExportObserver* observer_; // File we're writing to. - scoped_ptr file_; + std::unique_ptr file_; // How much we indent when writing a bookmark/folder. This is modified // via IncrementIndent and DecrementIndent. diff --git a/chrome/browser/bookmarks/bookmark_html_writer.h b/chrome/browser/bookmarks/bookmark_html_writer.h index 00c540d980ab9f..ed8ae816ecb175 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.h +++ b/chrome/browser/bookmarks/bookmark_html_writer.h @@ -88,7 +88,7 @@ class BookmarkFaviconFetcher: public content::NotificationObserver { base::CancelableTaskTracker cancelable_task_tracker_; // Map that stores favicon per URL. - scoped_ptr favicons_map_; + std::unique_ptr favicons_map_; // Path where html output is stored. base::FilePath path_; diff --git a/chrome/browser/bookmarks/bookmark_model_factory.cc b/chrome/browser/bookmarks/bookmark_model_factory.cc index 13297fa17f2ba7..4d9846a484f319 100644 --- a/chrome/browser/bookmarks/bookmark_model_factory.cc +++ b/chrome/browser/bookmarks/bookmark_model_factory.cc @@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/deferred_sequenced_task_runner.h" +#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "base/values.h" #include "build/build_config.h" @@ -71,7 +72,7 @@ KeyedService* BookmarkModelFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { Profile* profile = Profile::FromBrowserContext(context); BookmarkModel* bookmark_model = - new BookmarkModel(make_scoped_ptr(new ChromeBookmarkClient( + new BookmarkModel(base::WrapUnique(new ChromeBookmarkClient( profile, ManagedBookmarkServiceFactory::GetForProfile(profile)))); bookmark_model->Load(profile->GetPrefs(), profile->GetPath(), diff --git a/chrome/browser/bookmarks/managed_bookmark_service_factory.cc b/chrome/browser/bookmarks/managed_bookmark_service_factory.cc index 64fed097f24ea0..069f03606cc938 100644 --- a/chrome/browser/bookmarks/managed_bookmark_service_factory.cc +++ b/chrome/browser/bookmarks/managed_bookmark_service_factory.cc @@ -7,6 +7,7 @@ #include #include "base/bind.h" +#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/policy/profile_policy_connector_factory.h" @@ -26,10 +27,10 @@ std::string GetManagedBookmarksDomain(Profile* profile) { return std::string(); } -scoped_ptr BuildManagedBookmarkService( +std::unique_ptr BuildManagedBookmarkService( content::BrowserContext* context) { Profile* profile = Profile::FromBrowserContext(context); - return make_scoped_ptr(new bookmarks::ManagedBookmarkService( + return base::WrapUnique(new bookmarks::ManagedBookmarkService( profile->GetPrefs(), base::Bind(&GetManagedBookmarksDomain, base::Unretained(profile)))); } diff --git a/chrome/browser/bookmarks/managed_bookmark_service_factory.h b/chrome/browser/bookmarks/managed_bookmark_service_factory.h index 3ce2f656a45dfb..208372b6d3b18c 100644 --- a/chrome/browser/bookmarks/managed_bookmark_service_factory.h +++ b/chrome/browser/bookmarks/managed_bookmark_service_factory.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_BOOKMARKS_MANAGED_BOOKMARK_SERVICE_FACTORY_H_ #define CHROME_BROWSER_BOOKMARKS_MANAGED_BOOKMARK_SERVICE_FACTORY_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" namespace base { diff --git a/chrome/browser/bookmarks/managed_bookmark_service_unittest.cc b/chrome/browser/bookmarks/managed_bookmark_service_unittest.cc index ab173f5e27e718..5d7fd319171cfe 100644 --- a/chrome/browser/bookmarks/managed_bookmark_service_unittest.cc +++ b/chrome/browser/bookmarks/managed_bookmark_service_unittest.cc @@ -4,8 +4,9 @@ #include "components/bookmarks/managed/managed_bookmark_service.h" +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/bookmarks/bookmark_model_factory.h" @@ -158,14 +159,14 @@ TEST_F(ManagedBookmarkServiceTest, LoadInitial) { EXPECT_FALSE(managed_->managed_node()->empty()); EXPECT_TRUE(managed_->managed_node()->IsVisible()); - scoped_ptr expected(CreateExpectedTree()); + std::unique_ptr expected(CreateExpectedTree()); EXPECT_TRUE(NodeMatchesValue(managed_->managed_node(), expected.get())); } TEST_F(ManagedBookmarkServiceTest, SwapNodes) { // Swap the Google bookmark with the Folder. - scoped_ptr updated(CreateTestTree()); - scoped_ptr removed; + std::unique_ptr updated(CreateTestTree()); + std::unique_ptr removed; ASSERT_TRUE(updated->Remove(0, &removed)); updated->Append(removed.release()); @@ -177,14 +178,14 @@ TEST_F(ManagedBookmarkServiceTest, SwapNodes) { Mock::VerifyAndClearExpectations(&observer_); // Verify the final tree. - scoped_ptr expected( + std::unique_ptr expected( CreateFolder(GetManagedFolderTitle(), updated.release())); EXPECT_TRUE(NodeMatchesValue(managed_->managed_node(), expected.get())); } TEST_F(ManagedBookmarkServiceTest, RemoveNode) { // Remove the Folder. - scoped_ptr updated(CreateTestTree()); + std::unique_ptr updated(CreateTestTree()); ASSERT_TRUE(updated->Remove(1, NULL)); const BookmarkNode* parent = managed_->managed_node(); @@ -194,14 +195,14 @@ TEST_F(ManagedBookmarkServiceTest, RemoveNode) { Mock::VerifyAndClearExpectations(&observer_); // Verify the final tree. - scoped_ptr expected( + std::unique_ptr expected( CreateFolder(GetManagedFolderTitle(), updated.release())); EXPECT_TRUE(NodeMatchesValue(managed_->managed_node(), expected.get())); } TEST_F(ManagedBookmarkServiceTest, CreateNewNodes) { // Put all the nodes inside another folder. - scoped_ptr updated(new base::ListValue); + std::unique_ptr updated(new base::ListValue); updated->Append(CreateFolder("Container", CreateTestTree())); EXPECT_CALL(observer_, BookmarkNodeAdded(model_, _, _)).Times(5); @@ -214,7 +215,7 @@ TEST_F(ManagedBookmarkServiceTest, CreateNewNodes) { Mock::VerifyAndClearExpectations(&observer_); // Verify the final tree. - scoped_ptr expected( + std::unique_ptr expected( CreateFolder(GetManagedFolderTitle(), updated.release())); EXPECT_TRUE(NodeMatchesValue(managed_->managed_node(), expected.get())); } diff --git a/chrome/browser/browser_about_handler_unittest.cc b/chrome/browser/browser_about_handler_unittest.cc index c676c412e0a5c3..5e51f0e4731dde 100644 --- a/chrome/browser/browser_about_handler_unittest.cc +++ b/chrome/browser/browser_about_handler_unittest.cc @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/browser_about_handler.h" + #include +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" -#include "chrome/browser/browser_about_handler.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/navigation_controller.h" @@ -94,9 +96,10 @@ TEST_F(BrowserAboutHandlerTest, NoVirtualURLForFixup) { GURL rewritten_url("http://foo/"); TestingProfile profile; - scoped_ptr entry(NavigationController::CreateNavigationEntry( - url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), - &profile)); + std::unique_ptr entry( + NavigationController::CreateNavigationEntry( + url, Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), + &profile)); EXPECT_EQ(fixed_url, entry->GetVirtualURL()); EXPECT_EQ(rewritten_url, entry->GetURL()); } diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h index 540ba2a4de4aac..b38070761553c4 100644 --- a/chrome/browser/browser_process.h +++ b/chrome/browser/browser_process.h @@ -12,10 +12,10 @@ #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "build/build_config.h" #include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/shell_integration.h" @@ -208,7 +208,7 @@ class BrowserProcess { // Returns the object that manages background applications. virtual BackgroundModeManager* background_mode_manager() = 0; virtual void set_background_mode_manager_for_test( - scoped_ptr manager) = 0; + std::unique_ptr manager) = 0; // Returns the StatusTray, which provides an API for displaying status icons // in the system status tray. Returns NULL if status icons are not supported diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index 5f02edebc2ad63..0b2d2d4ccc9c74 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -5,6 +5,7 @@ #include "chrome/browser/browser_process_impl.h" #include + #include #include #include @@ -18,6 +19,7 @@ #include "base/debug/leak_annotations.h" #include "base/files/file_path.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" #include "base/path_service.h" @@ -494,7 +496,7 @@ BrowserProcessImpl::GetMetricsServicesManager() { DCHECK(CalledOnValidThread()); if (!metrics_services_manager_) { metrics_services_manager_.reset( - new metrics_services_manager::MetricsServicesManager(make_scoped_ptr( + new metrics_services_manager::MetricsServicesManager(base::WrapUnique( new ChromeMetricsServicesManagerClient(local_state())))); } return metrics_services_manager_.get(); @@ -726,9 +728,8 @@ WebRtcLogUploader* BrowserProcessImpl::webrtc_log_uploader() { network_time::NetworkTimeTracker* BrowserProcessImpl::network_time_tracker() { if (!network_time_tracker_) { network_time_tracker_.reset(new network_time::NetworkTimeTracker( - make_scoped_ptr(new base::DefaultClock()), - make_scoped_ptr(new base::DefaultTickClock()), - local_state())); + base::WrapUnique(new base::DefaultClock()), + base::WrapUnique(new base::DefaultTickClock()), local_state())); } return network_time_tracker_.get(); } @@ -819,7 +820,7 @@ BackgroundModeManager* BrowserProcessImpl::background_mode_manager() { } void BrowserProcessImpl::set_background_mode_manager_for_test( - scoped_ptr manager) { + std::unique_ptr manager) { #if BUILDFLAG(ENABLE_BACKGROUND) background_mode_manager_ = std::move(manager); #endif @@ -936,7 +937,7 @@ void BrowserProcessImpl::CreateWatchdogThread() { DCHECK(!created_watchdog_thread_ && watchdog_thread_.get() == NULL); created_watchdog_thread_ = true; - scoped_ptr thread(new WatchDogThread()); + std::unique_ptr thread(new WatchDogThread()); base::Thread::Options options; options.timer_slack = base::TIMER_SLACK_MAXIMUM; if (!thread->StartWithOptions(options)) @@ -1052,7 +1053,7 @@ void BrowserProcessImpl::CreateIconManager() { void BrowserProcessImpl::CreateIntranetRedirectDetector() { DCHECK(intranet_redirect_detector_.get() == NULL); - scoped_ptr intranet_redirect_detector( + std::unique_ptr intranet_redirect_detector( new IntranetRedirectDetector); intranet_redirect_detector_.swap(intranet_redirect_detector); } @@ -1129,11 +1130,8 @@ void BrowserProcessImpl::CreateGCMDriver() { base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); gcm_driver_ = gcm::CreateGCMDriverDesktop( - make_scoped_ptr(new gcm::GCMClientFactory), - local_state(), - store_path, - system_request_context(), - chrome::GetChannel(), + base::WrapUnique(new gcm::GCMClientFactory), local_state(), store_path, + system_request_context(), chrome::GetChannel(), content::BrowserThread::GetMessageLoopProxyForThread( content::BrowserThread::UI), content::BrowserThread::GetMessageLoopProxyForThread( @@ -1245,7 +1243,7 @@ const char* const kSwitchesToAddOnAutorestart[] = { void BrowserProcessImpl::RestartBackgroundInstance() { base::CommandLine* old_cl = base::CommandLine::ForCurrentProcess(); - scoped_ptr new_cl( + std::unique_ptr new_cl( new base::CommandLine(old_cl->GetProgram())); std::map switches = diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index a23775994ec269..e4a287d6ef024f 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -12,12 +12,12 @@ #include +#include #include #include "base/debug/stack_trace.h" #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/timer/timer.h" #include "build/build_config.h" @@ -128,7 +128,7 @@ class BrowserProcessImpl : public BrowserProcess, DownloadRequestLimiter* download_request_limiter() override; BackgroundModeManager* background_mode_manager() override; void set_background_mode_manager_for_test( - scoped_ptr manager) override; + std::unique_ptr manager) override; StatusTray* status_tray() override; safe_browsing::SafeBrowsingService* safe_browsing_service() override; safe_browsing::ClientSideDetectionService* safe_browsing_detection_service() @@ -190,62 +190,64 @@ class BrowserProcessImpl : public BrowserProcess, void Pin(); void Unpin(); - scoped_ptr + std::unique_ptr metrics_services_manager_; - scoped_ptr io_thread_; + std::unique_ptr io_thread_; bool created_watchdog_thread_; - scoped_ptr watchdog_thread_; + std::unique_ptr watchdog_thread_; bool created_browser_policy_connector_; // Must be destroyed after |local_state_|. - scoped_ptr browser_policy_connector_; + std::unique_ptr browser_policy_connector_; bool created_profile_manager_; - scoped_ptr profile_manager_; + std::unique_ptr profile_manager_; bool created_local_state_; - scoped_ptr local_state_; + std::unique_ptr local_state_; bool created_icon_manager_; - scoped_ptr icon_manager_; + std::unique_ptr icon_manager_; - scoped_ptr gl_string_manager_; + std::unique_ptr gl_string_manager_; - scoped_ptr gpu_mode_manager_; + std::unique_ptr gpu_mode_manager_; #if defined(ENABLE_EXTENSIONS) - scoped_ptr extensions_browser_client_; + std::unique_ptr + extensions_browser_client_; scoped_refptr extension_event_router_forwarder_; - scoped_ptr media_file_system_registry_; + std::unique_ptr media_file_system_registry_; #endif #if !defined(OS_ANDROID) - scoped_ptr remote_debugging_server_; - scoped_ptr devtools_auto_opener_; + std::unique_ptr remote_debugging_server_; + std::unique_ptr devtools_auto_opener_; #endif #if defined(ENABLE_PRINT_PREVIEW) scoped_refptr print_preview_dialog_controller_; - scoped_ptr background_printing_manager_; + std::unique_ptr + background_printing_manager_; #endif // Manager for desktop notification UI. bool created_notification_ui_manager_; - scoped_ptr notification_ui_manager_; + std::unique_ptr notification_ui_manager_; - scoped_ptr intranet_redirect_detector_; + std::unique_ptr intranet_redirect_detector_; - scoped_ptr status_tray_; + std::unique_ptr status_tray_; #if BUILDFLAG(ENABLE_BACKGROUND) - scoped_ptr background_mode_manager_; + std::unique_ptr background_mode_manager_; #endif bool created_safe_browsing_service_; @@ -256,14 +258,14 @@ class BrowserProcessImpl : public BrowserProcess, bool tearing_down_; // Ensures that all the print jobs are finished before closing the browser. - scoped_ptr print_job_manager_; + std::unique_ptr print_job_manager_; std::string locale_; // Download status updates (like a changing application icon on dock/taskbar) // are global per-application. DownloadStatusUpdater does no work in the ctor // so we don't have to worry about lazy initialization. - scoped_ptr download_status_updater_; + std::unique_ptr download_status_updater_; scoped_refptr download_request_limiter_; @@ -275,12 +277,12 @@ class BrowserProcessImpl : public BrowserProcess, PrefChangeRegistrar pref_change_registrar_; // Lives here so can safely log events on shutdown. - scoped_ptr net_log_; + std::unique_ptr net_log_; - scoped_ptr + std::unique_ptr resource_dispatcher_host_delegate_; - scoped_ptr promo_resource_service_; + std::unique_ptr promo_resource_service_; #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) base::RepeatingTimer autoupdate_timer_; @@ -295,7 +297,7 @@ class BrowserProcessImpl : public BrowserProcess, // component updater is normally not used under ChromeOS due // to concerns over integrity of data shared between profiles, // but some users of component updater only install per-user. - scoped_ptr component_updater_; + std::unique_ptr component_updater_; scoped_refptr crl_set_fetcher_; #if !defined(DISABLE_NACL) @@ -303,14 +305,14 @@ class BrowserProcessImpl : public BrowserProcess, pnacl_component_installer_; #endif - scoped_ptr + std::unique_ptr supervised_user_whitelist_installer_; #if defined(ENABLE_PLUGIN_INSTALLATION) - scoped_ptr plugins_resource_service_; + std::unique_ptr plugins_resource_service_; #endif - scoped_ptr platform_part_; + std::unique_ptr platform_part_; // TODO(eroman): Remove this when done debugging 113031. This tracks // the callstack which released the final module reference count. @@ -318,21 +320,21 @@ class BrowserProcessImpl : public BrowserProcess, #if defined(ENABLE_WEBRTC) // Lazily initialized. - scoped_ptr webrtc_log_uploader_; + std::unique_ptr webrtc_log_uploader_; #endif - scoped_ptr network_time_tracker_; + std::unique_ptr network_time_tracker_; - scoped_ptr gcm_driver_; + std::unique_ptr gcm_driver_; - scoped_ptr child_process_watcher_; + std::unique_ptr child_process_watcher_; - scoped_ptr device_client_; + std::unique_ptr device_client_; #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) // Any change to this #ifdef must be reflected as well in // chrome/browser/memory/tab_manager_browsertest.cc - scoped_ptr tab_manager_; + std::unique_ptr tab_manager_; #endif shell_integration::DefaultWebClientState cached_default_web_client_state_; diff --git a/chrome/browser/browser_process_impl_unittest.cc b/chrome/browser/browser_process_impl_unittest.cc index b86f2e77bb589e..7a79ae6294cb01 100644 --- a/chrome/browser/browser_process_impl_unittest.cc +++ b/chrome/browser/browser_process_impl_unittest.cc @@ -4,8 +4,9 @@ #include "chrome/browser/browser_process_impl.h" +#include + #include "base/command_line.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" @@ -67,10 +68,10 @@ class BrowserProcessImplTest : public ::testing::Test { BrowserProcess* stashed_browser_process_; base::MessageLoop loop_; content::TestBrowserThread ui_thread_; - scoped_ptr file_thread_; - scoped_ptr io_thread_; + std::unique_ptr file_thread_; + std::unique_ptr io_thread_; base::CommandLine command_line_; - scoped_ptr browser_process_impl_; + std::unique_ptr browser_process_impl_; }; @@ -85,7 +86,7 @@ TEST_F(BrowserProcessImplTest, LifeCycle) { browser_process_impl()->PreMainMessageLoopRun(); // Force the creation of the NTPResourceCache, to test the destruction order. - scoped_ptr profile(new TestingProfile); + std::unique_ptr profile(new TestingProfile); NTPResourceCache* cache = NTPResourceCacheFactory::GetForProfile(profile.get()); ASSERT_TRUE(cache); diff --git a/chrome/browser/browser_process_platform_part_base.cc b/chrome/browser/browser_process_platform_part_base.cc index fd7bee8bdeb5c0..e2acee95456708 100644 --- a/chrome/browser/browser_process_platform_part_base.cc +++ b/chrome/browser/browser_process_platform_part_base.cc @@ -36,8 +36,8 @@ void BrowserProcessPlatformPartBase::AttemptExit() { void BrowserProcessPlatformPartBase::PreMainMessageLoopRun() { } -scoped_ptr +std::unique_ptr BrowserProcessPlatformPartBase::CreateBrowserPolicyConnector() { - return scoped_ptr( + return std::unique_ptr( new policy::ChromeBrowserPolicyConnector()); } diff --git a/chrome/browser/browser_process_platform_part_base.h b/chrome/browser/browser_process_platform_part_base.h index d662dbd77795fd..af9d60c0683554 100644 --- a/chrome/browser/browser_process_platform_part_base.h +++ b/chrome/browser/browser_process_platform_part_base.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_BASE_H_ #define CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_BASE_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" namespace base { class CommandLine; @@ -37,8 +38,8 @@ class BrowserProcessPlatformPartBase { // Called at the end of BrowserProcessImpl::PreMainMessageLoopRun(). virtual void PreMainMessageLoopRun(); - virtual scoped_ptr - CreateBrowserPolicyConnector(); + virtual std::unique_ptr + CreateBrowserPolicyConnector(); private: DISALLOW_COPY_AND_ASSIGN(BrowserProcessPlatformPartBase); diff --git a/chrome/browser/browser_process_platform_part_chromeos.cc b/chrome/browser/browser_process_platform_part_chromeos.cc index b5debb4d900437..0378fddd25d56f 100644 --- a/chrome/browser/browser_process_platform_part_chromeos.cc +++ b/chrome/browser/browser_process_platform_part_chromeos.cc @@ -41,7 +41,7 @@ void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { DCHECK(!automatic_reboot_manager_); automatic_reboot_manager_.reset(new chromeos::system::AutomaticRebootManager( - scoped_ptr(new base::DefaultTickClock))); + std::unique_ptr(new base::DefaultTickClock))); } void BrowserProcessPlatformPart::ShutdownAutomaticRebootManager() { @@ -155,9 +155,9 @@ void BrowserProcessPlatformPart::StartTearDown() { profile_helper_.reset(); } -scoped_ptr +std::unique_ptr BrowserProcessPlatformPart::CreateBrowserPolicyConnector() { - return scoped_ptr( + return std::unique_ptr( new policy::BrowserPolicyConnectorChromeOS()); } diff --git a/chrome/browser/browser_process_platform_part_chromeos.h b/chrome/browser/browser_process_platform_part_chromeos.h index e90c9e50322420..48612f920f48b9 100644 --- a/chrome/browser/browser_process_platform_part_chromeos.h +++ b/chrome/browser/browser_process_platform_part_chromeos.h @@ -5,9 +5,10 @@ #ifndef CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_CHROMEOS_H_ #define CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_CHROMEOS_H_ +#include + #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/threading/non_thread_safe.h" #include "chrome/browser/browser_process_platform_part_base.h" @@ -102,7 +103,7 @@ class BrowserProcessPlatformPart : public BrowserProcessPlatformPartBase, // Overridden from BrowserProcessPlatformPartBase: void StartTearDown() override; - scoped_ptr CreateBrowserPolicyConnector() + std::unique_ptr CreateBrowserPolicyConnector() override; chromeos::system::SystemClock* GetSystemClock(); @@ -110,28 +111,28 @@ class BrowserProcessPlatformPart : public BrowserProcessPlatformPartBase, private: void CreateProfileHelper(); - scoped_ptr session_manager_; + std::unique_ptr session_manager_; bool created_profile_helper_; - scoped_ptr profile_helper_; + std::unique_ptr profile_helper_; - scoped_ptr + std::unique_ptr automatic_reboot_manager_; - scoped_ptr chrome_user_manager_; + std::unique_ptr chrome_user_manager_; - scoped_ptr + std::unique_ptr device_disabling_manager_delegate_; - scoped_ptr + std::unique_ptr device_disabling_manager_; - scoped_ptr + std::unique_ptr timezone_resolver_manager_; - scoped_ptr timezone_resolver_; + std::unique_ptr timezone_resolver_; - scoped_ptr system_clock_; + std::unique_ptr system_clock_; - scoped_ptr keep_alive_; + std::unique_ptr keep_alive_; DISALLOW_COPY_AND_ASSIGN(BrowserProcessPlatformPart); }; diff --git a/chrome/browser/browser_process_platform_part_mac.h b/chrome/browser/browser_process_platform_part_mac.h index d60a44b999ccd7..38a3693ac36206 100644 --- a/chrome/browser/browser_process_platform_part_mac.h +++ b/chrome/browser/browser_process_platform_part_mac.h @@ -5,9 +5,10 @@ #ifndef CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_MAC_H_ #define CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_MAC_H_ +#include + #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/apps/app_shim/app_shim_host_manager_mac.h" #include "chrome/browser/browser_process_platform_part_base.h" diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc index fc6d82185e99b6..b81446a2df396e 100644 --- a/chrome/browser/browser_shutdown.cc +++ b/chrome/browser/browser_shutdown.cc @@ -224,7 +224,7 @@ void ShutdownPostThreadsStop(bool restart_last_session) { // 46182). We therefore use GetSwitches to copy the command line (it stops // at the switch argument terminator). base::CommandLine old_cl(*base::CommandLine::ForCurrentProcess()); - scoped_ptr new_cl( + std::unique_ptr new_cl( new base::CommandLine(old_cl.GetProgram())); std::map switches = old_cl.GetSwitches(); diff --git a/chrome/browser/browsing_data/autofill_counter.cc b/chrome/browser/browsing_data/autofill_counter.cc index 7c2712e6d1953a..db83e1a995a3c5 100644 --- a/chrome/browser/browsing_data/autofill_counter.cc +++ b/chrome/browser/browsing_data/autofill_counter.cc @@ -143,8 +143,8 @@ void AutofillCounter::OnWebDataServiceRequestDone( if (HasPendingQuery()) return; - scoped_ptr reported_result(new AutofillResult( - this, num_suggestions_, num_credit_cards_, num_addresses_)); + std::unique_ptr reported_result(new AutofillResult( + this, num_suggestions_, num_credit_cards_, num_addresses_)); ReportResult(std::move(reported_result)); } diff --git a/chrome/browser/browsing_data/autofill_counter_browsertest.cc b/chrome/browser/browsing_data/autofill_counter_browsertest.cc index c5735ab92556ac..3a03de8220296d 100644 --- a/chrome/browser/browsing_data/autofill_counter_browsertest.cc +++ b/chrome/browser/browsing_data/autofill_counter_browsertest.cc @@ -161,7 +161,7 @@ class AutofillCounterTest : public InProcessBrowserTest { return num_addresses_; } - void Callback(scoped_ptr result) { + void Callback(std::unique_ptr result) { finished_ = result->Finished(); if (finished_) { @@ -178,7 +178,7 @@ class AutofillCounterTest : public InProcessBrowserTest { } private: - scoped_ptr run_loop_; + std::unique_ptr run_loop_; std::vector credit_card_ids_; std::vector address_ids_; diff --git a/chrome/browser/browsing_data/browsing_data_channel_id_helper.cc b/chrome/browser/browsing_data/browsing_data_channel_id_helper.cc index 73eccc1c3c1a27..d3f1f7bfab1018 100644 --- a/chrome/browser/browsing_data/browsing_data_channel_id_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_channel_id_helper.cc @@ -4,11 +4,12 @@ #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" +#include + #include "base/bind.h" #include "base/location.h" #include "base/logging.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/single_thread_task_runner.h" #include "base/thread_task_runner_handle.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc index 74bff944bb6dec..e5ef6c66ac0c75 100644 --- a/chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_channel_id_helper_unittest.cc @@ -4,8 +4,10 @@ #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" +#include + #include "base/bind.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "chrome/test/base/testing_profile.h" #include "content/public/browser/browser_thread.h" @@ -40,13 +42,13 @@ class BrowsingDataChannelIDHelperTest net::ChannelIDStore* channel_id_store = context->channel_id_service()->GetChannelIDStore(); channel_id_store->SetChannelID( - make_scoped_ptr(new net::ChannelIDStore::ChannelID( + base::WrapUnique(new net::ChannelIDStore::ChannelID( "https://www.google.com:443", base::Time(), - make_scoped_ptr(crypto::ECPrivateKey::Create())))); + base::WrapUnique(crypto::ECPrivateKey::Create())))); channel_id_store->SetChannelID( - make_scoped_ptr(new net::ChannelIDStore::ChannelID( + base::WrapUnique(new net::ChannelIDStore::ChannelID( "https://www.youtube.com:443", base::Time(), - make_scoped_ptr(crypto::ECPrivateKey::Create())))); + base::WrapUnique(crypto::ECPrivateKey::Create())))); } void FetchCallback( @@ -60,7 +62,7 @@ class BrowsingDataChannelIDHelperTest protected: content::TestBrowserThreadBundle thread_bundle_; - scoped_ptr testing_profile_; + std::unique_ptr testing_profile_; net::ChannelIDStore::ChannelIDList channel_id_list_; @@ -140,7 +142,7 @@ TEST_F(BrowsingDataChannelIDHelperTest, CannedEmpty) { ASSERT_TRUE(helper->empty()); helper->AddChannelID(net::ChannelIDStore::ChannelID( - origin, base::Time(), make_scoped_ptr(crypto::ECPrivateKey::Create()))); + origin, base::Time(), base::WrapUnique(crypto::ECPrivateKey::Create()))); ASSERT_FALSE(helper->empty()); helper->Reset(); ASSERT_TRUE(helper->empty()); diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper.cc index cac6e2d68d9980..fe405c4e8d1e4a 100644 --- a/chrome/browser/browsing_data/browsing_data_cookie_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_cookie_helper.cc @@ -4,12 +4,12 @@ #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" +#include #include #include "base/bind.h" #include "base/location.h" #include "base/logging.h" -#include "base/memory/scoped_ptr.h" #include "base/stl_util.h" #include "chrome/browser/profiles/profile.h" #include "content/public/browser/browser_thread.h" @@ -102,7 +102,7 @@ void CannedBrowsingDataCookieHelper::AddChangedCookie( const GURL& url, const std::string& cookie_line, const net::CookieOptions& options) { - scoped_ptr cookie(net::CanonicalCookie::Create( + std::unique_ptr cookie(net::CanonicalCookie::Create( url, cookie_line, base::Time::Now(), options)); if (cookie.get()) AddCookie(frame_url, *cookie); diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc index 7ea8335322fe8a..0220cd5cd2e0ef 100644 --- a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc @@ -198,7 +198,7 @@ class BrowsingDataCookieHelperTest : public testing::Test { protected: content::TestBrowserThreadBundle thread_bundle_; - scoped_ptr testing_profile_; + std::unique_ptr testing_profile_; std::vector cookie_expectations_; net::CookieList cookie_list_; @@ -396,7 +396,7 @@ TEST_F(BrowsingDataCookieHelperTest, CannedEmpty) { ASSERT_TRUE(helper->empty()); net::CookieList cookies; - scoped_ptr cookie(net::CanonicalCookie::Create( + std::unique_ptr cookie(net::CanonicalCookie::Create( url_google, "a=1", base::Time::Now(), net::CookieOptions())); cookies.push_back(*cookie); diff --git a/chrome/browser/browsing_data/browsing_data_counter.cc b/chrome/browser/browsing_data/browsing_data_counter.cc index f469e661ddd5d8..04c7772bc1a314 100644 --- a/chrome/browser/browsing_data/browsing_data_counter.cc +++ b/chrome/browser/browsing_data/browsing_data_counter.cc @@ -6,6 +6,7 @@ #include +#include "base/memory/ptr_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "components/prefs/pref_service.h" @@ -55,17 +56,17 @@ void BrowsingDataCounter::Restart() { if (!profile_->GetPrefs()->GetBoolean(GetPrefName())) return; - callback_.Run(make_scoped_ptr(new Result(this))); + callback_.Run(base::WrapUnique(new Result(this))); Count(); } void BrowsingDataCounter::ReportResult(ResultInt value) { DCHECK(initialized_); - callback_.Run(make_scoped_ptr(new FinishedResult(this, value))); + callback_.Run(base::WrapUnique(new FinishedResult(this, value))); } -void BrowsingDataCounter::ReportResult(scoped_ptr result) { +void BrowsingDataCounter::ReportResult(std::unique_ptr result) { DCHECK(initialized_); callback_.Run(std::move(result)); } diff --git a/chrome/browser/browsing_data/browsing_data_counter.h b/chrome/browser/browsing_data/browsing_data_counter.h index 7d5cb0050d5f22..3bd1e4b9744882 100644 --- a/chrome/browser/browsing_data/browsing_data_counter.h +++ b/chrome/browser/browsing_data/browsing_data_counter.h @@ -54,7 +54,7 @@ class BrowsingDataCounter { DISALLOW_COPY_AND_ASSIGN(FinishedResult); }; - typedef base::Callback)> Callback; + typedef base::Callback)> Callback; BrowsingDataCounter(); virtual ~BrowsingDataCounter(); @@ -81,7 +81,7 @@ class BrowsingDataCounter { // A convenience overload of the previous method that allows subclasses to // provide a custom |result|. - void ReportResult(scoped_ptr result); + void ReportResult(std::unique_ptr result); // Calculates the beginning of the counting period as |period_| before now. base::Time GetPeriodStart(); diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc index 302dffe3efdfd9..85487b60ba2cca 100644 --- a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc @@ -4,12 +4,12 @@ #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" +#include #include #include "base/bind.h" #include "base/location.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/sequenced_task_runner.h" #include "chrome/browser/browsing_data/browsing_data_helper.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc index ceb8dd2ca7f8b2..1573faa0c24d57 100644 --- a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc @@ -53,7 +53,7 @@ const int kEmptyFileSystemSize = 0; typedef std::list FileSystemInfoList; -typedef scoped_ptr ScopedFileSystemInfoList; +typedef std::unique_ptr ScopedFileSystemInfoList; // The FileSystem APIs are all asynchronous; this testing class wraps up the // boilerplate code necessary to deal with waiting for responses. In a nutshell, @@ -187,7 +187,7 @@ class BrowsingDataFileSystemHelperTest : public testing::Test { protected: content::TestBrowserThreadBundle thread_bundle_; - scoped_ptr profile_; + std::unique_ptr profile_; // Temporary storage to pass information back from callbacks. base::File::Error open_file_system_result_; diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc index dd96d388b129b3..05e0c2ed9b5fbc 100644 --- a/chrome/browser/browsing_data/browsing_data_remover.cc +++ b/chrome/browser/browsing_data/browsing_data_remover.cc @@ -1034,7 +1034,7 @@ void BrowsingDataRemover::OverrideStoragePartitionForTesting( #if BUILDFLAG(ANDROID_JAVA_UI) void BrowsingDataRemover::OverrideWebappRegistryForTesting( - scoped_ptr webapp_registry) { + std::unique_ptr webapp_registry) { webapp_registry_.reset(webapp_registry.release()); } #endif diff --git a/chrome/browser/browsing_data/browsing_data_remover.h b/chrome/browser/browsing_data/browsing_data_remover.h index 441cf1e7e788ea..19c8921b8d23fe 100644 --- a/chrome/browser/browsing_data/browsing_data_remover.h +++ b/chrome/browser/browsing_data/browsing_data_remover.h @@ -204,7 +204,7 @@ class BrowsingDataRemover : public KeyedService }; using Callback = base::Callback; - using CallbackSubscription = scoped_ptr< + using CallbackSubscription = std::unique_ptr< base::CallbackList::Subscription>; // The completion inhibitor can artificially delay completion of the browsing @@ -276,7 +276,7 @@ class BrowsingDataRemover : public KeyedService #if BUILDFLAG(ANDROID_JAVA_UI) void OverrideWebappRegistryForTesting( - scoped_ptr webapp_registry); + std::unique_ptr webapp_registry); #endif private: @@ -456,11 +456,11 @@ class BrowsingDataRemover : public KeyedService #if defined(ENABLE_PLUGINS) // Used to delete plugin data. - scoped_ptr plugin_data_remover_; + std::unique_ptr plugin_data_remover_; base::WaitableEventWatcher watcher_; // Used to deauthorize content licenses for Pepper Flash. - scoped_ptr pepper_flash_settings_manager_; + std::unique_ptr pepper_flash_settings_manager_; #endif uint32_t deauthorize_content_licenses_request_id_ = 0; @@ -508,7 +508,7 @@ class BrowsingDataRemover : public KeyedService // Used if we need to clear history. base::CancelableTaskTracker history_task_tracker_; - scoped_ptr template_url_sub_; + std::unique_ptr template_url_sub_; // We do not own this. content::StoragePartition* storage_partition_for_testing_ = nullptr; @@ -516,7 +516,7 @@ class BrowsingDataRemover : public KeyedService #if BUILDFLAG(ANDROID_JAVA_UI) // WebappRegistry makes calls across the JNI. In unit tests, the Java side is // not initialised, so the registry must be mocked out. - scoped_ptr webapp_registry_; + std::unique_ptr webapp_registry_; #endif base::WeakPtrFactory weak_ptr_factory_; diff --git a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc index eb2ddbf048a022..840d1e29f0c62a 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_browsertest.cc @@ -73,7 +73,7 @@ class BrowsingDataRemoverBrowserTest : public InProcessBrowserTest { // Start a download. content::DownloadManager* download_manager = content::BrowserContext::GetDownloadManager(browser()->profile()); - scoped_ptr observer( + std::unique_ptr observer( new content::DownloadTestObserverTerminal( download_manager, 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc index 538eec25f11318..62fc5f4d193955 100644 --- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -17,7 +18,7 @@ #include "base/files/file_util.h" #include "base/guid.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/run_loop.h" #include "base/strings/utf_string_conversions.h" @@ -493,9 +494,9 @@ class RemoveChannelIDTester : public net::SSLConfigService::Observer { void AddChannelIDWithTimes(const std::string& server_identifier, base::Time creation_time) { GetChannelIDStore()->SetChannelID( - make_scoped_ptr(new net::ChannelIDStore::ChannelID( + base::WrapUnique(new net::ChannelIDStore::ChannelID( server_identifier, creation_time, - make_scoped_ptr(crypto::ECPrivateKey::Create())))); + base::WrapUnique(crypto::ECPrivateKey::Create())))); } // Add a server bound cert for |server|, with the current time as the @@ -838,11 +839,11 @@ class MockDomainReliabilityService : public DomainReliabilityService { ~MockDomainReliabilityService() override {} - scoped_ptr CreateMonitor( + std::unique_ptr CreateMonitor( scoped_refptr network_task_runner) override { NOTREACHED(); - return scoped_ptr(); + return std::unique_ptr(); } void ClearBrowsingData(DomainReliabilityClearMode clear_mode, @@ -852,7 +853,7 @@ class MockDomainReliabilityService : public DomainReliabilityService { callback.Run(); } - void GetWebUIData(const base::Callback)>& + void GetWebUIData(const base::Callback)>& callback) const override { NOTREACHED(); } @@ -889,7 +890,7 @@ struct TestingDomainReliabilityServiceFactoryUserData const void* TestingDomainReliabilityServiceFactoryUserData::kKey = &TestingDomainReliabilityServiceFactoryUserData::kKey; -scoped_ptr TestingDomainReliabilityServiceFactoryFunction( +std::unique_ptr TestingDomainReliabilityServiceFactoryFunction( content::BrowserContext* context) { const void* kKey = TestingDomainReliabilityServiceFactoryUserData::kKey; @@ -901,7 +902,7 @@ scoped_ptr TestingDomainReliabilityServiceFactoryFunction( EXPECT_FALSE(data->attached); data->attached = true; - return make_scoped_ptr(data->service); + return base::WrapUnique(data->service); } class ClearDomainReliabilityTester { @@ -1009,7 +1010,7 @@ class BrowsingDataRemoverTest : public testing::Test { BrowsingDataRemover* remover = BrowsingDataRemoverFactory::GetForBrowserContext(profile_.get()); remover->OverrideWebappRegistryForTesting( - scoped_ptr(new TestWebappRegistry())); + std::unique_ptr(new TestWebappRegistry())); #endif } @@ -1143,11 +1144,12 @@ class BrowsingDataRemoverTest : public testing::Test { } protected: - scoped_ptr called_with_details_; + std::unique_ptr + called_with_details_; private: content::TestBrowserThreadBundle thread_bundle_; - scoped_ptr profile_; + std::unique_ptr profile_; StoragePartitionRemovalData storage_partition_removal_data_; @@ -2219,12 +2221,12 @@ TEST_F(BrowsingDataRemoverTest, ContentProtectionPlatformKeysRemoval) { AccountId::FromUserEmail("test@example.com")); chromeos::ScopedUserManagerEnabler user_manager_enabler(mock_user_manager); - scoped_ptr dbus_setter = + std::unique_ptr dbus_setter = chromeos::DBusThreadManager::GetSetterForTesting(); chromeos::MockCryptohomeClient* cryptohome_client = new chromeos::MockCryptohomeClient; dbus_setter->SetCryptohomeClient( - scoped_ptr(cryptohome_client)); + std::unique_ptr(cryptohome_client)); // Expect exactly one call. No calls means no attempt to delete keys and more // than one call means a significant performance problem. @@ -2461,7 +2463,7 @@ TEST_F(BrowsingDataRemoverTest, ClearWithPredicate) { host_content_settings_map->SetWebsiteSettingCustomScope( pattern2, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_APP_BANNER, std::string(), - make_scoped_ptr(new base::DictionaryValue())); + base::WrapUnique(new base::DictionaryValue())); // First, test that we clear only IMAGES (not APP_BANNER), and pattern2. BrowsingDataRemover::ClearSettingsForOneTypeWithPredicate( diff --git a/chrome/browser/browsing_data/cache_counter_browsertest.cc b/chrome/browser/browsing_data/cache_counter_browsertest.cc index 0d4d6a9bec6366..1b1b67954a194e 100644 --- a/chrome/browser/browsing_data/cache_counter_browsertest.cc +++ b/chrome/browser/browsing_data/cache_counter_browsertest.cc @@ -129,7 +129,7 @@ class CacheCounterTest : public InProcessBrowserTest { } // Callback from the counter. - void CountingCallback(scoped_ptr result) { + void CountingCallback(std::unique_ptr result) { DCHECK_CURRENTLY_ON(BrowserThread::UI); finished_ = result->Finished(); @@ -159,7 +159,7 @@ class CacheCounterTest : public InProcessBrowserTest { disk_cache::Backend* backend_; disk_cache::Entry* entry_; - scoped_ptr run_loop_; + std::unique_ptr run_loop_; bool finished_; BrowsingDataCounter::ResultInt result_; diff --git a/chrome/browser/browsing_data/cookies_tree_model.cc b/chrome/browser/browsing_data/cookies_tree_model.cc index cd94f346cd3011..959624e12a0d98 100644 --- a/chrome/browser/browsing_data/cookies_tree_model.cc +++ b/chrome/browser/browsing_data/cookies_tree_model.cc @@ -599,8 +599,7 @@ CookieTreeRootNode::CookieTreeRootNode(CookiesTreeModel* model) CookieTreeRootNode::~CookieTreeRootNode() {} CookieTreeHostNode* CookieTreeRootNode::GetOrCreateHostNode(const GURL& url) { - scoped_ptr host_node( - new CookieTreeHostNode(url)); + std::unique_ptr host_node(new CookieTreeHostNode(url)); // First see if there is an existing match. std::vector::iterator host_node_iterator = diff --git a/chrome/browser/browsing_data/cookies_tree_model.h b/chrome/browser/browsing_data/cookies_tree_model.h index 222e758f8475e1..e54d9273252667 100644 --- a/chrome/browser/browsing_data/cookies_tree_model.h +++ b/chrome/browser/browsing_data/cookies_tree_model.h @@ -851,7 +851,7 @@ class CookiesTreeModel : public ui::TreeNodeModel { // Map of app ids to LocalDataContainer objects to use when retrieving // locally stored data. - scoped_ptr data_container_; + std::unique_ptr data_container_; #if defined(ENABLE_EXTENSIONS) // The extension special storage policy; see ExtensionsProtectingNode() above. diff --git a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc index e78380805dfacb..3141e2597d82f0 100644 --- a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc +++ b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc @@ -6,6 +6,7 @@ #include +#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/browsing_data/mock_browsing_data_appcache_helper.h" @@ -108,7 +109,7 @@ class CookiesTreeModelTest : public testing::Test { base::MessageLoop::current()->RunUntilIdle(); } - scoped_ptr CreateCookiesTreeModelWithInitialSample() { + std::unique_ptr CreateCookiesTreeModelWithInitialSample() { LocalDataContainer* container = new LocalDataContainer(mock_browsing_data_cookie_helper_.get(), mock_browsing_data_database_helper_.get(), @@ -208,7 +209,7 @@ class CookiesTreeModelTest : public testing::Test { EXPECT_EQ("xyz.com", GetDisplayedFlashLSOs(cookies_model)); } - return make_scoped_ptr(cookies_model); + return base::WrapUnique(cookies_model); } // Checks that, when setting content settings for host nodes in the @@ -434,7 +435,7 @@ class CookiesTreeModelTest : public testing::Test { } content::TestBrowserThreadBundle thread_bundle_; - scoped_ptr profile_; + std::unique_ptr profile_; scoped_refptr mock_browsing_data_cookie_helper_; scoped_refptr @@ -466,7 +467,7 @@ class CookiesTreeModelTest : public testing::Test { }; TEST_F(CookiesTreeModelTest, RemoveAll) { - scoped_ptr cookies_model( + std::unique_ptr cookies_model( CreateCookiesTreeModelWithInitialSample()); // Reset the selection of the first row. @@ -531,7 +532,7 @@ TEST_F(CookiesTreeModelTest, RemoveAll) { } TEST_F(CookiesTreeModelTest, Remove) { - scoped_ptr cookies_model( + std::unique_ptr cookies_model( CreateCookiesTreeModelWithInitialSample()); // Children start out arranged as follows: @@ -940,7 +941,7 @@ TEST_F(CookiesTreeModelTest, Remove) { } TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { - scoped_ptr cookies_model( + std::unique_ptr cookies_model( CreateCookiesTreeModelWithInitialSample()); DeleteStoredObjects(cookies_model->GetRoot()->GetChild(2)->GetChild(0)); @@ -1013,7 +1014,7 @@ TEST_F(CookiesTreeModelTest, RemoveCookiesNode) { } TEST_F(CookiesTreeModelTest, RemoveCookieNode) { - scoped_ptr cookies_model( + std::unique_ptr cookies_model( CreateCookiesTreeModelWithInitialSample()); DeleteStoredObjects(cookies_model->GetRoot()->GetChild(3)->GetChild(0)); @@ -1440,7 +1441,7 @@ TEST_F(CookiesTreeModelTest, ContentSettings) { } TEST_F(CookiesTreeModelTest, FileSystemFilter) { - scoped_ptr cookies_model( + std::unique_ptr cookies_model( CreateCookiesTreeModelWithInitialSample()); cookies_model->UpdateSearchResults(base::ASCIIToUTF16("fshost1")); @@ -1461,7 +1462,7 @@ TEST_F(CookiesTreeModelTest, FileSystemFilter) { } TEST_F(CookiesTreeModelTest, ServiceWorkerFilter) { - scoped_ptr cookies_model( + std::unique_ptr cookies_model( CreateCookiesTreeModelWithInitialSample()); cookies_model->UpdateSearchResults(base::ASCIIToUTF16("swhost1")); @@ -1481,7 +1482,7 @@ TEST_F(CookiesTreeModelTest, ServiceWorkerFilter) { } TEST_F(CookiesTreeModelTest, CacheStorageFilter) { - scoped_ptr cookies_model( + std::unique_ptr cookies_model( CreateCookiesTreeModelWithInitialSample()); cookies_model->UpdateSearchResults(base::ASCIIToUTF16("cshost1")); diff --git a/chrome/browser/browsing_data/history_counter.cc b/chrome/browser/browsing_data/history_counter.cc index 00f8b510d0ae38..edb03723d2d3b1 100644 --- a/chrome/browser/browsing_data/history_counter.cc +++ b/chrome/browser/browsing_data/history_counter.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 "chrome/browser/browsing_data/history_counter.h" + #include #include +#include "base/memory/ptr_util.h" #include "base/timer/timer.h" -#include "chrome/browser/browsing_data/history_counter.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/history/web_history_service_factory.h" #include "chrome/browser/sync/profile_sync_service_factory.h" @@ -165,8 +167,8 @@ void HistoryCounter::MergeResults() { if (!local_counting_finished_ || !web_counting_finished_) return; - ReportResult(make_scoped_ptr(new HistoryResult( - this, local_result_, has_synced_visits_))); + ReportResult(base::WrapUnique( + new HistoryResult(this, local_result_, has_synced_visits_))); } HistoryCounter::HistoryResult::HistoryResult( diff --git a/chrome/browser/browsing_data/history_counter.h b/chrome/browser/browsing_data/history_counter.h index 3c0209691f66ae..1fb8c589a87866 100644 --- a/chrome/browser/browsing_data/history_counter.h +++ b/chrome/browser/browsing_data/history_counter.h @@ -56,7 +56,7 @@ class HistoryCounter: public BrowsingDataCounter, history::WebHistoryService* testing_web_history_service_; base::CancelableTaskTracker cancelable_task_tracker_; - scoped_ptr web_history_request_; + std::unique_ptr web_history_request_; base::OneShotTimer web_history_timeout_; base::ThreadChecker thread_checker_; diff --git a/chrome/browser/browsing_data/history_counter_browsertest.cc b/chrome/browser/browsing_data/history_counter_browsertest.cc index ca5548275bc21d..8bf2fc04035379 100644 --- a/chrome/browser/browsing_data/history_counter_browsertest.cc +++ b/chrome/browser/browsing_data/history_counter_browsertest.cc @@ -80,7 +80,7 @@ class HistoryCounterTest : public SyncTest { return has_synced_visits_; } - void Callback(scoped_ptr result) { + void Callback(std::unique_ptr result) { finished_ = result->Finished(); if (finished_) { @@ -110,7 +110,7 @@ class HistoryCounterTest : public SyncTest { } private: - scoped_ptr run_loop_; + std::unique_ptr run_loop_; history::HistoryService* service_; base::Time time_; @@ -239,7 +239,7 @@ IN_PROC_BROWSER_TEST_F(HistoryCounterTest, PeriodChanged) { IN_PROC_BROWSER_TEST_F(HistoryCounterTest, Synced) { // WebHistoryService makes network requests, so we need to use a fake one // for testing. - scoped_ptr service( + std::unique_ptr service( new history::FakeWebHistoryService( ProfileOAuth2TokenServiceFactory::GetForProfile(browser()->profile()), SigninManagerFactory::GetForProfile(browser()->profile()), @@ -325,7 +325,7 @@ IN_PROC_BROWSER_TEST_F(HistoryCounterTest, DISABLED_RestartOnSyncChange) { Profile* profile = GetProfile(kFirstProfileIndex); // Set up the fake web history service and the counter. - scoped_ptr web_history_service( + std::unique_ptr web_history_service( new history::FakeWebHistoryService( ProfileOAuth2TokenServiceFactory::GetForProfile(browser()->profile()), SigninManagerFactory::GetForProfile(browser()->profile()), diff --git a/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.cc b/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.cc index 76e1ebbbdd264f..5c4a04030416ab 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.cc +++ b/chrome/browser/browsing_data/mock_browsing_data_channel_id_helper.cc @@ -34,7 +34,7 @@ void MockBrowsingDataChannelIDHelper::DeleteChannelID( void MockBrowsingDataChannelIDHelper::AddChannelIDSample( const std::string& server_id) { ASSERT_FALSE(ContainsKey(channel_ids_, server_id)); - scoped_ptr key(crypto::ECPrivateKey::Create()); + std::unique_ptr key(crypto::ECPrivateKey::Create()); channel_id_list_.push_back( net::ChannelIDStore::ChannelID(server_id, base::Time(), std::move(key))); channel_ids_[server_id] = true; diff --git a/chrome/browser/browsing_data/mock_browsing_data_cookie_helper.cc b/chrome/browser/browsing_data/mock_browsing_data_cookie_helper.cc index caf8d28dde7724..f6dfebcdf98993 100644 --- a/chrome/browser/browsing_data/mock_browsing_data_cookie_helper.cc +++ b/chrome/browser/browsing_data/mock_browsing_data_cookie_helper.cc @@ -36,7 +36,7 @@ void MockBrowsingDataCookieHelper::DeleteCookie( void MockBrowsingDataCookieHelper::AddCookieSamples( const GURL& url, const std::string& cookie_line) { - scoped_ptr cc(net::CanonicalCookie::Create( + std::unique_ptr cc(net::CanonicalCookie::Create( url, cookie_line, base::Time::Now(), net::CookieOptions())); if (cc.get()) { diff --git a/chrome/browser/browsing_data/passwords_counter_browsertest.cc b/chrome/browser/browsing_data/passwords_counter_browsertest.cc index 1ee92946974942..8344e4ad9f7e26 100644 --- a/chrome/browser/browsing_data/passwords_counter_browsertest.cc +++ b/chrome/browser/browsing_data/passwords_counter_browsertest.cc @@ -87,7 +87,7 @@ class PasswordsCounterTest : public InProcessBrowserTest, return result_; } - void Callback(scoped_ptr result) { + void Callback(std::unique_ptr result) { finished_ = result->Finished(); if (finished_) { @@ -115,7 +115,7 @@ class PasswordsCounterTest : public InProcessBrowserTest, scoped_refptr store_; - scoped_ptr run_loop_; + std::unique_ptr run_loop_; base::Time time_; bool finished_; diff --git a/chrome/browser/browsing_data/registrable_domain_filter_builder_unittest.cc b/chrome/browser/browsing_data/registrable_domain_filter_builder_unittest.cc index 172f0100fa810d..f6f2bd07783166 100644 --- a/chrome/browser/browsing_data/registrable_domain_filter_builder_unittest.cc +++ b/chrome/browser/browsing_data/registrable_domain_filter_builder_unittest.cc @@ -5,11 +5,11 @@ #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" #include +#include #include #include #include "base/callback.h" -#include "base/memory/scoped_ptr.h" #include "components/content_settings/core/common/content_settings_pattern.h" #include "net/cookies/canonical_cookie.h" #include "testing/gtest/include/gtest/gtest.h" @@ -53,7 +53,7 @@ void RunTestCase( std::string cookie_line = "A=2"; GURL test_url(test_case.url); EXPECT_TRUE(test_url.is_valid()) << test_case.url; - scoped_ptr cookie = net::CanonicalCookie::Create( + std::unique_ptr cookie = net::CanonicalCookie::Create( test_url, cookie_line, base::Time::Now(), net::CookieOptions()); EXPECT_TRUE(cookie) << cookie_line << " from " << test_case.url << " is not a valid cookie"; diff --git a/chrome/browser/caps/generate_state_json.cc b/chrome/browser/caps/generate_state_json.cc index f876aa63622388..14c3fb6079bf38 100644 --- a/chrome/browser/caps/generate_state_json.cc +++ b/chrome/browser/caps/generate_state_json.cc @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -16,7 +17,6 @@ #include "base/json/json_writer.h" #include "base/location.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" #include "base/sys_info.h" diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc index 18e860f23de45d..8fa21fbd79818a 100644 --- a/chrome/browser/captive_portal/captive_portal_browsertest.cc +++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include +#include #include #include #include @@ -14,7 +15,6 @@ #include "base/compiler_specific.h" #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/path_service.h" #include "base/strings/utf_string_conversions.h" @@ -411,7 +411,7 @@ class URLRequestMockCaptivePortalJobFactory { // Create a new Interceptor and add it to |interceptors_|, though it returns // ownership. - scoped_ptr CreateInterceptor(); + std::unique_ptr CreateInterceptor(); // These variables are only accessed on IO thread, though // URLRequestMockCaptivePortalJobFactory is created and @@ -441,10 +441,11 @@ void URLRequestMockCaptivePortalJobFactory::SetBehindCaptivePortal( base::Unretained(this), behind_captive_portal)); } -scoped_ptr +std::unique_ptr URLRequestMockCaptivePortalJobFactory::CreateInterceptor() { EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); - scoped_ptr interceptor(new Interceptor(behind_captive_portal_)); + std::unique_ptr interceptor( + new Interceptor(behind_captive_portal_)); interceptors_.push_back(interceptor.get()); return std::move(interceptor); } diff --git a/chrome/browser/captive_portal/captive_portal_service.h b/chrome/browser/captive_portal/captive_portal_service.h index 7f7f87e4c78421..f100dacba94cc2 100644 --- a/chrome/browser/captive_portal/captive_portal_service.h +++ b/chrome/browser/captive_portal/captive_portal_service.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_SERVICE_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/threading/non_thread_safe.h" #include "base/time/tick_clock.h" #include "base/time/time.h" @@ -180,7 +181,7 @@ class CaptivePortalService : public KeyedService, public base::NonThreadSafe { // captive_portal::CaptivePortalResult, BackoffEntry::Policy is updated and // |backoff_entry_| is recreated. Each check that returns the same result // is considered a "failure", to trigger throttling. - scoped_ptr backoff_entry_; + std::unique_ptr backoff_entry_; // URL that returns a 204 response code when connected to the Internet. GURL test_url_; diff --git a/chrome/browser/captive_portal/captive_portal_service_unittest.cc b/chrome/browser/captive_portal/captive_portal_service_unittest.cc index 5a60bb2bb79650..01bad9cbd0371a 100644 --- a/chrome/browser/captive_portal/captive_portal_service_unittest.cc +++ b/chrome/browser/captive_portal/captive_portal_service_unittest.cc @@ -282,16 +282,16 @@ class CaptivePortalServiceTest : public testing::Test, content::TestBrowserThreadBundle thread_bundle_; // Note that the construction order of these matters. - scoped_ptr profile_; - scoped_ptr tick_clock_; - scoped_ptr service_; + std::unique_ptr profile_; + std::unique_ptr tick_clock_; + std::unique_ptr service_; }; // Verify that an observer doesn't get messages from the wrong profile. TEST_F(CaptivePortalServiceTest, CaptivePortalTwoProfiles) { Initialize(CaptivePortalService::SKIP_OS_CHECK_FOR_TESTING); TestingProfile profile2; - scoped_ptr service2( + std::unique_ptr service2( new CaptivePortalService(&profile2)); CaptivePortalObserver observer2(&profile2, service2.get()); diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper.h b/chrome/browser/captive_portal/captive_portal_tab_helper.h index f27c4c298c6b3a..b2ced03c364935 100644 --- a/chrome/browser/captive_portal/captive_portal_tab_helper.h +++ b/chrome/browser/captive_portal/captive_portal_tab_helper.h @@ -5,9 +5,10 @@ #ifndef CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_HELPER_H_ #define CHROME_BROWSER_CAPTIVE_PORTAL_CAPTIVE_PORTAL_TAB_HELPER_H_ +#include + #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/threading/non_thread_safe.h" #include "chrome/browser/captive_portal/captive_portal_service.h" #include "content/public/browser/notification_observer.h" @@ -115,8 +116,8 @@ class CaptivePortalTabHelper content::NavigationHandle* navigation_handle_; // Neither of these will ever be NULL. - scoped_ptr tab_reloader_; - scoped_ptr login_detector_; + std::unique_ptr tab_reloader_; + std::unique_ptr login_detector_; content::NotificationRegistrar registrar_; diff --git a/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc b/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc index fba2d1f8454f02..11efa40a67127c 100644 --- a/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc +++ b/chrome/browser/captive_portal/captive_portal_tab_helper_unittest.cc @@ -4,9 +4,10 @@ #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" +#include + #include "base/callback.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/captive_portal/captive_portal_service.h" #include "chrome/browser/captive_portal/captive_portal_tab_reloader.h" #include "chrome/browser/chrome_notification_types.h" @@ -192,7 +193,7 @@ class CaptivePortalTabHelperTest : public ChromeRenderViewHostTestHarness { void SetIsLoginTab() { tab_helper()->SetIsLoginTab(); } private: - scoped_ptr tab_helper_; + std::unique_ptr tab_helper_; // Owned by |tab_helper_|. testing::StrictMock* mock_reloader_; diff --git a/chrome/browser/captive_portal/captive_portal_tab_reloader_unittest.cc b/chrome/browser/captive_portal/captive_portal_tab_reloader_unittest.cc index 18fa4a538527e6..07103607c522ae 100644 --- a/chrome/browser/captive_portal/captive_portal_tab_reloader_unittest.cc +++ b/chrome/browser/captive_portal/captive_portal_tab_reloader_unittest.cc @@ -104,7 +104,7 @@ class CaptivePortalTabReloaderTest : public ChromeRenderViewHostTestHarness { TestCaptivePortalTabReloader& tab_reloader() { return *tab_reloader_.get(); } private: - scoped_ptr tab_reloader_; + std::unique_ptr tab_reloader_; }; // Simulates a slow SSL load when the Internet is connected. diff --git a/chrome/browser/certificate_manager_model.cc b/chrome/browser/certificate_manager_model.cc index 77f22c006601dd..3d366edc97e98d 100644 --- a/chrome/browser/certificate_manager_model.cc +++ b/chrome/browser/certificate_manager_model.cc @@ -225,7 +225,7 @@ void CertificateManagerModel::DidGetCertDBOnUIThread( const CreationCallback& callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - scoped_ptr model(new CertificateManagerModel( + std::unique_ptr model(new CertificateManagerModel( cert_db, is_user_db_available, is_tpm_available, observer)); callback.Run(std::move(model)); } diff --git a/chrome/browser/certificate_manager_model.h b/chrome/browser/certificate_manager_model.h index ee315c42d0a729..64fcb2c467339c 100644 --- a/chrome/browser/certificate_manager_model.h +++ b/chrome/browser/certificate_manager_model.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_ #include +#include #include #include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "net/cert/nss_cert_database.h" @@ -29,7 +29,7 @@ class CertificateManagerModel { // subject's CertPrincipal::GetDisplayName() value is used instead. typedef std::map OrgGroupingMap; - typedef base::Callback)> + typedef base::Callback)> CreationCallback; // Enumeration of the possible columns in the certificate manager tree view. diff --git a/chrome/browser/character_encoding.cc b/chrome/browser/character_encoding.cc index 6ee4e73ab60ec2..b7c9f6fdd38818 100644 --- a/chrome/browser/character_encoding.cc +++ b/chrome/browser/character_encoding.cc @@ -7,11 +7,11 @@ #include #include +#include #include #include "base/logging.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string_tokenizer.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -121,9 +121,9 @@ class CanonicalEncodingMap { } private: - scoped_ptr id_to_encoding_name_map_; - scoped_ptr encoding_name_to_id_map_; - scoped_ptr + std::unique_ptr id_to_encoding_name_map_; + std::unique_ptr encoding_name_to_id_map_; + std::unique_ptr encoding_name_to_display_name_map_; std::vector locale_dependent_encoding_ids_; std::vector current_display_encodings_; diff --git a/chrome/browser/chrome_browser_application_mac_unittest.mm b/chrome/browser/chrome_browser_application_mac_unittest.mm index 69faabfc8d6f04..09d10bfa279261 100644 --- a/chrome/browser/chrome_browser_application_mac_unittest.mm +++ b/chrome/browser/chrome_browser_application_mac_unittest.mm @@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#import "chrome/browser/chrome_browser_application_mac.h" + #import #include -#include "base/memory/scoped_ptr.h" +#include + #include "base/metrics/histogram.h" #include "base/metrics/histogram_samples.h" #include "base/metrics/statistics_recorder.h" -#import "chrome/browser/chrome_browser_application_mac.h" #include "testing/gtest/include/gtest/gtest.h" using base::HistogramBase; @@ -76,7 +78,7 @@ size_t BinForExceptionNamed(NSString* name) { EXPECT_EQ(1U, histograms.size()); EXPECT_EQ(HistogramBase::kUmaTargetedHistogramFlag, histograms[0]->flags()); - scoped_ptr samples(histograms[0]->SnapshotSamples()); + std::unique_ptr samples(histograms[0]->SnapshotSamples()); EXPECT_EQ(4, samples->GetCount(0)); EXPECT_EQ(1, samples->GetCount(1)); EXPECT_EQ(3, samples->GetCount(2)); diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index c3e48db67c1830..1d00e401fce351 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -6,6 +6,7 @@ #include #include + #include #include #include @@ -20,6 +21,7 @@ #include "base/feature_list.h" #include "base/files/file_path.h" #include "base/files/file_util.h" +#include "base/memory/ptr_util.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" #include "base/path_service.h" @@ -335,13 +337,10 @@ PrefService* InitializeLocalState( base::FilePath parent_profile = parsed_command_line.GetSwitchValuePath(switches::kParentProfile); scoped_refptr registry = new PrefRegistrySimple(); - scoped_ptr parent_local_state( + std::unique_ptr parent_local_state( chrome_prefs::CreateLocalState( - parent_profile, - local_state_task_runner, - g_browser_process->policy_service(), - registry, - false)); + parent_profile, local_state_task_runner, + g_browser_process->policy_service(), registry, false)); registry->RegisterStringPref(prefs::kApplicationLocale, std::string()); // Right now, we only inherit the locale setting from the parent profile. local_state->SetString( @@ -718,7 +717,7 @@ void ChromeBrowserMainParts::SetupMetricsAndFieldTrials() { metrics->AddSyntheticTrialObserver(provider); } - scoped_ptr feature_list(new base::FeatureList); + std::unique_ptr feature_list(new base::FeatureList); feature_list->InitializeFromCommandLine( command_line->GetSwitchValueASCII(switches::kEnableFeatures), command_line->GetSwitchValueASCII(switches::kDisableFeatures)); @@ -1122,7 +1121,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() { // Initialize tracking synchronizer system. tracking_synchronizer_ = new metrics::TrackingSynchronizer( - make_scoped_ptr(new base::DefaultTickClock()), + base::WrapUnique(new base::DefaultTickClock()), base::Bind(&metrics::ContentTrackingSynchronizerDelegate::Create)); #if defined(OS_MACOSX) @@ -1606,7 +1605,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // Negative ping delay means to send ping immediately after a first search is // recorded. rlz::RLZTracker::SetRlzDelegate( - make_scoped_ptr(new ChromeRLZTrackerDelegate)); + base::WrapUnique(new ChromeRLZTrackerDelegate)); rlz::RLZTracker::InitRlzDelayed( first_run::IsChromeFirstRun(), ping_delay < 0, base::TimeDelta::FromMilliseconds(abs(ping_delay)), diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h index da58d176abdca1..326406eb990e61 100644 --- a/chrome/browser/chrome_browser_main.h +++ b/chrome/browser/chrome_browser_main.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ #define CHROME_BROWSER_CHROME_BROWSER_MAIN_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/field_trial.h" #include "base/profiler/stack_sampling_profiler.h" #include "base/tracked_objects.h" @@ -129,25 +130,25 @@ class ChromeBrowserMainParts : public content::BrowserMainParts { int result_code_; // Create StartupTimeBomb object for watching jank during startup. - scoped_ptr startup_watcher_; + std::unique_ptr startup_watcher_; // Create ShutdownWatcherHelper object for watching jank during shutdown. // Please keep |shutdown_watcher| as the first object constructed, and hence // it is destroyed last. - scoped_ptr shutdown_watcher_; + std::unique_ptr shutdown_watcher_; // Statistical testing infrastructure for the entire browser. NULL until // SetupMetricsAndFieldTrials is called. - scoped_ptr field_trial_list_; + std::unique_ptr field_trial_list_; ChromeBrowserFieldTrials browser_field_trials_; #if !defined(OS_ANDROID) && !defined(OS_IOS) // A monitor for attributing power consumption to origins. - scoped_ptr process_power_collector_; + std::unique_ptr process_power_collector_; - scoped_ptr webusb_browser_client_; - scoped_ptr webusb_detector_; + std::unique_ptr webusb_browser_client_; + std::unique_ptr webusb_detector_; #endif // Vector of additional ChromeBrowserMainExtraParts. @@ -163,23 +164,23 @@ class ChromeBrowserMainParts : public content::BrowserMainParts { // Members initialized after / released before main_message_loop_ ------------ - scoped_ptr browser_process_; + std::unique_ptr browser_process_; scoped_refptr tracking_synchronizer_; #if !defined(OS_ANDROID) // Browser creation happens on the Java side in Android. - scoped_ptr browser_creator_; + std::unique_ptr browser_creator_; // Android doesn't support multiple browser processes, so it doesn't implement // ProcessSingleton. - scoped_ptr process_singleton_; + std::unique_ptr process_singleton_; // Android's first run is done in Java instead of native. - scoped_ptr master_prefs_; + std::unique_ptr master_prefs_; #endif Profile* profile_; bool run_message_loop_; ProcessSingleton::NotifyResult notify_result_; - scoped_ptr three_d_observer_; + std::unique_ptr three_d_observer_; // Initialized in SetupMetricsAndFieldTrials. scoped_refptr field_trial_synchronizer_; diff --git a/chrome/browser/chrome_browser_main_android.h b/chrome/browser/chrome_browser_main_android.h index d9c996bea6a5d6..7d919c4a51daf5 100644 --- a/chrome/browser/chrome_browser_main_android.h +++ b/chrome/browser/chrome_browser_main_android.h @@ -29,8 +29,8 @@ class ChromeBrowserMainPartsAndroid : public ChromeBrowserMainParts { void ShowMissingLocaleMessageBox() override; private: - scoped_ptr main_message_loop_; - scoped_ptr crash_dump_manager_; + std::unique_ptr main_message_loop_; + std::unique_ptr crash_dump_manager_; DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsAndroid); }; diff --git a/chrome/browser/chrome_browser_main_extra_parts_exo.cc b/chrome/browser/chrome_browser_main_extra_parts_exo.cc index 54d0a17b87149e..cdd2a698bc9276 100644 --- a/chrome/browser/chrome_browser_main_extra_parts_exo.cc +++ b/chrome/browser/chrome_browser_main_extra_parts_exo.cc @@ -4,6 +4,8 @@ #include "chrome/browser/chrome_browser_main_extra_parts_exo.h" +#include "base/memory/ptr_util.h" + #if defined(USE_GLIB) #include #endif @@ -74,7 +76,7 @@ class ChromeBrowserMainExtraPartsExo::WaylandWatcher { private: // The poll attached to |wayland_source_|. - scoped_ptr wayland_poll_; + std::unique_ptr wayland_poll_; // The GLib event source for wayland events. GLibWaylandSource* wayland_source_; @@ -120,7 +122,7 @@ void ChromeBrowserMainExtraPartsExo::PreProfileInit() { switches::kEnableWaylandServer)) { wayland_server_ = exo::wayland::Server::Create(display_.get()); wayland_watcher_ = - make_scoped_ptr(new WaylandWatcher(wayland_server_.get())); + base::WrapUnique(new WaylandWatcher(wayland_server_.get())); } } diff --git a/chrome/browser/chrome_browser_main_extra_parts_exo.h b/chrome/browser/chrome_browser_main_extra_parts_exo.h index 16960e9b145804..aa5612028756a6 100644 --- a/chrome/browser/chrome_browser_main_extra_parts_exo.h +++ b/chrome/browser/chrome_browser_main_extra_parts_exo.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_CHROME_BROWSER_MAIN_EXTRA_PARTS_EXO_H_ #define CHROME_BROWSER_CHROME_BROWSER_MAIN_EXTRA_PARTS_EXO_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/chrome_browser_main_extra_parts.h" namespace exo { @@ -26,10 +27,10 @@ class ChromeBrowserMainExtraPartsExo : public ChromeBrowserMainExtraParts { void PostMainMessageLoopRun() override; private: - scoped_ptr display_; - scoped_ptr wayland_server_; + std::unique_ptr display_; + std::unique_ptr wayland_server_; class WaylandWatcher; - scoped_ptr wayland_watcher_; + std::unique_ptr wayland_watcher_; DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsExo); }; diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc index 05463bd554b2ba..2dcaec9efdc112 100644 --- a/chrome/browser/chrome_browser_main_win.cc +++ b/chrome/browser/chrome_browser_main_win.cc @@ -4,11 +4,12 @@ #include "chrome/browser/chrome_browser_main_win.h" -#include #include #include +#include #include +#include #include "base/base_switches.h" #include "base/command_line.h" @@ -19,7 +20,6 @@ #include "base/i18n/rtl.h" #include "base/location.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/scoped_native_library.h" @@ -360,7 +360,7 @@ void ChromeBrowserMainPartsWin::PostBrowserStart() { void ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment( const base::CommandLine& parsed_command_line) { // Clear this var so child processes don't show the dialog by default. - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); env->UnSetVar(env_vars::kShowRestart); // For non-interactive tests we don't restart on crash. diff --git a/chrome/browser/chrome_browser_main_win.h b/chrome/browser/chrome_browser_main_win.h index c948edbf64897f..35165b002fb192 100644 --- a/chrome/browser/chrome_browser_main_win.h +++ b/chrome/browser/chrome_browser_main_win.h @@ -71,7 +71,7 @@ class ChromeBrowserMainPartsWin : public ChromeBrowserMainParts { private: #if defined(GOOGLE_CHROME_BUILD) - scoped_ptr did_run_updater_; + std::unique_ptr did_run_updater_; #endif #if BUILDFLAG(ENABLE_KASKO) // Cleans up Kasko crash reports that exceeded the maximum upload attempts. diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 12d723d4d0a883..2a8495aa37f968 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -16,6 +16,7 @@ #include "base/files/scoped_file.h" #include "base/lazy_instance.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/path_service.h" #include "base/strings/string_number_conversions.h" @@ -1418,7 +1419,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( base::CommandLine* command_line, int child_process_id) { #if defined(OS_MACOSX) - scoped_ptr client_info = + std::unique_ptr client_info = GoogleUpdateSettings::LoadMetricsClientInfo(); if (client_info) { command_line->AppendSwitchASCII(switches::kMetricsClientID, @@ -1427,7 +1428,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( #elif defined(OS_POSIX) if (breakpad::IsCrashReporterEnabled()) { std::string switch_value; - scoped_ptr client_info = + std::unique_ptr client_info = GoogleUpdateSettings::LoadMetricsClientInfo(); if (client_info) switch_value = client_info->client_id; @@ -2025,11 +2026,11 @@ ChromeContentBrowserClient::CreateQuotaPermissionContext() { return new ChromeQuotaPermissionContext(); } -scoped_ptr +std::unique_ptr ChromeContentBrowserClient::GetTemporaryStorageEvictionPolicy( content::BrowserContext* context) { return SiteEngagementEvictionPolicy::IsEnabled() - ? make_scoped_ptr(new SiteEngagementEvictionPolicy(context)) + ? base::WrapUnique(new SiteEngagementEvictionPolicy(context)) : nullptr; } @@ -2075,7 +2076,7 @@ void ChromeContentBrowserClient::AllowCertificateError( safe_browsing::SafeBrowsingService* safe_browsing_service = g_browser_process->safe_browsing_service(); - scoped_ptr cert_reporter( + std::unique_ptr cert_reporter( new SafeBrowsingSSLCertReporter(safe_browsing_service ? safe_browsing_service->ui_manager() : nullptr)); @@ -2087,7 +2088,7 @@ void ChromeContentBrowserClient::AllowCertificateError( void ChromeContentBrowserClient::SelectClientCertificate( content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, - scoped_ptr delegate) { + std::unique_ptr delegate) { prerender::PrerenderContents* prerender_contents = prerender::PrerenderContents::FromWebContents(web_contents); if (prerender_contents) { @@ -2103,13 +2104,10 @@ void ChromeContentBrowserClient::SelectClientCertificate( Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); - scoped_ptr filter = + std::unique_ptr filter = HostContentSettingsMapFactory::GetForProfile(profile)->GetWebsiteSetting( - requesting_url, - requesting_url, - CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, - std::string(), - NULL); + requesting_url, requesting_url, + CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, std::string(), NULL); if (filter.get()) { // Try to automatically select a client certificate. @@ -2867,7 +2865,7 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation( if (handle->IsInMainFrame()) { // Redirect some navigations to apps that have registered matching URL // handlers ('url_handlers' in the manifest). - scoped_ptr url_to_app_throttle = + std::unique_ptr url_to_app_throttle = AppUrlRedirector::MaybeCreateThrottleFor(handle); if (url_to_app_throttle) throttles.push_back(std::move(url_to_app_throttle)); diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 043218d38845a0..a01f4d591e3c1a 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -7,13 +7,13 @@ #include +#include #include #include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "build/build_config.h" #include "content/public/browser/content_browser_client.h" @@ -166,8 +166,8 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { const GURL& url, content::ResourceContext* context) override; content::QuotaPermissionContext* CreateQuotaPermissionContext() override; - scoped_ptr GetTemporaryStorageEvictionPolicy( - content::BrowserContext* context) override; + std::unique_ptr + GetTemporaryStorageEvictionPolicy(content::BrowserContext* context) override; void AllowCertificateError( content::WebContents* web_contents, int cert_error, @@ -182,7 +182,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { void SelectClientCertificate( content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, - scoped_ptr delegate) override; + std::unique_ptr delegate) override; void AddCertificate(net::CertificateMimeType cert_type, const void* cert_data, size_t cert_size, diff --git a/chrome/browser/chrome_content_browser_client_unittest.cc b/chrome/browser/chrome_content_browser_client_unittest.cc index c8b4b437fb7fb1..191985bb25e2f9 100644 --- a/chrome/browser/chrome_content_browser_client_unittest.cc +++ b/chrome/browser/chrome_content_browser_client_unittest.cc @@ -362,7 +362,7 @@ class InstantNTPURLRewriteTest : public BrowserWithTestWindowTest { template_url_service->SetUserSelectedDefaultSearchProvider(template_url); } - scoped_ptr field_trial_list_; + std::unique_ptr field_trial_list_; }; TEST_F(InstantNTPURLRewriteTest, UberURLHandler_InstantExtendedNewTabPage) { diff --git a/chrome/browser/chrome_device_client.h b/chrome/browser/chrome_device_client.h index a121a695d9fecf..aa6635efb2ba9d 100644 --- a/chrome/browser/chrome_device_client.h +++ b/chrome/browser/chrome_device_client.h @@ -7,9 +7,10 @@ #include "device/core/device_client.h" +#include + #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" // Implementation of device::DeviceClient that returns //device service // singletons appropriate for use within the Chrome application. @@ -23,8 +24,8 @@ class ChromeDeviceClient : device::DeviceClient { device::HidService* GetHidService() override; private: - scoped_ptr hid_service_; - scoped_ptr usb_service_; + std::unique_ptr hid_service_; + std::unique_ptr usb_service_; DISALLOW_COPY_AND_ASSIGN(ChromeDeviceClient); }; diff --git a/chrome/browser/chrome_elf_init_unittest_win.cc b/chrome/browser/chrome_elf_init_unittest_win.cc index 648de0a5925a41..92d8567e00815f 100644 --- a/chrome/browser/chrome_elf_init_unittest_win.cc +++ b/chrome/browser/chrome_elf_init_unittest_win.cc @@ -4,8 +4,9 @@ #include "chrome/browser/chrome_elf_init_win.h" +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/field_trial.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" @@ -54,7 +55,7 @@ class ChromeBlacklistTrialTest : public testing::Test { return blacklist_version; } - scoped_ptr blacklist_registry_key_; + std::unique_ptr blacklist_registry_key_; registry_util::RegistryOverrideManager override_manager_; content::TestBrowserThreadBundle test_browser_thread_bundle_; diff --git a/chrome/browser/chrome_net_benchmarking_message_filter.cc b/chrome/browser/chrome_net_benchmarking_message_filter.cc index 9dbe3d12c8da64..b95edb47744fc3 100644 --- a/chrome/browser/chrome_net_benchmarking_message_filter.cc +++ b/chrome/browser/chrome_net_benchmarking_message_filter.cc @@ -4,11 +4,12 @@ #include "chrome/browser/chrome_net_benchmarking_message_filter.h" +#include + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/net/predictor.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/benchmarking_messages.h" diff --git a/chrome/browser/chrome_quota_permission_context.cc b/chrome/browser/chrome_quota_permission_context.cc index 0de3b2b12d3ae3..a517382a490cd5 100644 --- a/chrome/browser/chrome_quota_permission_context.cc +++ b/chrome/browser/chrome_quota_permission_context.cc @@ -175,7 +175,7 @@ void RequestQuotaInfoBarDelegate::Create( int64_t requested_quota, const content::QuotaPermissionContext::PermissionCallback& callback) { infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( - scoped_ptr(new RequestQuotaInfoBarDelegate( + std::unique_ptr(new RequestQuotaInfoBarDelegate( context, origin_url, requested_quota, callback)))); } diff --git a/chrome/browser/chrome_webusb_browser_client.cc b/chrome/browser/chrome_webusb_browser_client.cc index 709040f820d052..4cfe5ac333d65b 100644 --- a/chrome/browser/chrome_webusb_browser_client.cc +++ b/chrome/browser/chrome_webusb_browser_client.cc @@ -113,7 +113,7 @@ void ChromeWebUsbBrowserClient::OnDeviceAdded( ResourceBundle& rb = ResourceBundle::GetSharedInstance(); message_center::RichNotificationData rich_notification_data; - scoped_ptr notification( + std::unique_ptr notification( new message_center::Notification( message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, l10n_util::GetStringFUTF16( @@ -121,11 +121,10 @@ void ChromeWebUsbBrowserClient::OnDeviceAdded( l10n_util::GetStringFUTF16( IDS_WEBUSB_DEVICE_DETECTED_NOTIFICATION, base::UTF8ToUTF16(landing_page.GetContent())), - rb.GetNativeImageNamed(IDR_USB_NOTIFICATION_ICON), - base::string16(), GURL(), - message_center::NotifierId( - message_center::NotifierId::SYSTEM_COMPONENT, - kWebUsbDetectorNotificationID), + rb.GetNativeImageNamed(IDR_USB_NOTIFICATION_ICON), base::string16(), + GURL(), message_center::NotifierId( + message_center::NotifierId::SYSTEM_COMPONENT, + kWebUsbDetectorNotificationID), rich_notification_data, new WebUsbNotificationDelegate(landing_page, notification_id))); diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index fd443495a24b49..6555895f05ac07 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -959,7 +959,7 @@ void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete( } bool WallpaperPrivateRecordWallpaperUMAFunction::RunSync() { - scoped_ptr params( + std::unique_ptr params( record_wallpaper_uma::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params); diff --git a/chrome/browser/component_updater/caps_installer_win.cc b/chrome/browser/component_updater/caps_installer_win.cc index a02bf53b146dd1..d2d36303fb697f 100644 --- a/chrome/browser/component_updater/caps_installer_win.cc +++ b/chrome/browser/component_updater/caps_installer_win.cc @@ -86,9 +86,10 @@ class CAPSInstallerTraits : public ComponentInstallerTraits { return true; } - void ComponentReady(const base::Version& version, - const base::FilePath& install_dir, - scoped_ptr manifest) override { + void ComponentReady( + const base::Version& version, + const base::FilePath& install_dir, + std::unique_ptr manifest) override { // Can't block here. This is usually the browser UI thread. base::WorkerPool::PostTask( FROM_HERE, @@ -118,8 +119,7 @@ class CAPSInstallerTraits : public ComponentInstallerTraits { void RegisterCAPSComponent(ComponentUpdateService* cus) { // The component updater takes ownership of |installer|. - scoped_ptr traits( - new CAPSInstallerTraits()); + std::unique_ptr traits(new CAPSInstallerTraits()); DefaultComponentInstaller* installer = new DefaultComponentInstaller(std::move(traits)); installer->Register(cus, base::Closure()); diff --git a/chrome/browser/component_updater/cld_component_installer.cc b/chrome/browser/component_updater/cld_component_installer.cc index 672848fc137f06..fc0a5e6bea547f 100644 --- a/chrome/browser/component_updater/cld_component_installer.cc +++ b/chrome/browser/component_updater/cld_component_installer.cc @@ -79,7 +79,7 @@ base::FilePath CldComponentInstallerTraits::GetInstalledPath( void CldComponentInstallerTraits::ComponentReady( const base::Version& version, const base::FilePath& path, - scoped_ptr manifest) { + std::unique_ptr manifest) { VLOG(1) << "Component ready, version " << version.GetString() << " in " << path.value(); SetLatestCldDataFile(GetInstalledPath(path)); @@ -129,7 +129,7 @@ void RegisterCldComponent(ComponentUpdateService* cus) { // configured. See also: chrome://translate-internals VLOG(1) << "Registering CLD component with the component update service"; - scoped_ptr traits( + std::unique_ptr traits( new CldComponentInstallerTraits()); // |cus| will take ownership of |installer| during installer->Register(cus). DefaultComponentInstaller* installer = diff --git a/chrome/browser/component_updater/cld_component_installer.h b/chrome/browser/component_updater/cld_component_installer.h index 7a279761c845c6..32a04fc93c3da3 100644 --- a/chrome/browser/component_updater/cld_component_installer.h +++ b/chrome/browser/component_updater/cld_component_installer.h @@ -49,7 +49,7 @@ class CldComponentInstallerTraits : public ComponentInstallerTraits { const base::FilePath& install_dir) const override; void ComponentReady(const base::Version& version, const base::FilePath& path, - scoped_ptr manifest) override; + std::unique_ptr manifest) override; base::FilePath GetBaseDirectory() const override; void GetHash(std::vector* hash) const override; std::string GetName() const override; diff --git a/chrome/browser/component_updater/cld_component_installer_unittest.cc b/chrome/browser/component_updater/cld_component_installer_unittest.cc index 97ceb443741306..5cf6e4834b092f 100644 --- a/chrome/browser/component_updater/cld_component_installer_unittest.cc +++ b/chrome/browser/component_updater/cld_component_installer_unittest.cc @@ -6,6 +6,8 @@ #include #include + +#include #include #include @@ -13,7 +15,6 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" @@ -125,7 +126,7 @@ TEST_F(CldComponentInstallerTest, GetName) { } TEST_F(CldComponentInstallerTest, ComponentReady) { - scoped_ptr manifest; + std::unique_ptr manifest; const base::FilePath install_dir(FILE_PATH_LITERAL("/foo")); const base::Version version("1.2.3.4"); traits_.ComponentReady(version, install_dir, std::move(manifest)); diff --git a/chrome/browser/component_updater/component_installers_unittest.cc b/chrome/browser/component_updater/component_installers_unittest.cc index e56b51cc278679..aefce5ff205e52 100644 --- a/chrome/browser/component_updater/component_installers_unittest.cc +++ b/chrome/browser/component_updater/component_installers_unittest.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/json/json_file_value_serializer.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/path_service.h" #include "base/version.h" @@ -15,7 +16,6 @@ #include "chrome/common/pepper_flash.h" #include "content/public/test/test_browser_thread.h" #include "ppapi/shared_impl/test_globals.h" - #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; @@ -75,7 +75,7 @@ TEST(ComponentInstallerTest, PepperFlashCheck) { JSONFileValueDeserializer deserializer(manifest); std::string error; - scoped_ptr root = + std::unique_ptr root = base::DictionaryValue::From(deserializer.Deserialize(NULL, &error)); ASSERT_TRUE(root); diff --git a/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc b/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc index 64257ac1b07b1c..72ff040d56c721 100644 --- a/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc +++ b/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc @@ -30,7 +30,7 @@ class PatchHost : public content::UtilityProcessHostClient { PatchHost(base::Callback callback, scoped_refptr task_runner); - void StartProcess(scoped_ptr message); + void StartProcess(std::unique_ptr message); private: ~PatchHost() override; @@ -54,7 +54,7 @@ PatchHost::PatchHost(base::Callback callback, PatchHost::~PatchHost() { } -void PatchHost::StartProcess(scoped_ptr message) { +void PatchHost::StartProcess(std::unique_ptr message) { // The DeltaUpdateOpPatchHost is not responsible for deleting the // UtilityProcessHost object. content::UtilityProcessHost* host = content::UtilityProcessHost::Create( @@ -102,7 +102,7 @@ void ChromeOutOfProcessPatcher::Patch( const base::FilePath& output_abs_path, base::Callback callback) { host_ = new PatchHost(callback, task_runner); - scoped_ptr patch_message; + std::unique_ptr patch_message; if (operation == update_client::kBsdiff) { patch_message.reset(new ChromeUtilityMsg_PatchFileBsdiff( input_abs_path, patch_abs_path, output_abs_path)); diff --git a/chrome/browser/component_updater/ev_whitelist_component_installer.cc b/chrome/browser/component_updater/ev_whitelist_component_installer.cc index c54361164891c4..8007b5affd1a23 100644 --- a/chrome/browser/component_updater/ev_whitelist_component_installer.cc +++ b/chrome/browser/component_updater/ev_whitelist_component_installer.cc @@ -98,7 +98,7 @@ base::FilePath EVWhitelistComponentInstallerTraits::GetInstalledPath( void EVWhitelistComponentInstallerTraits::ComponentReady( const base::Version& version, const base::FilePath& install_dir, - scoped_ptr manifest) { + std::unique_ptr manifest) { VLOG(1) << "Component ready, version " << version.GetString() << " in " << install_dir.value(); @@ -140,7 +140,7 @@ void RegisterEVWhitelistComponent(ComponentUpdateService* cus, const base::FilePath& user_data_dir) { VLOG(1) << "Registering EV whitelist component."; - scoped_ptr traits( + std::unique_ptr traits( new EVWhitelistComponentInstallerTraits()); // |cus| will take ownership of |installer| during installer->Register(cus). DefaultComponentInstaller* installer = diff --git a/chrome/browser/component_updater/ev_whitelist_component_installer.h b/chrome/browser/component_updater/ev_whitelist_component_installer.h index 99b5d18c60aac7..72a1382b5d0d3f 100644 --- a/chrome/browser/component_updater/ev_whitelist_component_installer.h +++ b/chrome/browser/component_updater/ev_whitelist_component_installer.h @@ -37,7 +37,7 @@ class EVWhitelistComponentInstallerTraits : public ComponentInstallerTraits { const base::FilePath& install_dir) const override; void ComponentReady(const base::Version& version, const base::FilePath& install_dir, - scoped_ptr manifest) override; + std::unique_ptr manifest) override; base::FilePath GetBaseDirectory() const override; void GetHash(std::vector* hash) const override; std::string GetName() const override; diff --git a/chrome/browser/component_updater/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl_component_installer.cc index 1eec3895b89f9d..9319cf9d56d3ba 100644 --- a/chrome/browser/component_updater/pnacl_component_installer.cc +++ b/chrome/browser/component_updater/pnacl_component_installer.cc @@ -128,7 +128,7 @@ bool GetLatestPnaclDirectory(const scoped_refptr& pci, base::DictionaryValue* ReadJSONManifest(const base::FilePath& manifest_path) { JSONFileValueDeserializer deserializer(manifest_path); std::string error; - scoped_ptr root = deserializer.Deserialize(NULL, &error); + std::unique_ptr root = deserializer.Deserialize(NULL, &error); if (!root.get()) return NULL; if (!root->IsType(base::Value::TYPE_DICTIONARY)) @@ -227,7 +227,7 @@ base::FilePath PnaclComponentInstaller::GetPnaclBaseDirectory() { bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest, const base::FilePath& unpack_path) { - scoped_ptr pnacl_manifest( + std::unique_ptr pnacl_manifest( ReadPnaclManifest(unpack_path)); if (pnacl_manifest == NULL) { LOG(WARNING) << "Failed to read pnacl manifest."; @@ -329,8 +329,10 @@ void StartPnaclUpdateRegistration( std::string current_fingerprint; std::vector older_dirs; if (GetLatestPnaclDirectory(pci, &path, ¤t_version, &older_dirs)) { - scoped_ptr manifest(ReadComponentManifest(path)); - scoped_ptr pnacl_manifest(ReadPnaclManifest(path)); + std::unique_ptr manifest( + ReadComponentManifest(path)); + std::unique_ptr pnacl_manifest( + ReadPnaclManifest(path)); Version manifest_version; // Check that the component manifest and PNaCl manifest files // are legit, and that the indicated version matches the one diff --git a/chrome/browser/component_updater/pnacl_component_installer.h b/chrome/browser/component_updater/pnacl_component_installer.h index 5b7e3cdb6a4c9d..5e44209c4ea272 100644 --- a/chrome/browser/component_updater/pnacl_component_installer.h +++ b/chrome/browser/component_updater/pnacl_component_installer.h @@ -6,13 +6,13 @@ #define CHROME_BROWSER_COMPONENT_UPDATER_PNACL_COMPONENT_INSTALLER_H_ #include +#include #include #include "base/callback.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/version.h" #include "components/update_client/update_client.h" diff --git a/chrome/browser/component_updater/recovery_component_installer.cc b/chrome/browser/component_updater/recovery_component_installer.cc index 41c61b370d4c5f..26660c97006dc6 100644 --- a/chrome/browser/component_updater/recovery_component_installer.cc +++ b/chrome/browser/component_updater/recovery_component_installer.cc @@ -5,6 +5,8 @@ #include "chrome/browser/component_updater/recovery_component_installer.h" #include + +#include #include #include "base/base_paths.h" @@ -14,7 +16,6 @@ #include "base/files/file_util.h" #include "base/json/json_file_value_serializer.h" #include "base/logging.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/process/kill.h" @@ -115,7 +116,8 @@ base::CommandLine GetRecoveryInstallCommandLine( } #if defined(OS_WIN) -scoped_ptr ReadManifest(const base::FilePath& manifest) { +std::unique_ptr ReadManifest( + const base::FilePath& manifest) { JSONFileValueDeserializer deserializer(manifest); std::string error; return base::DictionaryValue::From(deserializer.Deserialize(NULL, &error)); @@ -142,7 +144,7 @@ void DoElevatedInstallRecoveryComponent(const base::FilePath& path) { if (!base::PathExists(main_file) || !base::PathExists(manifest_file)) return; - scoped_ptr manifest(ReadManifest(manifest_file)); + std::unique_ptr manifest(ReadManifest(manifest_file)); std::string name; manifest->GetStringASCII("name", &name); if (name != kRecoveryManifestName) diff --git a/chrome/browser/component_updater/sth_set_component_installer.cc b/chrome/browser/component_updater/sth_set_component_installer.cc index 6c63be4e07269c..fc393ceff3dc20 100644 --- a/chrome/browser/component_updater/sth_set_component_installer.cc +++ b/chrome/browser/component_updater/sth_set_component_installer.cc @@ -49,7 +49,7 @@ const uint8_t kPublicKeySHA256[32] = { const char kSTHSetFetcherManifestName[] = "Signed Tree Heads"; STHSetComponentInstallerTraits::STHSetComponentInstallerTraits( - scoped_ptr sth_observer) + std::unique_ptr sth_observer) : sth_observer_(std::move(sth_observer)) {} STHSetComponentInstallerTraits::~STHSetComponentInstallerTraits() {} @@ -72,7 +72,7 @@ bool STHSetComponentInstallerTraits::OnCustomInstall( void STHSetComponentInstallerTraits::ComponentReady( const base::Version& version, const base::FilePath& install_dir, - scoped_ptr manifest) { + std::unique_ptr manifest) { if (!content::BrowserThread::PostBlockingPoolTask( FROM_HERE, base::Bind(&STHSetComponentInstallerTraits::LoadSTHsFromDisk, @@ -156,7 +156,7 @@ void STHSetComponentInstallerTraits::LoadSTHsFromDisk( void STHSetComponentInstallerTraits::OnJsonParseSuccess( const std::string& log_id, - scoped_ptr parsed_json) { + std::unique_ptr parsed_json) { net::ct::SignedTreeHead signed_tree_head; DVLOG(1) << "STH parsing success for log: " << base::HexEncode(log_id.data(), log_id.length()); @@ -187,10 +187,10 @@ void RegisterSTHSetComponent(ComponentUpdateService* cus, // TODO(eranm): The next step in auditing CT logs (crbug.com/506227) is to // pass the distributor to the IOThread so it can be used in a per-profile // context for checking inclusion of SCTs. - scoped_ptr distributor( + std::unique_ptr distributor( new net::ct::STHDistributor()); - scoped_ptr traits( + std::unique_ptr traits( new STHSetComponentInstallerTraits(std::move(distributor))); // |cus| will take ownership of |installer| during installer->Register(cus). DefaultComponentInstaller* installer = diff --git a/chrome/browser/component_updater/sth_set_component_installer.h b/chrome/browser/component_updater/sth_set_component_installer.h index d02061f05f010f..ba3df76981b540 100644 --- a/chrome/browser/component_updater/sth_set_component_installer.h +++ b/chrome/browser/component_updater/sth_set_component_installer.h @@ -7,11 +7,11 @@ #include +#include #include #include #include "base/gtest_prod_util.h" -#include "base/memory/scoped_ptr.h" #include "components/component_updater/default_component_installer.h" namespace base { @@ -41,7 +41,7 @@ class STHSetComponentInstallerTraits : public ComponentInstallerTraits { public: // The |sth_distributor| will be notified each time a new STH is observed. explicit STHSetComponentInstallerTraits( - scoped_ptr sth_observer); + std::unique_ptr sth_observer); ~STHSetComponentInstallerTraits() override; private: @@ -56,7 +56,7 @@ class STHSetComponentInstallerTraits : public ComponentInstallerTraits { const base::FilePath& install_dir) const override; void ComponentReady(const base::Version& version, const base::FilePath& install_dir, - scoped_ptr manifest) override; + std::unique_ptr manifest) override; base::FilePath GetBaseDirectory() const override; void GetHash(std::vector* hash) const override; std::string GetName() const override; @@ -68,12 +68,12 @@ class STHSetComponentInstallerTraits : public ComponentInstallerTraits { // Handle successful parsing of JSON by distributing the new STH. void OnJsonParseSuccess(const std::string& log_id, - scoped_ptr parsed_json); + std::unique_ptr parsed_json); // STH parsing failed - do nothing. void OnJsonParseError(const std::string& log_id, const std::string& error); - scoped_ptr sth_observer_; + std::unique_ptr sth_observer_; DISALLOW_COPY_AND_ASSIGN(STHSetComponentInstallerTraits); }; diff --git a/chrome/browser/component_updater/sth_set_component_installer_unittest.cc b/chrome/browser/component_updater/sth_set_component_installer_unittest.cc index 4f2480b47e8cc7..5b6b1014df1737 100644 --- a/chrome/browser/component_updater/sth_set_component_installer_unittest.cc +++ b/chrome/browser/component_updater/sth_set_component_installer_unittest.cc @@ -5,13 +5,13 @@ #include "chrome/browser/component_updater/sth_set_component_installer.h" #include +#include #include #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -44,7 +44,7 @@ class STHSetComponentInstallerTest : public PlatformTest { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - scoped_ptr observer(new StoringSTHObserver()); + std::unique_ptr observer(new StoringSTHObserver()); observer_ = observer.get(); traits_.reset(new STHSetComponentInstallerTraits(std::move(observer))); } @@ -82,7 +82,7 @@ class STHSetComponentInstallerTest : public PlatformTest { content::TestBrowserThreadBundle thread_bundle_; base::ScopedTempDir temp_dir_; - scoped_ptr traits_; + std::unique_ptr traits_; StoringSTHObserver* observer_; safe_json::TestingJsonParser::ScopedFactoryOverride factory_override_; diff --git a/chrome/browser/component_updater/supervised_user_whitelist_installer.cc b/chrome/browser/component_updater/supervised_user_whitelist_installer.cc index 323bfbc94241cb..1636411f545325 100644 --- a/chrome/browser/component_updater/supervised_user_whitelist_installer.cc +++ b/chrome/browser/component_updater/supervised_user_whitelist_installer.cc @@ -5,6 +5,7 @@ #include "chrome/browser/component_updater/supervised_user_whitelist_installer.h" #include + #include #include @@ -16,6 +17,7 @@ #include "base/files/important_file_writer.h" #include "base/location.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" @@ -254,7 +256,7 @@ class SupervisedUserWhitelistComponentInstallerTraits const base::FilePath& install_dir) override; void ComponentReady(const base::Version& version, const base::FilePath& install_dir, - scoped_ptr manifest) override; + std::unique_ptr manifest) override; base::FilePath GetBaseDirectory() const override; void GetHash(std::vector* hash) const override; std::string GetName() const override; @@ -294,7 +296,7 @@ bool SupervisedUserWhitelistComponentInstallerTraits::OnCustomInstall( void SupervisedUserWhitelistComponentInstallerTraits::ComponentReady( const base::Version& version, const base::FilePath& install_dir, - scoped_ptr manifest) { + std::unique_ptr manifest) { // TODO(treib): Before getting the title, we should localize the manifest // using extension_l10n_util::LocalizeExtension, but that doesn't exist on // Android. crbug.com/558387 @@ -392,7 +394,7 @@ void SupervisedUserWhitelistInstallerImpl::RegisterComponent( const std::string& crx_id, const std::string& name, const base::Closure& callback) { - scoped_ptr traits( + std::unique_ptr traits( new SupervisedUserWhitelistComponentInstallerTraits( crx_id, name, base::Bind(&SupervisedUserWhitelistInstallerImpl::OnRawWhitelistReady, @@ -582,12 +584,12 @@ void SupervisedUserWhitelistInstallerImpl::OnProfileWillBeRemoved( } // namespace // static -scoped_ptr +std::unique_ptr SupervisedUserWhitelistInstaller::Create( ComponentUpdateService* cus, ProfileAttributesStorage* profile_attributes_storage, PrefService* local_state) { - return make_scoped_ptr(new SupervisedUserWhitelistInstallerImpl( + return base::WrapUnique(new SupervisedUserWhitelistInstallerImpl( cus, profile_attributes_storage, local_state)); } diff --git a/chrome/browser/component_updater/supervised_user_whitelist_installer.h b/chrome/browser/component_updater/supervised_user_whitelist_installer.h index 47ea4c669bfe53..5137442bbb7278 100644 --- a/chrome/browser/component_updater/supervised_user_whitelist_installer.h +++ b/chrome/browser/component_updater/supervised_user_whitelist_installer.h @@ -7,12 +7,12 @@ #include +#include #include #include #include #include "base/callback_forward.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" namespace base { @@ -38,7 +38,7 @@ class SupervisedUserWhitelistInstaller { virtual ~SupervisedUserWhitelistInstaller() {} - static scoped_ptr Create( + static std::unique_ptr Create( ComponentUpdateService* cus, ProfileAttributesStorage* profile_attributes_storage, PrefService* local_state); diff --git a/chrome/browser/component_updater/supervised_user_whitelist_installer_unittest.cc b/chrome/browser/component_updater/supervised_user_whitelist_installer_unittest.cc index a45fb3a374e5d6..81ab714fb69317 100644 --- a/chrome/browser/component_updater/supervised_user_whitelist_installer_unittest.cc +++ b/chrome/browser/component_updater/supervised_user_whitelist_installer_unittest.cc @@ -151,7 +151,7 @@ class MockComponentUpdateService : public ComponentUpdateService, private: scoped_refptr task_runner_; - scoped_ptr component_; + std::unique_ptr component_; base::Closure registration_callback_; bool on_demand_update_called_; }; @@ -228,21 +228,22 @@ class SupervisedUserWhitelistInstallerTest : public testing::Test { whitelist_path_ = installed_whitelist_directory_.AppendASCII(crx_id + ".json"); - scoped_ptr whitelist_dict( + std::unique_ptr whitelist_dict( new base::DictionaryValue); whitelist_dict->SetString("sites", kWhitelistFile); manifest_.Set("whitelisted_content", whitelist_dict.release()); large_icon_path_ = whitelist_version_directory_.AppendASCII(kLargeIconFile); - scoped_ptr icons_dict(new base::DictionaryValue); + std::unique_ptr icons_dict( + new base::DictionaryValue); icons_dict->SetString("128", kLargeIconFile); manifest_.Set("icons", icons_dict.release()); manifest_.SetString("version", kVersion); - scoped_ptr crx_dict(new base::DictionaryValue); + std::unique_ptr crx_dict(new base::DictionaryValue); crx_dict->SetString("name", kName); - scoped_ptr clients(new base::ListValue); + std::unique_ptr clients(new base::ListValue); clients->AppendString(kClientId); clients->AppendString(kOtherClientId); crx_dict->Set("clients", clients.release()); @@ -293,7 +294,7 @@ class SupervisedUserWhitelistInstallerTest : public testing::Test { safe_json::TestingJsonParser::ScopedFactoryOverride json_parser_override_; MockComponentUpdateService component_update_service_; TestingPrefServiceSimple local_state_; - scoped_ptr installer_; + std::unique_ptr installer_; base::FilePath whitelist_base_directory_; base::FilePath whitelist_directory_; base::FilePath whitelist_version_directory_; diff --git a/chrome/browser/component_updater/sw_reporter_installer_win.cc b/chrome/browser/component_updater/sw_reporter_installer_win.cc index 7d930fcd8b2ea4..d3ffde39f662ff 100644 --- a/chrome/browser/component_updater/sw_reporter_installer_win.cc +++ b/chrome/browser/component_updater/sw_reporter_installer_win.cc @@ -122,9 +122,10 @@ class SwReporterInstallerTraits : public ComponentInstallerTraits { return true; } - void ComponentReady(const base::Version& version, - const base::FilePath& install_dir, - scoped_ptr manifest) override { + void ComponentReady( + const base::Version& version, + const base::FilePath& install_dir, + std::unique_ptr manifest) override { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); safe_browsing::RunSwReporter(install_dir.Append(kSwReporterExeName), version, base::ThreadTaskRunnerHandle::Get(), @@ -240,7 +241,8 @@ void RegisterSwReporterComponent(ComponentUpdateService* cus) { } // Install the component. - scoped_ptr traits(new SwReporterInstallerTraits()); + std::unique_ptr traits( + new SwReporterInstallerTraits()); // |cus| will take ownership of |installer| during installer->Register(cus). DefaultComponentInstaller* installer = new DefaultComponentInstaller(std::move(traits)); diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc index 8458acfc937423..134abb75348b10 100644 --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc @@ -200,9 +200,10 @@ void GetAdditionalParams(const base::DictionaryValue& manifest, } } -void RegisterWidevineCdmWithChrome(const base::Version& cdm_version, - const base::FilePath& adapter_install_path, - scoped_ptr manifest) { +void RegisterWidevineCdmWithChrome( + const base::Version& cdm_version, + const base::FilePath& adapter_install_path, + std::unique_ptr manifest) { DCHECK_CURRENTLY_ON(BrowserThread::UI); std::vector additional_param_names; std::vector additional_param_values; @@ -242,10 +243,9 @@ class WidevineCdmComponentInstallerTraits : public ComponentInstallerTraits { bool VerifyInstallation( const base::DictionaryValue& manifest, const base::FilePath& install_dir) const override; - void ComponentReady( - const base::Version& version, - const base::FilePath& path, - scoped_ptr manifest) override; + void ComponentReady(const base::Version& version, + const base::FilePath& path, + std::unique_ptr manifest) override; base::FilePath GetBaseDirectory() const override; void GetHash(std::vector* hash) const override; std::string GetName() const override; @@ -258,7 +258,7 @@ class WidevineCdmComponentInstallerTraits : public ComponentInstallerTraits { // VerifyInstallation). void UpdateCdmAdapter(const base::Version& cdm_version, const base::FilePath& cdm_install_dir, - scoped_ptr manifest); + std::unique_ptr manifest); DISALLOW_COPY_AND_ASSIGN(WidevineCdmComponentInstallerTraits); }; @@ -284,7 +284,7 @@ bool WidevineCdmComponentInstallerTraits::OnCustomInstall( void WidevineCdmComponentInstallerTraits::ComponentReady( const base::Version& version, const base::FilePath& path, - scoped_ptr manifest) { + std::unique_ptr manifest) { if (!IsCompatibleWithChrome(*manifest)) { VLOG(1) << "Installed Widevine CDM component is incompatible."; return; @@ -331,7 +331,7 @@ std::string WidevineCdmComponentInstallerTraits::GetAp() const { void WidevineCdmComponentInstallerTraits::UpdateCdmAdapter( const base::Version& cdm_version, const base::FilePath& cdm_install_dir, - scoped_ptr manifest) { + std::unique_ptr manifest) { const base::FilePath adapter_version_path = GetPlatformDirectory(cdm_install_dir).AppendASCII(kCdmAdapterVersionName); const base::FilePath adapter_install_path = @@ -380,7 +380,7 @@ void RegisterWidevineCdmComponent(ComponentUpdateService* cus) { PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &adapter_source_path); if (!base::PathExists(adapter_source_path)) return; - scoped_ptr traits( + std::unique_ptr traits( new WidevineCdmComponentInstallerTraits); // |cus| will take ownership of |installer| during installer->Register(cus). DefaultComponentInstaller* installer = diff --git a/chrome/browser/content_settings/chrome_content_settings_client.cc b/chrome/browser/content_settings/chrome_content_settings_client.cc index 40c49f75a35dd0..26666c6e855bc0 100644 --- a/chrome/browser/content_settings/chrome_content_settings_client.cc +++ b/chrome/browser/content_settings/chrome_content_settings_client.cc @@ -74,7 +74,7 @@ ChromeContentSettingsClient::local_shared_objects(AccessType type) const { return blocked_local_shared_objects_; } -scoped_ptr +std::unique_ptr ChromeContentSettingsClient::CreateCookiesTreeModel(AccessType type) const { switch (type) { case ALLOWED: @@ -85,7 +85,7 @@ ChromeContentSettingsClient::CreateCookiesTreeModel(AccessType type) const { // Some compilers don't believe this is not reachable, so let's return a dummy // value. NOTREACHED(); - return scoped_ptr(); + return std::unique_ptr(); } ChromeContentSettingsClient::ChromeContentSettingsClient( diff --git a/chrome/browser/content_settings/chrome_content_settings_client.h b/chrome/browser/content_settings/chrome_content_settings_client.h index 3e33275cce89a6..6fdf9f164afca8 100644 --- a/chrome/browser/content_settings/chrome_content_settings_client.h +++ b/chrome/browser/content_settings/chrome_content_settings_client.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_ #define CHROME_BROWSER_CONTENT_SETTINGS_CHROME_CONTENT_SETTINGS_CLIENT_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/browsing_data/cookies_tree_model.h" #include "chrome/browser/content_settings/local_shared_objects_container.h" #include "components/content_settings/core/browser/content_settings_client.h" @@ -45,7 +46,8 @@ class ChromeContentSettingsClient // Creates a new copy of a CookiesTreeModel for all allowed (or blocked, // depending on |type|) local shared objects. - scoped_ptr CreateCookiesTreeModel(AccessType type) const; + std::unique_ptr CreateCookiesTreeModel( + AccessType type) const; private: friend class content::WebContentsUserData; diff --git a/chrome/browser/content_settings/content_settings_default_provider_unittest.cc b/chrome/browser/content_settings/content_settings_default_provider_unittest.cc index 6283f11afbede2..cba972c14ae14e 100644 --- a/chrome/browser/content_settings/content_settings_default_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_default_provider_unittest.cc @@ -2,7 +2,8 @@ // 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 + #include "base/message_loop/message_loop.h" #include "chrome/browser/content_settings/content_settings_mock_observer.h" #include "chrome/common/pref_names.h" @@ -68,7 +69,7 @@ TEST_F(DefaultProviderTest, DefaultValues) { CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string(), false)); - scoped_ptr value(TestUtils::GetContentSettingValue( + std::unique_ptr value(TestUtils::GetContentSettingValue( &provider_, GURL("http://example.com/"), GURL("http://example.com/"), CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, std::string(), false)); EXPECT_FALSE(value.get()); @@ -82,7 +83,7 @@ TEST_F(DefaultProviderTest, IgnoreNonDefaultSettings) { TestUtils::GetContentSetting(&provider_, primary_url, secondary_url, CONTENT_SETTINGS_TYPE_COOKIES, std::string(), false)); - scoped_ptr value( + std::unique_ptr value( new base::FundamentalValue(CONTENT_SETTING_BLOCK)); bool owned = provider_.SetWebsiteSetting( ContentSettingsPattern::FromURL(primary_url), @@ -182,7 +183,7 @@ TEST_F(DefaultProviderTest, OffTheRecord) { std::string(), true /* include_incognito */)); // Changing content settings on the incognito provider should be ignored. - scoped_ptr value( + std::unique_ptr value( new base::FundamentalValue(CONTENT_SETTING_ALLOW)); bool owned = otr_provider.SetWebsiteSetting( ContentSettingsPattern::Wildcard(), diff --git a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc index 0a5891eb1534c3..239039fcb3651e 100644 --- a/chrome/browser/content_settings/content_settings_internal_extension_provider.cc +++ b/chrome/browser/content_settings/content_settings_internal_extension_provider.cc @@ -63,7 +63,7 @@ InternalExtensionProvider::~InternalExtensionProvider() { DCHECK(!registrar_.get()); } -scoped_ptr InternalExtensionProvider::GetRuleIterator( +std::unique_ptr InternalExtensionProvider::GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, bool incognito) const { @@ -195,7 +195,7 @@ void InternalExtensionProvider::SetContentSettingForExtensionAndResource( const extensions::Extension* extension, const ResourceIdentifier& resource, ContentSetting setting) { - scoped_ptr pattern_builder( + std::unique_ptr pattern_builder( ContentSettingsPattern::CreateBuilder(false)); pattern_builder->WithScheme(extensions::kExtensionScheme); pattern_builder->WithHost(extension->id()); diff --git a/chrome/browser/content_settings/content_settings_internal_extension_provider.h b/chrome/browser/content_settings/content_settings_internal_extension_provider.h index 39ca41d76cb5e8..c38383a826790d 100644 --- a/chrome/browser/content_settings/content_settings_internal_extension_provider.h +++ b/chrome/browser/content_settings/content_settings_internal_extension_provider.h @@ -5,11 +5,11 @@ #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_INTERNAL_EXTENSION_PROVIDER_H_ #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_INTERNAL_EXTENSION_PROVIDER_H_ +#include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" #include "components/content_settings/core/browser/content_settings_observable_provider.h" #include "components/content_settings/core/browser/content_settings_origin_identifier_value_map.h" @@ -37,7 +37,7 @@ class InternalExtensionProvider : public ObservableProvider, ~InternalExtensionProvider() override; // ProviderInterface methods: - scoped_ptr GetRuleIterator( + std::unique_ptr GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, bool incognito) const override; @@ -80,7 +80,7 @@ class InternalExtensionProvider : public ObservableProvider, // Used around accesses to the |value_map_| list to guarantee thread safety. mutable base::Lock lock_; - scoped_ptr registrar_; + std::unique_ptr registrar_; // Extension IDs used by the Chrome Remote Desktop app. std::set chrome_remote_desktop_; diff --git a/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc b/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc index 96bcc4ef8f026d..7ac0d445d62325 100644 --- a/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc +++ b/chrome/browser/content_settings/content_settings_origin_identifier_value_map_unittest.cc @@ -4,7 +4,8 @@ #include "components/content_settings/core/browser/content_settings_origin_identifier_value_map.h" -#include "base/memory/scoped_ptr.h" +#include + #include "base/values.h" #include "components/content_settings/core/browser/content_settings_rule.h" #include "components/content_settings/core/browser/content_settings_utils.h" @@ -25,7 +26,7 @@ TEST(OriginIdentifierValueMapTest, SetGetValue) { std::string(), new base::FundamentalValue(1)); - scoped_ptr expected_value(new base::FundamentalValue(1)); + std::unique_ptr expected_value(new base::FundamentalValue(1)); EXPECT_TRUE(expected_value->Equals(map.GetValue(GURL("http://www.google.com"), GURL("http://www.google.com"), CONTENT_SETTINGS_TYPE_COOKIES, @@ -172,7 +173,7 @@ TEST(OriginIdentifierValueMapTest, ListEntryPrecedences) { TEST(OriginIdentifierValueMapTest, IterateEmpty) { content_settings::OriginIdentifierValueMap map; - scoped_ptr rule_iterator( + std::unique_ptr rule_iterator( map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, std::string(), NULL)); EXPECT_FALSE(rule_iterator->HasNext()); } @@ -195,7 +196,7 @@ TEST(OriginIdentifierValueMapTest, IterateNonempty) { std::string(), new base::FundamentalValue(2)); - scoped_ptr rule_iterator( + std::unique_ptr rule_iterator( map.GetRuleIterator(CONTENT_SETTINGS_TYPE_COOKIES, std::string(), NULL)); ASSERT_TRUE(rule_iterator->HasNext()); content_settings::Rule rule = rule_iterator->Next(); diff --git a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc index 5ed0ab45775a95..f287af6eb1d1e0 100644 --- a/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_policy_provider_unittest.cc @@ -4,11 +4,11 @@ #include "components/content_settings/core/browser/content_settings_policy_provider.h" +#include #include #include "base/auto_reset.h" #include "base/command_line.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "chrome/browser/content_settings/content_settings_mock_observer.h" #include "chrome/common/chrome_switches.h" @@ -43,11 +43,8 @@ TEST_F(PolicyProviderTest, DefaultGeolocationContentSetting) { Rules rules; - scoped_ptr rule_iterator( - provider.GetRuleIterator( - CONTENT_SETTINGS_TYPE_GEOLOCATION, - std::string(), - false)); + std::unique_ptr rule_iterator(provider.GetRuleIterator( + CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string(), false)); EXPECT_FALSE(rule_iterator->HasNext()); // Change the managed value of the default geolocation setting @@ -76,11 +73,8 @@ TEST_F(PolicyProviderTest, ManagedDefaultContentSettings) { prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, new base::FundamentalValue(CONTENT_SETTING_BLOCK)); - scoped_ptr rule_iterator( - provider.GetRuleIterator( - CONTENT_SETTINGS_TYPE_PLUGINS, - std::string(), - false)); + std::unique_ptr rule_iterator(provider.GetRuleIterator( + CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), false)); EXPECT_TRUE(rule_iterator->HasNext()); Rule rule = rule_iterator->Next(); EXPECT_FALSE(rule_iterator->HasNext()); @@ -152,7 +146,7 @@ TEST_F(PolicyProviderTest, GettingManagedContentSettings) { TestUtils::GetContentSetting(&provider, google_url, google_url, CONTENT_SETTINGS_TYPE_IMAGES, std::string(), false)); - scoped_ptr value_ptr(TestUtils::GetContentSettingValue( + std::unique_ptr value_ptr(TestUtils::GetContentSettingValue( &provider, google_url, google_url, CONTENT_SETTINGS_TYPE_IMAGES, std::string(), false)); @@ -163,7 +157,7 @@ TEST_F(PolicyProviderTest, GettingManagedContentSettings) { // The PolicyProvider does not allow setting content settings as they are // enforced via policies and not set by the user or extension. So a call to // SetWebsiteSetting does nothing. - scoped_ptr value_block( + std::unique_ptr value_block( new base::FundamentalValue(CONTENT_SETTING_BLOCK)); bool owned = provider.SetWebsiteSetting(yt_url_pattern, yt_url_pattern, @@ -241,7 +235,7 @@ TEST_F(PolicyProviderTest, AutoSelectCertificateList) { &provider, youtube_url, youtube_url, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, std::string(), false)); - scoped_ptr cert_filter(TestUtils::GetContentSettingValue( + std::unique_ptr cert_filter(TestUtils::GetContentSettingValue( &provider, google_url, google_url, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, std::string(), false)); diff --git a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc index 7bd4b66a376398..0d31af2948bcd1 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc @@ -4,10 +4,12 @@ #include "components/content_settings/core/browser/content_settings_pref_provider.h" +#include + #include "base/auto_reset.h" #include "base/command_line.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/test/simple_test_clock.h" #include "base/threading/platform_thread.h" @@ -160,11 +162,11 @@ TEST_F(PrefProviderTest, Incognito) { chrome::RegisterUserProfilePrefs(otr_registry.get()); TestingProfile::Builder profile_builder; - profile_builder.SetPrefService(make_scoped_ptr(regular_prefs)); - scoped_ptr profile = profile_builder.Build(); + profile_builder.SetPrefService(base::WrapUnique(regular_prefs)); + std::unique_ptr profile = profile_builder.Build(); TestingProfile::Builder otr_profile_builder; - otr_profile_builder.SetPrefService(make_scoped_ptr(otr_prefs)); + otr_profile_builder.SetPrefService(base::WrapUnique(otr_prefs)); otr_profile_builder.BuildIncognito(profile.get()); PrefProvider pref_content_settings_provider(regular_prefs, false); @@ -224,7 +226,7 @@ TEST_F(PrefProviderTest, GetContentSettingsValue) { TestUtils::GetContentSetting(&provider, primary_url, primary_url, CONTENT_SETTINGS_TYPE_IMAGES, std::string(), false)); - scoped_ptr value_ptr(TestUtils::GetContentSettingValue( + std::unique_ptr value_ptr(TestUtils::GetContentSettingValue( &provider, primary_url, primary_url, CONTENT_SETTINGS_TYPE_IMAGES, std::string(), false)); int int_value = -1; @@ -376,7 +378,7 @@ TEST_F(PrefProviderTest, LastUsage) { test_clock->SetNow(base::Time::Now()); pref_content_settings_provider.SetClockForTesting( - scoped_ptr(test_clock)); + std::unique_ptr(test_clock)); GURL host("http://example.com/"); ContentSettingsPattern pattern = ContentSettingsPattern::FromString("[*.]example.com"); @@ -413,7 +415,7 @@ TEST_F(PrefProviderTest, IncognitoInheritsValueMap) { ContentSettingsPattern::FromString("www.google.com"); ContentSettingsPattern wildcard = ContentSettingsPattern::FromString("*"); - scoped_ptr value( + std::unique_ptr value( new base::FundamentalValue(CONTENT_SETTING_ALLOW)); // Create a normal provider and set a setting. @@ -426,7 +428,7 @@ TEST_F(PrefProviderTest, IncognitoInheritsValueMap) { // Non-OTR provider, Non-OTR iterator has one setting (pattern 1). { - scoped_ptr it(normal_provider.GetRuleIterator( + std::unique_ptr it(normal_provider.GetRuleIterator( CONTENT_SETTINGS_TYPE_IMAGES, std::string(), false)); EXPECT_TRUE(it->HasNext()); EXPECT_EQ(pattern_1, it->Next().primary_pattern); @@ -435,7 +437,7 @@ TEST_F(PrefProviderTest, IncognitoInheritsValueMap) { // Non-OTR provider, OTR iterator has no settings. { - scoped_ptr it(normal_provider.GetRuleIterator( + std::unique_ptr it(normal_provider.GetRuleIterator( CONTENT_SETTINGS_TYPE_IMAGES, std::string(), true)); EXPECT_FALSE(it->HasNext()); } @@ -450,7 +452,7 @@ TEST_F(PrefProviderTest, IncognitoInheritsValueMap) { // OTR provider, non-OTR iterator has one setting (pattern 1). { - scoped_ptr it(incognito_provider.GetRuleIterator( + std::unique_ptr it(incognito_provider.GetRuleIterator( CONTENT_SETTINGS_TYPE_IMAGES, std::string(), false)); EXPECT_TRUE(it->HasNext()); EXPECT_EQ(pattern_1, it->Next().primary_pattern); @@ -459,7 +461,7 @@ TEST_F(PrefProviderTest, IncognitoInheritsValueMap) { // OTR provider, OTR iterator has one setting (pattern 2). { - scoped_ptr it(incognito_provider.GetRuleIterator( + std::unique_ptr it(incognito_provider.GetRuleIterator( CONTENT_SETTINGS_TYPE_IMAGES, std::string(), true)); EXPECT_TRUE(it->HasNext()); EXPECT_EQ(pattern_2, it->Next().primary_pattern); @@ -478,7 +480,7 @@ TEST_F(PrefProviderTest, ClearAllContentSettingsRules) { ContentSettingsPattern::FromString("google.com"); ContentSettingsPattern wildcard = ContentSettingsPattern::FromString("*"); - scoped_ptr value( + std::unique_ptr value( new base::FundamentalValue(CONTENT_SETTING_ALLOW)); ResourceIdentifier res_id("abcde"); diff --git a/chrome/browser/content_settings/content_settings_supervised_provider.cc b/chrome/browser/content_settings/content_settings_supervised_provider.cc index 6a199a5f8a03bf..75cfcd21d8b811 100644 --- a/chrome/browser/content_settings/content_settings_supervised_provider.cc +++ b/chrome/browser/content_settings/content_settings_supervised_provider.cc @@ -52,11 +52,11 @@ SupervisedProvider::SupervisedProvider( SupervisedProvider::~SupervisedProvider() { } -scoped_ptr SupervisedProvider::GetRuleIterator( +std::unique_ptr SupervisedProvider::GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, bool incognito) const { - scoped_ptr auto_lock(new base::AutoLock(lock_)); + std::unique_ptr auto_lock(new base::AutoLock(lock_)); return value_map_.GetRuleIterator(content_type, resource_identifier, std::move(auto_lock)); } diff --git a/chrome/browser/content_settings/content_settings_supervised_provider.h b/chrome/browser/content_settings/content_settings_supervised_provider.h index 9a01168de0cb7f..942ff23d4ae60f 100644 --- a/chrome/browser/content_settings/content_settings_supervised_provider.h +++ b/chrome/browser/content_settings/content_settings_supervised_provider.h @@ -27,7 +27,7 @@ class SupervisedProvider : public ObservableProvider { ~SupervisedProvider() override; // ProviderInterface implementations. - scoped_ptr GetRuleIterator( + std::unique_ptr GetRuleIterator( ContentSettingsType content_type, const ResourceIdentifier& resource_identifier, bool incognito) const override; @@ -52,8 +52,9 @@ class SupervisedProvider : public ObservableProvider { // thread safety. mutable base::Lock lock_; - scoped_ptr::Subscription> user_settings_subscription_; + std::unique_ptr< + base::CallbackList::Subscription> + user_settings_subscription_; DISALLOW_COPY_AND_ASSIGN(SupervisedProvider); }; diff --git a/chrome/browser/content_settings/content_settings_supervised_provider_unittest.cc b/chrome/browser/content_settings/content_settings_supervised_provider_unittest.cc index d0199af5b230d4..726ed496832136 100644 --- a/chrome/browser/content_settings/content_settings_supervised_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_supervised_provider_unittest.cc @@ -4,9 +4,9 @@ #include "chrome/browser/content_settings/content_settings_supervised_provider.h" +#include #include -#include "base/memory/scoped_ptr.h" #include "chrome/browser/content_settings/content_settings_mock_observer.h" #include "chrome/browser/supervised_user/supervised_user_constants.h" #include "chrome/browser/supervised_user/supervised_user_settings_service.h" @@ -29,7 +29,7 @@ class SupervisedUserProviderTest : public ::testing::Test { protected: SupervisedUserSettingsService service_; scoped_refptr pref_store_; - scoped_ptr provider_; + std::unique_ptr provider_; content_settings::MockObserver mock_observer_; }; @@ -49,7 +49,7 @@ void SupervisedUserProviderTest::TearDown() { } TEST_F(SupervisedUserProviderTest, GeolocationTest) { - scoped_ptr rule_iterator(provider_->GetRuleIterator( + std::unique_ptr rule_iterator(provider_->GetRuleIterator( CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string(), false)); EXPECT_FALSE(rule_iterator->HasNext()); rule_iterator.reset(); @@ -59,7 +59,7 @@ TEST_F(SupervisedUserProviderTest, GeolocationTest) { _, _, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); service_.SetLocalSetting( supervised_users::kGeolocationDisabled, - scoped_ptr(new base::FundamentalValue(true))); + std::unique_ptr(new base::FundamentalValue(true))); rule_iterator = provider_->GetRuleIterator(CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string(), false); @@ -77,7 +77,7 @@ TEST_F(SupervisedUserProviderTest, GeolocationTest) { _, _, CONTENT_SETTINGS_TYPE_GEOLOCATION, "")); service_.SetLocalSetting( supervised_users::kGeolocationDisabled, - scoped_ptr(new base::FundamentalValue(false))); + std::unique_ptr(new base::FundamentalValue(false))); rule_iterator = provider_->GetRuleIterator(CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string(), false); @@ -85,7 +85,7 @@ TEST_F(SupervisedUserProviderTest, GeolocationTest) { } TEST_F(SupervisedUserProviderTest, CameraMicTest) { - scoped_ptr rule_iterator(provider_->GetRuleIterator( + std::unique_ptr rule_iterator(provider_->GetRuleIterator( CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string(), false)); EXPECT_FALSE(rule_iterator->HasNext()); rule_iterator.reset(); @@ -103,7 +103,7 @@ TEST_F(SupervisedUserProviderTest, CameraMicTest) { OnContentSettingChanged(_, _, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "")); service_.SetLocalSetting( supervised_users::kCameraMicDisabled, - scoped_ptr(new base::FundamentalValue(true))); + std::unique_ptr(new base::FundamentalValue(true))); rule_iterator = provider_->GetRuleIterator( CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string(), false); @@ -136,7 +136,7 @@ TEST_F(SupervisedUserProviderTest, CameraMicTest) { OnContentSettingChanged(_, _, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "")); service_.SetLocalSetting( supervised_users::kCameraMicDisabled, - scoped_ptr(new base::FundamentalValue(false))); + std::unique_ptr(new base::FundamentalValue(false))); rule_iterator = provider_->GetRuleIterator( CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, std::string(), false); diff --git a/chrome/browser/content_settings/host_content_settings_map_factory.cc b/chrome/browser/content_settings/host_content_settings_map_factory.cc index c95b10490d63be..a96b421a0b5b60 100644 --- a/chrome/browser/content_settings/host_content_settings_map_factory.cc +++ b/chrome/browser/content_settings/host_content_settings_map_factory.cc @@ -85,7 +85,7 @@ scoped_refptr SupervisedUserSettingsServiceFactory::GetForProfile(profile); // This may be null in testing. if (supervised_service) { - scoped_ptr supervised_provider( + std::unique_ptr supervised_provider( new content_settings::SupervisedProvider(supervised_service)); settings_map->RegisterProvider(HostContentSettingsMap::SUPERVISED_PROVIDER, std::move(supervised_provider)); diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc index 8347f04f339969..b890f952115b19 100644 --- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc +++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc @@ -340,7 +340,7 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) { PrefService* prefs = profile.GetPrefs(); // Make a copy of the default pref value so we can reset it later. - scoped_ptr default_value( + std::unique_ptr default_value( prefs->FindPreference(GetPrefName(CONTENT_SETTINGS_TYPE_IMAGES)) ->GetValue() ->DeepCopy()); @@ -359,7 +359,7 @@ TEST_F(HostContentSettingsMapTest, ObserveExceptionPref) { host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); // Make a copy of the pref's new value so we can reset it later. - scoped_ptr new_value( + std::unique_ptr new_value( prefs->FindPreference(GetPrefName(CONTENT_SETTINGS_TYPE_IMAGES)) ->GetValue() ->DeepCopy()); @@ -763,7 +763,7 @@ TEST_F(HostContentSettingsMapTest, OffTheRecordDontInheritSetting) { test_value.DeepCopy()); // The setting is not inherted by |otr_map|. - scoped_ptr stored_value = + std::unique_ptr stored_value = host_content_settings_map->GetWebsiteSetting( host, host, CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA, std::string(), nullptr); @@ -808,12 +808,12 @@ TEST_F(HostContentSettingsMapTest, CanonicalizeExceptionsUnicodeOnly) { TEST_F(HostContentSettingsMapTest, CanonicalizeExceptionsUnicodeAndPunycode) { TestingProfile profile; - scoped_ptr value = + std::unique_ptr value = base::JSONReader::Read("{\"[*.]\\xC4\\x87ira.com,*\":{\"setting\":1}}"); profile.GetPrefs()->Set(GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES), *value); // Set punycode equivalent, with different setting. - scoped_ptr puny_value = + std::unique_ptr puny_value = base::JSONReader::Read("{\"[*.]xn--ira-ppa.com,*\":{\"setting\":2}}"); profile.GetPrefs()->Set(GetPrefName(CONTENT_SETTINGS_TYPE_COOKIES), *puny_value); @@ -1129,7 +1129,7 @@ TEST_F(HostContentSettingsMapTest, GuestProfileMigration) { profile.SetGuestSession(true); // Set a pref manually in the guest profile. - scoped_ptr value = + std::unique_ptr value = base::JSONReader::Read("{\"[*.]\\xC4\\x87ira.com,*\":{\"setting\":1}}"); profile.GetPrefs()->Set(GetPrefName(CONTENT_SETTINGS_TYPE_IMAGES), *value); diff --git a/chrome/browser/content_settings/local_shared_objects_container.cc b/chrome/browser/content_settings/local_shared_objects_container.cc index 29598c1b1434f1..7327d2a3c03c47 100644 --- a/chrome/browser/content_settings/local_shared_objects_container.cc +++ b/chrome/browser/content_settings/local_shared_objects_container.cc @@ -4,6 +4,7 @@ #include "chrome/browser/content_settings/local_shared_objects_container.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" #include "chrome/browser/browsing_data/browsing_data_cache_storage_helper.h" #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" @@ -216,12 +217,12 @@ void LocalSharedObjectsContainer::Reset() { session_storages_->Reset(); } -scoped_ptr +std::unique_ptr LocalSharedObjectsContainer::CreateCookiesTreeModel() const { LocalDataContainer* container = new LocalDataContainer( cookies(), databases(), local_storages(), session_storages(), appcaches(), indexed_dbs(), file_systems(), NULL, channel_ids(), service_workers(), cache_storages(), NULL); - return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); + return base::WrapUnique(new CookiesTreeModel(container, NULL, true)); } diff --git a/chrome/browser/content_settings/local_shared_objects_container.h b/chrome/browser/content_settings/local_shared_objects_container.h index bfc59802e94e48..e9928c190e8a17 100644 --- a/chrome/browser/content_settings/local_shared_objects_container.h +++ b/chrome/browser/content_settings/local_shared_objects_container.h @@ -7,9 +7,10 @@ #include +#include + #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "components/content_settings/core/browser/local_shared_objects_counter.h" class CannedBrowsingDataAppCacheHelper; @@ -38,7 +39,7 @@ class LocalSharedObjectsContainer : public LocalSharedObjectsCounter { // Creates a new CookiesTreeModel for all objects in the container, // copying each of them. - scoped_ptr CreateCookiesTreeModel() const; + std::unique_ptr CreateCookiesTreeModel() const; CannedBrowsingDataAppCacheHelper* appcaches() const { return appcaches_.get(); diff --git a/chrome/browser/content_settings/tab_specific_content_settings.h b/chrome/browser/content_settings/tab_specific_content_settings.h index 99df9427254582..dc20cd10212232 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings.h +++ b/chrome/browser/content_settings/tab_specific_content_settings.h @@ -8,11 +8,11 @@ #include #include +#include #include #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/scoped_observer.h" #include "build/build_config.h" @@ -286,11 +286,11 @@ class TabSpecificContentSettings // Creates a new copy of a CookiesTreeModel for all allowed, and blocked, // respectively, local shared objects. - scoped_ptr CreateAllowedCookiesTreeModel() const { + std::unique_ptr CreateAllowedCookiesTreeModel() const { return allowed_local_shared_objects_.CreateCookiesTreeModel(); } - scoped_ptr CreateBlockedCookiesTreeModel() const { + std::unique_ptr CreateBlockedCookiesTreeModel() const { return blocked_local_shared_objects_.CreateCookiesTreeModel(); } diff --git a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc index a5e400b79d288e..b7a71667137db1 100644 --- a/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc +++ b/chrome/browser/content_settings/tab_specific_content_settings_unittest.cc @@ -244,10 +244,9 @@ TEST_F(TabSpecificContentSettingsTest, SiteDataObserver) { net::CookieOptions(), blocked_by_policy); net::CookieList cookie_list; - scoped_ptr cookie( - net::CanonicalCookie::Create(GURL("http://google.com"), - "CookieName=CookieValue", - base::Time::Now(), net::CookieOptions())); + std::unique_ptr cookie(net::CanonicalCookie::Create( + GURL("http://google.com"), "CookieName=CookieValue", base::Time::Now(), + net::CookieOptions())); cookie_list.push_back(*cookie); content_settings->OnCookiesRead(GURL("http://google.com"), diff --git a/chrome/browser/copresence/chrome_whispernet_client.cc b/chrome/browser/copresence/chrome_whispernet_client.cc index 0c84c79bdf8bb4..95e13a37119d26 100644 --- a/chrome/browser/copresence/chrome_whispernet_client.cc +++ b/chrome/browser/copresence/chrome_whispernet_client.cc @@ -5,8 +5,10 @@ #include "chrome/browser/copresence/chrome_whispernet_client.h" #include + #include +#include "base/memory/ptr_util.h" #include "chrome/browser/copresence/chrome_whispernet_config.h" #include "chrome/browser/extensions/api/copresence_private/copresence_private_api.h" #include "chrome/browser/extensions/component_loader.h" @@ -134,7 +136,7 @@ void ChromeWhispernetClient::EncodeToken( params.token.audible = (type == AUDIBLE); ConvertTokenParams(token_params[type], ¶ms.token_params); - SendEventIfLoaded(make_scoped_ptr(new Event( + SendEventIfLoaded(base::WrapUnique(new Event( extensions::events::COPRESENCE_PRIVATE_ON_ENCODE_TOKEN_REQUEST, OnEncodeTokenRequest::kEventName, OnEncodeTokenRequest::Create(client_id_, params), browser_context_))); @@ -151,7 +153,7 @@ void ChromeWhispernetClient::DecodeSamples( ConvertTokenParams(token_params[AUDIBLE], ¶ms.audible_token_params); ConvertTokenParams(token_params[INAUDIBLE], ¶ms.inaudible_token_params); - SendEventIfLoaded(make_scoped_ptr(new Event( + SendEventIfLoaded(base::WrapUnique(new Event( extensions::events::COPRESENCE_PRIVATE_ON_DECODE_SAMPLES_REQUEST, OnDecodeSamplesRequest::kEventName, OnDecodeSamplesRequest::Create(client_id_, params), browser_context_))); @@ -193,14 +195,14 @@ void ChromeWhispernetClient::AudioConfiguration(const AudioParamData& params) { memcpy(audio_params.param_data.data(), ¶ms, params_size); DVLOG(3) << "Configuring audio for client " << client_id_; - SendEventIfLoaded(make_scoped_ptr(new Event( + SendEventIfLoaded(base::WrapUnique(new Event( extensions::events::COPRESENCE_PRIVATE_ON_CONFIG_AUDIO, OnConfigAudio::kEventName, OnConfigAudio::Create(client_id_, audio_params), browser_context_))); } void ChromeWhispernetClient::SendEventIfLoaded( - scoped_ptr event) { + std::unique_ptr event) { DCHECK(event_router_); if (extension_loaded_) { @@ -226,7 +228,7 @@ void ChromeWhispernetClient::OnExtensionLoaded(bool success) { DCHECK(event_router_); for (Event* event : queued_events_) { event_router_->DispatchEventToExtension(kWhispernetProxyExtensionId, - make_scoped_ptr(event)); + base::WrapUnique(event)); } queued_events_.weak_clear(); diff --git a/chrome/browser/copresence/chrome_whispernet_client.h b/chrome/browser/copresence/chrome_whispernet_client.h index 5548104aaf35a8..62beccbf9e9aee 100644 --- a/chrome/browser/copresence/chrome_whispernet_client.h +++ b/chrome/browser/copresence/chrome_whispernet_client.h @@ -66,7 +66,7 @@ class ChromeWhispernetClient final : public audio_modem::WhispernetClient { // Fire an event to configure whispernet with the given audio parameters. void AudioConfiguration(const AudioParamData& params); - void SendEventIfLoaded(scoped_ptr event); + void SendEventIfLoaded(std::unique_ptr event); // This gets called when the proxy extension loads. void OnExtensionLoaded(bool success); diff --git a/chrome/browser/copresence/chrome_whispernet_client_browsertest.cc b/chrome/browser/copresence/chrome_whispernet_client_browsertest.cc index 11ee46299a6d6d..c51fb770fd79e4 100644 --- a/chrome/browser/copresence/chrome_whispernet_client_browsertest.cc +++ b/chrome/browser/copresence/chrome_whispernet_client_browsertest.cc @@ -8,11 +8,11 @@ #include #include +#include #include #include "base/bind.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/stl_util.h" #include "build/build_config.h" @@ -79,7 +79,7 @@ class ChromeWhispernetClientTest : public ExtensionBrowserTest, ~ChromeWhispernetClientTest() override {} void InitializeWhispernet() { - scoped_ptr client( + std::unique_ptr client( new ChromeWhispernetClient(browser()->profile())); client->Initialize(base::Bind( &ChromeWhispernetClientTest::InitCallback, base::Unretained(this))); @@ -225,7 +225,7 @@ class ChromeWhispernetClientTest : public ExtensionBrowserTest, return 1.0; } - scoped_ptr run_loop_; + std::unique_ptr run_loop_; bool initialized_; std::string expected_token_; @@ -235,7 +235,7 @@ class ChromeWhispernetClientTest : public ExtensionBrowserTest, scoped_refptr saved_samples_stereo_; int saved_samples_index_; - scoped_ptr converter_; + std::unique_ptr converter_; media::AudioParameters default_params_; media::AudioParameters coder_params_; @@ -271,7 +271,7 @@ IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, MAYBE_Initialize) { } IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, MAYBE_EncodeAndDecode) { - scoped_ptr client( + std::unique_ptr client( new ChromeWhispernetClient(browser()->profile())); client->Initialize(base::Bind(&IgnoreResult)); SetupDecode(); @@ -287,7 +287,7 @@ IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, MAYBE_EncodeAndDecode) { } IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, MAYBE_TokenLengths) { - scoped_ptr client( + std::unique_ptr client( new ChromeWhispernetClient(browser()->profile())); client->Initialize(base::Bind(&IgnoreResult)); SetupDecode(); @@ -304,7 +304,7 @@ IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, MAYBE_TokenLengths) { } IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, MAYBE_Crc) { - scoped_ptr client( + std::unique_ptr client( new ChromeWhispernetClient(browser()->profile())); client->Initialize(base::Bind(&IgnoreResult)); SetupDecode(); @@ -322,7 +322,7 @@ IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, MAYBE_Crc) { } IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, MAYBE_Parity) { - scoped_ptr client( + std::unique_ptr client( new ChromeWhispernetClient(browser()->profile())); client->Initialize(base::Bind(&IgnoreResult)); SetupDecode(); @@ -340,11 +340,11 @@ IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, MAYBE_Parity) { } IN_PROC_BROWSER_TEST_F(ChromeWhispernetClientTest, MAYBE_MultipleClients) { - scoped_ptr client_1( + std::unique_ptr client_1( new ChromeWhispernetClient(browser()->profile())); - scoped_ptr client_2( + std::unique_ptr client_2( new ChromeWhispernetClient(browser()->profile())); - scoped_ptr client_3( + std::unique_ptr client_3( new ChromeWhispernetClient(browser()->profile())); SetupDecode(); diff --git a/chrome/browser/crash_recovery_browsertest.cc b/chrome/browser/crash_recovery_browsertest.cc index cb6073f8c11ace..e7ca591acd10b9 100644 --- a/chrome/browser/crash_recovery_browsertest.cc +++ b/chrome/browser/crash_recovery_browsertest.cc @@ -52,13 +52,13 @@ class CacheMaxAgeHandler { explicit CacheMaxAgeHandler(const std::string& path) : path_(path), request_count_(0) { } - scoped_ptr HandleRequest( + std::unique_ptr HandleRequest( const net::test_server::HttpRequest& request) { if (request.relative_url != path_) - return scoped_ptr(); + return std::unique_ptr(); request_count_++; - scoped_ptr response( + std::unique_ptr response( new net::test_server::BasicHttpResponse); response->set_content(base::StringPrintf("%d", request_count_)); diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc index 71fa56a2f34018..ab59762240b442 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc @@ -173,7 +173,7 @@ ProtocolHandlerRegistry::JobInterceptorFactory::~JobInterceptorFactory() { } void ProtocolHandlerRegistry::JobInterceptorFactory::Chain( - scoped_ptr job_factory) { + std::unique_ptr job_factory) { job_factory_ = std::move(job_factory); } @@ -696,9 +696,10 @@ void ProtocolHandlerRegistry::Save() { if (is_loading_) { return; } - scoped_ptr registered_protocol_handlers( + std::unique_ptr registered_protocol_handlers( EncodeRegisteredHandlers()); - scoped_ptr ignored_protocol_handlers(EncodeIgnoredHandlers()); + std::unique_ptr ignored_protocol_handlers( + EncodeIgnoredHandlers()); PrefService* prefs = user_prefs::UserPrefs::Get(context_); prefs->Set(prefs::kRegisteredProtocolHandlers, @@ -920,12 +921,12 @@ ProtocolHandlerRegistry::GetDefaultWebClientCallback( weak_ptr_factory_.GetWeakPtr(), protocol); } -scoped_ptr +std::unique_ptr ProtocolHandlerRegistry::CreateJobInterceptorFactory() { DCHECK_CURRENTLY_ON(BrowserThread::UI); // this is always created on the UI thread (in profile_io's // InitializeOnUIThread. Any method calls must be done // on the IO thread (this is checked). - return scoped_ptr( + return std::unique_ptr( new JobInterceptorFactory(io_thread_delegate_.get())); } diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.h b/chrome/browser/custom_handlers/protocol_handler_registry.h index a5926fd106208e..00d08c269803e0 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry.h +++ b/chrome/browser/custom_handlers/protocol_handler_registry.h @@ -6,11 +6,11 @@ #define CHROME_BROWSER_CUSTOM_HANDLERS_PROTOCOL_HANDLER_REGISTRY_H_ #include +#include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/sequenced_task_runner_helpers.h" #include "base/values.h" @@ -75,7 +75,7 @@ class ProtocolHandlerRegistry : public KeyedService { // |job_factory| is set as the URLRequestJobFactory where requests are // forwarded if JobInterceptorFactory decides to pass on them. - void Chain(scoped_ptr job_factory); + void Chain(std::unique_ptr job_factory); // URLRequestJobFactory implementation. net::URLRequestJob* MaybeCreateJobWithProtocolHandler( @@ -99,7 +99,7 @@ class ProtocolHandlerRegistry : public KeyedService { private: // When JobInterceptorFactory decides to pass on particular requests, // they're forwarded to the chained URLRequestJobFactory, |job_factory_|. - scoped_ptr job_factory_; + std::unique_ptr job_factory_; // |io_thread_delegate_| performs the actual job creation decisions by // mirroring the ProtocolHandlerRegistry on the IO thread. scoped_refptr io_thread_delegate_; @@ -117,7 +117,7 @@ class ProtocolHandlerRegistry : public KeyedService { // Returns a net::URLRequestJobFactory suitable for use on the IO thread, but // is initialized on the UI thread. - scoped_ptr CreateJobInterceptorFactory(); + std::unique_ptr CreateJobInterceptorFactory(); // Called when a site tries to register as a protocol handler. If the request // can be handled silently by the registry - either to ignore the request @@ -347,7 +347,7 @@ class ProtocolHandlerRegistry : public KeyedService { content::BrowserContext* context_; // The Delegate that registers / deregisters external handlers on our behalf. - scoped_ptr delegate_; + std::unique_ptr delegate_; // If false then registered protocol handlers will not be used to handle // requests. diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc index abb2ca63fd33ca..62680a7ab048ae 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_browsertest.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include #include -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" @@ -76,7 +76,7 @@ class RegisterProtocolHandlerBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest, ContextMenuEntryAppearsForHandledUrls) { - scoped_ptr menu( + std::unique_ptr menu( CreateContextMenu(GURL("http://www.google.com/"))); ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKWITH)); @@ -93,7 +93,7 @@ IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest, IN_PROC_BROWSER_TEST_F(RegisterProtocolHandlerBrowserTest, UnregisterProtocolHandler) { - scoped_ptr menu( + std::unique_ptr menu( CreateContextMenu(GURL("http://www.google.com/"))); ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKWITH)); diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index ea07eebfef94c9..fd3e3dcba23c22 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc @@ -6,9 +6,9 @@ #include +#include #include -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/synchronization/waitable_event.h" @@ -39,9 +39,9 @@ void AssertInterceptedIO( net::URLRequestJobFactory* interceptor) { DCHECK_CURRENTLY_ON(BrowserThread::IO); net::URLRequestContext context; - scoped_ptr request( + std::unique_ptr request( context.CreateRequest(url, net::DEFAULT_PRIORITY, nullptr)); - scoped_ptr job( + std::unique_ptr job( interceptor->MaybeCreateJobWithProtocolHandler( url.scheme(), request.get(), context.network_delegate())); ASSERT_TRUE(job.get()); @@ -100,10 +100,10 @@ void AssertWillHandleIO( bool expected, ProtocolHandlerRegistry::JobInterceptorFactory* interceptor) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - interceptor->Chain(scoped_ptr( + interceptor->Chain(std::unique_ptr( new FakeURLRequestJobFactory())); ASSERT_EQ(expected, interceptor->IsHandledProtocol(scheme)); - interceptor->Chain(scoped_ptr()); + interceptor->Chain(std::unique_ptr()); } void AssertWillHandle( @@ -410,9 +410,9 @@ class ProtocolHandlerRegistryTest : public testing::Test { content::TestBrowserThread file_thread_; content::TestBrowserThread io_thread_; - scoped_ptr profile_; + std::unique_ptr profile_; FakeDelegate* delegate_; // Registry assumes ownership of delegate_. - scoped_ptr registry_; + std::unique_ptr registry_; ProtocolHandler test_protocol_handler_; }; @@ -783,7 +783,7 @@ TEST_F(ProtocolHandlerRegistryTest, TestMaybeCreateTaskWorksFromIOThread) { registry()->OnAcceptRegisterProtocolHandler(ph1); GURL url("mailto:someone@something.com"); - scoped_ptr interceptor( + std::unique_ptr interceptor( registry()->CreateJobInterceptorFactory()); AssertIntercepted(url, interceptor.get()); } @@ -794,7 +794,7 @@ TEST_F(ProtocolHandlerRegistryTest, ProtocolHandler ph1 = CreateProtocolHandler(scheme, "test1"); registry()->OnAcceptRegisterProtocolHandler(ph1); - scoped_ptr interceptor( + std::unique_ptr interceptor( registry()->CreateJobInterceptorFactory()); AssertWillHandle(scheme, true, interceptor.get()); } @@ -841,7 +841,7 @@ TEST_F(ProtocolHandlerRegistryTest, TestClearDefaultGetsPropagatedToIO) { registry()->OnAcceptRegisterProtocolHandler(ph1); registry()->ClearDefault(scheme); - scoped_ptr interceptor( + std::unique_ptr interceptor( registry()->CreateJobInterceptorFactory()); AssertWillHandle(scheme, false, interceptor.get()); } @@ -851,7 +851,7 @@ TEST_F(ProtocolHandlerRegistryTest, TestLoadEnabledGetsPropogatedToIO) { ProtocolHandler ph1 = CreateProtocolHandler(mailto, "MailtoHandler"); registry()->OnAcceptRegisterProtocolHandler(ph1); - scoped_ptr interceptor( + std::unique_ptr interceptor( registry()->CreateJobInterceptorFactory()); AssertWillHandle(mailto, true, interceptor.get()); registry()->Disable(); diff --git a/chrome/browser/data_saver/data_saver_browsertest.cc b/chrome/browser/data_saver/data_saver_browsertest.cc index 09290309fe024b..740db9716504b7 100644 --- a/chrome/browser/data_saver/data_saver_browsertest.cc +++ b/chrome/browser/data_saver/data_saver_browsertest.cc @@ -63,7 +63,7 @@ class DataSaverWithServerBrowserTest : public InProcessBrowserTest { prefs->SetBoolean(prefs::kDataSaverEnabled, enabled); } - scoped_ptr VerifySaveDataHeader( + std::unique_ptr VerifySaveDataHeader( const net::test_server::HttpRequest& request) { auto save_data_header_it = request.headers.find("save-data"); @@ -73,10 +73,10 @@ class DataSaverWithServerBrowserTest : public InProcessBrowserTest { } else { EXPECT_TRUE(save_data_header_it == request.headers.end()); } - return scoped_ptr(); + return std::unique_ptr(); } - scoped_ptr test_server_; + std::unique_ptr test_server_; std::string expected_save_data_header_; }; diff --git a/chrome/browser/data_usage/tab_id_annotator.cc b/chrome/browser/data_usage/tab_id_annotator.cc index c3b199282eb900..6754b20731535b 100644 --- a/chrome/browser/data_usage/tab_id_annotator.cc +++ b/chrome/browser/data_usage/tab_id_annotator.cc @@ -44,7 +44,7 @@ int32_t GetTabIdForRenderFrame(int render_process_id, int render_frame_id) { // destroyed. This doesn't make much of a difference for production code, but // makes it easier to test the TabIdAnnotator. void AnnotateDataUse( - scoped_ptr data_use, + std::unique_ptr data_use, const data_usage::DataUseAnnotator::DataUseConsumerCallback& callback, int32_t tab_id) { DCHECK(data_use); @@ -58,7 +58,7 @@ TabIdAnnotator::TabIdAnnotator() {} TabIdAnnotator::~TabIdAnnotator() {} void TabIdAnnotator::Annotate(net::URLRequest* request, - scoped_ptr data_use, + std::unique_ptr data_use, const DataUseConsumerCallback& callback) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(data_use); @@ -82,7 +82,7 @@ void TabIdAnnotator::Annotate(net::URLRequest* request, scoped_refptr ui_thread_task_runner = BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI); - scoped_ptr tab_id_provider(new TabIdProvider( + std::unique_ptr tab_id_provider(new TabIdProvider( ui_thread_task_runner.get(), FROM_HERE, base::Bind(&GetTabIdForRenderFrame, render_process_id, render_frame_id))); tab_id_provider->ProvideTabId( diff --git a/chrome/browser/data_usage/tab_id_annotator.h b/chrome/browser/data_usage/tab_id_annotator.h index f4fcccf8255cc6..513cd17a81666b 100644 --- a/chrome/browser/data_usage/tab_id_annotator.h +++ b/chrome/browser/data_usage/tab_id_annotator.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_DATA_USAGE_TAB_ID_ANNOTATOR_H_ #define CHROME_BROWSER_DATA_USAGE_TAB_ID_ANNOTATOR_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/threading/thread_checker.h" #include "components/data_usage/core/data_use_annotator.h" @@ -33,7 +34,7 @@ class TabIdAnnotator : public data_usage::DataUseAnnotator { // data if there isn't one attached already and |request| has enough // information to get a tab ID. void Annotate(net::URLRequest* request, - scoped_ptr data_use, + std::unique_ptr data_use, const DataUseConsumerCallback& callback) override; private: diff --git a/chrome/browser/data_usage/tab_id_annotator_unittest.cc b/chrome/browser/data_usage/tab_id_annotator_unittest.cc index c17ccb52f4839f..cee54639239258 100644 --- a/chrome/browser/data_usage/tab_id_annotator_unittest.cc +++ b/chrome/browser/data_usage/tab_id_annotator_unittest.cc @@ -5,6 +5,8 @@ #include "chrome/browser/data_usage/tab_id_annotator.h" #include + +#include #include #include @@ -12,7 +14,6 @@ #include "base/callback.h" #include "base/location.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/time/time.h" #include "chrome/browser/sessions/session_tab_helper.h" @@ -51,14 +52,15 @@ class TabIdAnnotatorTest : public ChromeRenderViewHostTestHarness { }; // Synthesizes a DataUse object with the given |tab_id|. -scoped_ptr CreateDataUse(int32_t tab_id) { - return scoped_ptr(new DataUse( +std::unique_ptr CreateDataUse(int32_t tab_id) { + return std::unique_ptr(new DataUse( GURL("http://foo.com"), base::TimeTicks(), GURL(), tab_id, net::NetworkChangeNotifier::CONNECTION_UNKNOWN, std::string(), 100, 100)); } // Expects that |expected| and |actual| are equal. -void ExpectDataUse(scoped_ptr expected, scoped_ptr actual) { +void ExpectDataUse(std::unique_ptr expected, + std::unique_ptr actual) { // Single out the |tab_id| for better debug output in failure cases. EXPECT_EQ(expected->tab_id, actual->tab_id); EXPECT_EQ(*expected, *actual); @@ -67,8 +69,8 @@ void ExpectDataUse(scoped_ptr expected, scoped_ptr actual) { // Expects that |expected| and |actual| are equal, then quits |ui_run_loop| on // the UI thread. void ExpectDataUseAndQuit(base::RunLoop* ui_run_loop, - scoped_ptr expected, - scoped_ptr actual) { + std::unique_ptr expected, + std::unique_ptr actual) { DCHECK(ui_run_loop); ExpectDataUse(std::move(expected), std::move(actual)); @@ -95,7 +97,7 @@ void TestAnnotateOnIOThread(base::RunLoop* ui_run_loop, TabIdAnnotator annotator; net::TestURLRequestContext context; net::TestDelegate test_delegate; - scoped_ptr request = + std::unique_ptr request = context.CreateRequest(GURL("http://foo.com"), net::IDLE, &test_delegate); if (render_process_id != -1 && render_frame_id != -1) { @@ -113,13 +115,15 @@ void TestAnnotateOnIOThread(base::RunLoop* ui_run_loop, // Annotate two separate DataUse objects to ensure that repeated annotations // for the same URLRequest work properly. - scoped_ptr first_expected_data_use = CreateDataUse(expected_tab_id); + std::unique_ptr first_expected_data_use = + CreateDataUse(expected_tab_id); annotator.Annotate( request.get(), CreateDataUse(kInvalidTabId), base::Bind(&ExpectDataUse, base::Passed(&first_expected_data_use))); // Quit the |ui_run_loop| after the second annotation. - scoped_ptr second_expected_data_use = CreateDataUse(expected_tab_id); + std::unique_ptr second_expected_data_use = + CreateDataUse(expected_tab_id); annotator.Annotate(request.get(), CreateDataUse(kInvalidTabId), base::Bind(&ExpectDataUseAndQuit, ui_run_loop, base::Passed(&second_expected_data_use))); diff --git a/chrome/browser/data_usage/tab_id_provider.cc b/chrome/browser/data_usage/tab_id_provider.cc index 89fee80a43a3b4..4278666c515cfb 100644 --- a/chrome/browser/data_usage/tab_id_provider.cc +++ b/chrome/browser/data_usage/tab_id_provider.cc @@ -4,6 +4,7 @@ #include "chrome/browser/data_usage/tab_id_provider.h" +#include #include #include "base/bind.h" @@ -11,7 +12,6 @@ #include "base/location.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/single_thread_task_runner.h" #include "base/task_runner.h" #include "base/task_runner_util.h" @@ -79,7 +79,7 @@ TabIdProvider::TabIdProvider(base::TaskRunner* task_runner, const tracked_objects::Location& from_here, const TabIdGetter& tab_id_getter) : is_tab_id_ready_(false), tab_id_(-1), weak_ptr_factory_(this) { - scoped_ptr callback_runner(new CallbackRunner()); + std::unique_ptr callback_runner(new CallbackRunner()); weak_callback_runner_ = callback_runner->GetWeakPtr(); callback_runner->AddCallback( base::Bind(&TabIdProvider::OnTabIdReady, GetWeakPtr())); diff --git a/chrome/browser/data_usage/tab_id_provider_unittest.cc b/chrome/browser/data_usage/tab_id_provider_unittest.cc index 057b544ff6d6ab..0413865b8777e6 100644 --- a/chrome/browser/data_usage/tab_id_provider_unittest.cc +++ b/chrome/browser/data_usage/tab_id_provider_unittest.cc @@ -6,12 +6,13 @@ #include +#include + #include "base/bind.h" #include "base/callback.h" #include "base/location.h" #include "base/macros.h" #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 "base/single_thread_task_runner.h" @@ -116,7 +117,7 @@ TEST_F(TabIdProviderTest, ProvideTabIdCacheHit) { } TEST_F(TabIdProviderTest, ProvideTabIdAfterProviderDestroyed) { - scoped_ptr provider( + std::unique_ptr provider( new TabIdProvider(task_runner(), FROM_HERE, TabIdGetterCallback())); // Ask for two tab IDs. diff --git a/chrome/browser/diagnostics/diagnostics_controller.cc b/chrome/browser/diagnostics/diagnostics_controller.cc index c8d7280ac9ae89..3ef7cd441cc12d 100644 --- a/chrome/browser/diagnostics/diagnostics_controller.cc +++ b/chrome/browser/diagnostics/diagnostics_controller.cc @@ -4,11 +4,11 @@ #include "chrome/browser/diagnostics/diagnostics_controller.h" +#include #include #include "base/command_line.h" #include "base/logging.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" #include "base/time/time.h" #include "build/build_config.h" diff --git a/chrome/browser/diagnostics/diagnostics_controller.h b/chrome/browser/diagnostics/diagnostics_controller.h index b62c5346aa2641..a98608b3e5475d 100644 --- a/chrome/browser/diagnostics/diagnostics_controller.h +++ b/chrome/browser/diagnostics/diagnostics_controller.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ #define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_CONTROLLER_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" namespace base { @@ -53,7 +54,7 @@ class DiagnosticsController { DiagnosticsController(); ~DiagnosticsController(); - scoped_ptr model_; + std::unique_ptr model_; DiagnosticsWriter* writer_; DISALLOW_COPY_AND_ASSIGN(DiagnosticsController); diff --git a/chrome/browser/diagnostics/diagnostics_controller_unittest.cc b/chrome/browser/diagnostics/diagnostics_controller_unittest.cc index bed7f36a641fab..a2f005c9a610fe 100644 --- a/chrome/browser/diagnostics/diagnostics_controller_unittest.cc +++ b/chrome/browser/diagnostics/diagnostics_controller_unittest.cc @@ -4,12 +4,13 @@ #include "chrome/browser/diagnostics/diagnostics_controller.h" +#include + #include "base/base_paths.h" #include "base/command_line.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "build/build_config.h" #include "chrome/browser/diagnostics/diagnostics_model.h" @@ -71,10 +72,10 @@ class DiagnosticsControllerTest : public testing::Test { base::WriteFile(path, bogus_data, arraysize(bogus_data)); } - scoped_ptr model_; + std::unique_ptr model_; base::CommandLine cmdline_; base::ScopedTempDir temp_dir_; - scoped_ptr writer_; + std::unique_ptr writer_; base::FilePath profile_dir_; #if defined(OS_CHROMEOS) diff --git a/chrome/browser/diagnostics/diagnostics_model_unittest.cc b/chrome/browser/diagnostics/diagnostics_model_unittest.cc index d593bb4a45730d..e6ab6e524baf2a 100644 --- a/chrome/browser/diagnostics/diagnostics_model_unittest.cc +++ b/chrome/browser/diagnostics/diagnostics_model_unittest.cc @@ -4,10 +4,11 @@ #include "chrome/browser/diagnostics/diagnostics_model.h" +#include + #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" namespace diagnostics { @@ -26,7 +27,7 @@ class DiagnosticsModelTest : public testing::Test { void TearDown() override { model_.reset(); } - scoped_ptr model_; + std::unique_ptr model_; base::CommandLine cmdline_; DISALLOW_COPY_AND_ASSIGN(DiagnosticsModelTest); diff --git a/chrome/browser/diagnostics/diagnostics_writer.h b/chrome/browser/diagnostics/diagnostics_writer.h index 7b4e9adc9bab3e..094ae64b4cf39c 100644 --- a/chrome/browser/diagnostics/diagnostics_writer.h +++ b/chrome/browser/diagnostics/diagnostics_writer.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_WRITER_H_ #define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_WRITER_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/diagnostics/diagnostics_model.h" namespace diagnostics { @@ -54,7 +55,7 @@ class DiagnosticsWriter : public DiagnosticsModel::Observer { int outcome_code, const std::string& extra); - scoped_ptr console_; + std::unique_ptr console_; // Keeps track of how many tests reported failure. int failures_; diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index 366d9c5cbeb511..11d1af831c4b45 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -7,13 +7,13 @@ #include #include +#include #include #include "base/files/file_util.h" #include "base/json/json_reader.h" #include "base/json/json_string_value_serializer.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -63,7 +63,7 @@ class ConflictingDllsTest : public DiagnosticsTest { EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); model->set_limited_mode(true); model->ScanNow(); - scoped_ptr list(model->GetModuleList()); + std::unique_ptr list(model->GetModuleList()); if (!model->confirmed_bad_modules_detected() && !model->suspected_bad_modules_detected()) { RecordSuccess("No conflicting modules found"); @@ -220,7 +220,7 @@ class JSONTest : public DiagnosticsTest { JSONStringValueDeserializer json(json_data); int error_code = base::JSONReader::JSON_NO_ERROR; std::string error_message; - scoped_ptr json_root( + std::unique_ptr json_root( json.Deserialize(&error_code, &error_message)); if (base::JSONReader::JSON_NO_ERROR != error_code) { if (error_message.empty()) { diff --git a/chrome/browser/dom_distiller/dom_distiller_service_factory.cc b/chrome/browser/dom_distiller/dom_distiller_service_factory.cc index ceea05052c4ffb..1048e7ddcaf387 100644 --- a/chrome/browser/dom_distiller/dom_distiller_service_factory.cc +++ b/chrome/browser/dom_distiller/dom_distiller_service_factory.cc @@ -23,10 +23,10 @@ namespace dom_distiller { DomDistillerContextKeyedService::DomDistillerContextKeyedService( - scoped_ptr store, - scoped_ptr distiller_factory, - scoped_ptr distiller_page_factory, - scoped_ptr distilled_page_prefs) + std::unique_ptr store, + std::unique_ptr distiller_factory, + std::unique_ptr distiller_page_factory, + std::unique_ptr distilled_page_prefs) : DomDistillerService(std::move(store), std::move(distiller_factory), std::move(distiller_page_factory), @@ -58,22 +58,22 @@ KeyedService* DomDistillerServiceFactory::BuildServiceInstanceFor( content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( base::SequencedWorkerPool::GetSequenceToken()); - scoped_ptr > db( + std::unique_ptr> db( new leveldb_proto::ProtoDatabaseImpl( background_task_runner)); base::FilePath database_dir( profile->GetPath().Append(FILE_PATH_LITERAL("Articles"))); - scoped_ptr dom_distiller_store( + std::unique_ptr dom_distiller_store( new DomDistillerStore(std::move(db), database_dir)); - scoped_ptr distiller_page_factory( + std::unique_ptr distiller_page_factory( new DistillerPageWebContentsFactory(profile)); - scoped_ptr distiller_url_fetcher_factory( + std::unique_ptr distiller_url_fetcher_factory( new DistillerURLFetcherFactory( - content::BrowserContext::GetDefaultStoragePartition(profile)-> - GetURLRequestContext())); + content::BrowserContext::GetDefaultStoragePartition(profile) + ->GetURLRequestContext())); dom_distiller::proto::DomDistillerOptions options; if (VLOG_IS_ON(1)) { @@ -85,9 +85,9 @@ KeyedService* DomDistillerServiceFactory::BuildServiceInstanceFor( // - "pagenum": detect anchors with numeric page numbers // Default is "next". options.set_pagination_algo("next"); - scoped_ptr distiller_factory(new DistillerFactoryImpl( + std::unique_ptr distiller_factory(new DistillerFactoryImpl( std::move(distiller_url_fetcher_factory), options)); - scoped_ptr distilled_page_prefs( + std::unique_ptr distilled_page_prefs( new DistilledPagePrefs(Profile::FromBrowserContext(profile)->GetPrefs())); DomDistillerContextKeyedService* service = diff --git a/chrome/browser/dom_distiller/dom_distiller_service_factory.h b/chrome/browser/dom_distiller/dom_distiller_service_factory.h index 1632bae7d4b061..db65e6301e8b5c 100644 --- a/chrome/browser/dom_distiller/dom_distiller_service_factory.h +++ b/chrome/browser/dom_distiller/dom_distiller_service_factory.h @@ -24,10 +24,10 @@ class DomDistillerContextKeyedService : public KeyedService, public DomDistillerService { public: DomDistillerContextKeyedService( - scoped_ptr store, - scoped_ptr distiller_factory, - scoped_ptr distiller_page_factory, - scoped_ptr distilled_page_prefs); + std::unique_ptr store, + std::unique_ptr distiller_factory, + std::unique_ptr distiller_page_factory, + std::unique_ptr distilled_page_prefs); ~DomDistillerContextKeyedService() override {} private: diff --git a/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc b/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc index b14ba2eea5d8a4..f67d5c641b3201 100644 --- a/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc +++ b/chrome/browser/dom_distiller/dom_distiller_viewer_source_browsertest.cc @@ -3,11 +3,12 @@ // found in the LICENSE file. #include + +#include #include #include "base/command_line.h" #include "base/guid.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" @@ -119,18 +120,18 @@ class DomDistillerViewerSourceBrowserTest : public InProcessBrowserTest { command_line->AppendSwitch(switches::kEnableDomDistiller); } - static scoped_ptr Build(content::BrowserContext* context) { + static std::unique_ptr Build(content::BrowserContext* context) { FakeDB* fake_db = new FakeDB(database_model_); distiller_factory_ = new MockDistillerFactory(); MockDistillerPageFactory* distiller_page_factory_ = new MockDistillerPageFactory(); - scoped_ptr service( + std::unique_ptr service( new DomDistillerContextKeyedService( - scoped_ptr(CreateStoreWithFakeDB( + std::unique_ptr(CreateStoreWithFakeDB( fake_db, FakeDB::EntryMap())), - scoped_ptr(distiller_factory_), - scoped_ptr(distiller_page_factory_), - scoped_ptr(new DistilledPagePrefs( + std::unique_ptr(distiller_factory_), + std::unique_ptr(distiller_page_factory_), + std::unique_ptr(new DistilledPagePrefs( Profile::FromBrowserContext(context)->GetPrefs())))); fake_db->InitCallback(true); fake_db->LoadCallback(true); @@ -336,7 +337,7 @@ IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, // Finish distillation and make sure the spinner has been replaced by text. std::vector > update_pages; - scoped_ptr article(new DistilledArticleProto()); + std::unique_ptr article(new DistilledArticleProto()); scoped_refptr > page_proto = new base::RefCountedData(); @@ -445,7 +446,7 @@ IN_PROC_BROWSER_TEST_F(DomDistillerViewerSourceBrowserTest, MultiPageArticle) { std::vector > update_pages; - scoped_ptr article(new DistilledArticleProto()); + std::unique_ptr article(new DistilledArticleProto()); // Flush page 1. { diff --git a/chrome/browser/dom_distiller/lazy_dom_distiller_service.cc b/chrome/browser/dom_distiller/lazy_dom_distiller_service.cc index eefec74874803a..90419f6468cd88 100644 --- a/chrome/browser/dom_distiller/lazy_dom_distiller_service.cc +++ b/chrome/browser/dom_distiller/lazy_dom_distiller_service.cc @@ -58,7 +58,7 @@ std::string LazyDomDistillerService::GetUrlForEntry( const std::string LazyDomDistillerService::AddToList( const GURL& url, - scoped_ptr distiller_page, + std::unique_ptr distiller_page, const ArticleAvailableCallback& article_cb) { return instance()->AddToList(url, std::move(distiller_page), article_cb); } @@ -67,34 +67,34 @@ std::vector LazyDomDistillerService::GetEntries() const { return instance()->GetEntries(); } -scoped_ptr LazyDomDistillerService::RemoveEntry( +std::unique_ptr LazyDomDistillerService::RemoveEntry( const std::string& entry_id) { return instance()->RemoveEntry(entry_id); } -scoped_ptr LazyDomDistillerService::ViewEntry( +std::unique_ptr LazyDomDistillerService::ViewEntry( ViewRequestDelegate* delegate, - scoped_ptr distiller_page, + std::unique_ptr distiller_page, const std::string& entry_id) { return instance()->ViewEntry(delegate, std::move(distiller_page), entry_id); } -scoped_ptr LazyDomDistillerService::ViewUrl( +std::unique_ptr LazyDomDistillerService::ViewUrl( ViewRequestDelegate* delegate, - scoped_ptr distiller_page, + std::unique_ptr distiller_page, const GURL& url) { return instance()->ViewUrl(delegate, std::move(distiller_page), url); } -scoped_ptr +std::unique_ptr LazyDomDistillerService::CreateDefaultDistillerPage( const gfx::Size& render_view_size) { return instance()->CreateDefaultDistillerPage(render_view_size); } -scoped_ptr +std::unique_ptr LazyDomDistillerService::CreateDefaultDistillerPageWithHandle( - scoped_ptr handle) { + std::unique_ptr handle) { return instance()->CreateDefaultDistillerPageWithHandle(std::move(handle)); } diff --git a/chrome/browser/dom_distiller/lazy_dom_distiller_service.h b/chrome/browser/dom_distiller/lazy_dom_distiller_service.h index abaa7048511d83..9264f0333cf97d 100644 --- a/chrome/browser/dom_distiller/lazy_dom_distiller_service.h +++ b/chrome/browser/dom_distiller/lazy_dom_distiller_service.h @@ -38,22 +38,25 @@ class LazyDomDistillerService : public DomDistillerServiceInterface, syncer::SyncableService* GetSyncableService() const override; const std::string AddToList( const GURL& url, - scoped_ptr distiller_page, + std::unique_ptr distiller_page, const ArticleAvailableCallback& article_cb) override; bool HasEntry(const std::string& entry_id) override; std::string GetUrlForEntry(const std::string& entry_id) override; std::vector GetEntries() const override; - scoped_ptr RemoveEntry(const std::string& entry_id) override; - scoped_ptr ViewEntry(ViewRequestDelegate* delegate, - scoped_ptr distiller_page, - const std::string& entry_id) override; - scoped_ptr ViewUrl(ViewRequestDelegate* delegate, - scoped_ptr distiller_page, - const GURL& url) override; - scoped_ptr CreateDefaultDistillerPage( + std::unique_ptr RemoveEntry( + const std::string& entry_id) override; + std::unique_ptr ViewEntry( + ViewRequestDelegate* delegate, + std::unique_ptr distiller_page, + const std::string& entry_id) override; + std::unique_ptr ViewUrl( + ViewRequestDelegate* delegate, + std::unique_ptr distiller_page, + const GURL& url) override; + std::unique_ptr CreateDefaultDistillerPage( const gfx::Size& render_view_size) override; - scoped_ptr CreateDefaultDistillerPageWithHandle( - scoped_ptr handle) override; + std::unique_ptr CreateDefaultDistillerPageWithHandle( + std::unique_ptr handle) override; void AddObserver(DomDistillerObserver* observer) override; void RemoveObserver(DomDistillerObserver* observer) override; DistilledPagePrefs* GetDistilledPagePrefs() override; diff --git a/chrome/browser/dom_distiller/profile_utils.cc b/chrome/browser/dom_distiller/profile_utils.cc index e365c6f74b5776..bc1038d4059917 100644 --- a/chrome/browser/dom_distiller/profile_utils.cc +++ b/chrome/browser/dom_distiller/profile_utils.cc @@ -4,10 +4,10 @@ #include "chrome/browser/dom_distiller/profile_utils.h" +#include #include #include "base/command_line.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/dom_distiller/dom_distiller_service_factory.h" #include "chrome/browser/dom_distiller/lazy_dom_distiller_service.h" #include "chrome/browser/profiles/profile.h" @@ -43,7 +43,7 @@ void RegisterDomDistillerViewerSource(Profile* profile) { dom_distiller::LazyDomDistillerService* lazy_service = new dom_distiller::LazyDomDistillerService( profile, dom_distiller_service_factory); - scoped_ptr ui_handle; + std::unique_ptr ui_handle; #if BUILDFLAG(ANDROID_JAVA_UI) ui_handle.reset( diff --git a/chrome/browser/dom_distiller/tab_utils.cc b/chrome/browser/dom_distiller/tab_utils.cc index 8f93f38503c43c..85eac2a9d82c8e 100644 --- a/chrome/browser/dom_distiller/tab_utils.cc +++ b/chrome/browser/dom_distiller/tab_utils.cc @@ -55,12 +55,12 @@ class SelfDeletingRequestDelegate : public ViewRequestDelegate, // Takes ownership of the ViewerHandle to keep distillation alive until |this| // is deleted. - void TakeViewerHandle(scoped_ptr viewer_handle); + void TakeViewerHandle(std::unique_ptr viewer_handle); private: // The handle to the view request towards the DomDistillerService. It // needs to be kept around to ensure the distillation request finishes. - scoped_ptr viewer_handle_; + std::unique_ptr viewer_handle_; }; void SelfDeletingRequestDelegate::DidNavigateMainFrame( @@ -98,7 +98,7 @@ void SelfDeletingRequestDelegate::OnArticleUpdated( } void SelfDeletingRequestDelegate::TakeViewerHandle( - scoped_ptr viewer_handle) { + std::unique_ptr viewer_handle) { viewer_handle_ = std::move(viewer_handle); } @@ -113,7 +113,7 @@ void StartNavigationToDistillerViewer(content::WebContents* web_contents, } void MaybeStartDistillation( - scoped_ptr source_page_handle) { + std::unique_ptr source_page_handle) { const GURL& last_committed_url = source_page_handle->web_contents()->GetLastCommittedURL(); if (!dom_distiller::url_utils::IsUrlDistillable(last_committed_url)) @@ -126,11 +126,11 @@ void MaybeStartDistillation( DomDistillerService* dom_distiller_service = DomDistillerServiceFactory::GetForBrowserContext( source_page_handle->web_contents()->GetBrowserContext()); - scoped_ptr distiller_page = + std::unique_ptr distiller_page = dom_distiller_service->CreateDefaultDistillerPageWithHandle( std::move(source_page_handle)); - scoped_ptr viewer_handle = dom_distiller_service->ViewUrl( + std::unique_ptr viewer_handle = dom_distiller_service->ViewUrl( view_request_delegate, std::move(distiller_page), last_committed_url); view_request_delegate->TakeViewerHandle(std::move(viewer_handle)); } @@ -160,7 +160,7 @@ void DistillCurrentPageAndView(content::WebContents* old_web_contents) { CoreTabHelper::FromWebContents(old_web_contents)->delegate()->SwapTabContents( old_web_contents, new_web_contents, false, false); - scoped_ptr source_page_handle( + std::unique_ptr source_page_handle( new SourcePageHandleWebContents(old_web_contents, true)); MaybeStartDistillation(std::move(source_page_handle)); @@ -171,7 +171,7 @@ void DistillAndView(content::WebContents* source_web_contents, DCHECK(source_web_contents); DCHECK(destination_web_contents); - scoped_ptr source_page_handle( + std::unique_ptr source_page_handle( new SourcePageHandleWebContents(source_web_contents, false)); MaybeStartDistillation(std::move(source_page_handle)); diff --git a/chrome/browser/dom_distiller/tab_utils_browsertest.cc b/chrome/browser/dom_distiller/tab_utils_browsertest.cc index 2d5fa76fba48ec..ddc07da66ca99e 100644 --- a/chrome/browser/dom_distiller/tab_utils_browsertest.cc +++ b/chrome/browser/dom_distiller/tab_utils_browsertest.cc @@ -111,7 +111,7 @@ IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest, browser()->tab_strip_model()->GetActiveWebContents(); ASSERT_TRUE(after_web_contents != NULL); base::RunLoop new_url_loaded_runner; - scoped_ptr distilled_page_loaded( + std::unique_ptr distilled_page_loaded( new WebContentsMainFrameHelper(after_web_contents, new_url_loaded_runner.QuitClosure())); new_url_loaded_runner.Run(); @@ -154,7 +154,7 @@ IN_PROC_BROWSER_TEST_F(DomDistillerTabUtilsBrowserTest, // Wait until the destination WebContents has fully navigated. base::RunLoop new_url_loaded_runner; - scoped_ptr distilled_page_loaded( + std::unique_ptr distilled_page_loaded( new WebContentsMainFrameHelper(destination_web_contents, new_url_loaded_runner.QuitClosure())); new_url_loaded_runner.Run(); diff --git a/chrome/browser/engagement/site_engagement_eviction_policy.h b/chrome/browser/engagement/site_engagement_eviction_policy.h index d160beea5d0373..42664497be6fcf 100644 --- a/chrome/browser/engagement/site_engagement_eviction_policy.h +++ b/chrome/browser/engagement/site_engagement_eviction_policy.h @@ -8,10 +8,10 @@ #include #include +#include #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "storage/browser/quota/quota_manager.h" #include "url/gurl.h" diff --git a/chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc b/chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc index 85127f9f1ef952..da297828b7f292 100644 --- a/chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc +++ b/chrome/browser/engagement/site_engagement_eviction_policy_unittest.cc @@ -2,15 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/engagement/site_engagement_eviction_policy.h" + #include +#include + #include "base/files/scoped_temp_dir.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" -#include "chrome/browser/engagement/site_engagement_eviction_policy.h" #include "chrome/browser/engagement/site_engagement_service.h" #include "content/public/test/mock_special_storage_policy.h" #include "content/public/test/mock_storage_client.h" @@ -84,7 +86,7 @@ class SiteEngagementEvictionPolicyTest : public testing::Test { } private: - scoped_ptr score_provider_; + std::unique_ptr score_provider_; scoped_refptr storage_policy_; DISALLOW_COPY_AND_ASSIGN(SiteEngagementEvictionPolicyTest); diff --git a/chrome/browser/engagement/site_engagement_helper.cc b/chrome/browser/engagement/site_engagement_helper.cc index 265580e0a889bb..5e9bdb1d291958 100644 --- a/chrome/browser/engagement/site_engagement_helper.cc +++ b/chrome/browser/engagement/site_engagement_helper.cc @@ -53,7 +53,7 @@ bool SiteEngagementHelper::PeriodicTracker::IsTimerRunning() { } void SiteEngagementHelper::PeriodicTracker::SetPauseTimerForTesting( - scoped_ptr timer) { + std::unique_ptr timer) { pause_timer_ = std::move(timer); } diff --git a/chrome/browser/engagement/site_engagement_helper.h b/chrome/browser/engagement/site_engagement_helper.h index 0b002ab93bf14e..4a56fb0b7f09cb 100644 --- a/chrome/browser/engagement/site_engagement_helper.h +++ b/chrome/browser/engagement/site_engagement_helper.h @@ -57,7 +57,7 @@ class SiteEngagementHelper bool IsTimerRunning(); // Set the timer object for testing. - void SetPauseTimerForTesting(scoped_ptr timer); + void SetPauseTimerForTesting(std::unique_ptr timer); SiteEngagementHelper* helper() { return helper_; } @@ -76,7 +76,7 @@ class SiteEngagementHelper private: SiteEngagementHelper* helper_; - scoped_ptr pause_timer_; + std::unique_ptr pause_timer_; }; // Class to encapsulate time-on-site engagement detection. Time-on-site is diff --git a/chrome/browser/engagement/site_engagement_helper_unittest.cc b/chrome/browser/engagement/site_engagement_helper_unittest.cc index 88a071967afbe3..919837f9d9ffb3 100644 --- a/chrome/browser/engagement/site_engagement_helper_unittest.cc +++ b/chrome/browser/engagement/site_engagement_helper_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/engagement/site_engagement_helper.h" +#include "base/memory/ptr_util.h" #include "base/test/histogram_tester.h" #include "base/timer/mock_timer.h" #include "base/values.h" @@ -69,13 +70,13 @@ class SiteEngagementHelperTest : public ChromeRenderViewHostTestHarness { // Set a pause timer on the input tracker for test purposes. void SetInputTrackerPauseTimer(SiteEngagementHelper* helper, - scoped_ptr timer) { + std::unique_ptr timer) { helper->input_tracker_.SetPauseTimerForTesting(std::move(timer)); } // Set a pause timer on the input tracker for test purposes. void SetMediaTrackerPauseTimer(SiteEngagementHelper* helper, - scoped_ptr timer) { + std::unique_ptr timer) { helper->media_tracker_.SetPauseTimerForTesting(std::move(timer)); } @@ -213,7 +214,7 @@ TEST_F(SiteEngagementHelperTest, MediaEngagement) { base::MockTimer* media_tracker_timer = new base::MockTimer(true, false); SiteEngagementHelper* helper = GetHelper(contents); - SetMediaTrackerPauseTimer(helper, make_scoped_ptr(media_tracker_timer)); + SetMediaTrackerPauseTimer(helper, base::WrapUnique(media_tracker_timer)); SiteEngagementService* service = SiteEngagementServiceFactory::GetForProfile(profile()); DCHECK(service); @@ -398,8 +399,8 @@ TEST_F(SiteEngagementHelperTest, CheckTimerAndCallbacks) { base::MockTimer* input_tracker_timer = new base::MockTimer(true, false); base::MockTimer* media_tracker_timer = new base::MockTimer(true, false); SiteEngagementHelper* helper = GetHelper(contents); - SetInputTrackerPauseTimer(helper, make_scoped_ptr(input_tracker_timer)); - SetMediaTrackerPauseTimer(helper, make_scoped_ptr(media_tracker_timer)); + SetInputTrackerPauseTimer(helper, base::WrapUnique(input_tracker_timer)); + SetMediaTrackerPauseTimer(helper, base::WrapUnique(media_tracker_timer)); SiteEngagementService* service = SiteEngagementServiceFactory::GetForProfile(profile()); @@ -506,8 +507,8 @@ TEST_F(SiteEngagementHelperTest, ShowAndHide) { base::MockTimer* input_tracker_timer = new base::MockTimer(true, false); base::MockTimer* media_tracker_timer = new base::MockTimer(true, false); SiteEngagementHelper* helper = GetHelper(contents); - SetInputTrackerPauseTimer(helper, make_scoped_ptr(input_tracker_timer)); - SetMediaTrackerPauseTimer(helper, make_scoped_ptr(media_tracker_timer)); + SetInputTrackerPauseTimer(helper, base::WrapUnique(input_tracker_timer)); + SetMediaTrackerPauseTimer(helper, base::WrapUnique(media_tracker_timer)); Navigate(url1); input_tracker_timer->Fire(); @@ -557,7 +558,7 @@ TEST_F(SiteEngagementHelperTest, SingleTabNavigation) { base::MockTimer* input_tracker_timer = new base::MockTimer(true, false); SiteEngagementHelper* helper = GetHelper(contents); - SetInputTrackerPauseTimer(helper, make_scoped_ptr(input_tracker_timer)); + SetInputTrackerPauseTimer(helper, base::WrapUnique(input_tracker_timer)); // Navigation should start the initial delay timer. Navigate(url1); diff --git a/chrome/browser/engagement/site_engagement_service.cc b/chrome/browser/engagement/site_engagement_service.cc index b336708446b92e..8eeb49c651171d 100644 --- a/chrome/browser/engagement/site_engagement_service.cc +++ b/chrome/browser/engagement/site_engagement_service.cc @@ -5,12 +5,14 @@ #include "chrome/browser/engagement/site_engagement_service.h" #include + #include #include #include #include #include "base/command_line.h" +#include "base/memory/ptr_util.h" #include "base/metrics/field_trial.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -67,9 +69,9 @@ const double kTimeDelta = 1000000; // for which WEB_APP_INSTALLED_POINTS will be added to the engagement score. const int kMaxDaysSinceShortcutLaunch = 10; -scoped_ptr GetEngagementContentSettings( +std::unique_ptr GetEngagementContentSettings( HostContentSettingsMap* settings_map) { - scoped_ptr engagement_settings( + std::unique_ptr engagement_settings( new ContentSettingsForOneType); settings_map->GetSettingsForOneType(CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), engagement_settings.get()); @@ -97,22 +99,22 @@ bool IsEngagementNavigation(ui::PageTransition transition) { ui::PAGE_TRANSITION_KEYWORD_GENERATED); } -scoped_ptr GetScoreDictForOrigin( +std::unique_ptr GetScoreDictForOrigin( HostContentSettingsMap* settings, const GURL& origin_url) { if (!settings) - return scoped_ptr(); + return std::unique_ptr(); - scoped_ptr value = settings->GetWebsiteSetting( + std::unique_ptr value = settings->GetWebsiteSetting( origin_url, origin_url, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, std::string(), NULL); if (!value.get()) - return make_scoped_ptr(new base::DictionaryValue()); + return base::WrapUnique(new base::DictionaryValue()); if (!value->IsType(base::Value::TYPE_DICTIONARY)) - return make_scoped_ptr(new base::DictionaryValue()); + return base::WrapUnique(new base::DictionaryValue()); - return make_scoped_ptr(static_cast(value.release())); + return base::WrapUnique(static_cast(value.release())); } } // namespace @@ -396,7 +398,7 @@ bool SiteEngagementService::IsEnabled() { } SiteEngagementService::SiteEngagementService(Profile* profile) - : SiteEngagementService(profile, make_scoped_ptr(new base::DefaultClock)) { + : SiteEngagementService(profile, base::WrapUnique(new base::DefaultClock)) { content::BrowserThread::PostAfterStartupTask( FROM_HERE, content::BrowserThread::GetMessageLoopProxyForThread( content::BrowserThread::UI), @@ -451,7 +453,7 @@ void SiteEngagementService::ResetScoreForURL(const GURL& url, double score) { HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(profile_); - scoped_ptr score_dict = + std::unique_ptr score_dict = GetScoreDictForOrigin(settings_map, url); SiteEngagementScore engagement_score(clock_.get(), *score_dict); @@ -491,7 +493,7 @@ void SiteEngagementService::OnURLsDeleted( void SiteEngagementService::SetLastShortcutLaunchTime(const GURL& url) { HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(profile_); - scoped_ptr score_dict = + std::unique_ptr score_dict = GetScoreDictForOrigin(settings_map, url); SiteEngagementScore score(clock_.get(), *score_dict); @@ -517,7 +519,7 @@ void SiteEngagementService::SetLastShortcutLaunchTime(const GURL& url) { double SiteEngagementService::GetScore(const GURL& url) const { HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(profile_); - scoped_ptr score_dict = + std::unique_ptr score_dict = GetScoreDictForOrigin(settings_map, url); SiteEngagementScore score(clock_.get(), *score_dict); @@ -537,7 +539,7 @@ double SiteEngagementService::GetTotalEngagementPoints() const { std::map SiteEngagementService::GetScoreMap() const { HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(profile_); - scoped_ptr engagement_settings = + std::unique_ptr engagement_settings = GetEngagementContentSettings(settings_map); std::map score_map; @@ -546,7 +548,7 @@ std::map SiteEngagementService::GetScoreMap() const { if (!origin.is_valid()) continue; - scoped_ptr score_dict = + std::unique_ptr score_dict = GetScoreDictForOrigin(settings_map, origin); SiteEngagementScore score(clock_.get(), *score_dict); score_map[origin] = score.Score(); @@ -603,7 +605,7 @@ bool SiteEngagementService::IsEngagementAtLeast( } SiteEngagementService::SiteEngagementService(Profile* profile, - scoped_ptr clock) + std::unique_ptr clock) : profile_(profile), clock_(std::move(clock)), weak_factory_(this) { // May be null in tests. history::HistoryService* history = HistoryServiceFactory::GetForProfile( @@ -615,7 +617,7 @@ SiteEngagementService::SiteEngagementService(Profile* profile, void SiteEngagementService::AddPoints(const GURL& url, double points) { HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(profile_); - scoped_ptr score_dict = + std::unique_ptr score_dict = GetScoreDictForOrigin(settings_map, url); SiteEngagementScore score(clock_.get(), *score_dict); @@ -635,13 +637,13 @@ void SiteEngagementService::AfterStartupTask() { void SiteEngagementService::CleanupEngagementScores() { HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(profile_); - scoped_ptr engagement_settings = + std::unique_ptr engagement_settings = GetEngagementContentSettings(settings_map); for (const auto& site : *engagement_settings) { GURL origin(site.primary_pattern.ToString()); if (origin.is_valid()) { - scoped_ptr score_dict = + std::unique_ptr score_dict = GetScoreDictForOrigin(settings_map, origin); SiteEngagementScore score(clock_.get(), *score_dict); if (score.Score() != 0) @@ -711,7 +713,7 @@ double SiteEngagementService::GetMedianEngagement( int SiteEngagementService::OriginsWithMaxDailyEngagement() const { HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(profile_); - scoped_ptr engagement_settings = + std::unique_ptr engagement_settings = GetEngagementContentSettings(settings_map); int total_origins = 0; @@ -722,7 +724,7 @@ int SiteEngagementService::OriginsWithMaxDailyEngagement() const { if (!origin.is_valid()) continue; - scoped_ptr score_dict = + std::unique_ptr score_dict = GetScoreDictForOrigin(settings_map, origin); SiteEngagementScore score(clock_.get(), *score_dict); if (score.MaxPointsPerDayAdded()) diff --git a/chrome/browser/engagement/site_engagement_service.h b/chrome/browser/engagement/site_engagement_service.h index 4cfdc78a6f7d68..554fb2df274d9e 100644 --- a/chrome/browser/engagement/site_engagement_service.h +++ b/chrome/browser/engagement/site_engagement_service.h @@ -278,7 +278,7 @@ class SiteEngagementService : public KeyedService, FRIEND_TEST_ALL_PREFIXES(AppBannerSettingsHelperTest, SiteEngagementTrigger); // Only used in tests. - SiteEngagementService(Profile* profile, scoped_ptr clock); + SiteEngagementService(Profile* profile, std::unique_ptr clock); // Adds the specified number of points to the given origin, respecting the // maximum limits for the day and overall. @@ -306,7 +306,7 @@ class SiteEngagementService : public KeyedService, Profile* profile_; // The clock used to vend times. - scoped_ptr clock_; + std::unique_ptr clock_; // Metrics are recorded at non-incognito browser startup, and then // approximately once per hour thereafter. Store the local time at which diff --git a/chrome/browser/engagement/site_engagement_service_unittest.cc b/chrome/browser/engagement/site_engagement_service_unittest.cc index 29cfa2e988ce1e..08da629baf8cd3 100644 --- a/chrome/browser/engagement/site_engagement_service_unittest.cc +++ b/chrome/browser/engagement/site_engagement_service_unittest.cc @@ -8,6 +8,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/test/histogram_tester.h" #include "base/test/simple_test_clock.h" @@ -89,9 +90,10 @@ base::Time GetReferenceTime() { return base::Time::FromLocalExploded(exploded_reference_time); } -scoped_ptr BuildTestHistoryService( +std::unique_ptr BuildTestHistoryService( content::BrowserContext* context) { - scoped_ptr service(new history::HistoryService()); + std::unique_ptr service( + new history::HistoryService()); service->Init(history::TestHistoryDatabaseParamsForPath(g_temp_history_dir)); return std::move(service); } @@ -652,8 +654,8 @@ TEST_F(SiteEngagementServiceTest, GetTotalUserInputPoints) { TEST_F(SiteEngagementServiceTest, LastShortcutLaunch) { base::SimpleTestClock* clock = new base::SimpleTestClock(); - scoped_ptr service( - new SiteEngagementService(profile(), make_scoped_ptr(clock))); + std::unique_ptr service( + new SiteEngagementService(profile(), base::WrapUnique(clock))); base::HistogramTester histograms; @@ -717,8 +719,8 @@ TEST_F(SiteEngagementServiceTest, CheckHistograms) { base::HistogramTester histograms; base::SimpleTestClock* clock = new base::SimpleTestClock(); - scoped_ptr service( - new SiteEngagementService(profile(), make_scoped_ptr(clock))); + std::unique_ptr service( + new SiteEngagementService(profile(), base::WrapUnique(clock))); base::Time current_day = GetReferenceTime(); clock->SetNow(current_day); @@ -982,8 +984,8 @@ TEST_F(SiteEngagementServiceTest, CheckHistograms) { // Expect that sites that have reached zero engagement are cleaned up. TEST_F(SiteEngagementServiceTest, CleanupEngagementScores) { base::SimpleTestClock* clock = new base::SimpleTestClock(); - scoped_ptr service( - new SiteEngagementService(profile(), make_scoped_ptr(clock))); + std::unique_ptr service( + new SiteEngagementService(profile(), base::WrapUnique(clock))); base::Time current_day = GetReferenceTime(); clock->SetNow(current_day); @@ -1080,8 +1082,8 @@ TEST_F(SiteEngagementServiceTest, NavigationAccumulation) { TEST_F(SiteEngagementServiceTest, IsBootstrapped) { base::SimpleTestClock* clock = new base::SimpleTestClock(); - scoped_ptr service( - new SiteEngagementService(profile(), make_scoped_ptr(clock))); + std::unique_ptr service( + new SiteEngagementService(profile(), base::WrapUnique(clock))); base::Time current_day = GetReferenceTime(); clock->SetNow(current_day); @@ -1192,8 +1194,8 @@ TEST_F(SiteEngagementServiceTest, EngagementLevel) { "enum values should not be equal"); base::SimpleTestClock* clock = new base::SimpleTestClock(); - scoped_ptr service( - new SiteEngagementService(profile(), make_scoped_ptr(clock))); + std::unique_ptr service( + new SiteEngagementService(profile(), base::WrapUnique(clock))); base::Time current_day = GetReferenceTime(); clock->SetNow(current_day); @@ -1292,8 +1294,8 @@ TEST_F(SiteEngagementServiceTest, EngagementLevel) { TEST_F(SiteEngagementServiceTest, ScoreDecayHistograms) { base::SimpleTestClock* clock = new base::SimpleTestClock(); - scoped_ptr service( - new SiteEngagementService(profile(), make_scoped_ptr(clock))); + std::unique_ptr service( + new SiteEngagementService(profile(), base::WrapUnique(clock))); base::Time current_day = GetReferenceTime(); clock->SetNow(current_day); diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc index 372f367b7146a0..a199a9f76ca949 100644 --- a/chrome/browser/enumerate_modules_model_win.cc +++ b/chrome/browser/enumerate_modules_model_win.cc @@ -4,11 +4,13 @@ #include "chrome/browser/enumerate_modules_model_win.h" +#include #include #include -#include #include + #include +#include #include "base/bind.h" #include "base/command_line.h" @@ -17,7 +19,6 @@ #include "base/files/file_path.h" #include "base/i18n/case_conversion.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" @@ -627,7 +628,7 @@ void ModuleEnumerator::PopulateModuleInformation(Module* module) { module->digital_signer = GetSubjectNameFromDigitalSignature(base::FilePath(module->location)); module->recommended_action = NONE; - scoped_ptr version_info( + std::unique_ptr version_info( FileVersionInfo::CreateFileVersionInfo(base::FilePath(module->location))); if (version_info.get()) { FileVersionInfoWin* version_info_win = @@ -663,7 +664,7 @@ void ModuleEnumerator::AddToListWithoutDuplicating(const Module& module) { void ModuleEnumerator::PreparePathMappings() { path_mapping_.clear(); - scoped_ptr environment(base::Environment::Create()); + std::unique_ptr environment(base::Environment::Create()); std::vector env_vars; env_vars.push_back(L"LOCALAPPDATA"); env_vars.push_back(L"ProgramFiles"); @@ -787,7 +788,7 @@ base::string16 ModuleEnumerator::GetSubjectNameFromDigitalSignature( return base::string16(); // Allocate enough space to hold the signer info. - scoped_ptr signer_info_buffer(new BYTE[signer_info_size]); + std::unique_ptr signer_info_buffer(new BYTE[signer_info_size]); CMSG_SIGNER_INFO* signer_info = reinterpret_cast(signer_info_buffer.get()); diff --git a/chrome/browser/errorpage_browsertest.cc b/chrome/browser/errorpage_browsertest.cc index 676f642ad88205..eddd55d41b637c 100644 --- a/chrome/browser/errorpage_browsertest.cc +++ b/chrome/browser/errorpage_browsertest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include #include #include "base/bind.h" @@ -10,7 +11,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/logging.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/path_service.h" #include "base/strings/stringprintf.h" @@ -155,9 +155,8 @@ std::string GetShowSavedButtonLabel() { return l10n_util::GetStringUTF8(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY); } -void AddInterceptorForURL( - const GURL& url, - scoped_ptr handler) { +void AddInterceptorForURL(const GURL& url, + std::unique_ptr handler) { DCHECK_CURRENTLY_ON(BrowserThread::IO); net::URLRequestFilter::GetInstance()->AddUrlInterceptor(url, std::move(handler)); @@ -274,7 +273,7 @@ class LinkDoctorInterceptor : public net::URLRequestInterceptor { // These are only used on the UI thread. int num_requests_; int requests_to_wait_for_; - scoped_ptr run_loop_; + std::unique_ptr run_loop_; // This prevents any risk of flake if any test doesn't wait for a request // it sent. Mutable so it can be accessed from a const function. @@ -285,7 +284,7 @@ class LinkDoctorInterceptor : public net::URLRequestInterceptor { void InstallMockInterceptors( const GURL& search_url, - scoped_ptr link_doctor_interceptor) { + std::unique_ptr link_doctor_interceptor) { chrome_browser_net::SetUrlRequestMocksEnabled(true); AddInterceptorForURL(google_util::LinkDoctorBaseURL(), @@ -425,7 +424,7 @@ class ErrorPageTest : public InProcessBrowserTest { protected: void SetUpOnMainThread() override { link_doctor_interceptor_ = new LinkDoctorInterceptor(); - scoped_ptr owned_interceptor( + std::unique_ptr owned_interceptor( link_doctor_interceptor_); // Ownership of the |interceptor_| is passed to an object the IO thread, but // a pointer is kept in the test fixture. As soon as anything calls @@ -518,7 +517,7 @@ void InterceptNetworkTransactions(net::URLRequestContextGetter* getter, net::HttpCache* cache( getter->GetURLRequestContext()->http_transaction_factory()->GetCache()); DCHECK(cache); - scoped_ptr factory( + std::unique_ptr factory( new net::FailingHttpTransactionFactory(cache->GetSession(), error)); // Throw away old version; since this is a a browser test, we don't // need to restore the old state. @@ -1020,7 +1019,7 @@ class ErrorPageAutoReloadTest : public InProcessBrowserTest { void InstallInterceptor(const GURL& url, int requests_to_fail) { interceptor_ = new FailFirstNRequestsInterceptor(requests_to_fail); - scoped_ptr owned_interceptor(interceptor_); + std::unique_ptr owned_interceptor(interceptor_); // Tests don't need to wait for this task to complete before using the // filter; any requests that might be affected by it will end up in the IO @@ -1184,7 +1183,7 @@ class ErrorPageNavigationCorrectionsFailTest : public ErrorPageTest { net::URLRequestFilter::GetInstance()->AddUrlInterceptor( google_util::LinkDoctorBaseURL(), - scoped_ptr( + std::unique_ptr( new AddressUnreachableInterceptor())); } @@ -1266,7 +1265,7 @@ class ErrorPageOfflineTest : public ErrorPageTest { #if defined(OS_CHROMEOS) if (enroll_) { // Set up fake install attributes. - scoped_ptr attributes( + std::unique_ptr attributes( new policy::StubEnterpriseInstallAttributes()); attributes->SetDomain("example.com"); attributes->SetRegistrationUser("user@example.com"); diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_event_log_apitest.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_event_log_apitest.cc index b621e233ba3f80..726a8d96f16f4f 100644 --- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_event_log_apitest.cc +++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_event_log_apitest.cc @@ -127,12 +127,13 @@ IN_PROC_BROWSER_TEST_F(WebrtcEventLogApiTest, TestStartStopWebRtcEventLogging) { scoped_refptr start_function(CreateExtensionFunction< WebrtcLoggingPrivateStartWebRtcEventLoggingFunction>()); - scoped_ptr start_result(utils::RunFunctionAndReturnSingleResult( - start_function.get(), ParamsToString(start_params), browser())); + std::unique_ptr start_result( + utils::RunFunctionAndReturnSingleResult( + start_function.get(), ParamsToString(start_params), browser())); ASSERT_TRUE(start_result.get()); // Get the file name. - scoped_ptr + std::unique_ptr recordings_info_start( extensions::api::webrtc_logging_private::RecordingInfo::FromValue( *start_result.get())); @@ -152,11 +153,12 @@ IN_PROC_BROWSER_TEST_F(WebrtcEventLogApiTest, TestStartStopWebRtcEventLogging) { scoped_refptr stop_function(CreateExtensionFunction< WebrtcLoggingPrivateStopWebRtcEventLoggingFunction>()); - scoped_ptr stop_result(utils::RunFunctionAndReturnSingleResult( - stop_function.get(), ParamsToString(stop_params), browser())); + std::unique_ptr stop_result( + utils::RunFunctionAndReturnSingleResult( + stop_function.get(), ParamsToString(stop_params), browser())); // Get the file name. - scoped_ptr + std::unique_ptr recordings_info_stop( extensions::api::webrtc_logging_private::RecordingInfo::FromValue( *stop_result.get())); @@ -218,12 +220,13 @@ IN_PROC_BROWSER_TEST_F(WebrtcEventLogApiTest, scoped_refptr start_function(CreateExtensionFunction< WebrtcLoggingPrivateStartWebRtcEventLoggingFunction>()); - scoped_ptr start_result(utils::RunFunctionAndReturnSingleResult( - start_function.get(), ParamsToString(start_params), browser())); + std::unique_ptr start_result( + utils::RunFunctionAndReturnSingleResult( + start_function.get(), ParamsToString(start_params), browser())); ASSERT_TRUE(start_result.get()); // Get the file name. - scoped_ptr + std::unique_ptr recordings_info_start( extensions::api::webrtc_logging_private::RecordingInfo::FromValue( *start_result.get())); diff --git a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc index 291e7daa77b175..bd0d7f37f588bc 100644 --- a/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc +++ b/chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc @@ -456,7 +456,7 @@ bool WebrtcLoggingPrivateStartWebRtcEventLoggingFunction::RunAsync() { return false; } - scoped_ptr params( + std::unique_ptr params( StartWebRtcEventLogging::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); @@ -491,7 +491,7 @@ bool WebrtcLoggingPrivateStopWebRtcEventLoggingFunction::RunAsync() { return false; } - scoped_ptr params( + std::unique_ptr params( StopWebRtcEventLogging::Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params.get()); diff --git a/chrome/browser/favicon/content_favicon_driver_browsertest.cc b/chrome/browser/favicon/content_favicon_driver_browsertest.cc index 12101ba5977a46..eb782f36d211a7 100644 --- a/chrome/browser/favicon/content_favicon_driver_browsertest.cc +++ b/chrome/browser/favicon/content_favicon_driver_browsertest.cc @@ -210,7 +210,7 @@ IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, ReloadBypassingCache) { GURL url = embedded_test_server()->GetURL("/favicon/page_with_favicon.html"); GURL icon_url = embedded_test_server()->GetURL("/favicon/icon.png"); - scoped_ptr delegate( + std::unique_ptr delegate( new TestResourceDispatcherHostDelegate(icon_url)); content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); diff --git a/chrome/browser/favicon/favicon_service_factory.cc b/chrome/browser/favicon/favicon_service_factory.cc index c15ba95f3ac05b..d1717cb011bbe8 100644 --- a/chrome/browser/favicon/favicon_service_factory.cc +++ b/chrome/browser/favicon/favicon_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/favicon/favicon_service_factory.h" +#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "chrome/browser/favicon/chrome_favicon_client.h" #include "chrome/browser/history/history_service_factory.h" @@ -15,10 +16,11 @@ namespace { -scoped_ptr BuildFaviconService(content::BrowserContext* context) { +std::unique_ptr BuildFaviconService( + content::BrowserContext* context) { Profile* profile = Profile::FromBrowserContext(context); - return make_scoped_ptr(new favicon::FaviconService( - make_scoped_ptr(new ChromeFaviconClient(profile)), + return base::WrapUnique(new favicon::FaviconService( + base::WrapUnique(new ChromeFaviconClient(profile)), HistoryServiceFactory::GetForProfile( profile, ServiceAccessType::EXPLICIT_ACCESS))); } diff --git a/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc b/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc index c2cccc16a7b149..804875eeec8951 100644 --- a/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc +++ b/chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc @@ -112,7 +112,7 @@ void ChromeInternalLogSource::PopulateSyncLogs(SystemLogsResponse* response) { ProfileSyncService* service = ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); - scoped_ptr sync_logs( + std::unique_ptr sync_logs( sync_driver::sync_ui_util::ConstructAboutInformation( service, service->signin(), chrome::GetChannel())); diff --git a/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.cc b/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.cc index ecaf6b7e11faf7..bdcfd7f72c3ed5 100644 --- a/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.cc +++ b/chrome/browser/feedback/system_logs/log_sources/memory_details_log_source.cc @@ -21,7 +21,7 @@ class SystemLogsMemoryHandler : public MemoryDetails { void OnDetailsAvailable() override { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - scoped_ptr response(new SystemLogsResponse); + std::unique_ptr response(new SystemLogsResponse); (*response)["mem_usage"] = ToLogString(); callback_.Run(response.get()); } diff --git a/chrome/browser/feedback/system_logs/system_logs_fetcher_base.h b/chrome/browser/feedback/system_logs/system_logs_fetcher_base.h index 349c4489942e8e..9526da16449bcf 100644 --- a/chrome/browser/feedback/system_logs/system_logs_fetcher_base.h +++ b/chrome/browser/feedback/system_logs/system_logs_fetcher_base.h @@ -8,11 +8,11 @@ #include #include +#include #include #include "base/callback.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" @@ -25,7 +25,7 @@ typedef base::Callback SysLogsSourceCallback; // Callback that the SystemLogsFetcherBase uses to return data. -typedef base::Callback response)> +typedef base::Callback response)> SysLogsFetcherCallback; // The SystemLogsSource provides a interface for the data sources that @@ -86,7 +86,7 @@ class SystemLogsFetcherBase ScopedVector data_sources_; SysLogsFetcherCallback callback_; - scoped_ptr response_; // The actual response data. + std::unique_ptr response_; // The actual response data. size_t num_pending_requests_; // The number of callbacks it should get. private: diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc index 046a310be909ac..5ea49d736eda25 100644 --- a/chrome/browser/file_select_helper.cc +++ b/chrome/browser/file_select_helper.cc @@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" +#include "base/memory/ptr_util.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -89,8 +90,8 @@ bool IsValidProfile(Profile* profile) { struct FileSelectHelper::ActiveDirectoryEnumeration { ActiveDirectoryEnumeration() : rvh_(NULL) {} - scoped_ptr delegate_; - scoped_ptr lister_; + std::unique_ptr delegate_; + std::unique_ptr lister_; RenderViewHost* rvh_; std::vector results_; }; @@ -199,7 +200,8 @@ void FileSelectHelper::FileSelectionCanceled(void* params) { void FileSelectHelper::StartNewEnumeration(const base::FilePath& path, int request_id, RenderViewHost* render_view_host) { - scoped_ptr entry(new ActiveDirectoryEnumeration); + std::unique_ptr entry( + new ActiveDirectoryEnumeration); entry->rvh_ = render_view_host; entry->delegate_.reset(new DirectoryListerDispatchDelegate(this, request_id)); entry->lister_.reset(new net::DirectoryLister( @@ -229,7 +231,8 @@ void FileSelectHelper::OnListFile( void FileSelectHelper::OnListDone(int id, int error) { // This entry needs to be cleaned up when this function is done. - scoped_ptr entry(directory_enumerations_[id]); + std::unique_ptr entry( + directory_enumerations_[id]); directory_enumerations_.erase(id); if (!entry->rvh_) return; @@ -316,16 +319,16 @@ void FileSelectHelper::CleanUpOnRenderViewHostChange() { } } -scoped_ptr +std::unique_ptr FileSelectHelper::GetFileTypesFromAcceptType( const std::vector& accept_types) { - scoped_ptr base_file_type( + std::unique_ptr base_file_type( new ui::SelectFileDialog::FileTypeInfo()); if (accept_types.empty()) return base_file_type; // Create FileTypeInfo and pre-allocate for the first extension list. - scoped_ptr file_type( + std::unique_ptr file_type( new ui::SelectFileDialog::FileTypeInfo(*base_file_type)); file_type->include_all_files = true; file_type->extensions.resize(1); @@ -393,7 +396,7 @@ void FileSelectHelper::RunFileChooser(content::WebContents* tab, new FileSelectHelper(profile)); file_select_helper->RunFileChooser( tab->GetRenderViewHost(), tab, - make_scoped_ptr(new content::FileChooserParams(params))); + base::WrapUnique(new content::FileChooserParams(params))); } // static @@ -408,9 +411,10 @@ void FileSelectHelper::EnumerateDirectory(content::WebContents* tab, request_id, tab->GetRenderViewHost(), path); } -void FileSelectHelper::RunFileChooser(RenderViewHost* render_view_host, - content::WebContents* web_contents, - scoped_ptr params) { +void FileSelectHelper::RunFileChooser( + RenderViewHost* render_view_host, + content::WebContents* web_contents, + std::unique_ptr params) { DCHECK(!render_view_host_); DCHECK(!web_contents_); DCHECK(params->default_file_name.empty() || @@ -442,7 +446,7 @@ void FileSelectHelper::RunFileChooser(RenderViewHost* render_view_host, } void FileSelectHelper::GetFileTypesOnFileThread( - scoped_ptr params) { + std::unique_ptr params) { select_file_types_ = GetFileTypesFromAcceptType(params->accept_types); select_file_types_->allowed_paths = params->need_local_path ? ui::SelectFileDialog::FileTypeInfo::NATIVE_PATH @@ -455,7 +459,7 @@ void FileSelectHelper::GetFileTypesOnFileThread( } void FileSelectHelper::GetSanitizedFilenameOnUIThread( - scoped_ptr params) { + std::unique_ptr params) { base::FilePath default_file_path = profile_->last_selected_directory().Append( GetSanitizedFileName(params->default_file_name)); @@ -487,7 +491,7 @@ void FileSelectHelper::GetSanitizedFilenameOnUIThread( #if defined(FULL_SAFE_BROWSING) void FileSelectHelper::ApplyUnverifiedDownloadPolicy( const base::FilePath& default_path, - scoped_ptr params, + std::unique_ptr params, safe_browsing::UnverifiedDownloadPolicy policy) { DCHECK(params); if (policy == safe_browsing::UnverifiedDownloadPolicy::DISALLOWED) { @@ -501,7 +505,7 @@ void FileSelectHelper::ApplyUnverifiedDownloadPolicy( void FileSelectHelper::RunFileChooserOnUIThread( const base::FilePath& default_file_path, - scoped_ptr params) { + std::unique_ptr params) { DCHECK(params); if (!render_view_host_ || !web_contents_ || !IsValidProfile(profile_) || !render_view_host_->GetWidget()->GetView()) { diff --git a/chrome/browser/file_select_helper.h b/chrome/browser/file_select_helper.h index 3011f13f16ac15..531ce927202353 100644 --- a/chrome/browser/file_select_helper.h +++ b/chrome/browser/file_select_helper.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_FILE_SELECT_HELPER_H_ #include +#include #include #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "build/build_config.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_observer.h" @@ -95,18 +95,20 @@ class FileSelectHelper : public base::RefCountedThreadSafe< void RunFileChooser(content::RenderViewHost* render_view_host, content::WebContents* web_contents, - scoped_ptr params); - void GetFileTypesOnFileThread(scoped_ptr params); + std::unique_ptr params); + void GetFileTypesOnFileThread( + std::unique_ptr params); void GetSanitizedFilenameOnUIThread( - scoped_ptr params); + std::unique_ptr params); #if defined(FULL_SAFE_BROWSING) void ApplyUnverifiedDownloadPolicy( const base::FilePath& default_path, - scoped_ptr params, + std::unique_ptr params, safe_browsing::UnverifiedDownloadPolicy policy); #endif - void RunFileChooserOnUIThread(const base::FilePath& default_path, - scoped_ptr params); + void RunFileChooserOnUIThread( + const base::FilePath& default_path, + std::unique_ptr params); // Cleans up and releases this instance. This must be called after the last // callback is received from the file chooser dialog. @@ -194,9 +196,8 @@ class FileSelectHelper : public base::RefCountedThreadSafe< // http://whatwg.org/html/number-state.html#attr-input-accept // |accept_types| contains only valid lowercased MIME types or file extensions // beginning with a period (.). - static scoped_ptr - GetFileTypesFromAcceptType( - const std::vector& accept_types); + static std::unique_ptr + GetFileTypesFromAcceptType(const std::vector& accept_types); // Check the accept type is valid. It is expected to be all lower case with // no whitespace. @@ -228,7 +229,7 @@ class FileSelectHelper : public base::RefCountedThreadSafe< // Dialog box used for choosing files to upload from file form fields. scoped_refptr select_file_dialog_; - scoped_ptr select_file_types_; + std::unique_ptr select_file_types_; // The type of file dialog last shown. ui::SelectFileDialog::Type dialog_type_; diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index dbe860660cce8a..e2fa0b8ff36799 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -282,7 +282,7 @@ void ImportFromFile(Profile* profile, // Imports settings from the first profile in |importer_list|. void ImportSettings(Profile* profile, - scoped_ptr importer_list, + std::unique_ptr importer_list, int items_to_import) { const importer::SourceProfile& source_profile = importer_list->GetSourceProfileAt(0); @@ -724,7 +724,8 @@ ProcessMasterPreferencesResult ProcessMasterPreferences( MasterPrefs* out_prefs) { DCHECK(!user_data_dir.empty()); - scoped_ptr install_prefs(LoadMasterPrefs()); + std::unique_ptr install_prefs( + LoadMasterPrefs()); // Default value in case master preferences is missing or corrupt, or // ping_delay is missing. @@ -760,7 +761,7 @@ void AutoImport( // It may be possible to do the if block below asynchronously. In which case, // get rid of this RunLoop. http://crbug.com/366116. base::RunLoop run_loop; - scoped_ptr importer_list(new ImporterList()); + std::unique_ptr importer_list(new ImporterList()); importer_list->DetectSourceProfiles( g_browser_process->GetApplicationLocale(), false, // include_interactive_profiles? diff --git a/chrome/browser/first_run/first_run_browsertest.cc b/chrome/browser/first_run/first_run_browsertest.cc index 519edab11520c6..90250a41410f4c 100644 --- a/chrome/browser/first_run/first_run_browsertest.cc +++ b/chrome/browser/first_run/first_run_browsertest.cc @@ -119,7 +119,7 @@ class FirstRunMasterPrefsBrowserTestBase : public InProcessBrowserTest { private: base::FilePath prefs_file_; - scoped_ptr text_; + std::unique_ptr text_; DISALLOW_COPY_AND_ASSIGN(FirstRunMasterPrefsBrowserTestBase); }; @@ -145,7 +145,7 @@ class FirstRunMasterPrefsBrowserTestT // bot configurations do not have another profile (browser) to import from and // thus the import must not be expected to have occurred. int MaskExpectedImportState(int expected_import_state) { - scoped_ptr importer_list(new ImporterList()); + std::unique_ptr importer_list(new ImporterList()); base::RunLoop run_loop; importer_list->DetectSourceProfiles( g_browser_process->GetApplicationLocale(), diff --git a/chrome/browser/geolocation/geolocation_browsertest.cc b/chrome/browser/geolocation/geolocation_browsertest.cc index b3ec17225dc101..d440c8619644c7 100644 --- a/chrome/browser/geolocation/geolocation_browsertest.cc +++ b/chrome/browser/geolocation/geolocation_browsertest.cc @@ -738,7 +738,7 @@ IN_PROC_BROWSER_TEST_F(GeolocationBrowserTest, MAYBE_LastUsageUpdated) { ASSERT_NO_FATAL_FAILURE(Initialize(INITIALIZATION_DEFAULT)); base::SimpleTestClock* clock_ = new base::SimpleTestClock(); GetHostContentSettingsMap()->SetPrefClockForTesting( - scoped_ptr(clock_)); + std::unique_ptr(clock_)); clock_->SetNow(base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(10)); // Setting the permission should trigger the last usage. diff --git a/chrome/browser/geolocation/geolocation_infobar_delegate_android.cc b/chrome/browser/geolocation/geolocation_infobar_delegate_android.cc index 523f08c2422f3f..a4b18a60e7c441 100644 --- a/chrome/browser/geolocation/geolocation_infobar_delegate_android.cc +++ b/chrome/browser/geolocation/geolocation_infobar_delegate_android.cc @@ -18,8 +18,8 @@ infobars::InfoBar* GeolocationInfoBarDelegateAndroid::Create( const GURL& requesting_frame, const PermissionSetCallback& callback) { return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( - scoped_ptr(new GeolocationInfoBarDelegateAndroid( - requesting_frame, callback)))); + std::unique_ptr( + new GeolocationInfoBarDelegateAndroid(requesting_frame, callback)))); } GeolocationInfoBarDelegateAndroid::GeolocationInfoBarDelegateAndroid( diff --git a/chrome/browser/geolocation/geolocation_permission_context_android.cc b/chrome/browser/geolocation/geolocation_permission_context_android.cc index 57fa1dfc9ce53d..cabc47409f5772 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_android.cc +++ b/chrome/browser/geolocation/geolocation_permission_context_android.cc @@ -92,6 +92,6 @@ void GeolocationPermissionContextAndroid::HandleUpdateAndroidPermissions( } void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( - scoped_ptr settings) { + std::unique_ptr settings) { location_settings_ = std::move(settings); } diff --git a/chrome/browser/geolocation/geolocation_permission_context_android.h b/chrome/browser/geolocation/geolocation_permission_context_android.h index 012839f804d641..443352f5cff1b5 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_android.h +++ b/chrome/browser/geolocation/geolocation_permission_context_android.h @@ -20,8 +20,9 @@ // infobars, etc.). // // Otherwise the permission is already decided. +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/geolocation/geolocation_permission_context.h" @@ -63,9 +64,10 @@ class GeolocationPermissionContextAndroid // Overrides the LocationSettings object used to determine whether // system and Chrome-wide location permissions are enabled. - void SetLocationSettingsForTesting(scoped_ptr settings); + void SetLocationSettingsForTesting( + std::unique_ptr settings); - scoped_ptr location_settings_; + std::unique_ptr location_settings_; // This is owned by the InfoBarService (owner of the InfoBar). infobars::InfoBar* permission_update_infobar_; diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc index 1360fd14d1b730..e62eb4b5225d10 100644 --- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc +++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc @@ -16,6 +16,7 @@ #include "base/containers/hash_tables.h" #include "base/gtest_prod_util.h" #include "base/id_map.h" +#include "base/memory/ptr_util.h" #include "base/synchronization/waitable_event.h" #include "base/test/simple_test_clock.h" #include "base/time/clock.h" @@ -164,9 +165,9 @@ class GeolocationPermissionContextTests // owned by the browser context GeolocationPermissionContext* geolocation_permission_context_; ClosedInfoBarTracker closed_infobar_tracker_; - std::vector> extra_tabs_; + std::vector> extra_tabs_; #if !BUILDFLAG(ANDROID_JAVA_UI) - std::vector> + std::vector> mock_permission_bubble_factories_; #endif @@ -254,7 +255,7 @@ void GeolocationPermissionContextTests::AddNewTab(const GURL& url) { SetupBubbleManager(new_tab); #endif - extra_tabs_.push_back(make_scoped_ptr(new_tab)); + extra_tabs_.push_back(base::WrapUnique(new_tab)); } void GeolocationPermissionContextTests::CheckTabContentsState( @@ -289,7 +290,7 @@ void GeolocationPermissionContextTests::SetUp() { static_cast( geolocation_permission_context_) ->SetLocationSettingsForTesting( - scoped_ptr(new MockLocationSettings())); + std::unique_ptr(new MockLocationSettings())); MockLocationSettings::SetLocationStatus(true, true); #else SetupBubbleManager(web_contents()); @@ -313,7 +314,7 @@ void GeolocationPermissionContextTests::SetupBubbleManager( PermissionBubbleManager::FromWebContents(web_contents); // Create a MockPermissionBubbleFactory for the PermissionBubbleManager. - mock_permission_bubble_factories_.push_back(make_scoped_ptr( + mock_permission_bubble_factories_.push_back(base::WrapUnique( new MockPermissionBubbleFactory(false, permission_bubble_manager))); // Prepare the PermissionBubbleManager to display a mock bubble. @@ -857,7 +858,7 @@ TEST_F(GeolocationPermissionContextTests, LastUsageAudited) { HostContentSettingsMap* map = HostContentSettingsMapFactory::GetForProfile(profile()); - map->SetPrefClockForTesting(scoped_ptr(test_clock)); + map->SetPrefClockForTesting(std::unique_ptr(test_clock)); // The permission shouldn't have been used yet. EXPECT_EQ(map->GetLastUsage(requesting_frame.GetOrigin(), @@ -895,7 +896,7 @@ TEST_F(GeolocationPermissionContextTests, LastUsageAuditedMultipleFrames) { HostContentSettingsMap* map = HostContentSettingsMapFactory::GetForProfile(profile()); - map->SetPrefClockForTesting(scoped_ptr(test_clock)); + map->SetPrefClockForTesting(std::unique_ptr(test_clock)); GURL requesting_frame_0("https://www.example.com/geolocation"); GURL requesting_frame_1("https://www.example-2.com/geolocation"); diff --git a/chrome/browser/geolocation/geolocation_settings_state_unittest.cc b/chrome/browser/geolocation/geolocation_settings_state_unittest.cc index 947b46faa05d29..20c79b4a1f0e66 100644 --- a/chrome/browser/geolocation/geolocation_settings_state_unittest.cc +++ b/chrome/browser/geolocation/geolocation_settings_state_unittest.cc @@ -35,7 +35,7 @@ TEST_F(GeolocationSettingsStateTests, ClearOnNewOrigin) { GeolocationSettingsState state(&profile); GURL url_0("http://www.example.com"); - scoped_ptr entry(NavigationEntry::Create()); + std::unique_ptr entry(NavigationEntry::Create()); entry->SetURL(url_0); content::LoadCommittedDetails load_committed_details; load_committed_details.entry = entry.get(); @@ -136,7 +136,7 @@ TEST_F(GeolocationSettingsStateTests, ShowPortOnSameHost) { GeolocationSettingsState state(&profile); GURL url_0("http://www.example.com"); - scoped_ptr entry(NavigationEntry::Create()); + std::unique_ptr entry(NavigationEntry::Create()); entry->SetURL(url_0); content::LoadCommittedDetails load_committed_details; load_committed_details.entry = entry.get(); diff --git a/chrome/browser/google/google_url_tracker_factory.cc b/chrome/browser/google/google_url_tracker_factory.cc index 1485681ba8c60c..d7ed50e926508b 100644 --- a/chrome/browser/google/google_url_tracker_factory.cc +++ b/chrome/browser/google/google_url_tracker_factory.cc @@ -41,7 +41,7 @@ KeyedService* GoogleURLTrackerFactory::BuildServiceInstanceFor( static_cast(context)->GetOriginalProfile()->GetPrefs()->ClearPref( prefs::kLastPromptedGoogleURL); - scoped_ptr client( + std::unique_ptr client( new ChromeGoogleURLTrackerClient(Profile::FromBrowserContext(context))); return new GoogleURLTracker(std::move(client), GoogleURLTracker::NORMAL_MODE); } diff --git a/chrome/browser/gpu/three_d_api_observer.cc b/chrome/browser/gpu/three_d_api_observer.cc index 2fa88038480161..1992cc3032ded2 100644 --- a/chrome/browser/gpu/three_d_api_observer.cc +++ b/chrome/browser/gpu/three_d_api_observer.cc @@ -66,8 +66,8 @@ void ThreeDAPIInfoBarDelegate::Create(InfoBarService* infobar_service, content::ThreeDAPIType requester) { if (!infobar_service) return; // NULL for apps. - infobar_service->AddInfoBar( - infobar_service->CreateConfirmInfoBar(scoped_ptr( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( + std::unique_ptr( new ThreeDAPIInfoBarDelegate(url, requester)))); } diff --git a/chrome/browser/guest_view/app_view/chrome_app_view_guest_delegate.cc b/chrome/browser/guest_view/app_view/chrome_app_view_guest_delegate.cc index d7a27b21958554..09c811dabf2dd7 100644 --- a/chrome/browser/guest_view/app_view/chrome_app_view_guest_delegate.cc +++ b/chrome/browser/guest_view/app_view/chrome_app_view_guest_delegate.cc @@ -25,7 +25,7 @@ bool ChromeAppViewGuestDelegate::HandleContextMenu( ContextMenuDelegate::FromWebContents(web_contents); DCHECK(menu_delegate); - scoped_ptr menu = + std::unique_ptr menu = menu_delegate->BuildMenu(web_contents, params); menu_delegate->ShowMenu(std::move(menu)); return true; diff --git a/chrome/browser/guest_view/extension_options/chrome_extension_options_guest_delegate.cc b/chrome/browser/guest_view/extension_options/chrome_extension_options_guest_delegate.cc index d21ceb9850dae5..087013a6ec2b50 100644 --- a/chrome/browser/guest_view/extension_options/chrome_extension_options_guest_delegate.cc +++ b/chrome/browser/guest_view/extension_options/chrome_extension_options_guest_delegate.cc @@ -28,7 +28,7 @@ bool ChromeExtensionOptionsGuestDelegate::HandleContextMenu( extension_options_guest()->web_contents()); DCHECK(menu_delegate); - scoped_ptr menu = menu_delegate->BuildMenu( + std::unique_ptr menu = menu_delegate->BuildMenu( extension_options_guest()->web_contents(), params); menu_delegate->ShowMenu(std::move(menu)); return true; diff --git a/chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.cc b/chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.cc index 224efb13596dd8..e22f0b49e5fef7 100644 --- a/chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.cc +++ b/chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_guest_delegate.cc @@ -24,7 +24,7 @@ bool ChromeMimeHandlerViewGuestDelegate::HandleContextMenu( ContextMenuDelegate::FromWebContents(web_contents); DCHECK(menu_delegate); - scoped_ptr menu = + std::unique_ptr menu = menu_delegate->BuildMenu(web_contents, params); menu_delegate->ShowMenu(std::move(menu)); return true; diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc index 32a00885584d24..5d3dee9e29d797 100644 --- a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc +++ b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.cc @@ -7,6 +7,7 @@ #include +#include "base/memory/ptr_util.h" #include "build/build_config.h" #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" #include "chrome/browser/favicon/favicon_utils.h" @@ -62,12 +63,12 @@ bool ChromeWebViewGuestDelegate::HandleContextMenu( // Pass it to embedder. int request_id = ++pending_context_menu_request_id_; - scoped_ptr args(new base::DictionaryValue()); - scoped_ptr items = + std::unique_ptr args(new base::DictionaryValue()); + std::unique_ptr items = MenuModelToValue(pending_menu_->menu_model()); args->Set(webview::kContextMenuItems, items.release()); args->SetInteger(webview::kRequestId, request_id); - web_view_guest()->DispatchEventToView(make_scoped_ptr( + web_view_guest()->DispatchEventToView(base::WrapUnique( new GuestViewEvent(webview::kEventContextMenuShow, std::move(args)))); return true; } @@ -84,9 +85,9 @@ void ChromeWebViewGuestDelegate::OnDidInitialize() { } // static -scoped_ptr ChromeWebViewGuestDelegate::MenuModelToValue( +std::unique_ptr ChromeWebViewGuestDelegate::MenuModelToValue( const ui::SimpleMenuModel& menu_model) { - scoped_ptr items(new base::ListValue()); + std::unique_ptr items(new base::ListValue()); for (int i = 0; i < menu_model.GetItemCount(); ++i) { base::DictionaryValue* item_value = new base::DictionaryValue(); // TODO(lazyboy): We need to expose some kind of enum equivalent of diff --git a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h index e9f310869da17b..3419de73729e50 100644 --- a/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h +++ b/chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h @@ -44,7 +44,7 @@ class ChromeWebViewGuestDelegate : public WebViewGuestDelegate { void SetContextMenuPosition(const gfx::Point& position) override; // Returns the top level items (ignoring submenus) as Value. - static scoped_ptr MenuModelToValue( + static std::unique_ptr MenuModelToValue( const ui::SimpleMenuModel& menu_model); void InjectChromeVoxIfNeeded(content::RenderViewHost* render_view_host); @@ -64,17 +64,17 @@ class ChromeWebViewGuestDelegate : public WebViewGuestDelegate { // Holds the RenderViewContextMenuBase that has been built but yet to be // shown. This is .reset() after ShowContextMenu(). - scoped_ptr pending_menu_; + std::unique_ptr pending_menu_; #if defined(OS_CHROMEOS) // Subscription to receive notifications on changes to a11y settings. - scoped_ptr + std::unique_ptr accessibility_subscription_; #endif WebViewGuest* const web_view_guest_; - scoped_ptr context_menu_position_; + std::unique_ptr context_menu_position_; // This is used to ensure pending tasks will not fire after this object is // destroyed. diff --git a/chrome/browser/icon_loader.h b/chrome/browser/icon_loader.h index a25532f3c60d6d..33301acd8295a6 100644 --- a/chrome/browser/icon_loader.h +++ b/chrome/browser/icon_loader.h @@ -5,15 +5,14 @@ #ifndef CHROME_BROWSER_ICON_LOADER_H_ #define CHROME_BROWSER_ICON_LOADER_H_ -#include "build/build_config.h" - +#include #include #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/single_thread_task_runner.h" +#include "build/build_config.h" #include "content/public/browser/browser_thread.h" #include "ui/gfx/image/image.h" @@ -96,7 +95,7 @@ class IconLoader : public base::RefCountedThreadSafe { IconSize icon_size_; - scoped_ptr image_; + std::unique_ptr image_; Delegate* delegate_; diff --git a/chrome/browser/icon_loader_win.cc b/chrome/browser/icon_loader_win.cc index f12050a1c4da2c..937829501576c6 100644 --- a/chrome/browser/icon_loader_win.cc +++ b/chrome/browser/icon_loader_win.cc @@ -58,8 +58,8 @@ void IconLoader::ReadIcon() { if (SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info, sizeof(SHFILEINFO), SHGFI_ICON | size | SHGFI_USEFILEATTRIBUTES)) { - scoped_ptr bitmap(IconUtil::CreateSkBitmapFromHICON( - file_info.hIcon)); + std::unique_ptr bitmap( + IconUtil::CreateSkBitmapFromHICON(file_info.hIcon)); if (bitmap.get()) { gfx::ImageSkia image_skia(gfx::ImageSkiaRep(*bitmap, gfx::GetDPIScale())); image_skia.MakeThreadSafe(); diff --git a/chrome/browser/icon_manager.cc b/chrome/browser/icon_manager.cc index 0b43141971b3ce..e0c8ce1ae9a8f0 100644 --- a/chrome/browser/icon_manager.cc +++ b/chrome/browser/icon_manager.cc @@ -4,10 +4,10 @@ #include "chrome/browser/icon_manager.h" +#include #include #include "base/bind.h" -#include "base/memory/scoped_ptr.h" #include "base/stl_util.h" #include "base/task_runner.h" #include "third_party/skia/include/core/SkBitmap.h" diff --git a/chrome/browser/image_decoder.h b/chrome/browser/image_decoder.h index e9c3526b0683ed..5e2845dd2f5a7a 100644 --- a/chrome/browser/image_decoder.h +++ b/chrome/browser/image_decoder.h @@ -13,7 +13,6 @@ #include "base/lazy_instance.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/sequence_checker.h" #include "base/sequenced_task_runner.h" #include "base/synchronization/lock.h" diff --git a/chrome/browser/image_decoder_browsertest.cc b/chrome/browser/image_decoder_browsertest.cc index 3541734e121350..f2fdf537da8e9e 100644 --- a/chrome/browser/image_decoder_browsertest.cc +++ b/chrome/browser/image_decoder_browsertest.cc @@ -230,7 +230,7 @@ IN_PROC_BROWSER_TEST_F(ImageDecoderBrowserTest, BasicDecode) { IN_PROC_BROWSER_TEST_F(ImageDecoderBrowserTest, StartAndDestroy) { scoped_refptr runner = new content::MessageLoopRunner; - scoped_ptr test_request( + std::unique_ptr test_request( new TestImageRequest(runner->QuitClosure())); ImageDecoder::Start(test_request.get(), std::string()); test_request.reset(); diff --git a/chrome/browser/importer/external_process_importer_host.h b/chrome/browser/importer/external_process_importer_host.h index 2c3c6897a494b9..b41717c1989d4a 100644 --- a/chrome/browser/importer/external_process_importer_host.h +++ b/chrome/browser/importer/external_process_importer_host.h @@ -7,10 +7,11 @@ #include +#include + #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 "chrome/browser/importer/importer_progress_observer.h" #include "chrome/browser/importer/profile_writer.h" @@ -124,7 +125,7 @@ class ExternalProcessImporterHost importer::ImporterProgressObserver* observer_; // Firefox profile lock. - scoped_ptr firefox_lock_; + std::unique_ptr firefox_lock_; // Profile we're importing from. Profile* profile_; @@ -134,7 +135,8 @@ class ExternalProcessImporterHost // May contain a Subscription waiting for the TemplateURLService to finish // loading. - scoped_ptr template_service_subscription_; + std::unique_ptr + template_service_subscription_; // Have we installed a listener on the bookmark model? bool installed_bookmark_observer_; diff --git a/chrome/browser/importer/firefox_profile_lock_unittest.cc b/chrome/browser/importer/firefox_profile_lock_unittest.cc index 4b1df9a1b9dbdc..b3a598585f8e4a 100644 --- a/chrome/browser/importer/firefox_profile_lock_unittest.cc +++ b/chrome/browser/importer/firefox_profile_lock_unittest.cc @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/importer/firefox_profile_lock.h" + +#include + #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string_util.h" #include "build/build_config.h" -#include "chrome/browser/importer/firefox_profile_lock.h" #include "chrome/common/chrome_paths.h" #include "testing/gtest/include/gtest/gtest.h" @@ -34,7 +36,7 @@ TEST_F(FirefoxProfileLockTest, ProfileLock) { base::FilePath lock_file_path = test_path.Append(FirefoxProfileLock::kLockFileName); - scoped_ptr lock; + std::unique_ptr lock; EXPECT_EQ(static_cast(NULL), lock.get()); EXPECT_FALSE(base::PathExists(lock_file_path)); lock.reset(new FirefoxProfileLock(test_path)); @@ -73,7 +75,7 @@ TEST_F(FirefoxProfileLockTest, ProfileLockOrphaned) { base::CloseFile(lock_file); EXPECT_TRUE(base::PathExists(lock_file_path)); - scoped_ptr lock; + std::unique_ptr lock; EXPECT_EQ(static_cast(NULL), lock.get()); lock.reset(new FirefoxProfileLock(test_path)); EXPECT_TRUE(lock->HasAcquired()); @@ -88,12 +90,12 @@ TEST_F(FirefoxProfileLockTest, ProfileLockOrphaned) { TEST_F(FirefoxProfileLockTest, ProfileLockContention) { base::FilePath test_path = temp_dir_.path(); - scoped_ptr lock1; + std::unique_ptr lock1; EXPECT_EQ(static_cast(NULL), lock1.get()); lock1.reset(new FirefoxProfileLock(test_path)); EXPECT_TRUE(lock1->HasAcquired()); - scoped_ptr lock2; + std::unique_ptr lock2; EXPECT_EQ(static_cast(NULL), lock2.get()); lock2.reset(new FirefoxProfileLock(test_path)); EXPECT_FALSE(lock2->HasAcquired()); diff --git a/chrome/browser/infobars/infobar_service.h b/chrome/browser/infobars/infobar_service.h index e2064b0a3040b1..a18e157e74adf1 100644 --- a/chrome/browser/infobars/infobar_service.h +++ b/chrome/browser/infobars/infobar_service.h @@ -5,10 +5,10 @@ #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ #define CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/infobars/core/infobar_manager.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" @@ -50,8 +50,8 @@ class InfoBarService : public infobars::InfoBarManager, // InfoBarManager: // TODO(sdefresne): Change clients to invoke this on infobars::InfoBarManager // and turn the method override private. - scoped_ptr CreateConfirmInfoBar( - scoped_ptr delegate) override; + std::unique_ptr CreateConfirmInfoBar( + std::unique_ptr delegate) override; void OpenURL(const GURL& url, WindowOpenDisposition disposition) override; private: diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc index d439d34b00a383..f1fea55b960a51 100644 --- a/chrome/browser/infobars/infobars_browsertest.cc +++ b/chrome/browser/infobars/infobars_browsertest.cc @@ -41,7 +41,7 @@ class InfoBarsTest : public InProcessBrowserTest { extensions::TestExtensionRegistryObserver observer( extensions::ExtensionRegistry::Get(browser()->profile())); - scoped_ptr client(new ExtensionInstallPrompt( + std::unique_ptr client(new ExtensionInstallPrompt( browser()->tab_strip_model()->GetActiveWebContents())); scoped_refptr installer( extensions::CrxInstaller::Create(service, std::move(client))); diff --git a/chrome/browser/infobars/insecure_content_infobar_delegate.cc b/chrome/browser/infobars/insecure_content_infobar_delegate.cc index 8af7856013e645..85cc4e02ba83ce 100644 --- a/chrome/browser/infobars/insecure_content_infobar_delegate.cc +++ b/chrome/browser/infobars/insecure_content_infobar_delegate.cc @@ -27,9 +27,10 @@ void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service) { UMA_HISTOGRAM_ENUMERATION("InsecureContentInfoBarDelegateV2", DISPLAY_INFOBAR_SHOWN, NUM_EVENTS); - scoped_ptr new_infobar( - infobar_service->CreateConfirmInfoBar(scoped_ptr( - new InsecureContentInfoBarDelegate()))); + std::unique_ptr new_infobar( + infobar_service->CreateConfirmInfoBar( + std::unique_ptr( + new InsecureContentInfoBarDelegate()))); for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { infobars::InfoBar* old_infobar = infobar_service->infobar_at(i); diff --git a/chrome/browser/install_verification/win/module_list.cc b/chrome/browser/install_verification/win/module_list.cc index 7a31bf17eaf06b..fc3461e5d6b19a 100644 --- a/chrome/browser/install_verification/win/module_list.cc +++ b/chrome/browser/install_verification/win/module_list.cc @@ -24,9 +24,9 @@ ModuleList::~ModuleList() { std::for_each(modules_.begin(), modules_.end(), &CheckFreeLibrary); } -scoped_ptr ModuleList::FromLoadedModuleSnapshot( +std::unique_ptr ModuleList::FromLoadedModuleSnapshot( const std::vector& snapshot) { - scoped_ptr instance(new ModuleList); + std::unique_ptr instance(new ModuleList); for (size_t i = 0; i < snapshot.size(); ++i) { HMODULE module = NULL; diff --git a/chrome/browser/install_verification/win/module_list.h b/chrome/browser/install_verification/win/module_list.h index 3497abef7d99ff..f4b28e4ce8eb6e 100644 --- a/chrome/browser/install_verification/win/module_list.h +++ b/chrome/browser/install_verification/win/module_list.h @@ -5,14 +5,14 @@ #ifndef CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_LIST_H_ #define CHROME_BROWSER_INSTALL_VERIFICATION_WIN_MODULE_LIST_H_ -#include #include +#include +#include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" struct ModuleInfo; @@ -26,7 +26,7 @@ class ModuleList { // AddRef'd HMODULEs will be inserted in the returned ModuleList. // // This method _always_ returns a valid ModuleList instance. - static scoped_ptr FromLoadedModuleSnapshot( + static std::unique_ptr FromLoadedModuleSnapshot( const std::vector& snapshot); // Retrieves name and address information for the module list. diff --git a/chrome/browser/install_verification/win/module_list_unittest.cc b/chrome/browser/install_verification/win/module_list_unittest.cc index a4c81c6ef34fbf..cca65a6a50d5f8 100644 --- a/chrome/browser/install_verification/win/module_list_unittest.cc +++ b/chrome/browser/install_verification/win/module_list_unittest.cc @@ -4,13 +4,15 @@ #include "chrome/browser/install_verification/win/module_list.h" -#include #include +#include + +#include #include + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback_helpers.h" -#include "base/memory/scoped_ptr.h" #include "base/win/win_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -18,7 +20,7 @@ TEST(ModuleListTest, TestCase) { std::vector snapshot; ASSERT_TRUE( base::win::GetLoadedModulesSnapshot(::GetCurrentProcess(), &snapshot)); - scoped_ptr module_list( + std::unique_ptr module_list( ModuleList::FromLoadedModuleSnapshot(snapshot)); // Lookup the number of loaded modules. diff --git a/chrome/browser/interests/android/interests_service.cc b/chrome/browser/interests/android/interests_service.cc index ad65e295656ad8..84d67d5962f3ad 100644 --- a/chrome/browser/interests/android/interests_service.cc +++ b/chrome/browser/interests/android/interests_service.cc @@ -25,7 +25,7 @@ namespace { ScopedJavaLocalRef ConvertInterestsToJava( JNIEnv* env, - scoped_ptr> interests) { + std::unique_ptr> interests) { if (!interests) return ScopedJavaLocalRef(); @@ -64,7 +64,7 @@ void InterestsService::GetInterests( const JavaParamRef& j_callback_obj) { ScopedJavaGlobalRef j_callback(env, j_callback_obj); - scoped_ptr fetcher = + std::unique_ptr fetcher = InterestsFetcher::CreateFromProfile(profile_); InterestsFetcher* fetcher_raw_ptr = fetcher.get(); @@ -81,9 +81,9 @@ bool InterestsService::Register(JNIEnv* env) { } void InterestsService::OnObtainedInterests( - scoped_ptr fetcher, + std::unique_ptr fetcher, const ScopedJavaGlobalRef& j_callback, - scoped_ptr> interests) { + std::unique_ptr> interests) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef j_interests = ConvertInterestsToJava(env, std::move(interests)); diff --git a/chrome/browser/interests/android/interests_service.h b/chrome/browser/interests/android/interests_service.h index 2e39fe4ab563ba..888942af1b6f24 100644 --- a/chrome/browser/interests/android/interests_service.h +++ b/chrome/browser/interests/android/interests_service.h @@ -7,9 +7,10 @@ #include +#include + #include "base/android/scoped_java_ref.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/interests/interests_fetcher.h" @@ -29,9 +30,9 @@ class InterestsService { private: void OnObtainedInterests( - scoped_ptr fetcher, + std::unique_ptr fetcher, const base::android::ScopedJavaGlobalRef& j_callback, - scoped_ptr> interests); + std::unique_ptr> interests); Profile* profile_; diff --git a/chrome/browser/interests/interests_fetcher.cc b/chrome/browser/interests/interests_fetcher.cc index c9c7ca5468a6c2..49ba04da0682da 100644 --- a/chrome/browser/interests/interests_fetcher.cc +++ b/chrome/browser/interests/interests_fetcher.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/json/json_reader.h" #include "base/logging.h" +#include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "base/values.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" @@ -65,17 +66,16 @@ InterestsFetcher::InterestsFetcher( InterestsFetcher::~InterestsFetcher() {} // static -scoped_ptr InterestsFetcher::CreateFromProfile( +std::unique_ptr InterestsFetcher::CreateFromProfile( Profile* profile) { ProfileOAuth2TokenService* token_service = ProfileOAuth2TokenServiceFactory::GetForProfile(profile); SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); - return make_scoped_ptr(new InterestsFetcher( - token_service, - signin->GetAuthenticatedAccountId(), - profile->GetRequestContext())); + return base::WrapUnique( + new InterestsFetcher(token_service, signin->GetAuthenticatedAccountId(), + profile->GetRequestContext())); } void InterestsFetcher::FetchInterests( @@ -159,14 +159,14 @@ OAuth2TokenService::ScopeSet InterestsFetcher::GetApiScopes() { return scopes; } -scoped_ptr InterestsFetcher::CreateFetcher() { +std::unique_ptr InterestsFetcher::CreateFetcher() { return net::URLFetcher::Create(0, GetInterestsURL(), net::URLFetcher::GET, this); } -scoped_ptr> +std::unique_ptr> InterestsFetcher::ExtractInterests(const std::string& response) { - scoped_ptr value = base::JSONReader::Read(response); + std::unique_ptr value = base::JSONReader::Read(response); DVLOG(2) << response; const base::DictionaryValue* dict = nullptr; @@ -181,7 +181,7 @@ InterestsFetcher::ExtractInterests(const std::string& response) { return nullptr; } - scoped_ptr> res(new std::vector()); + std::unique_ptr> res(new std::vector()); for (const base::Value* entry : *interests_list) { const base::DictionaryValue* interest_dict = nullptr; if (!entry->GetAsDictionary(&interest_dict)) { diff --git a/chrome/browser/interests/interests_fetcher.h b/chrome/browser/interests/interests_fetcher.h index 38e1f0febcafba..584e83ce2a2dac 100644 --- a/chrome/browser/interests/interests_fetcher.h +++ b/chrome/browser/interests/interests_fetcher.h @@ -5,13 +5,13 @@ #ifndef CHROME_BROWSER_INTERESTS_INTERESTS_FETCHER_H_ #define CHROME_BROWSER_INTERESTS_INTERESTS_FETCHER_H_ +#include #include #include #include "base/callback.h" #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/profiles/profile.h" #include "components/signin/core/browser/signin_manager.h" #include "google_apis/gaia/oauth2_token_service.h" @@ -46,7 +46,7 @@ class InterestsFetcher : public net::URLFetcherDelegate, }; using InterestsCallback = - base::Callback>)>; + base::Callback>)>; InterestsFetcher(OAuth2TokenService* oauth2_token_service, const std::string& account_id, @@ -54,7 +54,7 @@ class InterestsFetcher : public net::URLFetcherDelegate, ~InterestsFetcher() override; - static scoped_ptr CreateFromProfile(Profile* profile); + static std::unique_ptr CreateFromProfile(Profile* profile); void FetchInterests(const InterestsCallback& callback); @@ -71,20 +71,20 @@ class InterestsFetcher : public net::URLFetcherDelegate, void StartOAuth2Request(); OAuth2TokenService::ScopeSet GetApiScopes(); - scoped_ptr CreateFetcher(); + std::unique_ptr CreateFetcher(); // Parse the json response. - scoped_ptr> - ExtractInterests(const std::string& response); + std::unique_ptr> ExtractInterests( + const std::string& response); InterestsCallback callback_; - scoped_ptr fetcher_; + std::unique_ptr fetcher_; std::string account_id_; net::URLRequestContextGetter* url_request_context_; bool access_token_expired_; std::string access_token_; - scoped_ptr oauth_request_; + std::unique_ptr oauth_request_; OAuth2TokenService* token_service_; DISALLOW_COPY_AND_ASSIGN(InterestsFetcher); diff --git a/chrome/browser/interests/interests_fetcher_unittest.cc b/chrome/browser/interests/interests_fetcher_unittest.cc index ec67a18b13dfaa..04274f16230ccc 100644 --- a/chrome/browser/interests/interests_fetcher_unittest.cc +++ b/chrome/browser/interests/interests_fetcher_unittest.cc @@ -83,7 +83,7 @@ class InterestsFetcherTest : public testing::Test { MOCK_METHOD0(OnFailedResponse, void()); void OnReceivedInterests( - scoped_ptr> interests) { + std::unique_ptr> interests) { if (!interests) { OnFailedResponse(); return; @@ -150,8 +150,8 @@ class InterestsFetcherTest : public testing::Test { base::MessageLoop message_loop_; FakeProfileOAuth2TokenService token_service_; scoped_refptr request_context_; - scoped_ptr url_fetcher_factory_; - scoped_ptr request_; + std::unique_ptr url_fetcher_factory_; + std::unique_ptr request_; }; TEST_F(InterestsFetcherTest, EmptyResponse) { diff --git a/chrome/browser/internal_auth.cc b/chrome/browser/internal_auth.cc index a520add8c97cf6..42da3ffaf011f9 100644 --- a/chrome/browser/internal_auth.cc +++ b/chrome/browser/internal_auth.cc @@ -10,11 +10,11 @@ #include #include #include +#include #include "base/base64.h" #include "base/lazy_instance.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/rand_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" @@ -251,7 +251,7 @@ class InternalAuthVerificationService { if (key.size() != kKeySizeInBytes) return; - scoped_ptr new_engine( + std::unique_ptr new_engine( new crypto::HMAC(crypto::HMAC::SHA256)); if (!new_engine->Init(key)) return; @@ -302,8 +302,8 @@ class InternalAuthVerificationService { std::string old_key_; // Corresponding HMAC engines. - scoped_ptr engine_; - scoped_ptr old_engine_; + std::unique_ptr engine_; + std::unique_ptr old_engine_; // Tick at a time of recent key regeneration. int64_t key_change_tick_; @@ -341,7 +341,8 @@ class InternalAuthGenerationService : public base::ThreadChecker { void GenerateNewKey() { DCHECK(CalledOnValidThread()); - scoped_ptr new_engine(new crypto::HMAC(crypto::HMAC::SHA256)); + std::unique_ptr new_engine( + new crypto::HMAC(crypto::HMAC::SHA256)); std::string key = base::RandBytesAsString(kKeySizeInBytes); if (!new_engine->Init(key)) return; @@ -420,7 +421,7 @@ class InternalAuthGenerationService : public base::ThreadChecker { return InternalAuthVerification::get_verification_window_ticks(); } - scoped_ptr engine_; + std::unique_ptr engine_; int64_t key_regeneration_tick_; std::deque used_ticks_; diff --git a/chrome/browser/interstitials/chrome_metrics_helper.h b/chrome/browser/interstitials/chrome_metrics_helper.h index 5206a9eda94248..9b80931f40bcf8 100644 --- a/chrome/browser/interstitials/chrome_metrics_helper.h +++ b/chrome/browser/interstitials/chrome_metrics_helper.h @@ -50,10 +50,10 @@ class ChromeMetricsHelper : public security_interstitials::MetricsHelper { const GURL request_url_; const std::string sampling_event_name_; #if defined(ENABLE_EXTENSIONS) - scoped_ptr sampling_event_; + std::unique_ptr sampling_event_; #endif #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) - scoped_ptr captive_portal_recorder_; + std::unique_ptr captive_portal_recorder_; #endif DISALLOW_COPY_AND_ASSIGN(ChromeMetricsHelper); diff --git a/chrome/browser/intranet_redirect_detector.cc b/chrome/browser/intranet_redirect_detector.cc index 86e277eec7a653..998480909d54d2 100644 --- a/chrome/browser/intranet_redirect_detector.cc +++ b/chrome/browser/intranet_redirect_detector.cc @@ -104,7 +104,7 @@ void IntranetRedirectDetector::OnURLFetchComplete( Fetchers::iterator fetcher = fetchers_.find( const_cast(source)); DCHECK(fetcher != fetchers_.end()); - scoped_ptr clean_up_fetcher(*fetcher); + std::unique_ptr clean_up_fetcher(*fetcher); fetchers_.erase(fetcher); // If any two fetches result in the same domain/host, we set the redirect diff --git a/chrome/browser/invalidation/profile_invalidation_provider_factory.cc b/chrome/browser/invalidation/profile_invalidation_provider_factory.cc index 1292e592b0fd25..f56165000e47e1 100644 --- a/chrome/browser/invalidation/profile_invalidation_provider_factory.cc +++ b/chrome/browser/invalidation/profile_invalidation_provider_factory.cc @@ -4,9 +4,9 @@ #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" +#include #include -#include "base/memory/scoped_ptr.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" @@ -101,11 +101,11 @@ KeyedService* ProfileInvalidationProviderFactory::BuildServiceInstanceFor( return testing_factory_(context).release(); #if defined(OS_ANDROID) - return new ProfileInvalidationProvider(scoped_ptr( + return new ProfileInvalidationProvider(std::unique_ptr( new InvalidationServiceAndroid(base::android::GetApplicationContext()))); #else - scoped_ptr identity_provider; + std::unique_ptr identity_provider; #if defined(OS_CHROMEOS) policy::BrowserPolicyConnectorChromeOS* connector = @@ -126,13 +126,13 @@ KeyedService* ProfileInvalidationProviderFactory::BuildServiceInstanceFor( LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))); } - scoped_ptr service(new TiclInvalidationService( + std::unique_ptr service(new TiclInvalidationService( GetUserAgent(), std::move(identity_provider), - scoped_ptr( + std::unique_ptr( new TiclProfileSettingsProvider(profile->GetPrefs())), gcm::GCMProfileServiceFactory::GetForProfile(profile)->driver(), profile->GetRequestContext())); - service->Init(scoped_ptr( + service->Init(std::unique_ptr( new InvalidatorStorage(profile->GetPrefs()))); return new ProfileInvalidationProvider(std::move(service)); diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 33d6ba440cf68f..99a914c8229e65 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -17,6 +17,7 @@ #include "base/files/file_path.h" #include "base/logging.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/metrics/field_trial.h" #include "base/profiler/scoped_tracker.h" #include "base/stl_util.h" @@ -203,7 +204,7 @@ base::FilePath GetSSLKeyLogFile(const base::CommandLine& command_line) { LOG(WARNING) << "ssl-key-log-file argument missing"; } - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); std::string path_str; env->GetVar("SSLKEYLOGFILE", &path_str); #if defined(OS_WIN) @@ -232,7 +233,8 @@ class SystemURLRequestContext : public net::URLRequestContext { } }; -scoped_ptr CreateGlobalHostResolver(net::NetLog* net_log) { +std::unique_ptr CreateGlobalHostResolver( + net::NetLog* net_log) { TRACE_EVENT0("startup", "IOThread::CreateGlobalHostResolver"); const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); @@ -252,7 +254,7 @@ scoped_ptr CreateGlobalHostResolver(net::NetLog* net_log) { } } - scoped_ptr global_host_resolver; + std::unique_ptr global_host_resolver; #if defined OS_CHROMEOS global_host_resolver = chromeos::HostResolverImplChromeOS::CreateSystemResolver(options, @@ -268,7 +270,7 @@ scoped_ptr CreateGlobalHostResolver(net::NetLog* net_log) { if (!command_line.HasSwitch(switches::kHostResolverRules)) return global_host_resolver; - scoped_ptr remapped_resolver( + std::unique_ptr remapped_resolver( new net::MappedHostResolver(std::move(global_host_resolver))); remapped_resolver->SetRulesFromString( command_line.GetSwitchValueASCII(switches::kHostResolverRules)); @@ -600,13 +602,13 @@ void IOThread::Init() { extension_event_router_forwarder_; #endif - scoped_ptr data_use_amortizer; + std::unique_ptr data_use_amortizer; #if BUILDFLAG(ANDROID_JAVA_UI) data_use_amortizer.reset(new data_usage::android::TrafficStatsAmortizer()); #endif globals_->data_use_aggregator.reset(new data_usage::DataUseAggregator( - scoped_ptr( + std::unique_ptr( new chrome_browser_data_usage::TabIdAnnotator()), std::move(data_use_amortizer))); @@ -615,7 +617,7 @@ void IOThread::Init() { tracked_objects::ScopedTracker tracking_profile3( FROM_HERE_WITH_EXPLICIT_FUNCTION( "466432 IOThread::InitAsync::ChromeNetworkDelegate")); - scoped_ptr chrome_network_delegate( + std::unique_ptr chrome_network_delegate( new ChromeNetworkDelegate(extension_event_router_forwarder(), &system_enable_referrers_, metrics_data_use_forwarder_)); @@ -644,7 +646,7 @@ void IOThread::Init() { variations::GetVariationParams(kNetworkQualityEstimatorFieldTrialName, &network_quality_estimator_params); - scoped_ptr external_estimate_provider; + std::unique_ptr external_estimate_provider; #if BUILDFLAG(ANDROID_JAVA_UI) external_estimate_provider.reset( new chrome::android::ExternalEstimateProviderAndroid()); @@ -1746,14 +1748,14 @@ net::URLRequestContext* IOThread::ConstructProxyScriptFetcherContext( context->set_http_transaction_factory( globals->proxy_script_fetcher_http_transaction_factory.get()); - scoped_ptr job_factory( + std::unique_ptr job_factory( new net::URLRequestJobFactoryImpl()); job_factory->SetProtocolHandler( - url::kDataScheme, make_scoped_ptr(new net::DataProtocolHandler())); + url::kDataScheme, base::WrapUnique(new net::DataProtocolHandler())); job_factory->SetProtocolHandler( url::kFileScheme, - make_scoped_ptr(new net::FileProtocolHandler( + base::WrapUnique(new net::FileProtocolHandler( content::BrowserThread::GetBlockingPool() ->GetTaskRunnerWithShutdownBehavior( base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)))); @@ -1762,7 +1764,7 @@ net::URLRequestContext* IOThread::ConstructProxyScriptFetcherContext( new net::FtpNetworkLayer(globals->host_resolver.get())); job_factory->SetProtocolHandler( url::kFtpScheme, - make_scoped_ptr(new net::FtpProtocolHandler( + base::WrapUnique(new net::FtpProtocolHandler( globals->proxy_script_fetcher_ftp_transaction_factory.get()))); #endif globals->proxy_script_fetcher_url_request_job_factory = diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index 34987fbe14955c..7a3fdadad0596f 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -17,7 +18,6 @@ #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/strings/string_piece.h" #include "base/time/time.h" @@ -121,67 +121,68 @@ class IOThread : public content::BrowserThreadDelegate { // Global aggregator of data use. It must outlive the // |system_network_delegate|. - scoped_ptr data_use_aggregator; + std::unique_ptr data_use_aggregator; #if BUILDFLAG(ANDROID_JAVA_UI) // An external observer of data use. - scoped_ptr + std::unique_ptr external_data_use_observer; #endif // BUILDFLAG(ANDROID_JAVA_UI) // The "system" NetworkDelegate, used for Profile-agnostic network events. - scoped_ptr system_network_delegate; - scoped_ptr host_resolver; - scoped_ptr cert_verifier; + std::unique_ptr system_network_delegate; + std::unique_ptr host_resolver; + std::unique_ptr cert_verifier; // The ChannelIDService must outlive the HttpTransactionFactory. - scoped_ptr system_channel_id_service; + std::unique_ptr system_channel_id_service; // This TransportSecurityState doesn't load or save any state. It's only // used to enforce pinning for system requests and will only use built-in // pins. - scoped_ptr transport_security_state; + std::unique_ptr transport_security_state; std::vector> ct_logs; - scoped_ptr cert_transparency_verifier; - scoped_ptr ct_policy_enforcer; + std::unique_ptr cert_transparency_verifier; + std::unique_ptr ct_policy_enforcer; scoped_refptr ssl_config_service; - scoped_ptr http_auth_handler_factory; - scoped_ptr http_server_properties; - scoped_ptr proxy_script_fetcher_proxy_service; - scoped_ptr + std::unique_ptr http_auth_handler_factory; + std::unique_ptr http_server_properties; + std::unique_ptr proxy_script_fetcher_proxy_service; + std::unique_ptr proxy_script_fetcher_http_network_session; - scoped_ptr + std::unique_ptr proxy_script_fetcher_http_transaction_factory; - scoped_ptr + std::unique_ptr proxy_script_fetcher_ftp_transaction_factory; - scoped_ptr + std::unique_ptr proxy_script_fetcher_url_request_job_factory; - scoped_ptr url_request_backoff_manager; - scoped_ptr http_auth_preferences; + std::unique_ptr url_request_backoff_manager; + std::unique_ptr http_auth_preferences; // TODO(willchan): Remove proxy script fetcher context since it's not // necessary now that I got rid of refcounting URLRequestContexts. // // The first URLRequestContext is |system_url_request_context|. We introduce // |proxy_script_fetcher_context| for the second context. It has a direct // ProxyService, since we always directly connect to fetch the PAC script. - scoped_ptr proxy_script_fetcher_context; - scoped_ptr system_proxy_service; - scoped_ptr system_http_network_session; - scoped_ptr system_http_transaction_factory; - scoped_ptr system_url_request_job_factory; - scoped_ptr system_request_context; + std::unique_ptr proxy_script_fetcher_context; + std::unique_ptr system_proxy_service; + std::unique_ptr system_http_network_session; + std::unique_ptr + system_http_transaction_factory; + std::unique_ptr system_url_request_job_factory; + std::unique_ptr system_request_context; SystemRequestContextLeakChecker system_request_context_leak_checker; // |system_cookie_store| and |system_channel_id_service| are shared // between |proxy_script_fetcher_context| and |system_request_context|. - scoped_ptr system_cookie_store; + std::unique_ptr system_cookie_store; #if defined(ENABLE_EXTENSIONS) scoped_refptr extension_event_router_forwarder; #endif - scoped_ptr host_mapping_rules; - scoped_ptr http_user_agent_settings; - scoped_ptr network_quality_estimator; + std::unique_ptr host_mapping_rules; + std::unique_ptr http_user_agent_settings; + std::unique_ptr network_quality_estimator; // NetErrorTabHelper uses |dns_probe_service| to send DNS probes when a // main frame load fails with a DNS error in order to provide more useful // information to the renderer so it can show a more specific error page. - scoped_ptr dns_probe_service; + std::unique_ptr dns_probe_service; }; // Helper class to configure HttpNetworkSession::Params and @@ -520,7 +521,7 @@ class IOThread : public content::BrowserThreadDelegate { // Observer that logs network changes to the ChromeNetLog. class LoggingNetworkChangeObserver; - scoped_ptr network_change_observer_; + std::unique_ptr network_change_observer_; BooleanPrefMember system_enable_referrers_; @@ -549,13 +550,14 @@ class IOThread : public content::BrowserThreadDelegate { // This is an instance of the default SSLConfigServiceManager for the current // platform and it gets SSL preferences from local_state object. - scoped_ptr ssl_config_service_manager_; + std::unique_ptr + ssl_config_service_manager_; // These member variables are initialized by a task posted to the IO thread, // which gets posted by calling certain member functions of IOThread. - scoped_ptr system_proxy_config_service_; + std::unique_ptr system_proxy_config_service_; - scoped_ptr pref_proxy_config_tracker_; + std::unique_ptr pref_proxy_config_tracker_; scoped_refptr system_url_request_context_getter_; diff --git a/chrome/browser/io_thread_unittest.cc b/chrome/browser/io_thread_unittest.cc index f00aacb2b24c42..13753dc43c69c8 100644 --- a/chrome/browser/io_thread_unittest.cc +++ b/chrome/browser/io_thread_unittest.cc @@ -75,7 +75,7 @@ class NetworkSessionConfiguratorTest : public testing::Test { bool is_spdy_allowed_by_policy_; bool is_quic_allowed_by_policy_; - scoped_ptr field_trial_list_; + std::unique_ptr field_trial_list_; net::HttpNetworkSession::Params params_; private: @@ -810,7 +810,7 @@ class IOThreadTestWithIOThreadObject : public testing::Test { // TestBrowserThreadBundle's destructor is responsible for calling // CleanUp(), the IOThread must be declared before the bundle, so that // the bundle is deleted first. - scoped_ptr io_thread_; + std::unique_ptr io_thread_; content::TestBrowserThreadBundle thread_bundle_; }; diff --git a/chrome/browser/jumplist_win.h b/chrome/browser/jumplist_win.h index 0447cd495f8fea..16c319ac225327 100644 --- a/chrome/browser/jumplist_win.h +++ b/chrome/browser/jumplist_win.h @@ -165,8 +165,8 @@ class JumpList : public sessions::TabRestoreServiceObserver, Profile* profile_; // Lives on the UI thread. - scoped_ptr registrar_; - scoped_ptr pref_change_registrar_; + std::unique_ptr registrar_; + std::unique_ptr pref_change_registrar_; // App id to associate with the jump list. std::wstring app_id_; diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc index 4caf166318e915..4daeff48c6e825 100644 --- a/chrome/browser/lifetime/application_lifetime.cc +++ b/chrome/browser/lifetime/application_lifetime.cc @@ -4,9 +4,10 @@ #include "chrome/browser/lifetime/application_lifetime.h" +#include + #include "base/bind.h" #include "base/logging.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/process/process.h" #include "base/process/process_handle.h" diff --git a/chrome/browser/lifetime/browser_close_manager_browsertest.cc b/chrome/browser/lifetime/browser_close_manager_browsertest.cc index a1aeac6b573b9f..fa9d7b997d77c3 100644 --- a/chrome/browser/lifetime/browser_close_manager_browsertest.cc +++ b/chrome/browser/lifetime/browser_close_manager_browsertest.cc @@ -756,7 +756,7 @@ IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest, SetDownloadPathForProfile(browser()->profile()); // Set up the fake delegate that forces the download to be malicious. - scoped_ptr test_delegate( + std::unique_ptr test_delegate( new TestDownloadManagerDelegate(browser()->profile())); DownloadServiceFactory::GetForBrowserContext(browser()->profile()) ->SetDownloadManagerDelegateForTesting(std::move(test_delegate)); @@ -952,7 +952,7 @@ class BrowserCloseManagerWithBackgroundModeBrowserTest void SetUpOnMainThread() override { BrowserCloseManagerBrowserTest::SetUpOnMainThread(); g_browser_process->set_background_mode_manager_for_test( - scoped_ptr(new FakeBackgroundModeManager)); + std::unique_ptr(new FakeBackgroundModeManager)); } bool IsBackgroundModeSuspended() { @@ -971,7 +971,7 @@ class BrowserCloseManagerWithBackgroundModeBrowserTest IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithBackgroundModeBrowserTest, CloseAllBrowsersWithBackgroundMode) { EXPECT_FALSE(IsBackgroundModeSuspended()); - scoped_ptr tmp_keep_alive; + std::unique_ptr tmp_keep_alive; Profile* profile = browser()->profile(); { RepeatedNotificationObserver close_observer( diff --git a/chrome/browser/lifetime/keep_alive_registry_unittest.cc b/chrome/browser/lifetime/keep_alive_registry_unittest.cc index e634bbd946b725..e20a7782bd06cd 100644 --- a/chrome/browser/lifetime/keep_alive_registry_unittest.cc +++ b/chrome/browser/lifetime/keep_alive_registry_unittest.cc @@ -4,7 +4,8 @@ #include "chrome/browser/lifetime/keep_alive_registry.h" -#include "base/memory/scoped_ptr.h" +#include + #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/keep_alive_state_observer.h" #include "chrome/browser/lifetime/keep_alive_types.h" @@ -82,7 +83,7 @@ TEST_F(KeepAliveRegistryTest, BasicKeepAliveTest) { TEST_F(KeepAliveRegistryTest, DoubleKeepAliveTest) { EXPECT_EQ(0, start_keep_alive_call_count_); EXPECT_EQ(0, stop_keep_alive_call_count_); - scoped_ptr keep_alive_1, keep_alive_2; + std::unique_ptr keep_alive_1, keep_alive_2; keep_alive_1.reset(new ScopedKeepAlive(KeepAliveOrigin::CHROME_APP_DELEGATE, KeepAliveRestartOption::DISABLED)); @@ -109,7 +110,7 @@ TEST_F(KeepAliveRegistryTest, DoubleKeepAliveTest) { // Test the IsKeepingAlive state and when we interact with the browser with // more than one KeepAlive registered. TEST_F(KeepAliveRegistryTest, RestartOptionTest) { - scoped_ptr keep_alive, keep_alive_restart; + std::unique_ptr keep_alive, keep_alive_restart; EXPECT_EQ(0, on_restart_allowed_call_count_); EXPECT_EQ(0, on_restart_forbidden_call_count_); diff --git a/chrome/browser/locale_tests_browsertest.cc b/chrome/browser/locale_tests_browsertest.cc index 7202d31795d6cb..26b82d119bf77d 100644 --- a/chrome/browser/locale_tests_browsertest.cc +++ b/chrome/browser/locale_tests_browsertest.cc @@ -46,7 +46,7 @@ class ScopedLocale { ~ScopedLocale() { #if defined(OS_LINUX) - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); if (old_locale_) { env->SetVar("LC_ALL", old_locale_); } else { diff --git a/chrome/browser/logging_chrome_unittest.cc b/chrome/browser/logging_chrome_unittest.cc index dcc0dce793bf13..236b4b4da37132 100644 --- a/chrome/browser/logging_chrome_unittest.cc +++ b/chrome/browser/logging_chrome_unittest.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include "base/environment.h" #include "base/files/file_path.h" -#include "base/memory/scoped_ptr.h" #include "chrome/common/env_vars.h" #include "chrome/common/logging_chrome.h" #include "testing/gtest/include/gtest/gtest.h" @@ -14,7 +15,7 @@ class ChromeLoggingTest : public testing::Test { // Stores the current value of the log file name environment // variable and sets the variable to new_value. void SaveEnvironmentVariable(const std::string& new_value) { - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); if (!env->GetVar(env_vars::kLogFileName, &environment_filename_)) environment_filename_ = ""; @@ -24,7 +25,7 @@ class ChromeLoggingTest : public testing::Test { // Restores the value of the log file nave environment variable // previously saved by SaveEnvironmentVariable(). void RestoreEnvironmentVariable() { - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); env->SetVar(env_vars::kLogFileName, environment_filename_); } diff --git a/chrome/browser/memory/tab_manager.h b/chrome/browser/memory/tab_manager.h index b856c9fde7c90a..1614cc7401e14e 100644 --- a/chrome/browser/memory/tab_manager.h +++ b/chrome/browser/memory/tab_manager.h @@ -7,6 +7,7 @@ #include +#include #include #include #include @@ -17,7 +18,6 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/memory_pressure_listener.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" #include "base/task_runner.h" @@ -248,7 +248,7 @@ class TabManager : public TabStripModelObserver { base::RepeatingTimer recent_tab_discard_timer_; // A listener to global memory pressure events. - scoped_ptr memory_pressure_listener_; + std::unique_ptr memory_pressure_listener_; // Wall-clock time when the priority manager started running. base::TimeTicks start_time_; @@ -276,7 +276,7 @@ class TabManager : public TabStripModelObserver { base::TimeDelta minimum_protection_time_; #if defined(OS_CHROMEOS) - scoped_ptr delegate_; + std::unique_ptr delegate_; #endif // Responsible for automatically registering this class as an observer of all diff --git a/chrome/browser/memory/tab_manager_browsertest.cc b/chrome/browser/memory/tab_manager_browsertest.cc index a6d63a072a374c..4b0dbedc9d4517 100644 --- a/chrome/browser/memory/tab_manager_browsertest.cc +++ b/chrome/browser/memory/tab_manager_browsertest.cc @@ -373,7 +373,7 @@ IN_PROC_BROWSER_TEST_F(TabManagerTest, ProtectVideoTabs) { MediaCaptureDevicesDispatcher* dispatcher = MediaCaptureDevicesDispatcher::GetInstance(); dispatcher->SetTestVideoCaptureDevices(video_devices); - scoped_ptr video_stream_ui = + std::unique_ptr video_stream_ui = dispatcher->GetMediaStreamCaptureIndicator()->RegisterMediaStream( tab, video_devices); video_stream_ui->OnStarted(base::Closure()); diff --git a/chrome/browser/memory/tab_manager_web_contents_data_unittest.cc b/chrome/browser/memory/tab_manager_web_contents_data_unittest.cc index 0aa9e05c37bfcf..25f1108f08d949 100644 --- a/chrome/browser/memory/tab_manager_web_contents_data_unittest.cc +++ b/chrome/browser/memory/tab_manager_web_contents_data_unittest.cc @@ -39,7 +39,7 @@ class TabManagerWebContentsDataTest : public ChromeRenderViewHostTestHarness { base::SimpleTestTickClock& test_clock() { return test_clock_; } TabManager::WebContentsData* CreateWebContentsAndTabData( - scoped_ptr* web_contents) { + std::unique_ptr* web_contents) { web_contents->reset( WebContents::Create(WebContents::CreateParams(profile()))); TabManager::WebContentsData::CreateForWebContents(web_contents->get()); @@ -47,7 +47,7 @@ class TabManagerWebContentsDataTest : public ChromeRenderViewHostTestHarness { } private: - scoped_ptr web_contents_; + std::unique_ptr web_contents_; TabManager::WebContentsData* tab_data_; base::SimpleTestTickClock test_clock_; }; @@ -93,7 +93,7 @@ TEST_F(TabManagerWebContentsDataTest, LastInactiveTime) { } TEST_F(TabManagerWebContentsDataTest, CopyState) { - scoped_ptr web_contents2; + std::unique_ptr web_contents2; auto tab_data2 = CreateWebContentsAndTabData(&web_contents2); EXPECT_EQ(tab_data()->tab_data_, tab_data2->tab_data_); diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index 24479bdb4875db..1dbb852252811a 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -217,7 +217,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() { // First pass, collate the widgets by process ID. std::map> widgets_by_pid; - scoped_ptr widget_it( + std::unique_ptr widget_it( RenderWidgetHost::GetRenderWidgetHosts()); while (content::RenderWidgetHost* widget = widget_it->GetNextHost()) { // Ignore processes that don't have a connection, such as crashed tabs. diff --git a/chrome/browser/memory_details_android.cc b/chrome/browser/memory_details_android.cc index 1bceee04212ee6..8fa12e593f6c3c 100644 --- a/chrome/browser/memory_details_android.cc +++ b/chrome/browser/memory_details_android.cc @@ -4,12 +4,12 @@ #include "chrome/browser/memory_details.h" +#include #include #include #include #include "base/bind.h" -#include "base/memory/scoped_ptr.h" #include "base/process/process_iterator.h" #include "base/strings/utf_string_conversions.h" #include "chrome/common/chrome_constants.h" @@ -59,7 +59,7 @@ void GetProcessDataMemoryInformation( else pmi.process_type = content::PROCESS_TYPE_UNKNOWN; - scoped_ptr metrics( + std::unique_ptr metrics( base::ProcessMetrics::CreateProcessMetrics(*i)); metrics->GetWorkingSetKBytes(&pmi.working_set); diff --git a/chrome/browser/memory_details_linux.cc b/chrome/browser/memory_details_linux.cc index cbcc36c257655e..a86310955afb32 100644 --- a/chrome/browser/memory_details_linux.cc +++ b/chrome/browser/memory_details_linux.cc @@ -9,11 +9,11 @@ #include #include +#include #include #include "base/bind.h" #include "base/files/file_util.h" -#include "base/memory/scoped_ptr.h" #include "base/process/process_iterator.h" #include "base/process/process_metrics.h" #include "base/strings/string_number_conversions.h" @@ -67,7 +67,7 @@ ProcessData GetProcessDataMemoryInformation( else pmi.process_type = content::PROCESS_TYPE_UNKNOWN; - scoped_ptr metrics( + std::unique_ptr metrics( base::ProcessMetrics::CreateProcessMetrics(pid)); metrics->GetWorkingSetKBytes(&pmi.working_set); diff --git a/chrome/browser/memory_details_mac.cc b/chrome/browser/memory_details_mac.cc index 23a1ed93159d63..08ca920bff222d 100644 --- a/chrome/browser/memory_details_mac.cc +++ b/chrome/browser/memory_details_mac.cc @@ -6,6 +6,7 @@ #include +#include #include #include @@ -13,7 +14,6 @@ #include "base/file_version_info.h" #include "base/files/file_path.h" #include "base/mac/foundation_util.h" -#include "base/memory/scoped_ptr.h" #include "base/process/process_iterator.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -57,7 +57,7 @@ void CollectProcessDataForChromeProcess( } } - scoped_ptr metrics; + std::unique_ptr metrics; metrics.reset(base::ProcessMetrics::CreateProcessMetrics( pid, content::BrowserChildProcessHost::GetPortProvider())); metrics->GetCommittedAndWorkingSetKBytes(&info.committed, &info.working_set); diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc index b29fa705449b42..7452134b4429c0 100644 --- a/chrome/browser/memory_details_win.cc +++ b/chrome/browser/memory_details_win.cc @@ -8,10 +8,11 @@ #include #include +#include + #include "base/bind.h" #include "base/file_version_info.h" #include "base/files/file_path.h" -#include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -80,7 +81,7 @@ void MemoryDetails::CollectProcessData( else info.process_type = content::PROCESS_TYPE_UNKNOWN; - scoped_ptr metrics; + std::unique_ptr metrics; metrics.reset( base::ProcessMetrics::CreateProcessMetrics(process_handle.Get())); metrics->GetCommittedKBytes(&info.committed); diff --git a/chrome/browser/mod_pagespeed/mod_pagespeed_metrics_unittest.cc b/chrome/browser/mod_pagespeed/mod_pagespeed_metrics_unittest.cc index 38ef0cb91136b6..c809da8e47015d 100644 --- a/chrome/browser/mod_pagespeed/mod_pagespeed_metrics_unittest.cc +++ b/chrome/browser/mod_pagespeed/mod_pagespeed_metrics_unittest.cc @@ -5,10 +5,10 @@ #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" #include +#include #include #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" #include "base/metrics/histogram_samples.h" #include "base/metrics/statistics_recorder.h" @@ -37,8 +37,8 @@ TEST(ModPagespeedMetricsTest, CountPageSpeedHeadersTest) { int num_bucket_30 = 0; // 1.2.24.1 bucket int num_bucket_33 = 0; // 1.3.25.2 bucket - scoped_ptr server_samples; - scoped_ptr version_samples; + std::unique_ptr server_samples; + std::unique_ptr version_samples; // No PageSpeed header. The VersionCounts histogram isn't created yet. RecordMetrics(content::RESOURCE_TYPE_MAIN_FRAME, url, headers.get()); diff --git a/chrome/browser/nacl_host/nacl_infobar_delegate.cc b/chrome/browser/nacl_host/nacl_infobar_delegate.cc index 3bb7131a3b7ee3..3ed0512666dfde 100644 --- a/chrome/browser/nacl_host/nacl_infobar_delegate.cc +++ b/chrome/browser/nacl_host/nacl_infobar_delegate.cc @@ -28,7 +28,7 @@ void NaClInfoBarDelegate::Create(int render_process_id, int render_view_id) { InfoBarService::FromWebContents(web_contents); if (infobar_service) { infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( - scoped_ptr(new NaClInfoBarDelegate()))); + std::unique_ptr(new NaClInfoBarDelegate()))); } } diff --git a/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc b/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc index 0f036d6f3859cb..2fc111a9334cfe 100644 --- a/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc +++ b/chrome/browser/nacl_host/test/gdb_debug_stub_browsertest.cc @@ -53,7 +53,7 @@ void NaClGdbDebugStubTest::StartTestScript(base::Process* test_process, void NaClGdbDebugStubTest::RunDebugStubTest(const std::string& nacl_module, const std::string& test_name) { base::Process test_script; - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); nacl::NaClBrowser::GetInstance()->SetGdbDebugStubPortListener( base::Bind(&NaClGdbDebugStubTest::StartTestScript, base::Unretained(this), &test_script, test_name)); diff --git a/chrome/browser/nacl_host/test/mock_nacl_gdb.cc b/chrome/browser/nacl_host/test/mock_nacl_gdb.cc index a61c47ba428a8c..cb98b3a1c6fc5b 100644 --- a/chrome/browser/nacl_host/test/mock_nacl_gdb.cc +++ b/chrome/browser/nacl_host/test/mock_nacl_gdb.cc @@ -4,12 +4,12 @@ #include #include +#include #include "base/command_line.h" #include "base/environment.h" #include "base/files/file_util.h" #include "base/logging.h" -#include "base/memory/scoped_ptr.h" static const char kEvalCommand[] = "--eval-command"; static const char kCommand[] = "--command"; @@ -18,7 +18,7 @@ static const char kPass[] = "PASS"; static const char kAttach[] = "target remote :4014"; int main(int argc, char** argv) { - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); std::string mock_nacl_gdb_file; env->GetVar("MOCK_NACL_GDB", &mock_nacl_gdb_file); CHECK_GE(argc, 5); diff --git a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc index e061e8997f0e56..d498d9507b9153 100644 --- a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc +++ b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc @@ -38,7 +38,7 @@ class NaClGdbTest : public PPAPINaClNewlibTest { void RunWithNaClGdb(const std::string& test_name) { base::FilePath mock_nacl_gdb_file; - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); std::string content; // TODO(halyavin): Make this test work on Windows 32-bit. Currently this // is not possible because NaCl doesn't work without sandbox since 1Gb of diff --git a/chrome/browser/notifications/extension_welcome_notification.cc b/chrome/browser/notifications/extension_welcome_notification.cc index d790d38e449e97..19afb424db43d5 100644 --- a/chrome/browser/notifications/extension_welcome_notification.cc +++ b/chrome/browser/notifications/extension_welcome_notification.cc @@ -183,7 +183,7 @@ void ExtensionWelcomeNotification::OnIsSyncingChanged() { PrefServiceSyncableFromProfile(profile_); if (pref_service_syncable->IsSyncing()) { pref_service_syncable->RemoveObserver(this); - scoped_ptr previous_notification( + std::unique_ptr previous_notification( delayed_notification_.release()); ShowWelcomeNotificationIfNecessary(*(previous_notification.get())); } @@ -259,7 +259,7 @@ void ExtensionWelcomeNotification::ShowWelcomeNotification( welcome_notification_id_ = base::GenerateGUID(); if (!welcome_notification_id_.empty()) { - scoped_ptr message_center_notification( + std::unique_ptr message_center_notification( new message_center::Notification( message_center::NOTIFICATION_TYPE_BASE_FORMAT, welcome_notification_id_, diff --git a/chrome/browser/notifications/extension_welcome_notification.h b/chrome/browser/notifications/extension_welcome_notification.h index ef79acf05b501f..41bb4285392f76 100644 --- a/chrome/browser/notifications/extension_welcome_notification.h +++ b/chrome/browser/notifications/extension_welcome_notification.h @@ -5,10 +5,10 @@ #ifndef CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_ #define CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_ +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/timer/timer.h" #include "components/keyed_service/core/keyed_service.h" #include "components/prefs/pref_member.h" @@ -149,15 +149,15 @@ class ExtensionWelcomeNotification // Simplifying Assumption: The delayed notification has passed the // extension ID check. This means we do not need to store all of the // notifications that may also show a welcome notification. - scoped_ptr delayed_notification_; + std::unique_ptr delayed_notification_; // If the welcome notification is shown, this timer tracks when to hide the // welcome notification. - scoped_ptr expiration_timer_; + std::unique_ptr expiration_timer_; // Delegate for Chrome global calls like base::Time::GetTime() for // testability. - scoped_ptr delegate_; + std::unique_ptr delegate_; DISALLOW_COPY_AND_ASSIGN(ExtensionWelcomeNotification); }; diff --git a/chrome/browser/notifications/extension_welcome_notification_unittest.cc b/chrome/browser/notifications/extension_welcome_notification_unittest.cc index ae862a3a07ecf7..942eec88db0bd8 100644 --- a/chrome/browser/notifications/extension_welcome_notification_unittest.cc +++ b/chrome/browser/notifications/extension_welcome_notification_unittest.cc @@ -6,10 +6,10 @@ #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/test/test_simple_task_runner.h" @@ -51,7 +51,7 @@ class MockMessageCenter : public message_center::FakeMessageCenter { } void AddNotification( - scoped_ptr notification) override { + std::unique_ptr notification) override { EXPECT_FALSE(last_notification.get()); last_notification.swap(notification); add_notification_calls_++; @@ -72,7 +72,7 @@ class MockMessageCenter : public message_center::FakeMessageCenter { } private: - scoped_ptr last_notification; + std::unique_ptr last_notification; int add_notification_calls_; int remove_notification_calls_; int notifications_with_shown_as_popup_; @@ -119,7 +119,7 @@ class WelcomeNotificationDelegate private: const base::Time start_time_; base::TimeDelta elapsed_time_; - scoped_ptr message_center_; + std::unique_ptr message_center_; base::Closure pending_task_; DISALLOW_COPY_AND_ASSIGN(WelcomeNotificationDelegate); @@ -155,11 +155,10 @@ class ExtensionWelcomeNotificationTest : public testing::Test { void StartPreferenceSyncing() const { PrefServiceSyncableFromProfile(profile_.get()) ->GetSyncableService(syncer::PREFERENCES) - ->MergeDataAndStartSyncing(syncer::PREFERENCES, - syncer::SyncDataList(), - scoped_ptr( + ->MergeDataAndStartSyncing(syncer::PREFERENCES, syncer::SyncDataList(), + std::unique_ptr( new syncer::FakeSyncChangeProcessor), - scoped_ptr( + std::unique_ptr( new syncer::SyncErrorFactoryMock())); } @@ -235,11 +234,11 @@ class ExtensionWelcomeNotificationTest : public testing::Test { } scoped_refptr task_runner_; - scoped_ptr thread_task_runner_handle_; - scoped_ptr profile_; + std::unique_ptr thread_task_runner_handle_; + std::unique_ptr profile_; // Weak Ref owned by welcome_notification_ WelcomeNotificationDelegate* delegate_; - scoped_ptr welcome_notification_; + std::unique_ptr welcome_notification_; DISALLOW_COPY_AND_ASSIGN(ExtensionWelcomeNotificationTest); }; diff --git a/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc b/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc index a720c802774b5b..92cc81f6ec5642 100644 --- a/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc +++ b/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc @@ -46,7 +46,7 @@ class UserAddingFinishObserver : public chromeos::UserAddingScreen::Observer { void OnUserAddingStarted() override { finished_ = false; } private: - scoped_ptr run_loop_; + std::unique_ptr run_loop_; bool finished_ = false; // True if OnUserAddingFinished() has been called // before WaitUntilUserAddingFinishedOrCancelled(). DISALLOW_COPY_AND_ASSIGN(UserAddingFinishObserver); @@ -101,7 +101,7 @@ class LoginStateNotificationBlockerChromeOSBrowserTest private: int state_changed_count_; - scoped_ptr blocker_; + std::unique_ptr blocker_; DISALLOW_COPY_AND_ASSIGN(LoginStateNotificationBlockerChromeOSBrowserTest); }; diff --git a/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc b/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc index 32d8e5f511d790..dd52c0c9974e4e 100644 --- a/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc +++ b/chrome/browser/notifications/login_state_notification_blocker_chromeos_unittest.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/notifications/login_state_notification_blocker_chromeos.h" + +#include + #include "ash/shell.h" #include "ash/system/system_notifier.h" #include "ash/test/ash_test_base.h" #include "base/command_line.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" -#include "chrome/browser/notifications/login_state_notification_blocker_chromeos.h" #include "chromeos/login/login_state.h" #include "ui/message_center/message_center.h" #include "ui/message_center/notification.h" @@ -57,7 +59,7 @@ class LoginStateNotificationBlockerChromeOSTest private: int state_changed_count_; - scoped_ptr blocker_; + std::unique_ptr blocker_; DISALLOW_COPY_AND_ASSIGN(LoginStateNotificationBlockerChromeOSTest); }; diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc index da307bb49eb133..b004ccfc3ae5db 100644 --- a/chrome/browser/notifications/message_center_notification_manager.cc +++ b/chrome/browser/notifications/message_center_notification_manager.cc @@ -4,10 +4,11 @@ #include "chrome/browser/notifications/message_center_notification_manager.h" +#include #include #include "base/logging.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "build/build_config.h" @@ -55,7 +56,7 @@ NotificationUIManager::CreateNativeNotificationManager() { MessageCenterNotificationManager::MessageCenterNotificationManager( message_center::MessageCenter* message_center, - scoped_ptr settings_provider) + std::unique_ptr settings_provider) : message_center_(message_center), settings_provider_(std::move(settings_provider)), system_observer_(this), @@ -65,14 +66,14 @@ MessageCenterNotificationManager::MessageCenterNotificationManager( message_center_->SetNotifierSettingsProvider(settings_provider_.get()); #if defined(OS_CHROMEOS) - blockers_.push_back(make_scoped_ptr( + blockers_.push_back(base::WrapUnique( new LoginStateNotificationBlockerChromeOS(message_center))); #else - blockers_.push_back(make_scoped_ptr( - new ScreenLockNotificationBlocker(message_center))); + blockers_.push_back( + base::WrapUnique(new ScreenLockNotificationBlocker(message_center))); #endif - blockers_.push_back(make_scoped_ptr( - new FullscreenNotificationBlocker(message_center))); + blockers_.push_back( + base::WrapUnique(new FullscreenNotificationBlocker(message_center))); #if defined(OS_WIN) || defined(OS_MACOSX) \ || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) @@ -124,7 +125,7 @@ void MessageCenterNotificationManager::Add(const Notification& notification, AddNotificationToAlternateProvider(profile_notification->notification(), profile, extension_id); - message_center_->AddNotification(make_scoped_ptr( + message_center_->AddNotification(base::WrapUnique( new message_center::Notification(profile_notification->notification()))); } @@ -167,9 +168,8 @@ bool MessageCenterNotificationManager::Update(const Notification& notification, // center via the notification within a ProfileNotification object or the // profile ID will not be correctly set for ChromeOS. message_center_->UpdateNotification( - old_id, - make_scoped_ptr(new message_center::Notification( - new_notification->notification()))); + old_id, base::WrapUnique(new message_center::Notification( + new_notification->notification()))); return true; } diff --git a/chrome/browser/notifications/message_center_notification_manager.h b/chrome/browser/notifications/message_center_notification_manager.h index 40a5b61e04907c..8b153dbd47f463 100644 --- a/chrome/browser/notifications/message_center_notification_manager.h +++ b/chrome/browser/notifications/message_center_notification_manager.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_NOTIFICATIONS_MESSAGE_CENTER_NOTIFICATION_MANAGER_H_ #include +#include #include #include #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "base/timer/timer.h" @@ -43,7 +43,8 @@ class MessageCenterNotificationManager public: MessageCenterNotificationManager( message_center::MessageCenter* message_center, - scoped_ptr settings_provider); + std::unique_ptr + settings_provider); ~MessageCenterNotificationManager() override; // NotificationUIManager @@ -88,7 +89,7 @@ class MessageCenterNotificationManager FRIEND_TEST_ALL_PREFIXES(message_center::WebNotificationTrayTest, ManuallyCloseMessageCenter); - scoped_ptr tray_; + std::unique_ptr tray_; message_center::MessageCenter* message_center_; // Weak, global. // Use a map by notification_id since this mapping is the most often used. @@ -108,10 +109,10 @@ class MessageCenterNotificationManager // Chorme Notification Center. std::string GetExtensionTakingOverNotifications(Profile* profile); - scoped_ptr settings_provider_; + std::unique_ptr settings_provider_; // To own the blockers. - std::vector> blockers_; + std::vector> blockers_; NotificationSystemObserver system_observer_; diff --git a/chrome/browser/notifications/message_center_notifications_unittest.cc b/chrome/browser/notifications/message_center_notifications_unittest.cc index a0bf676cb211fc..742031378daffe 100644 --- a/chrome/browser/notifications/message_center_notifications_unittest.cc +++ b/chrome/browser/notifications/message_center_notifications_unittest.cc @@ -2,7 +2,8 @@ // 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 + #include "base/strings/utf_string_conversions.h" #include "base/test/test_timeouts.h" #include "base/values.h" @@ -93,7 +94,7 @@ class MessageCenterNotificationManagerTest : public BrowserWithTestWindowTest { } private: - scoped_ptr profile_manager_; + std::unique_ptr profile_manager_; MessageCenter* message_center_; FakeMessageCenterTrayDelegate* delegate_; }; @@ -124,10 +125,9 @@ TEST_F(MessageCenterNotificationManagerTest, MultiUserUpdates) { chrome::MultiUserWindowManager::SetInstanceForTest( multi_user_window_manager, chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED); - scoped_ptr blocker( + std::unique_ptr blocker( new MultiUserNotificationBlockerChromeOS( - message_center::MessageCenter::Get(), - active_user_id)); + message_center::MessageCenter::Get(), active_user_id)); EXPECT_EQ(0u, message_center()->NotificationCount()); notification_manager()->Add(GetANotification("test"), &profile); EXPECT_EQ(1u, message_center()->NotificationCount()); diff --git a/chrome/browser/notifications/message_center_settings_controller.cc b/chrome/browser/notifications/message_center_settings_controller.cc index f0e14e78192085..e1a85dfa5d0491 100644 --- a/chrome/browser/notifications/message_center_settings_controller.cc +++ b/chrome/browser/notifications/message_center_settings_controller.cc @@ -292,8 +292,8 @@ void MessageCenterSettingsController::GetNotifierList( #endif UErrorCode error = U_ZERO_ERROR; - scoped_ptr collator(icu::Collator::createInstance(error)); - scoped_ptr comparator( + std::unique_ptr collator(icu::Collator::createInstance(error)); + std::unique_ptr comparator( new NotifierComparator(U_SUCCESS(error) ? collator.get() : NULL)); std::sort(notifiers->begin(), notifiers->end(), *comparator); @@ -411,9 +411,9 @@ void MessageCenterSettingsController::OnNotifierAdvancedSettingsRequested( Profile* profile = notifier_groups_[current_notifier_group_]->profile(); extensions::EventRouter* event_router = extensions::EventRouter::Get(profile); - scoped_ptr args(new base::ListValue()); + std::unique_ptr args(new base::ListValue()); - scoped_ptr event(new extensions::Event( + std::unique_ptr event(new extensions::Event( extensions::events::NOTIFICATIONS_ON_SHOW_SETTINGS, extensions::api::notifications::OnShowSettings::kEventName, std::move(args))); @@ -493,11 +493,10 @@ void MessageCenterSettingsController::CreateNotifierGroupForGuestLogin() { chromeos::ProfileHelper::Get()->GetProfileByUserUnsafe(user); DCHECK(profile); - scoped_ptr group( - new message_center::ProfileNotifierGroup(gfx::Image(user->GetImage()), - user->GetDisplayName(), - user->GetDisplayName(), - profile)); + std::unique_ptr group( + new message_center::ProfileNotifierGroup( + gfx::Image(user->GetImage()), user->GetDisplayName(), + user->GetDisplayName(), profile)); notifier_groups_.push_back(std::move(group)); @@ -514,11 +513,9 @@ void MessageCenterSettingsController::RebuildNotifierGroups(bool notify) { std::vector entries = profile_attributes_storage_.GetAllProfilesAttributes(); for (const auto entry : entries) { - scoped_ptr group( + std::unique_ptr group( new message_center::ProfileNotifierGroup( - entry->GetAvatarIcon(), - entry->GetName(), - entry->GetUserName(), + entry->GetAvatarIcon(), entry->GetName(), entry->GetUserName(), entry->GetPath())); if (group->profile() == NULL) continue; diff --git a/chrome/browser/notifications/message_center_settings_controller.h b/chrome/browser/notifications/message_center_settings_controller.h index ae2f4f1afc4a8a..a65da5e33bfda2 100644 --- a/chrome/browser/notifications/message_center_settings_controller.h +++ b/chrome/browser/notifications/message_center_settings_controller.h @@ -8,10 +8,10 @@ #include #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "build/build_config.h" @@ -121,16 +121,16 @@ class MessageCenterSettingsController base::ObserverList observers_; // The task tracker for loading favicons. - scoped_ptr favicon_tracker_; + std::unique_ptr favicon_tracker_; - scoped_ptr app_icon_loader_; + std::unique_ptr app_icon_loader_; std::map patterns_; // The list of all configurable notifier groups. This is each profile that is // loaded (and in the ProfileAttributesStorage - so no incognito profiles go // here). - std::vector> + std::vector> notifier_groups_; size_t current_notifier_group_; diff --git a/chrome/browser/notifications/message_center_settings_controller_unittest.cc b/chrome/browser/notifications/message_center_settings_controller_unittest.cc index 770b31cf7d2a9d..0dd7c285329f44 100644 --- a/chrome/browser/notifications/message_center_settings_controller_unittest.cc +++ b/chrome/browser/notifications/message_center_settings_controller_unittest.cc @@ -62,7 +62,7 @@ class MessageCenterSettingsControllerBaseTest : public testing::Test { private: content::TestBrowserThreadBundle thread_bundle_; TestingProfileManager testing_profile_manager_; - scoped_ptr controller_; + std::unique_ptr controller_; DISALLOW_COPY_AND_ASSIGN(MessageCenterSettingsControllerBaseTest); }; @@ -108,7 +108,7 @@ class MessageCenterSettingsControllerChromeOSTest user_manager::UserManager::Get()); } - scoped_ptr user_manager_enabler_; + std::unique_ptr user_manager_enabler_; DISALLOW_COPY_AND_ASSIGN(MessageCenterSettingsControllerChromeOSTest); }; diff --git a/chrome/browser/notifications/notification.h b/chrome/browser/notifications/notification.h index 99b90721a8a21f..6c7b9f205e8b09 100644 --- a/chrome/browser/notifications/notification.h +++ b/chrome/browser/notifications/notification.h @@ -5,9 +5,9 @@ #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_H_ +#include #include -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "base/values.h" #include "chrome/browser/notifications/notification_delegate.h" diff --git a/chrome/browser/notifications/notification_browsertest.cc b/chrome/browser/notifications/notification_browsertest.cc index 6362499ace1fec..454830e484ab88 100644 --- a/chrome/browser/notifications/notification_browsertest.cc +++ b/chrome/browser/notifications/notification_browsertest.cc @@ -739,7 +739,7 @@ IN_PROC_BROWSER_TEST_F(NotificationsTest, TestLastUsage) { HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(browser()->profile()); base::SimpleTestClock* clock = new base::SimpleTestClock(); - settings_map->SetPrefClockForTesting(scoped_ptr(clock)); + settings_map->SetPrefClockForTesting(std::unique_ptr(clock)); clock->SetNow(base::Time::UnixEpoch() + base::TimeDelta::FromSeconds(10)); // Creates a simple notification. diff --git a/chrome/browser/notifications/notification_conversion_helper.cc b/chrome/browser/notifications/notification_conversion_helper.cc index c470a66d28a5a9..f11b363bba3305 100644 --- a/chrome/browser/notifications/notification_conversion_helper.cc +++ b/chrome/browser/notifications/notification_conversion_helper.cc @@ -7,12 +7,12 @@ #include #include +#include #include #include #include #include "base/logging.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/utf_string_conversions.h" #include "chrome/common/extensions/api/notification_provider.h" #include "chrome/common/extensions/api/notifications/notification_style.h" @@ -28,7 +28,7 @@ void NotificationConversionHelper::NotificationToNotificationOptions( options->type = extensions::api::notifications::ParseTemplateType(type); if (!notification.icon().IsEmpty()) { - scoped_ptr icon( + std::unique_ptr icon( new extensions::api::notifications::NotificationBitmap()); GfxImageToNotificationBitmap(¬ification.icon(), icon.get()); options->icon_bitmap = std::move(icon); @@ -44,8 +44,8 @@ void NotificationConversionHelper::NotificationToNotificationOptions( ¬ification.rich_notification_data(); if (!rich_data->small_image.IsEmpty()) { - scoped_ptr icon_mask( - new extensions::api::notifications::NotificationBitmap()); + std::unique_ptr + icon_mask(new extensions::api::notifications::NotificationBitmap()); GfxImageToNotificationBitmap(&rich_data->small_image, icon_mask.get()); options->app_icon_mask_bitmap = std::move(icon_mask); } @@ -68,8 +68,8 @@ void NotificationConversionHelper::NotificationToNotificationOptions( button.title = base::UTF16ToUTF8(button_info.title); if (!button_info.icon.IsEmpty()) { - scoped_ptr icon( - new extensions::api::notifications::NotificationBitmap()); + std::unique_ptr + icon(new extensions::api::notifications::NotificationBitmap()); GfxImageToNotificationBitmap(&button_info.icon, icon.get()); button.icon_bitmap = std::move(icon); } @@ -79,7 +79,7 @@ void NotificationConversionHelper::NotificationToNotificationOptions( // Only image type notifications should have images. if (type == "image" && !rich_data->image.IsEmpty()) { - scoped_ptr image( + std::unique_ptr image( new extensions::api::notifications::NotificationBitmap()); GfxImageToNotificationBitmap(¬ification.image(), image.get()); options->image_bitmap = std::move(image); @@ -122,7 +122,7 @@ void NotificationConversionHelper::GfxImageToNotificationBitmap( uint32_t* bitmap_pixels = sk_bitmap.getAddr32(0, 0); const unsigned char* bitmap = reinterpret_cast(bitmap_pixels); - scoped_ptr> rgba_bitmap_data( + std::unique_ptr> rgba_bitmap_data( new std::vector(pixel_count * BYTES_PER_PIXEL)); gfx::ConvertSkiaToRGBA(bitmap, pixel_count, reinterpret_cast( diff --git a/chrome/browser/notifications/notification_conversion_helper_unittest.cc b/chrome/browser/notifications/notification_conversion_helper_unittest.cc index e5072949f35303..d26ab6dd846121 100644 --- a/chrome/browser/notifications/notification_conversion_helper_unittest.cc +++ b/chrome/browser/notifications/notification_conversion_helper_unittest.cc @@ -24,7 +24,7 @@ class NotificationConversionHelperTest : public testing::Test { void TearDown() override {} protected: - scoped_ptr CreateNotification( + std::unique_ptr CreateNotification( message_center::NotificationType type) { message_center::RichNotificationData optional_fields; optional_fields.priority = 1; @@ -57,7 +57,7 @@ class NotificationConversionHelperTest : public testing::Test { bitmap.eraseColor(SkColorSetRGB(1, 2, 3)); gfx::Image icon = gfx::Image::CreateFrom1xBitmap(bitmap); - scoped_ptr notification(new Notification( + std::unique_ptr notification(new Notification( type, base::UTF8ToUTF16("Title"), base::UTF8ToUTF16("This is a message."), icon, message_center::NotifierId(message_center::NotifierId::APPLICATION, @@ -74,9 +74,9 @@ class NotificationConversionHelperTest : public testing::Test { TEST_F(NotificationConversionHelperTest, NotificationToNotificationOptions) { // Create a notification of image type - scoped_ptr notification1 = + std::unique_ptr notification1 = CreateNotification(message_center::NOTIFICATION_TYPE_IMAGE); - scoped_ptr options1( + std::unique_ptr options1( new extensions::api::notifications::NotificationOptions()); NotificationConversionHelper::NotificationToNotificationOptions( *(notification1), options1.get()); @@ -96,9 +96,9 @@ TEST_F(NotificationConversionHelperTest, NotificationToNotificationOptions) { EXPECT_EQ(options1->icon_bitmap->height, 1); // Create a notification of progress type - scoped_ptr notification2 = + std::unique_ptr notification2 = CreateNotification(message_center::NOTIFICATION_TYPE_PROGRESS); - scoped_ptr options2( + std::unique_ptr options2( new extensions::api::notifications::NotificationOptions()); NotificationConversionHelper::NotificationToNotificationOptions( *(notification2), options2.get()); @@ -107,9 +107,9 @@ TEST_F(NotificationConversionHelperTest, NotificationToNotificationOptions) { EXPECT_EQ(*(options2->progress), 50); // Create a notification of multiple type - scoped_ptr notification3 = + std::unique_ptr notification3 = CreateNotification(message_center::NOTIFICATION_TYPE_MULTIPLE); - scoped_ptr options3( + std::unique_ptr options3( new extensions::api::notifications::NotificationOptions()); NotificationConversionHelper::NotificationToNotificationOptions( *(notification3), options3.get()); diff --git a/chrome/browser/notifications/notification_object_proxy.cc b/chrome/browser/notifications/notification_object_proxy.cc index cef1b00a2a26fe..15a57b3d0deee3 100644 --- a/chrome/browser/notifications/notification_object_proxy.cc +++ b/chrome/browser/notifications/notification_object_proxy.cc @@ -13,7 +13,7 @@ NotificationObjectProxy::NotificationObjectProxy( content::BrowserContext* browser_context, - scoped_ptr delegate) + std::unique_ptr delegate) : browser_context_(browser_context), delegate_(std::move(delegate)), displayed_(false), diff --git a/chrome/browser/notifications/notification_object_proxy.h b/chrome/browser/notifications/notification_object_proxy.h index 1de7447ab1edd5..e09bfff868f859 100644 --- a/chrome/browser/notifications/notification_object_proxy.h +++ b/chrome/browser/notifications/notification_object_proxy.h @@ -5,10 +5,10 @@ #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/notifications/notification_delegate.h" namespace content { @@ -26,7 +26,7 @@ class NotificationObjectProxy : public NotificationDelegate { // will take ownership of |delegate|. NotificationObjectProxy( content::BrowserContext* browser_context, - scoped_ptr delegate); + std::unique_ptr delegate); // NotificationDelegate implementation. void Display() override; @@ -42,7 +42,7 @@ class NotificationObjectProxy : public NotificationDelegate { private: content::BrowserContext* browser_context_; - scoped_ptr delegate_; + std::unique_ptr delegate_; bool displayed_; std::string id_; diff --git a/chrome/browser/notifications/notification_permission_context.cc b/chrome/browser/notifications/notification_permission_context.cc index c156dac8824d0a..499c1159748600 100644 --- a/chrome/browser/notifications/notification_permission_context.cc +++ b/chrome/browser/notifications/notification_permission_context.cc @@ -59,7 +59,7 @@ class VisibilityTimerTabHelper bool is_visible_; struct Task { - Task(const PermissionRequestID& id, scoped_ptr timer) + Task(const PermissionRequestID& id, std::unique_ptr timer) : id(id), timer(std::move(timer)) {} Task& operator=(Task&& other) { @@ -69,7 +69,7 @@ class VisibilityTimerTabHelper } PermissionRequestID id; - scoped_ptr timer; + std::unique_ptr timer; private: DISALLOW_COPY_AND_ASSIGN(Task); @@ -107,7 +107,7 @@ void VisibilityTimerTabHelper::PostTaskAfterVisibleDelay( // Safe to use Unretained, as destroying this will destroy task_queue_, hence // cancelling all timers. - scoped_ptr timer(new base::Timer( + std::unique_ptr timer(new base::Timer( from_here, visible_delay, base::Bind(&VisibilityTimerTabHelper::RunTask, base::Unretained(this), task), false /* is_repeating */)); diff --git a/chrome/browser/notifications/notification_permission_infobar_delegate.cc b/chrome/browser/notifications/notification_permission_infobar_delegate.cc index 46b5a5c7b47ec1..39a1f39e86d470 100644 --- a/chrome/browser/notifications/notification_permission_infobar_delegate.cc +++ b/chrome/browser/notifications/notification_permission_infobar_delegate.cc @@ -18,7 +18,7 @@ infobars::InfoBar* NotificationPermissionInfobarDelegate::Create( const GURL& requesting_frame, const base::Callback& callback) { return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( - scoped_ptr( + std::unique_ptr( new NotificationPermissionInfobarDelegate(requesting_frame, callback)))); } diff --git a/chrome/browser/notifications/notification_ui_manager_desktop.cc b/chrome/browser/notifications/notification_ui_manager_desktop.cc index 7de03bb53d8361..d1fc804014b43c 100644 --- a/chrome/browser/notifications/notification_ui_manager_desktop.cc +++ b/chrome/browser/notifications/notification_ui_manager_desktop.cc @@ -4,9 +4,9 @@ #include "chrome/browser/notifications/notification_ui_manager.h" +#include #include -#include "base/memory/scoped_ptr.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/notifications/message_center_notification_manager.h" #include "chrome/browser/notifications/message_center_settings_controller.h" @@ -19,7 +19,7 @@ NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) { if (!profile_manager) return nullptr; - scoped_ptr settings_provider( + std::unique_ptr settings_provider( new MessageCenterSettingsController( profile_manager->GetProfileAttributesStorage())); return new MessageCenterNotificationManager( diff --git a/chrome/browser/notifications/notifier_state_tracker.cc b/chrome/browser/notifications/notifier_state_tracker.cc index 4b70c0025aaad1..dcf9015e977134 100644 --- a/chrome/browser/notifications/notifier_state_tracker.cc +++ b/chrome/browser/notifications/notifier_state_tracker.cc @@ -107,7 +107,7 @@ void NotifierStateTracker::SetNotifierEnabled( bool add_new_item = false; const char* pref_name = NULL; - scoped_ptr id; + std::unique_ptr id; switch (notifier_id.type) { case NotifierId::APPLICATION: pref_name = prefs::kMessageCenterDisabledExtensionIds; @@ -176,10 +176,10 @@ void NotifierStateTracker::FirePermissionLevelChangedEvent( extensions::api::notifications::PermissionLevel permission = enabled ? extensions::api::notifications::PERMISSION_LEVEL_GRANTED : extensions::api::notifications::PERMISSION_LEVEL_DENIED; - scoped_ptr args(new base::ListValue()); + std::unique_ptr args(new base::ListValue()); args->Append(new base::StringValue( extensions::api::notifications::ToString(permission))); - scoped_ptr event(new extensions::Event( + std::unique_ptr event(new extensions::Event( extensions::events::NOTIFICATIONS_ON_PERMISSION_LEVEL_CHANGED, extensions::api::notifications::OnPermissionLevelChanged::kEventName, std::move(args))); diff --git a/chrome/browser/notifications/platform_notification_service_browsertest.cc b/chrome/browser/notifications/platform_notification_service_browsertest.cc index c52b8e70135b3d..2258bbabb05ed0 100644 --- a/chrome/browser/notifications/platform_notification_service_browsertest.cc +++ b/chrome/browser/notifications/platform_notification_service_browsertest.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include #include #include #include "base/command_line.h" #include "base/files/file_path.h" -#include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" @@ -93,8 +93,8 @@ class PlatformNotificationServiceBrowserTest : public InProcessBrowserTest { const base::FilePath server_root_; const std::string test_page_url_; - scoped_ptr ui_manager_; - scoped_ptr https_server_; + std::unique_ptr ui_manager_; + std::unique_ptr https_server_; }; // ----------------------------------------------------------------------------- diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc index dc4cf994e758ec..7a5b8bbb8215db 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.cc +++ b/chrome/browser/notifications/platform_notification_service_impl.cc @@ -316,7 +316,7 @@ void PlatformNotificationServiceImpl::DisplayNotification( const GURL& origin, const content::PlatformNotificationData& notification_data, const content::NotificationResources& notification_resources, - scoped_ptr delegate, + std::unique_ptr delegate, base::Closure* cancel_callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); diff --git a/chrome/browser/notifications/platform_notification_service_impl.h b/chrome/browser/notifications/platform_notification_service_impl.h index 28bbbed27fa38b..b26aa2ab322385 100644 --- a/chrome/browser/notifications/platform_notification_service_impl.h +++ b/chrome/browser/notifications/platform_notification_service_impl.h @@ -6,14 +6,15 @@ #define CHROME_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_SERVICE_IMPL_H_ #include + #include +#include #include #include #include #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/strings/string16.h" #include "chrome/browser/notifications/notification.h" @@ -98,7 +99,7 @@ class PlatformNotificationServiceImpl const GURL& origin, const content::PlatformNotificationData& notification_data, const content::NotificationResources& notification_resources, - scoped_ptr delegate, + std::unique_ptr delegate, base::Closure* cancel_callback) override; void DisplayPersistentNotification( content::BrowserContext* browser_context, @@ -146,7 +147,7 @@ class PlatformNotificationServiceImpl // Platforms that display native notification interact with them through this // object. - scoped_ptr native_notification_ui_manager_; + std::unique_ptr native_notification_ui_manager_; // Weak reference. Ownership maintains with the test. NotificationUIManager* notification_ui_manager_for_tests_; diff --git a/chrome/browser/notifications/platform_notification_service_unittest.cc b/chrome/browser/notifications/platform_notification_service_unittest.cc index 282ed6754ba702..d9bf4090b335b5 100644 --- a/chrome/browser/notifications/platform_notification_service_unittest.cc +++ b/chrome/browser/notifications/platform_notification_service_unittest.cc @@ -7,6 +7,7 @@ #include #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/platform_thread.h" #include "base/time/time.h" @@ -114,7 +115,7 @@ class PlatformNotificationServiceTest : public testing::Test { service()->DisplayNotification(profile(), GURL("https://chrome.com/"), notification_data, NotificationResources(), - make_scoped_ptr(delegate), close_closure); + base::WrapUnique(delegate), close_closure); return delegate; } @@ -131,8 +132,8 @@ class PlatformNotificationServiceTest : public testing::Test { StubNotificationUIManager* ui_manager() const { return ui_manager_.get(); } private: - scoped_ptr ui_manager_; - scoped_ptr profile_; + std::unique_ptr ui_manager_; + std::unique_ptr profile_; content::TestBrowserThreadBundle thread_bundle_; }; @@ -200,7 +201,7 @@ TEST_F(PlatformNotificationServiceTest, DisplayPageNotificationMatches) { = new MockDesktopNotificationDelegate(); service()->DisplayNotification(profile(), GURL("https://chrome.com/"), notification_data, NotificationResources(), - make_scoped_ptr(delegate), nullptr); + base::WrapUnique(delegate), nullptr); ASSERT_EQ(1u, ui_manager()->GetNotificationCount()); diff --git a/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc b/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc index 1f2cb4a0eb8dca..779cc2d54fdecc 100644 --- a/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc +++ b/chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ntp_snippets/ntp_snippets_service_factory.h" +#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" @@ -73,7 +74,7 @@ KeyedService* NTPSnippetsServiceFactory::BuildServiceInstanceFor( return new ntp_snippets::NTPSnippetsService( profile->GetPrefs(), suggestions_service, task_runner, g_browser_process->GetApplicationLocale(), scheduler, - make_scoped_ptr(new ntp_snippets::NTPSnippetsFetcher( + base::WrapUnique(new ntp_snippets::NTPSnippetsFetcher( task_runner, request_context, chrome::GetChannel() == version_info::Channel::STABLE)), base::Bind(&safe_json::SafeJsonParser::Parse)); diff --git a/chrome/browser/ntp_snippets/ntp_snippets_service_factory.h b/chrome/browser/ntp_snippets/ntp_snippets_service_factory.h index 5a6bb543b0b019..a5ca8374542932 100644 --- a/chrome/browser/ntp_snippets/ntp_snippets_service_factory.h +++ b/chrome/browser/ntp_snippets/ntp_snippets_service_factory.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_FACTORY_H_ #define CHROME_BROWSER_NTP_SNIPPETS_NTP_SNIPPETS_SERVICE_FACTORY_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" class Profile; diff --git a/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc index 67959ce2510900..812fb06fb3a188 100644 --- a/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc @@ -3,13 +3,15 @@ // found in the LICENSE file. #include "chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.h" + +#include "base/memory/ptr_util.h" #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h" class AbortsPageLoadMetricsObserverTest : public page_load_metrics::PageLoadMetricsObserverTestHarness { protected: void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override { - tracker->AddObserver(make_scoped_ptr(new AbortsPageLoadMetricsObserver())); + tracker->AddObserver(base::WrapUnique(new AbortsPageLoadMetricsObserver())); } void SimulateTimingWithoutPaint() { diff --git a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc index af2778d12a61b9..36b111a2296ab3 100644 --- a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc +++ b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc @@ -376,7 +376,7 @@ void CorePageLoadMetricsObserver::RecordRappor( info)) { return; } - scoped_ptr sample = + std::unique_ptr sample = rappor_service->CreateSample(rappor::UMA_RAPPOR_TYPE); sample->SetStringField( "Domain", rappor::GetDomainAndRegistrySampleFromGURL(info.committed_url)); diff --git a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc index fdcefd58ab7bf4..922fa5620c11c1 100644 --- a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc @@ -3,6 +3,8 @@ // found in the LICENSE file. #include "chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h" + +#include "base/memory/ptr_util.h" #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h" #include "chrome/test/base/testing_browser_process.h" #include "components/rappor/rappor_utils.h" @@ -20,7 +22,7 @@ class CorePageLoadMetricsObserverTest : public page_load_metrics::PageLoadMetricsObserverTestHarness { protected: void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override { - tracker->AddObserver(make_scoped_ptr(new CorePageLoadMetricsObserver())); + tracker->AddObserver(base::WrapUnique(new CorePageLoadMetricsObserver())); } void AssertNoHistogramsLogged() { diff --git a/chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer_unittest.cc index 9c57d493312826..9f0a62790837f3 100644 --- a/chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer_unittest.cc @@ -3,6 +3,8 @@ // found in the LICENSE file. #include "chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer.h" + +#include "base/memory/ptr_util.h" #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h" #include "chrome/test/base/testing_browser_process.h" #include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h" @@ -12,7 +14,7 @@ class DocumentWritePageLoadMetricsObserverTest protected: void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override { tracker->AddObserver( - make_scoped_ptr(new DocumentWritePageLoadMetricsObserver())); + base::WrapUnique(new DocumentWritePageLoadMetricsObserver())); } void AssertNoHistogramsLogged() { histogram_tester().ExpectTotalCount( diff --git a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer_unittest.cc index ae25b656e54415..9fc0d336b6723a 100644 --- a/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer_unittest.cc +++ b/chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer_unittest.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/macros.h" #include "chrome/browser/page_load_metrics/observers/from_gws_page_load_metrics_observer.h" + +#include "base/macros.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h" namespace { @@ -35,7 +37,7 @@ class FromGWSPageLoadMetricsObserverTest public: void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override { tracker->AddObserver( - make_scoped_ptr(new TestFromGWSPageLoadMetricsObserver(referrer_))); + base::WrapUnique(new TestFromGWSPageLoadMetricsObserver(referrer_))); } // Inject this referrer to FromGWS observers. diff --git a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc index 5de79a21637d37..26a700d976130c 100644 --- a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc +++ b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc @@ -4,8 +4,10 @@ #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h" +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "components/page_load_metrics/common/page_load_metrics_messages.h" namespace page_load_metrics { @@ -84,10 +86,9 @@ void PageLoadMetricsObserverTestHarness::SetUp() { ChromeRenderViewHostTestHarness::SetUp(); SetContents(CreateTestWebContents()); NavigateAndCommit(GURL("http://www.google.com")); - observer_ = - MetricsWebContentsObserver::CreateForWebContents( - web_contents(), - make_scoped_ptr(new TestPageLoadMetricsEmbedderInterface(this))); + observer_ = MetricsWebContentsObserver::CreateForWebContents( + web_contents(), + base::WrapUnique(new TestPageLoadMetricsEmbedderInterface(this))); web_contents()->WasShown(); } diff --git a/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc b/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc index 95c1f04c4dcf3e..58f6beb76e9311 100644 --- a/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc +++ b/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc @@ -4,6 +4,7 @@ #include "chrome/browser/page_load_metrics/page_load_metrics_initialize.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.h" #include "chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h" #include "chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer.h" @@ -20,7 +21,7 @@ namespace chrome { void InitializePageLoadMetricsForWebContents( content::WebContents* web_contents) { page_load_metrics::MetricsWebContentsObserver::CreateForWebContents( - web_contents, make_scoped_ptr(new PageLoadMetricsEmbedder())); + web_contents, base::WrapUnique(new PageLoadMetricsEmbedder())); } PageLoadMetricsEmbedder::~PageLoadMetricsEmbedder() {} @@ -28,16 +29,16 @@ PageLoadMetricsEmbedder::~PageLoadMetricsEmbedder() {} void PageLoadMetricsEmbedder::RegisterObservers( page_load_metrics::PageLoadTracker* tracker) { // These classes are owned by the metrics. - tracker->AddObserver(make_scoped_ptr(new AbortsPageLoadMetricsObserver())); - tracker->AddObserver(make_scoped_ptr(new CorePageLoadMetricsObserver())); - tracker->AddObserver(make_scoped_ptr(new FromGWSPageLoadMetricsObserver())); + tracker->AddObserver(base::WrapUnique(new AbortsPageLoadMetricsObserver())); + tracker->AddObserver(base::WrapUnique(new CorePageLoadMetricsObserver())); + tracker->AddObserver(base::WrapUnique(new FromGWSPageLoadMetricsObserver())); tracker->AddObserver( - make_scoped_ptr(new google_captcha_observer::GoogleCaptchaObserver())); + base::WrapUnique(new google_captcha_observer::GoogleCaptchaObserver())); // TODO(ricea): Remove this in April 2016 or before. crbug.com/348877 tracker->AddObserver( - make_scoped_ptr(new chrome::StaleWhileRevalidateMetricsObserver())); + base::WrapUnique(new chrome::StaleWhileRevalidateMetricsObserver())); tracker->AddObserver( - make_scoped_ptr(new DocumentWritePageLoadMetricsObserver())); + base::WrapUnique(new DocumentWritePageLoadMetricsObserver())); } bool PageLoadMetricsEmbedder::IsPrerendering( diff --git a/chrome/browser/pepper_broker_infobar_delegate.cc b/chrome/browser/pepper_broker_infobar_delegate.cc index a8db641a63e137..a607c38ceb5aa6 100644 --- a/chrome/browser/pepper_broker_infobar_delegate.cc +++ b/chrome/browser/pepper_broker_infobar_delegate.cc @@ -55,9 +55,9 @@ void PepperBrokerInfoBarDelegate::Create( InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents); infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( - scoped_ptr(new PepperBrokerInfoBarDelegate( - url, plugin_path, content_settings, tab_content_settings, - callback)))); + std::unique_ptr( + new PepperBrokerInfoBarDelegate(url, plugin_path, content_settings, + tab_content_settings, callback)))); return; } @@ -103,7 +103,7 @@ base::string16 PepperBrokerInfoBarDelegate::GetMessageText() const { content::WebPluginInfo plugin; bool success = plugin_service->GetPluginInfoByPath(plugin_path_, &plugin); DCHECK(success); - scoped_ptr plugin_metadata( + std::unique_ptr plugin_metadata( PluginFinder::GetInstance()->GetPluginMetadata(plugin)); return l10n_util::GetStringFUTF16( IDS_PEPPER_BROKER_MESSAGE, plugin_metadata->name(), diff --git a/chrome/browser/pepper_flash_settings_manager.cc b/chrome/browser/pepper_flash_settings_manager.cc index 4f5dca1aec8d69..9cf779fd35127b 100644 --- a/chrome/browser/pepper_flash_settings_manager.cc +++ b/chrome/browser/pepper_flash_settings_manager.cc @@ -187,7 +187,7 @@ class PepperFlashSettingsManager::Core // The channel is NULL until we have opened a connection to the broker // process. Used only on the I/O thread. - scoped_ptr channel_; + std::unique_ptr channel_; // Used only on the I/O thread. State state_; diff --git a/chrome/browser/performance_monitor/performance_monitor.cc b/chrome/browser/performance_monitor/performance_monitor.cc index 84739978048248..6b648e9dbe380f 100644 --- a/chrome/browser/performance_monitor/performance_monitor.cc +++ b/chrome/browser/performance_monitor/performance_monitor.cc @@ -144,7 +144,7 @@ void PerformanceMonitor::GatherMetricsMapOnIOThread( int current_update_sequence) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - scoped_ptr> process_data_list( + std::unique_ptr> process_data_list( new std::vector()); // Find all child processes (does not include renderers), which has to be @@ -176,7 +176,7 @@ void PerformanceMonitor::GatherMetricsMapOnIOThread( } void PerformanceMonitor::MarkProcessesAsAliveOnUIThread( - scoped_ptr> process_data_list, + std::unique_ptr> process_data_list, int current_update_sequence) { DCHECK_CURRENTLY_ON(BrowserThread::UI); for (size_t i = 0; i < process_data_list->size(); ++i) { diff --git a/chrome/browser/performance_monitor/performance_monitor.h b/chrome/browser/performance_monitor/performance_monitor.h index 89b5434d7736bc..24c7c1e4b661de 100644 --- a/chrome/browser/performance_monitor/performance_monitor.h +++ b/chrome/browser/performance_monitor/performance_monitor.h @@ -6,10 +6,10 @@ #define CHROME_BROWSER_PERFORMANCE_MONITOR_PERFORMANCE_MONITOR_H_ #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/process/process_handle.h" #include "base/timer/timer.h" #include "chrome/browser/performance_monitor/process_metrics_history.h" @@ -54,7 +54,7 @@ class PerformanceMonitor { void MarkProcessAsAlive(const ProcessMetricsMetadata& process_data, int current_update_sequence); void MarkProcessesAsAliveOnUIThread( - scoped_ptr> process_data_list, + std::unique_ptr> process_data_list, int current_update_sequence); // Updates the ProcessMetrics map with the current list of processes and diff --git a/chrome/browser/permissions/chooser_context_base.cc b/chrome/browser/permissions/chooser_context_base.cc index eddb03f37fa714..af7b37e5d9cfa2 100644 --- a/chrome/browser/permissions/chooser_context_base.cc +++ b/chrome/browser/permissions/chooser_context_base.cc @@ -6,6 +6,7 @@ #include +#include "base/memory/ptr_util.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "components/content_settings/core/browser/host_content_settings_map.h" @@ -36,20 +37,20 @@ ChooserContextBase::Object::Object(GURL requesting_origin, ChooserContextBase::Object::~Object() = default; -std::vector> +std::vector> ChooserContextBase::GetGrantedObjects(const GURL& requesting_origin, const GURL& embedding_origin) { DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); - std::vector> results; - scoped_ptr setting = + std::vector> results; + std::unique_ptr setting = GetWebsiteSetting(requesting_origin, embedding_origin); - scoped_ptr objects; + std::unique_ptr objects; if (!setting->Remove(kObjectListKey, &objects)) return results; - scoped_ptr object_list = + std::unique_ptr object_list = base::ListValue::From(std::move(objects)); if (!object_list) return results; @@ -57,10 +58,10 @@ ChooserContextBase::GetGrantedObjects(const GURL& requesting_origin, for (base::ListValue::iterator it = object_list->begin(); it != object_list->end(); ++it) { // Steal ownership of |object| from |object_list|. - scoped_ptr object(*it); + std::unique_ptr object(*it); *it = nullptr; - scoped_ptr object_dict = + std::unique_ptr object_dict = base::DictionaryValue::From(std::move(object)); if (object_dict && IsValidObject(*object_dict)) results.push_back(std::move(object_dict)); @@ -68,20 +69,20 @@ ChooserContextBase::GetGrantedObjects(const GURL& requesting_origin, return results; } -std::vector> +std::vector> ChooserContextBase::GetAllGrantedObjects() { ContentSettingsForOneType content_settings; host_content_settings_map_->GetSettingsForOneType( data_content_settings_type_, std::string(), &content_settings); - std::vector> results; + std::vector> results; for (const ContentSettingPatternSource& content_setting : content_settings) { GURL requesting_origin(content_setting.primary_pattern.ToString()); GURL embedding_origin(content_setting.secondary_pattern.ToString()); if (!requesting_origin.is_valid() || !embedding_origin.is_valid()) continue; - scoped_ptr setting = + std::unique_ptr setting = GetWebsiteSetting(requesting_origin, embedding_origin); base::ListValue* object_list; if (!setting->GetList(kObjectListKey, &object_list)) @@ -94,7 +95,7 @@ ChooserContextBase::GetAllGrantedObjects() { continue; } - results.push_back(make_scoped_ptr( + results.push_back(base::WrapUnique( new Object(requesting_origin, embedding_origin, object_dict, content_setting.source, content_setting.incognito))); } @@ -106,12 +107,12 @@ ChooserContextBase::GetAllGrantedObjects() { void ChooserContextBase::GrantObjectPermission( const GURL& requesting_origin, const GURL& embedding_origin, - scoped_ptr object) { + std::unique_ptr object) { DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); DCHECK(object); DCHECK(IsValidObject(*object)); - scoped_ptr setting = + std::unique_ptr setting = GetWebsiteSetting(requesting_origin, embedding_origin); base::ListValue* object_list; if (!setting->GetList(kObjectListKey, &object_list)) { @@ -129,7 +130,7 @@ void ChooserContextBase::RevokeObjectPermission( DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); DCHECK(IsValidObject(object)); - scoped_ptr setting = + std::unique_ptr setting = GetWebsiteSetting(requesting_origin, embedding_origin); base::ListValue* object_list; if (!setting->GetList(kObjectListKey, &object_list)) @@ -138,10 +139,10 @@ void ChooserContextBase::RevokeObjectPermission( SetWebsiteSetting(requesting_origin, embedding_origin, std::move(setting)); } -scoped_ptr ChooserContextBase::GetWebsiteSetting( +std::unique_ptr ChooserContextBase::GetWebsiteSetting( const GURL& requesting_origin, const GURL& embedding_origin) { - scoped_ptr value = + std::unique_ptr value = base::DictionaryValue::From(host_content_settings_map_->GetWebsiteSetting( requesting_origin, embedding_origin, data_content_settings_type_, std::string(), nullptr)); @@ -153,7 +154,7 @@ scoped_ptr ChooserContextBase::GetWebsiteSetting( void ChooserContextBase::SetWebsiteSetting(const GURL& requesting_origin, const GURL& embedding_origin, - scoped_ptr value) { + std::unique_ptr value) { host_content_settings_map_->SetWebsiteSettingDefaultScope( requesting_origin, embedding_origin, data_content_settings_type_, std::string(), value.release()); diff --git a/chrome/browser/permissions/chooser_context_base.h b/chrome/browser/permissions/chooser_context_base.h index 1fdb222d81b841..5bf44603abc582 100644 --- a/chrome/browser/permissions/chooser_context_base.h +++ b/chrome/browser/permissions/chooser_context_base.h @@ -5,10 +5,10 @@ #ifndef CHROME_BROWSER_PERMISSIONS_CHOOSER_CONTEXT_BASE_H_ #define CHROME_BROWSER_PERMISSIONS_CHOOSER_CONTEXT_BASE_H_ +#include #include #include -#include "base/memory/scoped_ptr.h" #include "base/values.h" #include "components/content_settings/core/common/content_settings_types.h" #include "components/keyed_service/core/keyed_service.h" @@ -47,7 +47,7 @@ class ChooserContextBase : public KeyedService { // // This method may be extended by a subclass to return objects not stored in // |host_content_settings_map_|. - virtual std::vector> GetGrantedObjects( + virtual std::vector> GetGrantedObjects( const GURL& requesting_origin, const GURL& embedding_origin); @@ -56,13 +56,13 @@ class ChooserContextBase : public KeyedService { // // This method may be extended by a subclass to return objects not stored in // |host_content_settings_map_|. - virtual std::vector> GetAllGrantedObjects(); + virtual std::vector> GetAllGrantedObjects(); // Grants |requesting_origin| access to |object| when embedded within // |embedding_origin| by writing it into |host_content_settings_map_|. void GrantObjectPermission(const GURL& requesting_origin, const GURL& embedding_origin, - scoped_ptr object); + std::unique_ptr object); // Revokes |requesting_origin|'s permission to access |object| when embedded // within |embedding_origin|. @@ -79,12 +79,12 @@ class ChooserContextBase : public KeyedService { virtual bool IsValidObject(const base::DictionaryValue& object) = 0; private: - scoped_ptr GetWebsiteSetting( + std::unique_ptr GetWebsiteSetting( const GURL& requesting_origin, const GURL& embedding_origin); void SetWebsiteSetting(const GURL& requesting_origin, const GURL& embedding_origin, - scoped_ptr value); + std::unique_ptr value); HostContentSettingsMap* const host_content_settings_map_; const ContentSettingsType data_content_settings_type_; diff --git a/chrome/browser/permissions/chooser_context_base_unittest.cc b/chrome/browser/permissions/chooser_context_base_unittest.cc index 50f7e95463167d..0385f821c3e56c 100644 --- a/chrome/browser/permissions/chooser_context_base_unittest.cc +++ b/chrome/browser/permissions/chooser_context_base_unittest.cc @@ -57,7 +57,7 @@ TEST_F(ChooserContextBaseTest, GrantAndRevokeObjectPermissions) { context_.GrantObjectPermission(origin1_, origin1_, object1_.CreateDeepCopy()); context_.GrantObjectPermission(origin1_, origin1_, object2_.CreateDeepCopy()); - std::vector> objects = + std::vector> objects = context_.GetGrantedObjects(origin1_, origin1_); EXPECT_EQ(2u, objects.size()); EXPECT_TRUE(object1_.Equals(objects[0].get())); @@ -76,7 +76,7 @@ TEST_F(ChooserContextBaseTest, GrantObjectPermissionTwice) { context_.GrantObjectPermission(origin1_, origin1_, object1_.CreateDeepCopy()); context_.GrantObjectPermission(origin1_, origin1_, object1_.CreateDeepCopy()); - std::vector> objects = + std::vector> objects = context_.GetGrantedObjects(origin1_, origin1_); EXPECT_EQ(1u, objects.size()); EXPECT_TRUE(object1_.Equals(objects[0].get())); @@ -89,7 +89,7 @@ TEST_F(ChooserContextBaseTest, GrantObjectPermissionTwice) { TEST_F(ChooserContextBaseTest, GrantObjectPermissionEmbedded) { context_.GrantObjectPermission(origin1_, origin2_, object1_.CreateDeepCopy()); - std::vector> objects = + std::vector> objects = context_.GetGrantedObjects(origin1_, origin2_); EXPECT_EQ(1u, objects.size()); EXPECT_TRUE(object1_.Equals(objects[0].get())); @@ -107,7 +107,7 @@ TEST_F(ChooserContextBaseTest, GetAllGrantedObjects) { context_.GrantObjectPermission(origin1_, origin1_, object1_.CreateDeepCopy()); context_.GrantObjectPermission(origin2_, origin2_, object2_.CreateDeepCopy()); - std::vector> objects = + std::vector> objects = context_.GetAllGrantedObjects(); EXPECT_EQ(2u, objects.size()); bool found_one = false; diff --git a/chrome/browser/permissions/permission_context_base.cc b/chrome/browser/permissions/permission_context_base.cc index 715a7b8ff3a92c..74691a47252c14 100644 --- a/chrome/browser/permissions/permission_context_base.cc +++ b/chrome/browser/permissions/permission_context_base.cc @@ -174,7 +174,7 @@ void PermissionContextBase::DecidePermission( // prevent crashes. See crbug.com/457091. if (!bubble_manager) return; - scoped_ptr request_ptr( + std::unique_ptr request_ptr( new PermissionBubbleRequestImpl( requesting_origin, permission_type_, base::Bind(&PermissionContextBase::PermissionDecided, diff --git a/chrome/browser/permissions/permission_context_base.h b/chrome/browser/permissions/permission_context_base.h index 89ff58cdab11c4..e7257edde83178 100644 --- a/chrome/browser/permissions/permission_context_base.h +++ b/chrome/browser/permissions/permission_context_base.h @@ -5,10 +5,11 @@ #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ #define CHROME_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_BASE_H_ +#include + #include "base/callback.h" #include "base/containers/scoped_ptr_hash_map.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "build/build_config.h" #include "chrome/browser/ui/website_settings/permission_bubble_request.h" @@ -161,9 +162,9 @@ class PermissionContextBase : public KeyedService { const content::PermissionType permission_type_; const ContentSettingsType content_settings_type_; #if defined(OS_ANDROID) - scoped_ptr permission_queue_controller_; + std::unique_ptr permission_queue_controller_; #endif - base::ScopedPtrHashMap> + base::ScopedPtrHashMap> pending_bubbles_; // Must be the last member, to ensure that it will be diff --git a/chrome/browser/permissions/permission_context_base_unittest.cc b/chrome/browser/permissions/permission_context_base_unittest.cc index 8c052ba71900ac..87a84bc19e5f5e 100644 --- a/chrome/browser/permissions/permission_context_base_unittest.cc +++ b/chrome/browser/permissions/permission_context_base_unittest.cc @@ -101,7 +101,7 @@ class TestPermissionContext : public PermissionContextBase { private: std::vector decisions_; bool tab_context_updated_; - scoped_ptr field_trial_list_; + std::unique_ptr field_trial_list_; }; class PermissionContextBaseTests : public ChromeRenderViewHostTestHarness { diff --git a/chrome/browser/permissions/permission_manager.h b/chrome/browser/permissions/permission_manager.h index bae5ed1aff7c05..b160fa26cb1e04 100644 --- a/chrome/browser/permissions/permission_manager.h +++ b/chrome/browser/permissions/permission_manager.h @@ -110,7 +110,7 @@ class PermissionManager : public KeyedService, SubscriptionsMap subscriptions_; std::unordered_map, + std::unique_ptr, PermissionTypeHash> permission_contexts_; diff --git a/chrome/browser/permissions/permission_uma_util.cc b/chrome/browser/permissions/permission_uma_util.cc index b27935edc4dfab..119525689d54d8 100644 --- a/chrome/browser/permissions/permission_uma_util.cc +++ b/chrome/browser/permissions/permission_uma_util.cc @@ -158,7 +158,7 @@ void RecordPermissionAction(PermissionType permission, if (!rappor_service || permission_str.empty()) return; - scoped_ptr sample = + std::unique_ptr sample = rappor_service->CreateSample(rappor::SAFEBROWSING_RAPPOR_TYPE); sample->SetStringField("Scheme", requesting_origin.scheme()); sample->SetStringField("Host", requesting_origin.host()); diff --git a/chrome/browser/permissions/permission_update_infobar_delegate_android.cc b/chrome/browser/permissions/permission_update_infobar_delegate_android.cc index 4e6d6c684a1eb8..453bc8c647acc4 100644 --- a/chrome/browser/permissions/permission_update_infobar_delegate_android.cc +++ b/chrome/browser/permissions/permission_update_infobar_delegate_android.cc @@ -4,9 +4,10 @@ #include "chrome/browser/permissions/permission_update_infobar_delegate_android.h" +#include + #include "base/android/jni_array.h" #include "base/callback_helpers.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/android/preferences/pref_service_bridge.h" #include "chrome/browser/infobars/infobar_service.h" #include "chrome/grit/chromium_strings.h" @@ -79,8 +80,9 @@ infobars::InfoBar* PermissionUpdateInfoBarDelegate::Create( } return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( - scoped_ptr(new PermissionUpdateInfoBarDelegate( - web_contents, android_permissions, permission_msg_id, callback)))); + std::unique_ptr( + new PermissionUpdateInfoBarDelegate(web_contents, android_permissions, + permission_msg_id, callback)))); } // static diff --git a/chrome/browser/platform_util_unittest.cc b/chrome/browser/platform_util_unittest.cc index 1fd8eb8ad58a4d..2b48709530269d 100644 --- a/chrome/browser/platform_util_unittest.cc +++ b/chrome/browser/platform_util_unittest.cc @@ -4,12 +4,13 @@ #include "chrome/browser/platform_util.h" +#include + #include "base/bind.h" #include "base/callback.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "build/build_config.h" #include "chrome/browser/platform_util_internal.h" @@ -94,7 +95,7 @@ class PlatformUtilTestBase : public BrowserWithTestWindowTest { " }" "}"; JSONStringValueDeserializer json_string_deserializer(json_manifest); - scoped_ptr manifest = + std::unique_ptr manifest = json_string_deserializer.Deserialize(&error_code, &error); base::DictionaryValue* manifest_dictionary; @@ -122,7 +123,7 @@ class PlatformUtilTestBase : public BrowserWithTestWindowTest { } private: - scoped_ptr content_browser_client_; + std::unique_ptr content_browser_client_; content::ContentBrowserClient* old_content_browser_client_ = nullptr; }; @@ -190,7 +191,7 @@ class PlatformUtilTest : public PlatformUtilTestBase { base::ScopedTempDir directory_; private: - scoped_ptr run_loop_; + std::unique_ptr run_loop_; static void OnOpenOperationDone(const base::Closure& closure, OpenOperationResult* store_result, diff --git a/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc b/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc index 8d49cba7a43253..d0caa3f6df30c8 100644 --- a/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc +++ b/chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc @@ -147,7 +147,7 @@ bool ChromeContentBrowserClientPluginsPart::IsPluginAllowedToUseDevChannelAPIs( void ChromeContentBrowserClientPluginsPart::DidCreatePpapiPlugin( content::BrowserPpapiHost* browser_host) { browser_host->GetPpapiHost()->AddHostFactoryFilter( - scoped_ptr( + std::unique_ptr( new ChromeBrowserPepperHostFactory(browser_host))); } diff --git a/chrome/browser/plugins/plugin_finder.cc b/chrome/browser/plugins/plugin_finder.cc index 23fe235c224015..2279de03c7d3c8 100644 --- a/chrome/browser/plugins/plugin_finder.cc +++ b/chrome/browser/plugins/plugin_finder.cc @@ -175,7 +175,7 @@ void PluginFinder::Init() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); // Load the built-in plugin list first. If we have a newer version stored // locally or download one, we will replace this one with it. - scoped_ptr plugin_list(LoadBuiltInPluginList()); + std::unique_ptr plugin_list(LoadBuiltInPluginList()); // Gracefully handle the case where we couldn't parse the built-in plugin list // for some reason (https://crbug.com/388560). TODO(bauerb): Change back to a @@ -193,7 +193,7 @@ base::DictionaryValue* PluginFinder::LoadBuiltInPluginList() { IDR_PLUGIN_DB_JSON)); std::string error_str; int error_code = base::JSONReader::JSON_NO_ERROR; - scoped_ptr value = base::JSONReader::ReadAndReturnError( + std::unique_ptr value = base::JSONReader::ReadAndReturnError( json_resource, base::JSON_PARSE_RFC, &error_code, &error_str); if (!value) { DLOG(ERROR) << error_str; @@ -257,7 +257,7 @@ bool PluginFinder::FindPlugin( const std::string& mime_type, const std::string& language, PluginInstaller** installer, - scoped_ptr* plugin_metadata) { + std::unique_ptr* plugin_metadata) { if (g_browser_process->local_state()->GetBoolean(prefs::kDisablePluginFinder)) return false; @@ -281,7 +281,7 @@ bool PluginFinder::FindPlugin( bool PluginFinder::FindPluginWithIdentifier( const std::string& identifier, PluginInstaller** installer, - scoped_ptr* plugin_metadata) { + std::unique_ptr* plugin_metadata) { base::AutoLock lock(mutex_); PluginMap::const_iterator metadata_it = identifier_plugin_.find(identifier); if (metadata_it == identifier_plugin_.end()) @@ -328,7 +328,7 @@ void PluginFinder::ReinitializePlugins( } } -scoped_ptr PluginFinder::GetPluginMetadata( +std::unique_ptr PluginFinder::GetPluginMetadata( const content::WebPluginInfo& plugin) { base::AutoLock lock(mutex_); for (PluginMap::const_iterator it = identifier_plugin_.begin(); diff --git a/chrome/browser/plugins/plugin_finder.h b/chrome/browser/plugins/plugin_finder.h index 77be58f6753f5a..07c9695637a129 100644 --- a/chrome/browser/plugins/plugin_finder.h +++ b/chrome/browser/plugins/plugin_finder.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_PLUGINS_PLUGIN_FINDER_H_ #include +#include #include #include "base/callback.h" #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/strings/string16.h" #include "base/synchronization/lock.h" @@ -51,18 +51,19 @@ class PluginFinder { bool FindPlugin(const std::string& mime_type, const std::string& language, PluginInstaller** installer, - scoped_ptr* plugin_metadata); + std::unique_ptr* plugin_metadata); // Finds the plugin with the given identifier. If found, sets |installer| // to the corresponding PluginInstaller and |plugin_metadata| to a copy // of the corresponding PluginMetadata. |installer| may be NULL. - bool FindPluginWithIdentifier(const std::string& identifier, - PluginInstaller** installer, - scoped_ptr* plugin_metadata); + bool FindPluginWithIdentifier( + const std::string& identifier, + PluginInstaller** installer, + std::unique_ptr* plugin_metadata); #endif // Gets plugin metadata using |plugin|. - scoped_ptr GetPluginMetadata( + std::unique_ptr GetPluginMetadata( const content::WebPluginInfo& plugin); private: diff --git a/chrome/browser/plugins/plugin_finder_unittest.cc b/chrome/browser/plugins/plugin_finder_unittest.cc index 904d1762fdd8e3..0d6a7113789474 100644 --- a/chrome/browser/plugins/plugin_finder_unittest.cc +++ b/chrome/browser/plugins/plugin_finder_unittest.cc @@ -12,10 +12,10 @@ using base::DictionaryValue; using base::ListValue; TEST(PluginFinderTest, JsonSyntax) { - scoped_ptr plugin_list( - PluginFinder::LoadBuiltInPluginList()); + std::unique_ptr plugin_list( + PluginFinder::LoadBuiltInPluginList()); ASSERT_TRUE(plugin_list.get()); - scoped_ptr version; + std::unique_ptr version; ASSERT_TRUE(plugin_list->Remove("x-version", &version)); EXPECT_EQ(base::Value::TYPE_INTEGER, version->GetType()); diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc index 789082a03715c9..6f8879fd6af58e 100644 --- a/chrome/browser/plugins/plugin_info_message_filter.cc +++ b/chrome/browser/plugins/plugin_info_message_filter.cc @@ -5,10 +5,11 @@ #include "chrome/browser/plugins/plugin_info_message_filter.h" #include + +#include #include #include "base/bind.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" #include "base/strings/utf_string_conversions.h" #include "base/thread_task_runner_handle.h" @@ -252,7 +253,7 @@ void PluginInfoMessageFilter::PluginsLoaded( const std::vector& plugins) { ChromeViewHostMsg_GetPluginInfo_Output output; // This also fills in |actual_mime_type|. - scoped_ptr plugin_metadata; + std::unique_ptr plugin_metadata; if (context_.FindEnabledPlugin(params.render_frame_id, params.url, params.top_origin_url, params.mime_type, &output.status, &output.plugin, @@ -416,7 +417,7 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin( ChromeViewHostMsg_GetPluginInfo_Status* status, WebPluginInfo* plugin, std::string* actual_mime_type, - scoped_ptr* plugin_metadata) const { + std::unique_ptr* plugin_metadata) const { *status = ChromeViewHostMsg_GetPluginInfo_Status::kAllowed; bool allow_wildcard = true; @@ -467,7 +468,7 @@ void PluginInfoMessageFilter::Context::GetPluginContentSetting( ContentSetting* setting, bool* uses_default_content_setting, bool* is_managed) const { - scoped_ptr value; + std::unique_ptr value; content_settings::SettingInfo info; bool uses_plugin_specific_setting = false; if (ShouldUseJavaScriptSettingForPlugin(plugin)) { @@ -479,21 +480,15 @@ void PluginInfoMessageFilter::Context::GetPluginContentSetting( &info); } else { content_settings::SettingInfo specific_info; - scoped_ptr specific_setting = + std::unique_ptr specific_setting = host_content_settings_map_->GetWebsiteSetting( - policy_url, - plugin_url, - CONTENT_SETTINGS_TYPE_PLUGINS, - resource, + policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, resource, &specific_info); content_settings::SettingInfo general_info; - scoped_ptr general_setting = + std::unique_ptr general_setting = host_content_settings_map_->GetWebsiteSetting( - policy_url, - plugin_url, - CONTENT_SETTINGS_TYPE_PLUGINS, - std::string(), - &general_info); + policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, + std::string(), &general_info); // If there is a plugin-specific setting, we use it, unless the general // setting was set by policy, in which case it takes precedence. diff --git a/chrome/browser/plugins/plugin_info_message_filter.h b/chrome/browser/plugins/plugin_info_message_filter.h index 4105283f6e7df3..ece530845f9aef 100644 --- a/chrome/browser/plugins/plugin_info_message_filter.h +++ b/chrome/browser/plugins/plugin_info_message_filter.h @@ -52,14 +52,15 @@ class PluginInfoMessageFilter : public content::BrowserMessageFilter { const content::WebPluginInfo& plugin, const PluginMetadata* plugin_metadata, ChromeViewHostMsg_GetPluginInfo_Status* status) const; - bool FindEnabledPlugin(int render_frame_id, - const GURL& url, - const GURL& top_origin_url, - const std::string& mime_type, - ChromeViewHostMsg_GetPluginInfo_Status* status, - content::WebPluginInfo* plugin, - std::string* actual_mime_type, - scoped_ptr* plugin_metadata) const; + bool FindEnabledPlugin( + int render_frame_id, + const GURL& url, + const GURL& top_origin_url, + const std::string& mime_type, + ChromeViewHostMsg_GetPluginInfo_Status* status, + content::WebPluginInfo* plugin, + std::string* actual_mime_type, + std::unique_ptr* plugin_metadata) const; void GetPluginContentSetting(const content::WebPluginInfo& plugin, const GURL& policy_url, const GURL& plugin_url, diff --git a/chrome/browser/plugins/plugin_infobar_delegates.cc b/chrome/browser/plugins/plugin_infobar_delegates.cc index 09df30046c4542..4b8c0a3fed7f35 100644 --- a/chrome/browser/plugins/plugin_infobar_delegates.cc +++ b/chrome/browser/plugins/plugin_infobar_delegates.cc @@ -49,12 +49,12 @@ using base::UserMetricsAction; void OutdatedPluginInfoBarDelegate::Create( InfoBarService* infobar_service, PluginInstaller* installer, - scoped_ptr plugin_metadata) { + std::unique_ptr plugin_metadata) { // Copy the name out of |plugin_metadata| now, since the Pass() call below // will make it impossible to get at. base::string16 name(plugin_metadata->name()); infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( - scoped_ptr(new OutdatedPluginInfoBarDelegate( + std::unique_ptr(new OutdatedPluginInfoBarDelegate( installer, std::move(plugin_metadata), l10n_util::GetStringFUTF16( (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) @@ -65,7 +65,7 @@ void OutdatedPluginInfoBarDelegate::Create( OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( PluginInstaller* installer, - scoped_ptr plugin_metadata, + std::unique_ptr plugin_metadata, const base::string16& message) : ConfirmInfoBarDelegate(), WeakPluginInstallerObserver(installer), @@ -200,14 +200,14 @@ void OutdatedPluginInfoBarDelegate::ReplaceWithInfoBar( void OutdatedPluginInfoBarDelegate::Replace( infobars::InfoBar* infobar, PluginInstaller* installer, - scoped_ptr plugin_metadata, + std::unique_ptr plugin_metadata, const base::string16& message) { DCHECK(infobar->owner()); infobar->owner()->ReplaceInfoBar( - infobar, - infobar->owner()->CreateConfirmInfoBar( - scoped_ptr(new OutdatedPluginInfoBarDelegate( - installer, std::move(plugin_metadata), message)))); + infobar, infobar->owner()->CreateConfirmInfoBar( + std::unique_ptr( + new OutdatedPluginInfoBarDelegate( + installer, std::move(plugin_metadata), message)))); } #endif // defined(ENABLE_PLUGIN_INSTALLATION) diff --git a/chrome/browser/plugins/plugin_infobar_delegates.h b/chrome/browser/plugins/plugin_infobar_delegates.h index a5cedd84437199..7bad0c661536b6 100644 --- a/chrome/browser/plugins/plugin_infobar_delegates.h +++ b/chrome/browser/plugins/plugin_infobar_delegates.h @@ -32,18 +32,18 @@ class OutdatedPluginInfoBarDelegate : public ConfirmInfoBarDelegate, // |infobar_service|. static void Create(InfoBarService* infobar_service, PluginInstaller* installer, - scoped_ptr metadata); + std::unique_ptr metadata); // Replaces |infobar|, which must currently be owned, with an infobar asking // the user to update a particular plugin. static void Replace(infobars::InfoBar* infobar, PluginInstaller* installer, - scoped_ptr plugin_metadata, + std::unique_ptr plugin_metadata, const base::string16& message); private: OutdatedPluginInfoBarDelegate(PluginInstaller* installer, - scoped_ptr metadata, + std::unique_ptr metadata, const base::string16& message); ~OutdatedPluginInfoBarDelegate() override; @@ -73,7 +73,7 @@ class OutdatedPluginInfoBarDelegate : public ConfirmInfoBarDelegate, std::string identifier_; - scoped_ptr plugin_metadata_; + std::unique_ptr plugin_metadata_; base::string16 message_; diff --git a/chrome/browser/plugins/plugin_installer.cc b/chrome/browser/plugins/plugin_installer.cc index 3c6204b4ea6f6b..837be684f42102 100644 --- a/chrome/browser/plugins/plugin_installer.cc +++ b/chrome/browser/plugins/plugin_installer.cc @@ -103,7 +103,7 @@ void PluginInstaller::StartInstallingWithDownloadManager( DCHECK_EQ(INSTALLER_STATE_IDLE, state_); state_ = INSTALLER_STATE_DOWNLOADING; FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadStarted()); - scoped_ptr download_parameters( + std::unique_ptr download_parameters( content::DownloadUrlParameters::FromWebContents(web_contents, plugin_url)); download_parameters->set_callback( diff --git a/chrome/browser/plugins/plugin_installer_unittest.cc b/chrome/browser/plugins/plugin_installer_unittest.cc index 6938e243764cba..48e2d829486f29 100644 --- a/chrome/browser/plugins/plugin_installer_unittest.cc +++ b/chrome/browser/plugins/plugin_installer_unittest.cc @@ -4,7 +4,8 @@ #include "chrome/browser/plugins/plugin_installer.h" -#include "base/memory/scoped_ptr.h" +#include + #include "base/run_loop.h" #include "chrome/browser/plugins/plugin_installer_observer.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" @@ -26,10 +27,10 @@ class PluginInstallerTest : public ChromeRenderViewHostTestHarness { PluginInstaller* installer() { return installer_.get(); } - scoped_ptr CreateMockDownloadItem(); + std::unique_ptr CreateMockDownloadItem(); private: - scoped_ptr installer_; + std::unique_ptr installer_; }; PluginInstallerTest::PluginInstallerTest() { @@ -45,9 +46,9 @@ void PluginInstallerTest::TearDown() { content::RenderViewHostTestHarness::TearDown(); } -scoped_ptr +std::unique_ptr PluginInstallerTest::CreateMockDownloadItem() { - scoped_ptr mock_download_item( + std::unique_ptr mock_download_item( new testing::StrictMock()); ON_CALL(*mock_download_item, GetState()) .WillByDefault(testing::Return(content::DownloadItem::IN_PROGRESS)); @@ -101,7 +102,8 @@ const char kTestUrl[] = "http://example.com/some-url"; TEST_F(PluginInstallerTest, StartInstalling_SuccessfulDownload) { content::MockDownloadManager mock_download_manager; base::RunLoop run_loop; - scoped_ptr download_item(CreateMockDownloadItem()); + std::unique_ptr download_item( + CreateMockDownloadItem()); EXPECT_CALL(mock_download_manager, DownloadUrlMock(testing::Property( @@ -131,7 +133,8 @@ TEST_F(PluginInstallerTest, StartInstalling_SuccessfulDownload) { TEST_F(PluginInstallerTest, StartInstalling_FailedStart) { content::MockDownloadManager mock_download_manager; base::RunLoop run_loop; - scoped_ptr download_item(CreateMockDownloadItem()); + std::unique_ptr download_item( + CreateMockDownloadItem()); EXPECT_CALL(mock_download_manager, DownloadUrlMock(testing::Property( @@ -158,7 +161,8 @@ TEST_F(PluginInstallerTest, StartInstalling_FailedStart) { TEST_F(PluginInstallerTest, StartInstalling_Interrupted) { content::MockDownloadManager mock_download_manager; base::RunLoop run_loop; - scoped_ptr download_item(CreateMockDownloadItem()); + std::unique_ptr download_item( + CreateMockDownloadItem()); EXPECT_CALL(mock_download_manager, DownloadUrlMock(testing::Property( diff --git a/chrome/browser/plugins/plugin_metadata.cc b/chrome/browser/plugins/plugin_metadata.cc index 0c42ddec5b2f51..256a86c6be87c6 100644 --- a/chrome/browser/plugins/plugin_metadata.cc +++ b/chrome/browser/plugins/plugin_metadata.cc @@ -9,6 +9,7 @@ #include #include "base/logging.h" +#include "base/memory/ptr_util.h" #include "base/strings/pattern.h" #include "base/strings/string_util.h" #include "content/public/common/webplugininfo.h" @@ -126,7 +127,7 @@ bool PluginMetadata::VersionComparator::operator() (const Version& lhs, return lhs.CompareTo(rhs) > 0; } -scoped_ptr PluginMetadata::Clone() const { +std::unique_ptr PluginMetadata::Clone() const { PluginMetadata* copy = new PluginMetadata(identifier_, name_, url_for_display_, @@ -135,5 +136,5 @@ scoped_ptr PluginMetadata::Clone() const { group_name_matcher_, language_); copy->versions_ = versions_; - return make_scoped_ptr(copy); + return base::WrapUnique(copy); } diff --git a/chrome/browser/plugins/plugin_metadata.h b/chrome/browser/plugins/plugin_metadata.h index 726853efd26eb2..d54afd07f75b8c 100644 --- a/chrome/browser/plugins/plugin_metadata.h +++ b/chrome/browser/plugins/plugin_metadata.h @@ -6,9 +6,9 @@ #define CHROME_BROWSER_PLUGINS_PLUGIN_METADATA_H_ #include +#include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "base/version.h" #include "url/gurl.h" @@ -87,7 +87,7 @@ class PluginMetadata { // considered out-of-date, etc.) SecurityStatus GetSecurityStatus(const content::WebPluginInfo& plugin) const; - scoped_ptr Clone() const; + std::unique_ptr Clone() const; private: struct VersionComparator { diff --git a/chrome/browser/plugins/plugin_observer.cc b/chrome/browser/plugins/plugin_observer.cc index e3846d1f54ec78..605ca81f7bbd0f 100644 --- a/chrome/browser/plugins/plugin_observer.cc +++ b/chrome/browser/plugins/plugin_observer.cc @@ -64,7 +64,7 @@ class ConfirmInstallDialogDelegate : public TabModalConfirmDialogDelegate, public: ConfirmInstallDialogDelegate(content::WebContents* web_contents, PluginInstaller* installer, - scoped_ptr plugin_metadata); + std::unique_ptr plugin_metadata); // TabModalConfirmDialogDelegate methods: base::string16 GetTitle() override; @@ -79,13 +79,13 @@ class ConfirmInstallDialogDelegate : public TabModalConfirmDialogDelegate, private: content::WebContents* web_contents_; - scoped_ptr plugin_metadata_; + std::unique_ptr plugin_metadata_; }; ConfirmInstallDialogDelegate::ConfirmInstallDialogDelegate( content::WebContents* web_contents, PluginInstaller* installer, - scoped_ptr plugin_metadata) + std::unique_ptr plugin_metadata) : TabModalConfirmDialogDelegate(web_contents), WeakPluginInstallerObserver(installer), web_contents_(web_contents), @@ -153,8 +153,8 @@ void ReloadPluginInfoBarDelegate::Create( InfoBarService* infobar_service, content::NavigationController* controller, const base::string16& message) { - infobar_service->AddInfoBar( - infobar_service->CreateConfirmInfoBar(scoped_ptr( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( + std::unique_ptr( new ReloadPluginInfoBarDelegate(controller, message)))); } @@ -342,7 +342,7 @@ void PluginObserver::OnBlockedOutdatedPlugin(int placeholder_id, PluginFinder* finder = PluginFinder::GetInstance(); // Find plugin to update. PluginInstaller* installer = NULL; - scoped_ptr plugin; + std::unique_ptr plugin; if (finder->FindPluginWithIdentifier(identifier, &installer, &plugin)) { plugin_placeholders_[placeholder_id] = new PluginPlaceholderHost( this, placeholder_id, plugin->name(), installer); diff --git a/chrome/browser/plugins/plugin_observer.h b/chrome/browser/plugins/plugin_observer.h index dfe8ad076cc1e3..172b06d04ab933 100644 --- a/chrome/browser/plugins/plugin_observer.h +++ b/chrome/browser/plugins/plugin_observer.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ #define CHROME_BROWSER_PLUGINS_PLUGIN_OBSERVER_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" diff --git a/chrome/browser/plugins/plugin_power_saver_browsertest.cc b/chrome/browser/plugins/plugin_power_saver_browsertest.cc index 4ab99ea9e40c88..b517e54f500bda 100644 --- a/chrome/browser/plugins/plugin_power_saver_browsertest.cc +++ b/chrome/browser/plugins/plugin_power_saver_browsertest.cc @@ -147,10 +147,10 @@ void VerifyPluginMarkedEssential(content::WebContents* contents, EXPECT_TRUE(PluginLoaded(contents, element_id)); } -scoped_ptr RespondWithHTML( +std::unique_ptr RespondWithHTML( const std::string& html, const net::test_server::HttpRequest& request) { - scoped_ptr response( + std::unique_ptr response( new net::test_server::BasicHttpResponse()); response->set_content_type("text/html"); response->set_content(html); diff --git a/chrome/browser/plugins/plugin_prefs.cc b/chrome/browser/plugins/plugin_prefs.cc index e822886f72d113..dbe1b0a358213f 100644 --- a/chrome/browser/plugins/plugin_prefs.cc +++ b/chrome/browser/plugins/plugin_prefs.cc @@ -6,12 +6,12 @@ #include +#include #include #include "base/bind.h" #include "base/command_line.h" #include "base/location.h" -#include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/single_thread_task_runner.h" #include "base/strings/pattern.h" @@ -128,7 +128,8 @@ void PluginPrefs::EnablePluginGroupInternal( // Update the state for all plugins in the group. for (size_t i = 0; i < plugins.size(); ++i) { - scoped_ptr plugin(finder->GetPluginMetadata(plugins[i])); + std::unique_ptr plugin( + finder->GetPluginMetadata(plugins[i])); if (group_name != plugin->name()) continue; plugin_state_.Set(plugins[i].path, enabled); @@ -147,7 +148,7 @@ void PluginPrefs::EnablePlugin( content::WebPluginInfo plugin; bool can_enable = true; if (PluginService::GetInstance()->GetPluginInfoByPath(path, &plugin)) { - scoped_ptr plugin_metadata( + std::unique_ptr plugin_metadata( finder->GetPluginMetadata(plugin)); PolicyStatus plugin_status = PolicyStatusForPlugin(plugin.name); PolicyStatus group_status = PolicyStatusForPlugin(plugin_metadata->name()); @@ -188,7 +189,7 @@ void PluginPrefs::EnablePluginInternal( base::string16 group_name; for (size_t i = 0; i < plugins.size(); ++i) { if (plugins[i].path == path) { - scoped_ptr plugin_metadata( + std::unique_ptr plugin_metadata( plugin_finder->GetPluginMetadata(plugins[i])); // set the group name for this plugin. group_name = plugin_metadata->name(); @@ -199,7 +200,7 @@ void PluginPrefs::EnablePluginInternal( bool all_disabled = true; for (size_t i = 0; i < plugins.size(); ++i) { - scoped_ptr plugin_metadata( + std::unique_ptr plugin_metadata( plugin_finder->GetPluginMetadata(plugins[i])); DCHECK(!plugin_metadata->name().empty()); if (group_name == plugin_metadata->name()) { @@ -235,7 +236,7 @@ PluginPrefs::PolicyStatus PluginPrefs::PolicyStatusForPlugin( } bool PluginPrefs::IsPluginEnabled(const content::WebPluginInfo& plugin) const { - scoped_ptr plugin_metadata( + std::unique_ptr plugin_metadata( PluginFinder::GetInstance()->GetPluginMetadata(plugin)); base::string16 group_name = plugin_metadata->name(); @@ -490,7 +491,7 @@ void PluginPrefs::OnUpdatePreferences( summary->SetBoolean("enabled", enabled); plugins_list->Append(summary); - scoped_ptr plugin_metadata( + std::unique_ptr plugin_metadata( finder->GetPluginMetadata(plugins[i])); // Insert into a set of all group names. group_names.insert(plugin_metadata->name()); diff --git a/chrome/browser/power/process_power_collector.cc b/chrome/browser/power/process_power_collector.cc index 0d776afb33fdba..d0129b1dc7b6e6 100644 --- a/chrome/browser/power/process_power_collector.cc +++ b/chrome/browser/power/process_power_collector.cc @@ -32,7 +32,7 @@ const int kSecondsPerSample = 30; } ProcessPowerCollector::PerProcessData::PerProcessData( - scoped_ptr metrics, + std::unique_ptr metrics, const GURL& origin, Profile* profile) : metrics_(std::move(metrics)), @@ -201,14 +201,13 @@ void ProcessPowerCollector::UpdateProcessInMap( if (metrics_map_.find(handle) == metrics_map_.end()) { metrics_map_[handle] = linked_ptr(new PerProcessData( #if defined(OS_MACOSX) - scoped_ptr( + std::unique_ptr( base::ProcessMetrics::CreateProcessMetrics(handle, NULL)), #else - scoped_ptr( + std::unique_ptr( base::ProcessMetrics::CreateProcessMetrics(handle)), #endif - origin, - Profile::FromBrowserContext(rph->GetBrowserContext()))); + origin, Profile::FromBrowserContext(rph->GetBrowserContext()))); } linked_ptr& process_data = metrics_map_[handle]; diff --git a/chrome/browser/power/process_power_collector.h b/chrome/browser/power/process_power_collector.h index f1c88d6e3ef02a..67556959faedb4 100644 --- a/chrome/browser/power/process_power_collector.h +++ b/chrome/browser/power/process_power_collector.h @@ -41,7 +41,7 @@ class ProcessPowerCollector public: class PerProcessData { public: - PerProcessData(scoped_ptr metrics, + PerProcessData(std::unique_ptr metrics, const GURL& origin, Profile* profile); PerProcessData(); @@ -57,7 +57,7 @@ class ProcessPowerCollector private: // |metrics_| holds the ProcessMetrics information for the given process. - scoped_ptr metrics_; + std::unique_ptr metrics_; // |profile| is the profile that is visiting the |last_origin_|. // It is not owned by PerProcessData. diff --git a/chrome/browser/power/process_power_collector_unittest.cc b/chrome/browser/power/process_power_collector_unittest.cc index 695334e1261cab..dffe11aca5ac5f 100644 --- a/chrome/browser/power/process_power_collector_unittest.cc +++ b/chrome/browser/power/process_power_collector_unittest.cc @@ -73,19 +73,19 @@ class BrowserProcessPowerTest : public BrowserWithTestWindowTest { ->GetProcess()); } - scoped_ptr MakeProcessHandle(int process_id) { - scoped_ptr proc_handle(new base::ProcessHandle( + std::unique_ptr MakeProcessHandle(int process_id) { + std::unique_ptr proc_handle(new base::ProcessHandle( #if defined(OS_WIN) reinterpret_cast(process_id)) #else process_id) #endif - ); + ); return proc_handle; } - scoped_ptr collector; - scoped_ptr profile_manager_; + std::unique_ptr collector; + std::unique_ptr profile_manager_; }; TEST_F(BrowserProcessPowerTest, NoSite) { @@ -121,9 +121,9 @@ TEST_F(BrowserProcessPowerTest, MultipleSites) { GURL url1("http://www.google.com"); GURL url2("http://www.example.com"); GURL url3("https://www.google.com"); - scoped_ptr browser2( + std::unique_ptr browser2( chrome::CreateBrowserWithTestWindowForParams(&native_params)); - scoped_ptr browser3( + std::unique_ptr browser3( chrome::CreateBrowserWithTestWindowForParams(&native_params)); AddTab(browser(), url1); AddTab(browser2.get(), url2); @@ -166,7 +166,7 @@ TEST_F(BrowserProcessPowerTest, MultipleSites) { TEST_F(BrowserProcessPowerTest, IncognitoDoesntRecordPowerUsage) { Browser::CreateParams native_params(profile()->GetOffTheRecordProfile()); - scoped_ptr incognito_browser( + std::unique_ptr incognito_browser( chrome::CreateBrowserWithTestWindowForParams(&native_params)); GURL url("http://www.google.com"); AddTab(browser(), url); @@ -201,9 +201,9 @@ TEST_F(BrowserProcessPowerTest, IncognitoDoesntRecordPowerUsage) { } TEST_F(BrowserProcessPowerTest, MultipleProfilesRecordSeparately) { - scoped_ptr other_profile(CreateProfile()); + std::unique_ptr other_profile(CreateProfile()); Browser::CreateParams native_params(other_profile.get()); - scoped_ptr other_user( + std::unique_ptr other_user( chrome::CreateBrowserWithTestWindowForParams(&native_params)); GURL url("http://www.google.com"); @@ -272,7 +272,7 @@ TEST_F(BrowserProcessPowerTest, AppsRecordPowerUsage) { current_profile, content::SiteInstance::CreateForURL(current_profile, url)))); window->SetAppWindowContentsForTesting( - scoped_ptr( + std::unique_ptr( new extensions::TestAppWindowContents(web_contents))); extensions::AppWindowRegistry* app_registry = extensions::AppWindowRegistry::Get(current_profile); diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc index f31d763be570c1..db8a6bc12c5351 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor.cc @@ -153,7 +153,7 @@ void AutocompleteActionPredictor::StartPrerendering( const gfx::Size& size) { // Only cancel the old prerender after starting the new one, so if the URLs // are the same, the underlying prerender will be reused. - scoped_ptr old_prerender_handle( + std::unique_ptr old_prerender_handle( prerender_handle_.release()); if (prerender::PrerenderManager* prerender_manager = prerender::PrerenderManagerFactory::GetForProfile(profile_)) { diff --git a/chrome/browser/predictors/autocomplete_action_predictor.h b/chrome/browser/predictors/autocomplete_action_predictor.h index 5362bba2239916..e2df03d359f18d 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor.h +++ b/chrome/browser/predictors/autocomplete_action_predictor.h @@ -6,11 +6,11 @@ #define CHROME_BROWSER_PREDICTORS_AUTOCOMPLETE_ACTION_PREDICTOR_H_ #include +#include #include #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observer.h" #include "base/strings/string16.h" @@ -248,7 +248,7 @@ class AutocompleteActionPredictor // This is cleared after every Omnibox navigation. std::vector transitional_matches_; - scoped_ptr prerender_handle_; + std::unique_ptr prerender_handle_; // This allows us to predict the effect of confidence threshold changes on // accuracy. This is cleared after every omnibox navigation. diff --git a/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc b/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc index 0c96659bb9125c..d48e8ee1ab59c6 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc @@ -56,7 +56,7 @@ class AutocompleteActionPredictorTableTest : public testing::Test { private: base::MessageLoop loop_; TestingProfile profile_; - scoped_ptr db_; + std::unique_ptr db_; content::TestBrowserThread db_thread_; }; diff --git a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc index d89cd8c696b57e..025a1492efb756 100644 --- a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc +++ b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc @@ -220,8 +220,8 @@ class AutocompleteActionPredictorTest : public testing::Test { content::TestBrowserThread ui_thread_; content::TestBrowserThread db_thread_; content::TestBrowserThread file_thread_; - scoped_ptr profile_; - scoped_ptr predictor_; + std::unique_ptr profile_; + std::unique_ptr predictor_; }; diff --git a/chrome/browser/predictors/predictor_database.cc b/chrome/browser/predictors/predictor_database.cc index 2e6585335ca678..8fcdddf86d3095 100644 --- a/chrome/browser/predictors/predictor_database.cc +++ b/chrome/browser/predictors/predictor_database.cc @@ -55,7 +55,7 @@ class PredictorDatabaseInternal bool is_resource_prefetch_predictor_enabled_; base::FilePath db_path_; - scoped_ptr db_; + std::unique_ptr db_; // TODO(shishir): These tables may not need to be refcounted. Maybe move them // to using a WeakPtr instead. diff --git a/chrome/browser/predictors/resource_prefetch_common_unittest.cc b/chrome/browser/predictors/resource_prefetch_common_unittest.cc index 92a5dbf80d085d..4eed9173b7b34c 100644 --- a/chrome/browser/predictors/resource_prefetch_common_unittest.cc +++ b/chrome/browser/predictors/resource_prefetch_common_unittest.cc @@ -95,10 +95,10 @@ class ResourcePrefetchCommonTest : public testing::Test { protected: base::MessageLoop loop_; content::TestBrowserThread ui_thread_; - scoped_ptr profile_; + std::unique_ptr profile_; private: - scoped_ptr field_trial_list_; + std::unique_ptr field_trial_list_; }; ResourcePrefetchCommonTest::ResourcePrefetchCommonTest() @@ -297,22 +297,26 @@ TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingDisabledByNetwork) { // Set preference to WIFI_ONLY: prefetch when not on cellular. SetPreference(NetworkPredictionOptions::NETWORK_PREDICTION_WIFI_ONLY); { - scoped_ptr mock(new MockNetworkChangeNotifierWIFI); + std::unique_ptr mock( + new MockNetworkChangeNotifierWIFI); TestIsPrefetchEnabled(config); } { - scoped_ptr mock(new MockNetworkChangeNotifier4G); + std::unique_ptr mock( + new MockNetworkChangeNotifier4G); TestIsPrefetchLearning(config); } // Set preference to NEVER: never prefetch. SetPreference(NetworkPredictionOptions::NETWORK_PREDICTION_NEVER); { - scoped_ptr mock(new MockNetworkChangeNotifierWIFI); + std::unique_ptr mock( + new MockNetworkChangeNotifierWIFI); TestIsPrefetchLearning(config); } { - scoped_ptr mock(new MockNetworkChangeNotifier4G); + std::unique_ptr mock( + new MockNetworkChangeNotifier4G); TestIsPrefetchLearning(config); } } diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc index 4186282351cc8e..bc941c5aac1b76 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor.cc @@ -175,7 +175,7 @@ class GetUrlVisitCountTask : public history::HistoryDBTask { int visit_count_; NavigationID navigation_id_; - scoped_ptr > requests_; + std::unique_ptr> requests_; VisitInfoCallback callback_; DISALLOW_COPY_AND_ASSIGN(GetUrlVisitCountTask); @@ -423,7 +423,7 @@ void ResourcePrefetchPredictor::FinishedPrefetchForNavigation( ResourcePrefetcher::RequestVector* requests) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - scoped_ptr result(new Result(key_type, requests)); + std::unique_ptr result(new Result(key_type, requests)); // Add the results to the results map. if (!results_map_.insert(std::make_pair(navigation_id, std::move(result))) .second) @@ -552,7 +552,7 @@ base::TimeDelta ResourcePrefetchPredictor::OnNavigationComplete( PREFETCH_KEY_TYPE_URL); } } else { - scoped_ptr requests( + std::unique_ptr requests( new ResourcePrefetcher::RequestVector); PrefetchKeyType key_type; if (GetPrefetchData(navigation_id, requests.get(), &key_type)) { @@ -575,12 +575,10 @@ base::TimeDelta ResourcePrefetchPredictor::OnNavigationComplete( ServiceAccessType::EXPLICIT_ACCESS); DCHECK(history_service); history_service->ScheduleDBTask( - scoped_ptr( - new GetUrlVisitCountTask( - navigation_id, - requests, - base::Bind(&ResourcePrefetchPredictor::OnVisitCountLookup, - AsWeakPtr()))), + std::unique_ptr(new GetUrlVisitCountTask( + navigation_id, requests, + base::Bind(&ResourcePrefetchPredictor::OnVisitCountLookup, + AsWeakPtr()))), &history_lookup_consumer_); return plt; @@ -647,7 +645,7 @@ void ResourcePrefetchPredictor::StartPrefetching( return; // Prefer URL based data first. - scoped_ptr requests( + std::unique_ptr requests( new ResourcePrefetcher::RequestVector); PrefetchKeyType key_type; if (!GetPrefetchData(navigation_id, requests.get(), &key_type)) { @@ -682,8 +680,8 @@ void ResourcePrefetchPredictor::StartInitialization() { initialization_state_ = INITIALIZING; // Create local caches using the database as loaded. - scoped_ptr url_data_map(new PrefetchDataMap()); - scoped_ptr host_data_map(new PrefetchDataMap()); + std::unique_ptr url_data_map(new PrefetchDataMap()); + std::unique_ptr host_data_map(new PrefetchDataMap()); PrefetchDataMap* url_data_ptr = url_data_map.get(); PrefetchDataMap* host_data_ptr = host_data_map.get(); @@ -696,8 +694,8 @@ void ResourcePrefetchPredictor::StartInitialization() { } void ResourcePrefetchPredictor::CreateCaches( - scoped_ptr url_data_map, - scoped_ptr host_data_map) { + std::unique_ptr url_data_map, + std::unique_ptr host_data_map) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_EQ(INITIALIZING, initialization_state_); diff --git a/chrome/browser/predictors/resource_prefetch_predictor.h b/chrome/browser/predictors/resource_prefetch_predictor.h index a0c940979e21a6..a42124120e782f 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor.h +++ b/chrome/browser/predictors/resource_prefetch_predictor.h @@ -8,13 +8,13 @@ #include #include +#include #include #include #include "base/gtest_prod_util.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/scoped_observer.h" #include "base/task/cancelable_task_tracker.h" @@ -160,7 +160,7 @@ class ResourcePrefetchPredictor ~Result(); PrefetchKeyType key_type; - scoped_ptr requests; + std::unique_ptr requests; private: DISALLOW_COPY_AND_ASSIGN(Result); @@ -172,7 +172,7 @@ class ResourcePrefetchPredictor typedef ResourcePrefetchPredictorTables::PrefetchDataMap PrefetchDataMap; typedef std::map > > NavigationMap; - typedef std::map> ResultsMap; + typedef std::map> ResultsMap; // Returns true if the main page request is supported for prediction. static bool IsHandledMainPage(net::URLRequest* request); @@ -224,8 +224,8 @@ class ResourcePrefetchPredictor // Callback for task to read predictor database. Takes ownership of // |url_data_map| and |host_data_map|. - void CreateCaches(scoped_ptr url_data_map, - scoped_ptr host_data_map); + void CreateCaches(std::unique_ptr url_data_map, + std::unique_ptr host_data_map); // Called during initialization when history is read and the predictor // database has been read. @@ -319,8 +319,8 @@ class ResourcePrefetchPredictor NavigationMap inflight_navigations_; // Copy of the data in the predictor tables. - scoped_ptr url_table_cache_; - scoped_ptr host_table_cache_; + std::unique_ptr url_table_cache_; + std::unique_ptr host_table_cache_; ResultsMap results_map_; diff --git a/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc index 9cc50e53e869fb..c5455d27a89a2b 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc @@ -34,7 +34,7 @@ class ResourcePrefetchPredictorTablesTest : public testing::Test { base::MessageLoop loop_; content::TestBrowserThread db_thread_; TestingProfile profile_; - scoped_ptr db_; + std::unique_ptr db_; scoped_refptr tables_; private: diff --git a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc index ae8f29ebf1c0cf..c00d66ad66bbf0 100644 --- a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc +++ b/chrome/browser/predictors/resource_prefetch_predictor_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 "chrome/browser/predictors/resource_prefetch_predictor.h" + #include +#include + #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 "base/time/time.h" #include "chrome/browser/history/history_service_factory.h" -#include "chrome/browser/predictors/resource_prefetch_predictor.h" #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h" #include "chrome/test/base/testing_profile.h" #include "components/history/core/browser/history_service.h" @@ -156,9 +158,9 @@ class ResourcePrefetchPredictorTest : public testing::Test { base::MessageLoop loop_; content::TestBrowserThread ui_thread_; content::TestBrowserThread db_thread_; - scoped_ptr profile_; + std::unique_ptr profile_; - scoped_ptr predictor_; + std::unique_ptr predictor_; scoped_refptr > mock_tables_; PrefetchDataMap test_url_data_; diff --git a/chrome/browser/predictors/resource_prefetcher.cc b/chrome/browser/predictors/resource_prefetcher.cc index 63c9e247979b13..b9b01543dcbd1b 100644 --- a/chrome/browser/predictors/resource_prefetcher.cc +++ b/chrome/browser/predictors/resource_prefetcher.cc @@ -41,7 +41,7 @@ ResourcePrefetcher::ResourcePrefetcher( const ResourcePrefetchPredictorConfig& config, const NavigationID& navigation_id, PrefetchKeyType key_type, - scoped_ptr requests) + std::unique_ptr requests) : state_(INITIALIZED), delegate_(delegate), config_(config), diff --git a/chrome/browser/predictors/resource_prefetcher.h b/chrome/browser/predictors/resource_prefetcher.h index 6ce3a45d8c72df..43dbc8a6c67a89 100644 --- a/chrome/browser/predictors/resource_prefetcher.h +++ b/chrome/browser/predictors/resource_prefetcher.h @@ -9,10 +9,10 @@ #include #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/threading/thread_checker.h" #include "chrome/browser/predictors/resource_prefetch_common.h" @@ -90,7 +90,7 @@ class ResourcePrefetcher : public net::URLRequest::Delegate { const ResourcePrefetchPredictorConfig& config, const NavigationID& navigation_id, PrefetchKeyType key_type, - scoped_ptr requests); + std::unique_ptr requests); ~ResourcePrefetcher() override; void Start(); // Kicks off the prefetching. Can only be called once. @@ -152,7 +152,7 @@ class ResourcePrefetcher : public net::URLRequest::Delegate { ResourcePrefetchPredictorConfig const config_; NavigationID navigation_id_; PrefetchKeyType key_type_; - scoped_ptr request_vector_; + std::unique_ptr request_vector_; std::map inflight_requests_; std::list request_queue_; diff --git a/chrome/browser/predictors/resource_prefetcher_manager.cc b/chrome/browser/predictors/resource_prefetcher_manager.cc index bf2a0a7f638517..822935ea857f2e 100644 --- a/chrome/browser/predictors/resource_prefetcher_manager.cc +++ b/chrome/browser/predictors/resource_prefetcher_manager.cc @@ -53,7 +53,7 @@ void ResourcePrefetcherManager::ShutdownOnIOThread() { void ResourcePrefetcherManager::MaybeAddPrefetch( const NavigationID& navigation_id, PrefetchKeyType key_type, - scoped_ptr requests) { + std::unique_ptr requests) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); // Don't add a duplicate prefetch for the same host or URL. @@ -95,7 +95,7 @@ void ResourcePrefetcherManager::ResourcePrefetcherFinished( DCHECK_CURRENTLY_ON(content::BrowserThread::IO); // |predictor_| can only be accessed from the UI thread. - scoped_ptr scoped_requests(requests); + std::unique_ptr scoped_requests(requests); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&ResourcePrefetcherManager::ResourcePrefetcherFinishedOnUI, this, @@ -117,7 +117,7 @@ void ResourcePrefetcherManager::ResourcePrefetcherFinished( void ResourcePrefetcherManager::ResourcePrefetcherFinishedOnUI( const NavigationID& navigation_id, PrefetchKeyType key_type, - scoped_ptr requests) { + std::unique_ptr requests) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); // |predictor_| may have been set to NULL if the predictor is shutting down. diff --git a/chrome/browser/predictors/resource_prefetcher_manager.h b/chrome/browser/predictors/resource_prefetcher_manager.h index 8724975a72a534..d706df37e0fb87 100644 --- a/chrome/browser/predictors/resource_prefetcher_manager.h +++ b/chrome/browser/predictors/resource_prefetcher_manager.h @@ -46,9 +46,10 @@ class ResourcePrefetcherManager // Will create a new ResourcePrefetcher for the main frame url of the input // navigation if there isn't one already for the same URL or host (for host // based). - void MaybeAddPrefetch(const NavigationID& navigation_id, - PrefetchKeyType key_type, - scoped_ptr requests); + void MaybeAddPrefetch( + const NavigationID& navigation_id, + PrefetchKeyType key_type, + std::unique_ptr requests); // Stops the ResourcePrefetcher for the input navigation, if one was in // progress. @@ -72,7 +73,7 @@ class ResourcePrefetcherManager void ResourcePrefetcherFinishedOnUI( const NavigationID& navigation_id, PrefetchKeyType key_type, - scoped_ptr requests); + std::unique_ptr requests); ResourcePrefetchPredictor* predictor_; const ResourcePrefetchPredictorConfig config_; diff --git a/chrome/browser/predictors/resource_prefetcher_unittest.cc b/chrome/browser/predictors/resource_prefetcher_unittest.cc index ff3fe44c357ca8..e97d8e61f1e18c 100644 --- a/chrome/browser/predictors/resource_prefetcher_unittest.cc +++ b/chrome/browser/predictors/resource_prefetcher_unittest.cc @@ -5,11 +5,12 @@ #include "chrome/browser/predictors/resource_prefetcher.h" #include + +#include #include #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "chrome/browser/predictors/resource_prefetcher_manager.h" #include "chrome/test/base/testing_profile.h" @@ -34,7 +35,7 @@ class TestResourcePrefetcher : public ResourcePrefetcher { const ResourcePrefetchPredictorConfig& config, const NavigationID& navigation_id, PrefetchKeyType key_type, - scoped_ptr requests) + std::unique_ptr requests) : ResourcePrefetcher(delegate, config, navigation_id, @@ -143,7 +144,7 @@ class ResourcePrefetcherTest : public testing::Test { content::TestBrowserThread io_thread_; ResourcePrefetchPredictorConfig config_; TestResourcePrefetcherDelegate prefetcher_delegate_; - scoped_ptr prefetcher_; + std::unique_ptr prefetcher_; private: DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcherTest); @@ -161,7 +162,7 @@ ResourcePrefetcherTest::~ResourcePrefetcherTest() { } TEST_F(ResourcePrefetcherTest, TestPrefetcherFinishes) { - scoped_ptr requests( + std::unique_ptr requests( new ResourcePrefetcher::RequestVector); requests->push_back(new ResourcePrefetcher::Request(GURL( "http://www.google.com/resource1.html"))); @@ -294,7 +295,7 @@ TEST_F(ResourcePrefetcherTest, TestPrefetcherFinishes) { } TEST_F(ResourcePrefetcherTest, TestPrefetcherStopped) { - scoped_ptr requests( + std::unique_ptr requests( new ResourcePrefetcher::RequestVector); requests->push_back(new ResourcePrefetcher::Request(GURL( "http://www.google.com/resource1.html"))); diff --git a/chrome/browser/prefetch/prefetch_browsertest.cc b/chrome/browser/prefetch/prefetch_browsertest.cc index 5ade23934e3a9d..9adb78d1610bbf 100644 --- a/chrome/browser/prefetch/prefetch_browsertest.cc +++ b/chrome/browser/prefetch/prefetch_browsertest.cc @@ -101,27 +101,31 @@ IN_PROC_BROWSER_TEST_F(PrefetchBrowserTestPredictionDisabled, // the network type. IN_PROC_BROWSER_TEST_F(PrefetchBrowserTestPrediction, PreferenceWorks) { // Set real NetworkChangeNotifier singleton aside. - scoped_ptr disable_for_test( + std::unique_ptr disable_for_test( new NetworkChangeNotifier::DisableForTest); // Preference defaults to ALWAYS. { - scoped_ptr mock(new MockNetworkChangeNotifierWIFI); + std::unique_ptr mock( + new MockNetworkChangeNotifierWIFI); EXPECT_TRUE(RunPrefetchExperiment(true, browser())); } { - scoped_ptr mock(new MockNetworkChangeNotifier4G); + std::unique_ptr mock( + new MockNetworkChangeNotifier4G); EXPECT_TRUE(RunPrefetchExperiment(true, browser())); } // Set preference to NEVER: prefetch should be unaffected. SetPreference(NetworkPredictionOptions::NETWORK_PREDICTION_NEVER); { - scoped_ptr mock(new MockNetworkChangeNotifierWIFI); + std::unique_ptr mock( + new MockNetworkChangeNotifierWIFI); EXPECT_TRUE(RunPrefetchExperiment(true, browser())); } { - scoped_ptr mock(new MockNetworkChangeNotifier4G); + std::unique_ptr mock( + new MockNetworkChangeNotifier4G); EXPECT_TRUE(RunPrefetchExperiment(true, browser())); } } diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc index 4e3874e4cab0c5..0c7a9f50d92200 100644 --- a/chrome/browser/prefs/chrome_pref_service_factory.cc +++ b/chrome/browser/prefs/chrome_pref_service_factory.cc @@ -13,6 +13,7 @@ #include "base/compiler_specific.h" #include "base/files/file_path.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram_macros.h" #include "base/threading/sequenced_worker_pool.h" @@ -390,7 +391,7 @@ void HandleReadError(PersistentPrefStore::PrefReadError error) { } } -scoped_ptr CreateProfilePrefStoreManager( +std::unique_ptr CreateProfilePrefStoreManager( const base::FilePath& profile_path) { std::string device_id; #if defined(OS_WIN) && defined(ENABLE_RLZ) @@ -407,13 +408,9 @@ scoped_ptr CreateProfilePrefStoreManager( seed = ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_PREF_HASH_SEED_BIN).as_string(); #endif - return make_scoped_ptr(new ProfilePrefStoreManager( - profile_path, - GetTrackingConfiguration(), - kTrackedPrefsReportingIDsCount, - seed, - device_id, - g_browser_process->local_state())); + return base::WrapUnique(new ProfilePrefStoreManager( + profile_path, GetTrackingConfiguration(), kTrackedPrefsReportingIDsCount, + seed, device_id, g_browser_process->local_state())); } void PrepareFactory( @@ -467,25 +464,23 @@ const char kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE[] = } // namespace internals -scoped_ptr CreateLocalState( +std::unique_ptr CreateLocalState( const base::FilePath& pref_filename, base::SequencedTaskRunner* pref_io_task_runner, policy::PolicyService* policy_service, const scoped_refptr& pref_registry, bool async) { syncable_prefs::PrefServiceSyncableFactory factory; - PrepareFactory( - &factory, - policy_service, - NULL, // supervised_user_settings - new JsonPrefStore( - pref_filename, pref_io_task_runner, scoped_ptr()), - NULL, // extension_prefs - async); + PrepareFactory(&factory, policy_service, + NULL, // supervised_user_settings + new JsonPrefStore(pref_filename, pref_io_task_runner, + std::unique_ptr()), + NULL, // extension_prefs + async); return factory.Create(pref_registry.get()); } -scoped_ptr CreateProfilePrefs( +std::unique_ptr CreateProfilePrefs( const base::FilePath& profile_path, base::SequencedTaskRunner* pref_io_task_runner, TrackedPreferenceValidationDelegate* validation_delegate, @@ -519,7 +514,7 @@ scoped_ptr CreateProfilePrefs( user_pref_store, extension_prefs, async); - scoped_ptr pref_service = + std::unique_ptr pref_service = factory.CreateSyncable(pref_registry.get()); ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get()); diff --git a/chrome/browser/prefs/chrome_pref_service_factory.h b/chrome/browser/prefs/chrome_pref_service_factory.h index 30e6bffb67b80c..9dea6e5e613b7d 100644 --- a/chrome/browser/prefs/chrome_pref_service_factory.h +++ b/chrome/browser/prefs/chrome_pref_service_factory.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_FACTORY_H_ #define CHROME_BROWSER_PREFS_CHROME_PREF_SERVICE_FACTORY_H_ +#include + #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" namespace base { class DictionaryValue; @@ -64,14 +65,14 @@ extern const char kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE[]; // guaranteed that in asynchronous version initialization happens after this // function returned. -scoped_ptr CreateLocalState( +std::unique_ptr CreateLocalState( const base::FilePath& pref_filename, base::SequencedTaskRunner* pref_io_task_runner, policy::PolicyService* policy_service, const scoped_refptr& pref_registry, bool async); -scoped_ptr CreateProfilePrefs( +std::unique_ptr CreateProfilePrefs( const base::FilePath& pref_filename, base::SequencedTaskRunner* pref_io_task_runner, TrackedPreferenceValidationDelegate* validation_delegate, diff --git a/chrome/browser/prefs/chrome_pref_service_unittest.cc b/chrome/browser/prefs/chrome_pref_service_unittest.cc index 687e7b45f6ea48..595226ea48d121 100644 --- a/chrome/browser/prefs/chrome_pref_service_unittest.cc +++ b/chrome/browser/prefs/chrome_pref_service_unittest.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include "base/command_line.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" -#include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" diff --git a/chrome/browser/prefs/command_line_pref_store.cc b/chrome/browser/prefs/command_line_pref_store.cc index 1f08ea76db512a..042430cfb3d024 100644 --- a/chrome/browser/prefs/command_line_pref_store.cc +++ b/chrome/browser/prefs/command_line_pref_store.cc @@ -5,6 +5,7 @@ #include "chrome/browser/prefs/command_line_pref_store.h" #include + #include #include #include @@ -13,6 +14,7 @@ #include "base/files/file_path.h" #include "base/logging.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/values.h" @@ -115,7 +117,7 @@ void CommandLinePrefStore::ApplySimpleSwitches() { for (size_t i = 0; i < arraysize(string_switch_map_); ++i) { if (command_line_->HasSwitch(string_switch_map_[i].switch_name)) { SetValue(string_switch_map_[i].preference_path, - make_scoped_ptr( + base::WrapUnique( new base::StringValue(command_line_->GetSwitchValueASCII( string_switch_map_[i].switch_name))), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); @@ -126,7 +128,7 @@ void CommandLinePrefStore::ApplySimpleSwitches() { if (command_line_->HasSwitch(path_switch_map_[i].switch_name)) { SetValue( path_switch_map_[i].preference_path, - make_scoped_ptr(new base::StringValue( + base::WrapUnique(new base::StringValue( command_line_->GetSwitchValuePath(path_switch_map_[i].switch_name) .value())), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); @@ -145,7 +147,7 @@ void CommandLinePrefStore::ApplySimpleSwitches() { continue; } SetValue(integer_switch_map_[i].preference_path, - make_scoped_ptr(new base::FundamentalValue(int_value)), + base::WrapUnique(new base::FundamentalValue(int_value)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } } @@ -153,7 +155,7 @@ void CommandLinePrefStore::ApplySimpleSwitches() { for (size_t i = 0; i < arraysize(boolean_switch_map_); ++i) { if (command_line_->HasSwitch(boolean_switch_map_[i].switch_name)) { SetValue(boolean_switch_map_[i].preference_path, - make_scoped_ptr(new base::FundamentalValue( + base::WrapUnique(new base::FundamentalValue( boolean_switch_map_[i].set_value)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } @@ -163,18 +165,18 @@ void CommandLinePrefStore::ApplySimpleSwitches() { void CommandLinePrefStore::ApplyProxyMode() { if (command_line_->HasSwitch(switches::kNoProxyServer)) { SetValue(proxy_config::prefs::kProxy, - make_scoped_ptr(ProxyConfigDictionary::CreateDirect()), + base::WrapUnique(ProxyConfigDictionary::CreateDirect()), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } else if (command_line_->HasSwitch(switches::kProxyPacUrl)) { std::string pac_script_url = command_line_->GetSwitchValueASCII(switches::kProxyPacUrl); SetValue(proxy_config::prefs::kProxy, - make_scoped_ptr( + base::WrapUnique( ProxyConfigDictionary::CreatePacScript(pac_script_url, false)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } else if (command_line_->HasSwitch(switches::kProxyAutoDetect)) { SetValue(proxy_config::prefs::kProxy, - make_scoped_ptr(ProxyConfigDictionary::CreateAutoDetect()), + base::WrapUnique(ProxyConfigDictionary::CreateAutoDetect()), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } else if (command_line_->HasSwitch(switches::kProxyServer)) { std::string proxy_server = @@ -182,7 +184,7 @@ void CommandLinePrefStore::ApplyProxyMode() { std::string bypass_list = command_line_->GetSwitchValueASCII(switches::kProxyBypassList); SetValue(proxy_config::prefs::kProxy, - make_scoped_ptr(ProxyConfigDictionary::CreateFixedServers( + base::WrapUnique(ProxyConfigDictionary::CreateFixedServers( proxy_server, bypass_list)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } @@ -190,7 +192,7 @@ void CommandLinePrefStore::ApplyProxyMode() { void CommandLinePrefStore::ApplySSLSwitches() { if (command_line_->HasSwitch(switches::kCipherSuiteBlacklist)) { - scoped_ptr list_value(new base::ListValue()); + std::unique_ptr list_value(new base::ListValue()); list_value->AppendStrings(base::SplitString( command_line_->GetSwitchValueASCII(switches::kCipherSuiteBlacklist), ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)); @@ -202,7 +204,7 @@ void CommandLinePrefStore::ApplySSLSwitches() { void CommandLinePrefStore::ApplyBackgroundModeSwitches() { if (command_line_->HasSwitch(switches::kDisableExtensions)) { SetValue(prefs::kBackgroundModeEnabled, - make_scoped_ptr(new base::FundamentalValue(false)), + base::WrapUnique(new base::FundamentalValue(false)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); } } diff --git a/chrome/browser/prefs/command_line_pref_store_proxy_unittest.cc b/chrome/browser/prefs/command_line_pref_store_proxy_unittest.cc index a8d61323b214dd..4b2fef74187387 100644 --- a/chrome/browser/prefs/command_line_pref_store_proxy_unittest.cc +++ b/chrome/browser/prefs/command_line_pref_store_proxy_unittest.cc @@ -181,7 +181,7 @@ class CommandLinePrefStoreProxyTest private: base::CommandLine command_line_; - scoped_ptr pref_service_; + std::unique_ptr pref_service_; net::ProxyConfig proxy_config_; }; diff --git a/chrome/browser/prefs/command_line_pref_store_ssl_manager_unittest.cc b/chrome/browser/prefs/command_line_pref_store_ssl_manager_unittest.cc index d47a914dc5caab..2ab907bf121175 100644 --- a/chrome/browser/prefs/command_line_pref_store_ssl_manager_unittest.cc +++ b/chrome/browser/prefs/command_line_pref_store_ssl_manager_unittest.cc @@ -43,11 +43,11 @@ TEST_F(CommandLinePrefStoreSSLManagerTest, CommandLinePrefs) { factory.set_user_prefs(local_state_store); factory.set_command_line_prefs(new CommandLinePrefStore(&command_line)); scoped_refptr registry = new PrefRegistrySimple; - scoped_ptr local_state(factory.Create(registry.get())); + std::unique_ptr local_state(factory.Create(registry.get())); SSLConfigServiceManager::RegisterPrefs(registry.get()); - scoped_ptr config_manager( + std::unique_ptr config_manager( SSLConfigServiceManager::CreateDefaultManager( local_state.get(), base::ThreadTaskRunnerHandle::Get())); ASSERT_TRUE(config_manager.get()); diff --git a/chrome/browser/prefs/pref_functional_browsertest.cc b/chrome/browser/prefs/pref_functional_browsertest.cc index b449b607f4cdea..87bbec16240cf3 100644 --- a/chrome/browser/prefs/pref_functional_browsertest.cc +++ b/chrome/browser/prefs/pref_functional_browsertest.cc @@ -4,6 +4,7 @@ #include +#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/net/prediction_options.h" @@ -34,8 +35,9 @@ class PrefsFunctionalTest : public InProcessBrowserTest { protected: // Create a DownloadTestObserverTerminal that will wait for the // specified number of downloads to finish. - scoped_ptr CreateWaiter(Browser* browser, - int num_downloads) { + std::unique_ptr CreateWaiter( + Browser* browser, + int num_downloads) { DownloadManager* download_manager = BrowserContext::GetDownloadManager(browser->profile()); @@ -44,7 +46,7 @@ class PrefsFunctionalTest : public InProcessBrowserTest { download_manager, num_downloads, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); - return make_scoped_ptr(downloads_observer); + return base::WrapUnique(downloads_observer); } }; @@ -61,7 +63,7 @@ IN_PROC_BROWSER_TEST_F(PrefsFunctionalTest, TestDownloadDirPref) { prefs::kDownloadDefaultDirectory, new_download_dir.path()); // Create a downloads observer. - scoped_ptr downloads_observer( + std::unique_ptr downloads_observer( CreateWaiter(browser(), 1)); ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL("/downloads/a_zip_file.zip")); diff --git a/chrome/browser/prefs/pref_metrics_service.h b/chrome/browser/prefs/pref_metrics_service.h index b185f43b634a25..7627e48b4d2f1f 100644 --- a/chrome/browser/prefs/pref_metrics_service.h +++ b/chrome/browser/prefs/pref_metrics_service.h @@ -6,10 +6,10 @@ #define CHROME_BROWSER_PREFS_PREF_METRICS_SERVICE_H_ #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/profiles/profile.h" @@ -84,7 +84,7 @@ class PrefMetricsService : public KeyedService { PrefService* prefs_; PrefService* local_state_; - scoped_ptr + std::unique_ptr synced_pref_change_registrar_; base::WeakPtrFactory weak_factory_; diff --git a/chrome/browser/prefs/pref_service_browsertest.cc b/chrome/browser/prefs/pref_service_browsertest.cc index 35ea009fb0d579..8f6994c911f80c 100644 --- a/chrome/browser/prefs/pref_service_browsertest.cc +++ b/chrome/browser/prefs/pref_service_browsertest.cc @@ -102,7 +102,7 @@ IN_PROC_BROWSER_TEST_F(PreferenceServiceTest, Test) { // The window should open with the new reference profile, with window // placement values stored in the user data directory. JSONFileValueDeserializer deserializer(original_pref_file_); - scoped_ptr root = deserializer.Deserialize(NULL, NULL); + std::unique_ptr root = deserializer.Deserialize(NULL, NULL); ASSERT_TRUE(root.get()); ASSERT_TRUE(root->IsType(base::Value::TYPE_DICTIONARY)); diff --git a/chrome/browser/prefs/profile_pref_store_manager.cc b/chrome/browser/prefs/profile_pref_store_manager.cc index d694d5f68b4604..d1cca84046663e 100644 --- a/chrome/browser/prefs/profile_pref_store_manager.cc +++ b/chrome/browser/prefs/profile_pref_store_manager.cc @@ -92,11 +92,11 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( const scoped_refptr& io_task_runner, const base::Closure& on_reset_on_load, TrackedPreferenceValidationDelegate* validation_delegate) { - scoped_ptr pref_filter; + std::unique_ptr pref_filter; if (!kPlatformSupportsPreferenceTracking) { return new JsonPrefStore(profile_path_.Append(chrome::kPreferencesFilename), io_task_runner.get(), - scoped_ptr()); + std::unique_ptr()); } std::vector @@ -118,20 +118,13 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( } } - scoped_ptr unprotected_pref_hash_filter( - new PrefHashFilter(GetPrefHashStore(false), - unprotected_configuration, - base::Closure(), - validation_delegate, - reporting_ids_count_, - false)); - scoped_ptr protected_pref_hash_filter( - new PrefHashFilter(GetPrefHashStore(true), - protected_configuration, - on_reset_on_load, - validation_delegate, - reporting_ids_count_, - true)); + std::unique_ptr unprotected_pref_hash_filter( + new PrefHashFilter(GetPrefHashStore(false), unprotected_configuration, + base::Closure(), validation_delegate, + reporting_ids_count_, false)); + std::unique_ptr protected_pref_hash_filter(new PrefHashFilter( + GetPrefHashStore(true), protected_configuration, on_reset_on_load, + validation_delegate, reporting_ids_count_, true)); PrefHashFilter* raw_unprotected_pref_hash_filter = unprotected_pref_hash_filter.get(); @@ -157,7 +150,7 @@ PersistentPrefStore* ProfilePrefStoreManager::CreateProfilePrefStore( base::Bind(&JsonPrefStore::RegisterOnNextSuccessfulWriteCallback, protected_pref_store->AsWeakPtr()), GetPrefHashStore(false), GetPrefHashStore(true), - scoped_ptr(new PrefServiceHashStoreContents( + std::unique_ptr(new PrefServiceHashStoreContents( profile_path_.AsUTF8Unsafe(), local_state_)), raw_unprotected_pref_hash_filter, raw_protected_pref_hash_filter); @@ -173,7 +166,7 @@ bool ProfilePrefStoreManager::InitializePrefsFromMasterPrefs( return false; const base::DictionaryValue* to_serialize = &master_prefs; - scoped_ptr copy; + std::unique_ptr copy; if (kPlatformSupportsPreferenceTracking) { copy.reset(master_prefs.DeepCopy()); @@ -205,12 +198,12 @@ bool ProfilePrefStoreManager::InitializePrefsFromMasterPrefs( PersistentPrefStore* ProfilePrefStoreManager::CreateDeprecatedCombinedProfilePrefStore( const scoped_refptr& io_task_runner) { - scoped_ptr pref_filter; + std::unique_ptr pref_filter; if (kPlatformSupportsPreferenceTracking) { - scoped_ptr pref_hash_store_impl( + std::unique_ptr pref_hash_store_impl( new PrefHashStoreImpl(seed_, device_id_, true)); pref_hash_store_impl->set_legacy_hash_store_contents( - scoped_ptr(new PrefServiceHashStoreContents( + std::unique_ptr(new PrefServiceHashStoreContents( profile_path_.AsUTF8Unsafe(), local_state_))); pref_filter.reset(new PrefHashFilter( std::move(pref_hash_store_impl), tracking_configuration_, @@ -220,12 +213,10 @@ ProfilePrefStoreManager::CreateDeprecatedCombinedProfilePrefStore( io_task_runner.get(), std::move(pref_filter)); } -scoped_ptr ProfilePrefStoreManager::GetPrefHashStore( +std::unique_ptr ProfilePrefStoreManager::GetPrefHashStore( bool use_super_mac) { DCHECK(kPlatformSupportsPreferenceTracking); - return scoped_ptr(new PrefHashStoreImpl( - seed_, - device_id_, - use_super_mac)); + return std::unique_ptr( + new PrefHashStoreImpl(seed_, device_id_, use_super_mac)); } diff --git a/chrome/browser/prefs/profile_pref_store_manager.h b/chrome/browser/prefs/profile_pref_store_manager.h index a6223fedc35f86..adaba7be37aea9 100644 --- a/chrome/browser/prefs/profile_pref_store_manager.h +++ b/chrome/browser/prefs/profile_pref_store_manager.h @@ -7,13 +7,13 @@ #include +#include #include #include #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "components/user_prefs/tracked/pref_hash_filter.h" class PersistentPrefStore; @@ -103,7 +103,7 @@ class ProfilePrefStoreManager { // whether the returned object will calculate, store, and validate super MACs // (and, by extension, accept non-null newly protected preferences as // TrustedInitialized). - scoped_ptr GetPrefHashStore(bool use_super_mac); + std::unique_ptr GetPrefHashStore(bool use_super_mac); const base::FilePath profile_path_; const std::vector diff --git a/chrome/browser/prefs/profile_pref_store_manager_unittest.cc b/chrome/browser/prefs/profile_pref_store_manager_unittest.cc index bfd5e3670788d0..7e0d6dcc84e68a 100644 --- a/chrome/browser/prefs/profile_pref_store_manager_unittest.cc +++ b/chrome/browser/prefs/profile_pref_store_manager_unittest.cc @@ -6,6 +6,7 @@ #include +#include #include #include "base/compiler_specific.h" @@ -13,8 +14,8 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/strings/string_util.h" #include "base/values.h" @@ -147,7 +148,7 @@ class ProfilePrefStoreManagerTest : public testing::Test { PrefServiceFactory pref_service_factory; pref_service_factory.set_user_prefs(pref_store_); - scoped_ptr pref_service( + std::unique_ptr pref_service( pref_service_factory.Create(profile_pref_registry_.get())); EXPECT_EQ( @@ -161,7 +162,7 @@ class ProfilePrefStoreManagerTest : public testing::Test { PrefServiceFactory pref_service_factory; pref_service_factory.set_user_prefs(pref_store_); - scoped_ptr pref_service( + std::unique_ptr pref_service( pref_service_factory.Create(profile_pref_registry_.get())); ProfilePrefStoreManager::ClearResetTime(pref_service.get()); @@ -211,13 +212,13 @@ class ProfilePrefStoreManagerTest : public testing::Test { PersistentPrefStore::PrefReadError error = pref_store->ReadPrefs(); EXPECT_EQ(PersistentPrefStore::PREF_READ_ERROR_NO_FILE, error); pref_store->SetValue(kTrackedAtomic, - make_scoped_ptr(new base::StringValue(kFoobar)), + base::WrapUnique(new base::StringValue(kFoobar)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); pref_store->SetValue(kProtectedAtomic, - make_scoped_ptr(new base::StringValue(kHelloWorld)), + base::WrapUnique(new base::StringValue(kHelloWorld)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); pref_store->SetValue(kUnprotectedPref, - make_scoped_ptr(new base::StringValue(kFoobar)), + base::WrapUnique(new base::StringValue(kFoobar)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); pref_store->RemoveObserver(®istry_verifier_); pref_store->CommitPendingWrite(); @@ -279,7 +280,7 @@ class ProfilePrefStoreManagerTest : public testing::Test { scoped_refptr profile_pref_registry_; RegistryVerifier registry_verifier_; MockValidationDelegate mock_validation_delegate_; - scoped_ptr manager_; + std::unique_ptr manager_; scoped_refptr pref_store_; std::string seed_; @@ -571,7 +572,7 @@ TEST_F(ProfilePrefStoreManagerTest, ProtectedToUnprotected) { // Trigger the logic that migrates it back to the unprotected preferences // file. pref_store_->SetValue(kProtectedAtomic, - make_scoped_ptr(new base::StringValue(kGoodbyeWorld)), + base::WrapUnique(new base::StringValue(kGoodbyeWorld)), WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); LoadExistingPrefs(); ExpectStringValueEquals(kProtectedAtomic, kGoodbyeWorld); diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc index fb078bf3ddce2f..367d2e83cca6eb 100644 --- a/chrome/browser/prefs/proxy_policy_unittest.cc +++ b/chrome/browser/prefs/proxy_policy_unittest.cc @@ -100,7 +100,7 @@ class ProxyPolicyTest : public testing::Test { void TearDown() override { provider_.Shutdown(); } - scoped_ptr CreatePrefService(bool with_managed_policies) { + std::unique_ptr CreatePrefService(bool with_managed_policies) { syncable_prefs::PrefServiceMockFactory factory; factory.set_command_line_prefs(new CommandLinePrefStore(&command_line_)); if (with_managed_policies) { @@ -110,7 +110,7 @@ class ProxyPolicyTest : public testing::Test { scoped_refptr registry( new user_prefs::PrefRegistrySyncable); - scoped_ptr prefs = + std::unique_ptr prefs = factory.CreateSyncable(registry.get()); chrome::RegisterUserProfilePrefs(registry.get()); return std::move(prefs); @@ -119,7 +119,7 @@ class ProxyPolicyTest : public testing::Test { content::TestBrowserThreadBundle thread_bundle_; base::CommandLine command_line_; MockConfigurationPolicyProvider provider_; - scoped_ptr policy_service_; + std::unique_ptr policy_service_; }; TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { @@ -146,7 +146,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineOptions) { // First verify that command-line options are set correctly when // there is no policy in effect. - scoped_ptr prefs(CreatePrefService(false)); + std::unique_ptr prefs(CreatePrefService(false)); ProxyConfigDictionary dict(prefs->GetDictionary(proxy_config::prefs::kProxy)); assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS); assertProxyServer(dict, "789"); @@ -177,7 +177,7 @@ TEST_F(ProxyPolicyTest, OverridesUnrelatedCommandLineOptions) { // First verify that command-line options are set correctly when // there is no policy in effect. - scoped_ptr prefs = CreatePrefService(false); + std::unique_ptr prefs = CreatePrefService(false); ProxyConfigDictionary dict(prefs->GetDictionary(proxy_config::prefs::kProxy)); assertProxyMode(dict, ProxyPrefs::MODE_FIXED_SERVERS); assertProxyServer(dict, "789"); @@ -205,7 +205,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineNoProxy) { // First verify that command-line options are set correctly when // there is no policy in effect. - scoped_ptr prefs = CreatePrefService(false); + std::unique_ptr prefs = CreatePrefService(false); ProxyConfigDictionary dict(prefs->GetDictionary(proxy_config::prefs::kProxy)); assertProxyModeWithoutParams(dict, ProxyPrefs::MODE_DIRECT); @@ -229,7 +229,7 @@ TEST_F(ProxyPolicyTest, OverridesCommandLineAutoDetect) { // First verify that the auto-detect is set if there is no managed // PrefStore. - scoped_ptr prefs = CreatePrefService(false); + std::unique_ptr prefs = CreatePrefService(false); ProxyConfigDictionary dict(prefs->GetDictionary(proxy_config::prefs::kProxy)); assertProxyModeWithoutParams(dict, ProxyPrefs::MODE_AUTO_DETECT); diff --git a/chrome/browser/prefs/session_startup_pref_unittest.cc b/chrome/browser/prefs/session_startup_pref_unittest.cc index 31385b4c3978eb..e84a44a814482f 100644 --- a/chrome/browser/prefs/session_startup_pref_unittest.cc +++ b/chrome/browser/prefs/session_startup_pref_unittest.cc @@ -22,7 +22,7 @@ class SessionStartupPrefTest : public testing::Test { return pref_service_->registry(); } - scoped_ptr pref_service_; + std::unique_ptr pref_service_; }; TEST_F(SessionStartupPrefTest, URLListIsFixedUp) { diff --git a/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc b/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc index b46718343def72..7dedec07eaf6e4 100644 --- a/chrome/browser/prefs/synced_pref_change_registrar_browsertest.cc +++ b/chrome/browser/prefs/synced_pref_change_registrar_browsertest.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 #include #include "base/json/json_string_value_serializer.h" -#include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/values.h" #include "chrome/browser/prefs/pref_service_syncable_util.h" @@ -101,11 +101,11 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest { prefs_ = PrefServiceSyncableFromProfile(browser()->profile()); syncer_ = prefs_->GetSyncableService(syncer::PREFERENCES); syncer_->MergeDataAndStartSyncing( - syncer::PREFERENCES, - syncer::SyncDataList(), - scoped_ptr( + syncer::PREFERENCES, syncer::SyncDataList(), + std::unique_ptr( new syncer::FakeSyncChangeProcessor), - scoped_ptr(new syncer::SyncErrorFactoryMock)); + std::unique_ptr( + new syncer::SyncErrorFactoryMock)); registrar_.reset(new syncable_prefs::SyncedPrefChangeRegistrar(prefs_)); } @@ -115,7 +115,7 @@ class SyncedPrefChangeRegistrarTest : public InProcessBrowserTest { syncer::SyncableService* syncer_; int next_sync_data_id_; - scoped_ptr registrar_; + std::unique_ptr registrar_; policy::MockConfigurationPolicyProvider policy_provider_; }; diff --git a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc index 5fcf5e777857ea..7562c75bc0759a 100644 --- a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc +++ b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include #include #include "base/base_switches.h" @@ -9,7 +10,6 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/json/json_file_value_serializer.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/histogram_base.h" #include "base/metrics/histogram_samples.h" #include "base/metrics/statistics_recorder.h" @@ -69,7 +69,7 @@ int GetTrackedPrefHistogramCount(const char* histogram_name, if (!histogram) return 0; - scoped_ptr samples(histogram->SnapshotSamples()); + std::unique_ptr samples(histogram->SnapshotSamples()); int sum = 0; for (int i = 0; i < 100; ++i) { int count_for_id = samples->GetCount(i); @@ -84,22 +84,22 @@ int GetTrackedPrefHistogramCount(const char* histogram_name, return sum; } -scoped_ptr ReadPrefsDictionary( +std::unique_ptr ReadPrefsDictionary( const base::FilePath& pref_file) { JSONFileValueDeserializer deserializer(pref_file); int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; std::string error_str; - scoped_ptr prefs = + std::unique_ptr prefs = deserializer.Deserialize(&error_code, &error_str); if (!prefs || error_code != JSONFileValueDeserializer::JSON_NO_ERROR) { ADD_FAILURE() << "Error #" << error_code << ": " << error_str; - return scoped_ptr(); + return std::unique_ptr(); } if (!prefs->IsType(base::Value::TYPE_DICTIONARY)) { ADD_FAILURE(); - return scoped_ptr(); + return std::unique_ptr(); } - return scoped_ptr( + return std::unique_ptr( static_cast(prefs.release())); } @@ -199,12 +199,12 @@ class PrefHashBrowserTestBase EXPECT_EQ(protection_level_ > PROTECTION_DISABLED_ON_PLATFORM, base::PathExists(protected_pref_file)); - scoped_ptr unprotected_preferences( + std::unique_ptr unprotected_preferences( ReadPrefsDictionary(unprotected_pref_file)); if (!unprotected_preferences) return false; - scoped_ptr protected_preferences; + std::unique_ptr protected_preferences; if (protection_level_ > PROTECTION_DISABLED_ON_PLATFORM) { protected_preferences = ReadPrefsDictionary(protected_pref_file); if (!protected_preferences) diff --git a/chrome/browser/prerender/external_prerender_handler_android.h b/chrome/browser/prerender/external_prerender_handler_android.h index 3b1ef825971aa5..fafe0f1a4ce284 100644 --- a/chrome/browser/prerender/external_prerender_handler_android.h +++ b/chrome/browser/prerender/external_prerender_handler_android.h @@ -7,9 +7,10 @@ #include +#include + #include "base/android/scoped_java_ref.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" class GURL; class Profile; @@ -60,7 +61,7 @@ class ExternalPrerenderHandlerAndroid { private: virtual ~ExternalPrerenderHandlerAndroid(); - scoped_ptr prerender_handle_; + std::unique_ptr prerender_handle_; DISALLOW_COPY_AND_ASSIGN(ExternalPrerenderHandlerAndroid); }; diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index 308700560e94b5..630f23916789f0 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -442,7 +442,7 @@ class NewTabNavigationOrSwapObserver { private: content::WindowedNotificationObserver new_tab_observer_; - scoped_ptr swap_observer_; + std::unique_ptr swap_observer_; }; // PrerenderContents that stops the UI message loop on DidStopLoading(). @@ -655,7 +655,7 @@ class TestPrerender : public PrerenderContents::Observer, int number_of_loads_; int expected_number_of_loads_; - scoped_ptr load_waiter_; + std::unique_ptr load_waiter_; base::RunLoop create_loop_; base::RunLoop start_loop_; @@ -673,8 +673,9 @@ class TestPrerenderContentsFactory : public PrerenderContents::Factory { EXPECT_TRUE(expected_contents_queue_.empty()); } - scoped_ptr ExpectPrerenderContents(FinalStatus final_status) { - scoped_ptr handle(new TestPrerender()); + std::unique_ptr ExpectPrerenderContents( + FinalStatus final_status) { + std::unique_ptr handle(new TestPrerender()); expected_contents_queue_.push_back( ExpectedContents(final_status, handle->AsWeakPtr())); return handle; @@ -903,7 +904,7 @@ class HangingFirstRequestInterceptor : public net::URLRequestInterceptor { void CreateHangingFirstRequestInterceptorOnIO( const GURL& url, const base::FilePath& file, base::Closure callback) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - scoped_ptr never_respond_handler( + std::unique_ptr never_respond_handler( new HangingFirstRequestInterceptor(file, callback)); net::URLRequestFilter::GetInstance()->AddUrlInterceptor( url, std::move(never_respond_handler)); @@ -967,7 +968,7 @@ class RequestCounter : public base::SupportsWeakPtr { private: int count_; int expected_count_; - scoped_ptr loop_; + std::unique_ptr loop_; }; // Protocol handler which counts the number of requests that start. @@ -1009,7 +1010,7 @@ void CreateCountingInterceptorOnIO( const base::FilePath& file, const base::WeakPtr& counter) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - scoped_ptr request_interceptor( + std::unique_ptr request_interceptor( new CountingInterceptor(file, counter)); net::URLRequestFilter::GetInstance()->AddUrlInterceptor( url, std::move(request_interceptor)); @@ -1173,7 +1174,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { } // Overload for a single expected final status - scoped_ptr PrerenderTestURL( + std::unique_ptr PrerenderTestURL( const std::string& html_file, FinalStatus expected_final_status, int expected_number_of_loads) { @@ -1193,7 +1194,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { expected_number_of_loads); } - scoped_ptr PrerenderTestURL( + std::unique_ptr PrerenderTestURL( const GURL& url, FinalStatus expected_final_status, int expected_number_of_loads) { @@ -1204,7 +1205,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { expected_final_status_queue, expected_number_of_loads).release(&prerenders); CHECK_EQ(1u, prerenders.size()); - return scoped_ptr(prerenders[0]); + return std::unique_ptr(prerenders[0]); } void NavigateToDestURL() const { @@ -1449,7 +1450,7 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { // Returns length of |prerender_manager_|'s history, or -1 on failure. int GetHistoryLength() const { - scoped_ptr prerender_dict( + std::unique_ptr prerender_dict( static_cast( GetPrerenderManager()->GetAsValue())); if (!prerender_dict.get()) @@ -1536,7 +1537,8 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { return display_test_result; } - scoped_ptr ExpectPrerender(FinalStatus expected_final_status) { + std::unique_ptr ExpectPrerender( + FinalStatus expected_final_status) { return prerender_contents_factory_->ExpectPrerenderContents( expected_final_status); } @@ -1702,11 +1704,11 @@ class PrerenderBrowserTest : virtual public InProcessBrowserTest { TestPrerenderContentsFactory* prerender_contents_factory_; #if defined(FULL_SAFE_BROWSING) - scoped_ptr safe_browsing_factory_; + std::unique_ptr safe_browsing_factory_; #endif NeverRunsExternalProtocolHandlerDelegate external_protocol_handler_delegate_; GURL dest_url_; - scoped_ptr https_src_server_; + std::unique_ptr https_src_server_; bool call_javascript_; bool check_load_events_; std::string loader_host_override_; @@ -1765,11 +1767,12 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageCrossDomain) { // Checks that pending prerenders launch and receive proper event treatment. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPagePending) { - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_page_pending.html", FINAL_STATUS_USED, 1); // Navigate to the prerender. - scoped_ptr prerender2 = ExpectPrerender(FINAL_STATUS_USED); + std::unique_ptr prerender2 = + ExpectPrerender(FINAL_STATUS_USED); NavigateToDestURL(); // Abort early if the original prerender didn't swap, so as not to hang. ASSERT_FALSE(prerender->contents()); @@ -1817,7 +1820,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageRemovesPending) { } IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPageRemovingLink) { - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_page.html", FINAL_STATUS_CANCELLED, 1); // No ChannelDestructionWatcher is needed here, since prerenders in the @@ -1841,7 +1844,7 @@ IN_PROC_BROWSER_TEST_F( GetPrerenderManager()->mutable_config().max_link_concurrency_per_launcher = 2; set_loader_query("links_to_insert=2"); - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_page.html", FINAL_STATUS_CANCELLED, 1); EXPECT_TRUE(DidReceivePrerenderStartEventForLinkNumber(0)); EXPECT_FALSE(DidReceivePrerenderStopEventForLinkNumber(0)); @@ -1869,7 +1872,7 @@ IN_PROC_BROWSER_TEST_F( GetPrerenderManager()->mutable_config().max_link_concurrency_per_launcher = 2; GURL url = embedded_test_server()->GetURL("/prerender/prerender_page.html"); - scoped_ptr prerender = + std::unique_ptr prerender = PrerenderTestURL(url, FINAL_STATUS_CANCELLED, 1); // Add a second prerender for the same link. It reuses the prerender, so only @@ -2144,7 +2147,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, // The prerender will not completely load until after the swap, so wait for a // title change before calling DidPrerenderPass. - scoped_ptr prerender = + std::unique_ptr prerender = PrerenderTestURL(prerender_url, FINAL_STATUS_USED, 1); WaitForASCIITitle(prerender->contents()->prerender_contents(), kReadyTitle); EXPECT_TRUE(DidPrerenderPass(prerender->contents()->prerender_contents())); @@ -2320,7 +2323,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, // Checks that the referrer is set when prerendering is cancelled. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelReferrer) { - scoped_ptr test_content_browser_client( + std::unique_ptr test_content_browser_client( new TestContentBrowserClient); content::ContentBrowserClient* original_browser_client = content::SetBrowserClientForTesting(test_content_browser_client.get()); @@ -2451,7 +2454,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAbortPendingOnCancel) { const char* const kHtmlFileA = "/prerender/prerender_infinite_a.html"; const char* const kHtmlFileB = "/prerender/prerender_infinite_b.html"; - scoped_ptr prerender = + std::unique_ptr prerender = PrerenderTestURL(kHtmlFileA, FINAL_STATUS_CANCELLED, 1); ASSERT_TRUE(prerender->contents()); // Assert that the pending prerender is in there already. This relies on the @@ -2618,7 +2621,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5VideoJs) { // Checks for correct network events by using a busy sleep the javascript. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5VideoNetwork) { DisableJavascriptCalls(); - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_html5_video_network.html", FINAL_STATUS_USED, 1); WaitForASCIITitle(prerender->contents()->prerender_contents(), kReadyTitle); EXPECT_TRUE(DidPrerenderPass(prerender->contents()->prerender_contents())); @@ -2637,7 +2640,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderWindowSize) { // Checks that prerenderers will terminate when the RenderView crashes. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderRendererCrash) { - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_page.html", FINAL_STATUS_RENDERER_CRASHED, 1); // Navigate to about:crash and then wait for the renderer to crash. @@ -2893,8 +2896,8 @@ class TestClientCertStore : public net::ClientCertStore { } }; -scoped_ptr CreateCertStore() { - return scoped_ptr(new TestClientCertStore); +std::unique_ptr CreateCertStore() { + return std::unique_ptr(new TestClientCertStore); } // Checks that a top-level page which would normally request an SSL client @@ -3056,7 +3059,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderLocalStorageWrite) { // Checks that the favicon is properly loaded on prerender. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderFavicon) { - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_favicon.html", FINAL_STATUS_USED, 1); NavigateToDestURL(); @@ -3111,7 +3114,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHangingUnload) { // Checks that when the history is cleared, prerendering is cancelled and // prerendering history is cleared. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClearHistory) { - scoped_ptr prerender = + std::unique_ptr prerender = PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_CACHE_OR_HISTORY_CLEARED, 1); @@ -3125,7 +3128,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClearHistory) { // Checks that when the cache is cleared, prerenders are cancelled but // prerendering history is not cleared. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClearCache) { - scoped_ptr prerender = + std::unique_ptr prerender = PrerenderTestURL("/prerender/prerender_page.html", FINAL_STATUS_CACHE_OR_HISTORY_CLEARED, 1); @@ -3138,7 +3141,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClearCache) { } IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelAll) { - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_page.html", FINAL_STATUS_CANCELLED, 1); GetPrerenderManager()->CancelAllPrerenders(); @@ -3148,7 +3151,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelAll) { } IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderEvents) { - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_page.html", FINAL_STATUS_CANCELLED, 1); GetPrerenderManager()->CancelAllPrerenders(); @@ -3163,7 +3166,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderEvents) { // should never be started. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelPrerenderWithPrerender) { - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_infinite_a.html", FINAL_STATUS_CANCELLED, 1); GetPrerenderManager()->CancelAllPrerenders(); @@ -3321,7 +3324,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, // Checks that the referrer policy is used when prerendering is cancelled. IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelReferrerPolicy) { - scoped_ptr test_content_browser_client( + std::unique_ptr test_content_browser_client( new TestContentBrowserClient); content::ContentBrowserClient* original_browser_client = content::SetBrowserClientForTesting(test_content_browser_client.get()); @@ -3647,7 +3650,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDeferredImage) { // The prerender will not completely load until after the swap, so wait for a // title change before calling DidPrerenderPass. - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_deferred_image.html", FINAL_STATUS_USED, 0); WaitForASCIITitle(prerender->contents()->prerender_contents(), kReadyTitle); EXPECT_EQ(1, GetPrerenderDomContentLoadedEventCountForLinkNumber(0)); @@ -3691,7 +3694,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, // The prerender will not completely load until after the swap, so wait for a // title change before calling DidPrerenderPass. - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_deferred_image.html", FINAL_STATUS_USED, 0); WaitForASCIITitle(prerender->contents()->prerender_contents(), kReadyTitle); EXPECT_TRUE(DidPrerenderPass(prerender->contents()->prerender_contents())); @@ -3859,7 +3862,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderIncognitoBrowserTest, PrerenderIncognito) { // Checks that prerenders are aborted when an incognito profile is closed. IN_PROC_BROWSER_TEST_F(PrerenderIncognitoBrowserTest, PrerenderIncognitoClosed) { - scoped_ptr prerender = PrerenderTestURL( + std::unique_ptr prerender = PrerenderTestURL( "/prerender/prerender_page.html", FINAL_STATUS_PROFILE_DESTROYED, 1); current_browser()->window()->Close(); prerender->WaitForStop(); @@ -3892,10 +3895,10 @@ class PrerenderOmniboxBrowserTest : public PrerenderBrowserTest { profile); } - scoped_ptr StartOmniboxPrerender( + std::unique_ptr StartOmniboxPrerender( const GURL& url, FinalStatus expected_final_status) { - scoped_ptr prerender = + std::unique_ptr prerender = ExpectPrerender(expected_final_status); WebContents* web_contents = GetActiveWebContents(); GetAutocompleteActionPredictor()->StartPrerendering( @@ -3912,7 +3915,7 @@ class PrerenderOmniboxBrowserTest : public PrerenderBrowserTest { IN_PROC_BROWSER_TEST_F(PrerenderOmniboxBrowserTest, DISABLED_PrerenderOmniboxCancel) { // Fake an omnibox prerender. - scoped_ptr prerender = StartOmniboxPrerender( + std::unique_ptr prerender = StartOmniboxPrerender( embedded_test_server()->GetURL("/empty.html"), FINAL_STATUS_CANCELLED); // Revert the location bar. This should cancel the prerender. @@ -3938,7 +3941,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderOmniboxBrowserTest, WaitForAutocompleteDone(omnibox_view); // Fake an omnibox prerender for a different URL. - scoped_ptr prerender = + std::unique_ptr prerender = StartOmniboxPrerender(embedded_test_server()->GetURL("/empty.html?2"), FINAL_STATUS_APP_TERMINATING); diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h index 144ee610bb2c7e..907128cb238445 100644 --- a/chrome/browser/prerender/prerender_contents.h +++ b/chrome/browser/prerender/prerender_contents.h @@ -7,12 +7,12 @@ #include +#include #include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/time/time.h" @@ -312,7 +312,7 @@ class PrerenderContents : public content::NotificationObserver, base::TimeTicks load_start_time_; // The prerendered WebContents; may be null. - scoped_ptr prerender_contents_; + std::unique_ptr prerender_contents_; // The session storage namespace id for use in matching. We must save it // rather than get it from the RenderViewHost since in the control group @@ -377,9 +377,9 @@ class PrerenderContents : public content::NotificationObserver, // Process Metrics of the render process associated with the // RenderViewHost for this object. - scoped_ptr process_metrics_; + std::unique_ptr process_metrics_; - scoped_ptr web_contents_delegate_; + std::unique_ptr web_contents_delegate_; // These are -1 before a RenderView is created. int child_id_; diff --git a/chrome/browser/prerender/prerender_history_unittest.cc b/chrome/browser/prerender/prerender_history_unittest.cc index 19fef4a1364aa4..af243d60fdbf27 100644 --- a/chrome/browser/prerender/prerender_history_unittest.cc +++ b/chrome/browser/prerender/prerender_history_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 "chrome/browser/prerender/prerender_history.h" + #include -#include "base/memory/scoped_ptr.h" +#include + #include "base/values.h" -#include "chrome/browser/prerender/prerender_history.h" #include "testing/gtest/include/gtest/gtest.h" namespace prerender { @@ -50,7 +52,7 @@ bool ListEntryMatches(base::ListValue* list, } TEST(PrerenderHistoryTest, GetAsValue) { - scoped_ptr entry_value; + std::unique_ptr entry_value; base::ListValue* entry_list = NULL; // Create a history with only 2 values. diff --git a/chrome/browser/prerender/prerender_link_manager.cc b/chrome/browser/prerender/prerender_link_manager.cc index 94ed907eff5bb4..9b1a232b17c1dd 100644 --- a/chrome/browser/prerender/prerender_link_manager.cc +++ b/chrome/browser/prerender/prerender_link_manager.cc @@ -6,11 +6,11 @@ #include #include +#include #include #include #include -#include "base/memory/scoped_ptr.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram.h" #include "chrome/browser/prerender/prerender_contents.h" @@ -87,7 +87,7 @@ void RecordLinkManagerStarting(const uint32_t rel_types) { void Send(int child_id, IPC::Message* raw_message) { using content::RenderProcessHost; - scoped_ptr own_message(raw_message); + std::unique_ptr own_message(raw_message); RenderProcessHost* render_process_host = RenderProcessHost::FromID(child_id); if (!render_process_host) @@ -433,7 +433,7 @@ void PrerenderLinkManager::RemovePrerender(LinkPrerender* prerender) { for (std::list::iterator i = prerenders_.begin(); i != prerenders_.end(); ++i) { if (&(*i) == prerender) { - scoped_ptr own_handle(i->handle); + std::unique_ptr own_handle(i->handle); i->handle = NULL; prerenders_.erase(i); return; @@ -446,7 +446,7 @@ void PrerenderLinkManager::CancelPrerender(LinkPrerender* prerender) { for (std::list::iterator i = prerenders_.begin(); i != prerenders_.end(); ++i) { if (&(*i) == prerender) { - scoped_ptr own_handle(i->handle); + std::unique_ptr own_handle(i->handle); i->handle = NULL; prerenders_.erase(i); if (own_handle) diff --git a/chrome/browser/prerender/prerender_link_manager.h b/chrome/browser/prerender/prerender_link_manager.h index b99b656cabf47d..4a44774dfee8db 100644 --- a/chrome/browser/prerender/prerender_link_manager.h +++ b/chrome/browser/prerender/prerender_link_manager.h @@ -169,7 +169,7 @@ class PrerenderLinkManager : public KeyedService, // Helper object to manage prerenders which are launched by other prerenders // and must be deferred until the launcher is swapped in. - scoped_ptr pending_prerender_manager_; + std::unique_ptr pending_prerender_manager_; DISALLOW_COPY_AND_ASSIGN(PrerenderLinkManager); }; diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc index 743d117f38ca0a..3bc6d9cede0a50 100644 --- a/chrome/browser/prerender/prerender_manager.cc +++ b/chrome/browser/prerender/prerender_manager.cc @@ -170,7 +170,7 @@ class PrerenderManager::OnCloseWebContentsDeleter } PrerenderManager* manager_; - scoped_ptr tab_; + std::unique_ptr tab_; bool suppressed_dialog_; DISALLOW_COPY_AND_ASSIGN(OnCloseWebContentsDeleter); @@ -489,8 +489,8 @@ WebContents* PrerenderManager::SwapInternal( FindIteratorForPrerenderContents(prerender_data->contents()); DCHECK(active_prerenders_.end() != to_erase); DCHECK_EQ(prerender_data, *to_erase); - scoped_ptr - prerender_contents(prerender_data->ReleaseContents()); + std::unique_ptr prerender_contents( + prerender_data->ReleaseContents()); active_prerenders_.erase(to_erase); // Mark prerender as used. diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h index c33c540657d682..692d971df9b23a 100644 --- a/chrome/browser/prerender/prerender_manager.h +++ b/chrome/browser/prerender/prerender_manager.h @@ -8,11 +8,11 @@ #include #include +#include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/memory/weak_ptr.h" #include "base/threading/non_thread_safe.h" @@ -352,7 +352,7 @@ class PrerenderManager : public base::SupportsWeakPtr, private: PrerenderManager* manager_; - scoped_ptr contents_; + std::unique_ptr contents_; // The number of distinct PrerenderHandles created for |this|, including // ones that have called PrerenderData::OnHandleNavigatedAway(), but not @@ -526,7 +526,7 @@ class PrerenderManager : public base::SupportsWeakPtr, // navigate_time_. std::list navigations_; - scoped_ptr prerender_contents_factory_; + std::unique_ptr prerender_contents_factory_; static PrerenderManagerMode mode_; @@ -545,9 +545,9 @@ class PrerenderManager : public base::SupportsWeakPtr, ScopedVector on_close_web_contents_deleters_; - scoped_ptr prerender_history_; + std::unique_ptr prerender_history_; - scoped_ptr histograms_; + std::unique_ptr histograms_; content::NotificationRegistrar notification_registrar_; diff --git a/chrome/browser/prerender/prerender_message_filter.h b/chrome/browser/prerender/prerender_message_filter.h index 049db7dbffaa1a..f3695a4ed9bdd2 100644 --- a/chrome/browser/prerender/prerender_message_filter.h +++ b/chrome/browser/prerender/prerender_message_filter.h @@ -66,7 +66,8 @@ class PrerenderMessageFilter : public content::BrowserMessageFilter { PrerenderLinkManager* prerender_link_manager_; - scoped_ptr shutdown_notifier_; + std::unique_ptr + shutdown_notifier_; DISALLOW_COPY_AND_ASSIGN(PrerenderMessageFilter); }; diff --git a/chrome/browser/prerender/prerender_resource_throttle_unittest.cc b/chrome/browser/prerender/prerender_resource_throttle_unittest.cc index dcc365fd4563b4..aa7fa9a180b383 100644 --- a/chrome/browser/prerender/prerender_resource_throttle_unittest.cc +++ b/chrome/browser/prerender/prerender_resource_throttle_unittest.cc @@ -149,7 +149,7 @@ class DeferredRedirectDelegate : public net::URLRequest::Delegate, } private: - scoped_ptr run_loop_; + std::unique_ptr run_loop_; PrerenderResourceThrottle* throttle_; bool was_deferred_; bool cancel_called_; @@ -211,10 +211,9 @@ TEST_F(PrerenderResourceThrottleTest, RedirectResume) { // Fake a request. net::TestURLRequestContext url_request_context; DeferredRedirectDelegate delegate; - scoped_ptr request(url_request_context.CreateRequest( + std::unique_ptr request(url_request_context.CreateRequest( net::URLRequestMockHTTPJob::GetMockUrl("prerender/image-deferred.png"), - net::DEFAULT_PRIORITY, - &delegate)); + net::DEFAULT_PRIORITY, &delegate)); content::ResourceRequestInfo::AllocateForTesting( request.get(), content::RESOURCE_TYPE_IMAGE, @@ -255,10 +254,9 @@ TEST_F(PrerenderResourceThrottleTest, RedirectMainFrame) { // Fake a request. net::TestURLRequestContext url_request_context; DeferredRedirectDelegate delegate; - scoped_ptr request(url_request_context.CreateRequest( + std::unique_ptr request(url_request_context.CreateRequest( net::URLRequestMockHTTPJob::GetMockUrl("prerender/image-deferred.png"), - net::DEFAULT_PRIORITY, - &delegate)); + net::DEFAULT_PRIORITY, &delegate)); content::ResourceRequestInfo::AllocateForTesting( request.get(), content::RESOURCE_TYPE_MAIN_FRAME, @@ -297,10 +295,9 @@ TEST_F(PrerenderResourceThrottleTest, RedirectSyncXHR) { // Fake a request. net::TestURLRequestContext url_request_context; DeferredRedirectDelegate delegate; - scoped_ptr request(url_request_context.CreateRequest( + std::unique_ptr request(url_request_context.CreateRequest( net::URLRequestMockHTTPJob::GetMockUrl("prerender/image-deferred.png"), - net::DEFAULT_PRIORITY, - &delegate)); + net::DEFAULT_PRIORITY, &delegate)); content::ResourceRequestInfo::AllocateForTesting( request.get(), content::RESOURCE_TYPE_XHR, diff --git a/chrome/browser/prerender/prerender_tab_helper.h b/chrome/browser/prerender/prerender_tab_helper.h index e672f1047b99ce..da40e22ddfc864 100644 --- a/chrome/browser/prerender/prerender_tab_helper.h +++ b/chrome/browser/prerender/prerender_tab_helper.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ #define CHROME_BROWSER_PRERENDER_PRERENDER_TAB_HELPER_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "chrome/browser/prerender/prerender_histograms.h" diff --git a/chrome/browser/prerender/prerender_unittest.cc b/chrome/browser/prerender/prerender_unittest.cc index 499bd535b1d164..0db797f291ba70 100644 --- a/chrome/browser/prerender/prerender_unittest.cc +++ b/chrome/browser/prerender/prerender_unittest.cc @@ -252,7 +252,7 @@ class UnitTestPrerenderManager : public PrerenderManager { Time time_; TimeTicks time_ticks_; - scoped_ptr next_prerender_contents_; + std::unique_ptr next_prerender_contents_; // PrerenderContents with an |expected_final_status| of FINAL_STATUS_USED, // tracked so they will be automatically deleted. ScopedVector used_prerender_contents_; @@ -401,8 +401,8 @@ class PrerenderTest : public testing::Test { base::MessageLoop message_loop_; TestingProfile profile_; content::TestBrowserThread ui_thread_; - scoped_ptr prerender_manager_; - scoped_ptr prerender_link_manager_; + std::unique_ptr prerender_manager_; + std::unique_ptr prerender_link_manager_; int last_prerender_id_; base::FieldTrialList field_trial_list_; }; @@ -1080,7 +1080,7 @@ TEST_F(PrerenderTest, LinkRelStillAllowedWhenDisabled) { TEST_F(PrerenderTest, LinkRelAllowedOnCellular) { EnablePrerender(); GURL url("http://www.example.com"); - scoped_ptr mock( + std::unique_ptr mock( new MockNetworkChangeNotifier4G); EXPECT_TRUE(net::NetworkChangeNotifier::IsConnectionCellular( net::NetworkChangeNotifier::GetConnectionType())); @@ -1094,7 +1094,7 @@ TEST_F(PrerenderTest, LinkRelAllowedOnCellular) { TEST_F(PrerenderTest, PrerenderNotAllowedOnCellularWithExternalOrigin) { EnablePrerender(); - scoped_ptr mock( + std::unique_ptr mock( new MockNetworkChangeNotifier4G); EXPECT_TRUE(net::NetworkChangeNotifier::IsConnectionCellular( net::NetworkChangeNotifier::GetConnectionType())); @@ -1104,7 +1104,7 @@ TEST_F(PrerenderTest, PrerenderNotAllowedOnCellularWithExternalOrigin) { url, ORIGIN_EXTERNAL_REQUEST, FINAL_STATUS_MANAGER_SHUTDOWN); - scoped_ptr prerender_handle( + std::unique_ptr prerender_handle( prerender_manager()->AddPrerenderFromExternalRequest( url, content::Referrer(), nullptr, kSize)); EXPECT_FALSE(prerender_handle); @@ -1113,7 +1113,7 @@ TEST_F(PrerenderTest, PrerenderNotAllowedOnCellularWithExternalOrigin) { TEST_F(PrerenderTest,PrerenderAllowedOnCellularWithForcedOrigin) { EnablePrerender(); - scoped_ptr mock( + std::unique_ptr mock( new MockNetworkChangeNotifier4G); EXPECT_TRUE(net::NetworkChangeNotifier::IsConnectionCellular( net::NetworkChangeNotifier::GetConnectionType())); @@ -1123,7 +1123,7 @@ TEST_F(PrerenderTest,PrerenderAllowedOnCellularWithForcedOrigin) { url, ORIGIN_EXTERNAL_REQUEST_FORCED_CELLULAR, FINAL_STATUS_USED); - scoped_ptr prerender_handle( + std::unique_ptr prerender_handle( prerender_manager()->AddPrerenderOnCellularFromExternalRequest( url, content::Referrer(), nullptr, kSize)); EXPECT_TRUE(prerender_handle); @@ -1651,7 +1651,7 @@ TEST_F(PrerenderTest, PrerenderContentsForInstantSearch) { DummyPrerenderContents* prerender_contents = prerender_manager()->CreateNextPrerenderContents(url, ORIGIN_INSTANT, FINAL_STATUS_USED); - scoped_ptr prerender_handle( + std::unique_ptr prerender_handle( prerender_manager()->AddPrerenderForInstant(url, NULL, kSize)); CHECK(prerender_handle.get()); EXPECT_TRUE(prerender_handle->IsPrerendering()); diff --git a/chrome/browser/process_singleton_browsertest.cc b/chrome/browser/process_singleton_browsertest.cc index 0633d71716b5a8..ff7a4cbff3557c 100644 --- a/chrome/browser/process_singleton_browsertest.cc +++ b/chrome/browser/process_singleton_browsertest.cc @@ -211,7 +211,7 @@ class ProcessSingletonTest : public InProcessBrowserTest { // The idea is to start chrome from multiple threads all at once. static const size_t kNbThreads = 5; scoped_refptr chrome_starters_[kNbThreads]; - scoped_ptr chrome_starter_threads_[kNbThreads]; + std::unique_ptr chrome_starter_threads_[kNbThreads]; // The event that will get all threads to wake up simultaneously and try // to start a chrome process at the same time. diff --git a/chrome/browser/process_singleton_posix_unittest.cc b/chrome/browser/process_singleton_posix_unittest.cc index d0f68e9f787ac5..aca5d06b0b0828 100644 --- a/chrome/browser/process_singleton_posix_unittest.cc +++ b/chrome/browser/process_singleton_posix_unittest.cc @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -22,7 +23,6 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/location.h" -#include "base/memory/scoped_ptr.h" #include "base/posix/eintr_wrapper.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" @@ -164,7 +164,7 @@ class ProcessSingletonPosixTest : public testing::Test { } ProcessSingleton::NotifyResult NotifyOtherProcess(bool override_kill) { - scoped_ptr process_singleton( + std::unique_ptr process_singleton( CreateProcessSingleton()); base::CommandLine command_line( base::CommandLine::ForCurrentProcess()->GetProgram()); @@ -184,7 +184,7 @@ class ProcessSingletonPosixTest : public testing::Test { // A helper method to call ProcessSingleton::NotifyOtherProcessOrCreate(). ProcessSingleton::NotifyResult NotifyOtherProcessOrCreate( const std::string& url) { - scoped_ptr process_singleton( + std::unique_ptr process_singleton( CreateProcessSingleton()); base::CommandLine command_line( base::CommandLine::ForCurrentProcess()->GetProgram()); @@ -261,7 +261,7 @@ class ProcessSingletonPosixTest : public testing::Test { base::WaitableEvent wait_event_; base::WaitableEvent signal_event_; - scoped_ptr worker_thread_; + std::unique_ptr worker_thread_; TestableProcessSingleton* process_singleton_on_thread_; }; @@ -363,7 +363,7 @@ TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessOrCreate_DifferingHost) { TEST_F(ProcessSingletonPosixTest, CreateFailsWithExistingBrowser) { CreateProcessSingletonOnThread(); - scoped_ptr process_singleton( + std::unique_ptr process_singleton( CreateProcessSingleton()); process_singleton->OverrideCurrentPidForTesting(base::GetCurrentProcId() + 1); EXPECT_FALSE(process_singleton->Create()); @@ -373,7 +373,7 @@ TEST_F(ProcessSingletonPosixTest, CreateFailsWithExistingBrowser) { // but with the old socket location. TEST_F(ProcessSingletonPosixTest, CreateChecksCompatibilitySocket) { CreateProcessSingletonOnThread(); - scoped_ptr process_singleton( + std::unique_ptr process_singleton( CreateProcessSingleton()); process_singleton->OverrideCurrentPidForTesting(base::GetCurrentProcId() + 1); @@ -410,7 +410,7 @@ TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessOrCreate_BadCookie) { // Test that if there is an existing lock file, and we could not flock() // it, then exit. TEST_F(ProcessSingletonPosixTest, CreateRespectsOldMacLock) { - scoped_ptr process_singleton( + std::unique_ptr process_singleton( CreateProcessSingleton()); base::ScopedFD lock_fd(HANDLE_EINTR( open(lock_path_.value().c_str(), O_RDWR | O_CREAT | O_EXLOCK, 0644))); @@ -425,7 +425,7 @@ TEST_F(ProcessSingletonPosixTest, CreateRespectsOldMacLock) { // Test that if there is an existing lock file, and it's not locked, we replace // it. TEST_F(ProcessSingletonPosixTest, CreateReplacesOldMacLock) { - scoped_ptr process_singleton( + std::unique_ptr process_singleton( CreateProcessSingleton()); EXPECT_EQ(0, base::WriteFile(lock_path_, "", 0)); EXPECT_TRUE(process_singleton->Create()); diff --git a/chrome/browser/process_singleton_win_unittest.cc b/chrome/browser/process_singleton_win_unittest.cc index dad6dcedcc57f2..d12791dbf405e3 100644 --- a/chrome/browser/process_singleton_win_unittest.cc +++ b/chrome/browser/process_singleton_win_unittest.cc @@ -6,6 +6,8 @@ #include +#include + #include "base/bind.h" #include "base/command_line.h" #include "base/compiler_specific.h" @@ -13,7 +15,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/logging.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/process/launch.h" #include "base/process/process.h" #include "base/process/process_handle.h" @@ -246,7 +247,7 @@ class ProcessSingletonTest : public base::MultiProcessTest { base::Process browser_victim_; base::win::ScopedHandle continue_event_; - scoped_ptr test_singleton_; + std::unique_ptr test_singleton_; base::TimeDelta old_notification_timeout_; bool should_kill_called_; diff --git a/chrome/browser/profile_resetter/brandcode_config_fetcher.h b/chrome/browser/profile_resetter/brandcode_config_fetcher.h index 23884999ed7632..b56454c65da0f1 100644 --- a/chrome/browser/profile_resetter/brandcode_config_fetcher.h +++ b/chrome/browser/profile_resetter/brandcode_config_fetcher.h @@ -5,11 +5,11 @@ #ifndef CHROME_BROWSER_PROFILE_RESETTER_BRANDCODE_CONFIG_FETCHER_H_ #define CHROME_BROWSER_PROFILE_RESETTER_BRANDCODE_CONFIG_FETCHER_H_ +#include #include #include "base/callback.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/timer/timer.h" #include "net/url_request/url_fetcher_delegate.h" @@ -29,7 +29,7 @@ class BrandcodeConfigFetcher : public net::URLFetcherDelegate { bool IsActive() const { return !!config_fetcher_; } - scoped_ptr GetSettings() { + std::unique_ptr GetSettings() { return std::move(default_settings_); } @@ -50,10 +50,10 @@ class BrandcodeConfigFetcher : public net::URLFetcherDelegate { FetchCallback fetch_callback_; // Helper to fetch the online config file. - scoped_ptr config_fetcher_; + std::unique_ptr config_fetcher_; // Fetched settings. - scoped_ptr default_settings_; + std::unique_ptr default_settings_; DISALLOW_COPY_AND_ASSIGN(BrandcodeConfigFetcher); }; diff --git a/chrome/browser/profile_resetter/brandcoded_default_settings.cc b/chrome/browser/profile_resetter/brandcoded_default_settings.cc index 20145fbbe57a14..7e600f8856c1c4 100644 --- a/chrome/browser/profile_resetter/brandcoded_default_settings.cc +++ b/chrome/browser/profile_resetter/brandcoded_default_settings.cc @@ -18,7 +18,7 @@ BrandcodedDefaultSettings::BrandcodedDefaultSettings(const std::string& prefs) { if (!prefs.empty()) { JSONStringValueDeserializer json(prefs); std::string error; - scoped_ptr root(json.Deserialize(NULL, &error)); + std::unique_ptr root(json.Deserialize(NULL, &error)); if (!root.get()) { VLOG(1) << "Failed to parse brandcode prefs file: " << error; return; @@ -36,7 +36,7 @@ BrandcodedDefaultSettings::BrandcodedDefaultSettings(const std::string& prefs) { BrandcodedDefaultSettings::~BrandcodedDefaultSettings() { } -scoped_ptr +std::unique_ptr BrandcodedDefaultSettings::GetSearchProviderOverrides() const { return ExtractList(prefs::kSearchProviderOverrides); } @@ -86,18 +86,18 @@ bool BrandcodedDefaultSettings::GetRestoreOnStartup( restore_on_startup); } -scoped_ptr +std::unique_ptr BrandcodedDefaultSettings::GetUrlsToRestoreOnStartup() const { return ExtractList(prefs::kURLsToRestoreOnStartup); } -scoped_ptr BrandcodedDefaultSettings::ExtractList( +std::unique_ptr BrandcodedDefaultSettings::ExtractList( const char* pref_name) const { const base::ListValue* value = NULL; if (master_dictionary_ && master_dictionary_->GetList(pref_name, &value) && !value->empty()) { - return scoped_ptr(value->DeepCopy()); + return std::unique_ptr(value->DeepCopy()); } - return scoped_ptr(); + return std::unique_ptr(); } diff --git a/chrome/browser/profile_resetter/brandcoded_default_settings.h b/chrome/browser/profile_resetter/brandcoded_default_settings.h index 5365083d442475..905833c2d83ede 100644 --- a/chrome/browser/profile_resetter/brandcoded_default_settings.h +++ b/chrome/browser/profile_resetter/brandcoded_default_settings.h @@ -5,11 +5,11 @@ #ifndef CHROME_BROWSER_PROFILE_RESETTER_BRANDCODED_DEFAULT_SETTINGS_H_ #define CHROME_BROWSER_PROFILE_RESETTER_BRANDCODED_DEFAULT_SETTINGS_H_ +#include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/values.h" // BrandcodedDefaultSettings provides a set of default settings @@ -25,7 +25,7 @@ class BrandcodedDefaultSettings { // provided for given setting. // After the call return_value contains a list of default engines. // |return_value[0]| is default one. - scoped_ptr GetSearchProviderOverrides() const; + std::unique_ptr GetSearchProviderOverrides() const; bool GetHomepage(std::string* homepage) const; bool GetHomepageIsNewTab(bool* homepage_is_ntp) const; @@ -35,12 +35,12 @@ class BrandcodedDefaultSettings { bool GetExtensions(std::vector* extension_ids) const; bool GetRestoreOnStartup(int* restore_on_startup) const; - scoped_ptr GetUrlsToRestoreOnStartup() const; + std::unique_ptr GetUrlsToRestoreOnStartup() const; private: - scoped_ptr ExtractList(const char* pref_name) const; + std::unique_ptr ExtractList(const char* pref_name) const; - scoped_ptr master_dictionary_; + std::unique_ptr master_dictionary_; DISALLOW_COPY_AND_ASSIGN(BrandcodedDefaultSettings); }; diff --git a/chrome/browser/profile_resetter/profile_resetter.cc b/chrome/browser/profile_resetter/profile_resetter.cc index bf10109b116adb..84a667d4504083 100644 --- a/chrome/browser/profile_resetter/profile_resetter.cc +++ b/chrome/browser/profile_resetter/profile_resetter.cc @@ -88,7 +88,7 @@ ProfileResetter::~ProfileResetter() { void ProfileResetter::Reset( ProfileResetter::ResettableFlags resettable_flags, - scoped_ptr master_settings, + std::unique_ptr master_settings, const base::Closure& callback) { DCHECK(CalledOnValidThread()); DCHECK(master_settings); @@ -168,7 +168,7 @@ void ProfileResetter::ResetDefaultSearchEngine() { DCHECK(prefs); TemplateURLPrepopulateData::ClearPrepopulatedEnginesInPrefs( profile_->GetPrefs()); - scoped_ptr search_engines( + std::unique_ptr search_engines( master_settings_->GetSearchProviderOverrides()); if (search_engines) { // This Chrome distribution channel provides a custom search engine. We @@ -279,7 +279,7 @@ void ProfileResetter::ResetStartupPages() { DCHECK(CalledOnValidThread()); PrefService* prefs = profile_->GetPrefs(); DCHECK(prefs); - scoped_ptr url_list( + std::unique_ptr url_list( master_settings_->GetUrlsToRestoreOnStartup()); if (url_list) ListPrefUpdate(prefs, prefs::kURLsToRestoreOnStartup)->Swap(url_list.get()); diff --git a/chrome/browser/profile_resetter/profile_resetter.h b/chrome/browser/profile_resetter/profile_resetter.h index fad3dd6baa1025..f7226ee7615ed9 100644 --- a/chrome/browser/profile_resetter/profile_resetter.h +++ b/chrome/browser/profile_resetter/profile_resetter.h @@ -7,6 +7,7 @@ #include +#include #include #include @@ -14,7 +15,6 @@ #include "base/files/file_path.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/strings/string16.h" #include "base/threading/non_thread_safe.h" @@ -64,7 +64,7 @@ class ProfileResetter : public base::NonThreadSafe, // completion. |default_settings| allows the caller to specify some default // settings. |default_settings| shouldn't be NULL. virtual void Reset(ResettableFlags resettable_flags, - scoped_ptr master_settings, + std::unique_ptr master_settings, const base::Closure& callback); virtual bool IsActive() const; @@ -90,7 +90,7 @@ class ProfileResetter : public base::NonThreadSafe, void OnTemplateURLServiceLoaded(); Profile* const profile_; - scoped_ptr master_settings_; + std::unique_ptr master_settings_; TemplateURLService* template_url_service_; // Flags of a Resetable indicating which reset operations we are still waiting @@ -104,7 +104,7 @@ class ProfileResetter : public base::NonThreadSafe, // of deleting itself when done. BrowsingDataRemover* cookies_remover_; - scoped_ptr template_url_service_sub_; + std::unique_ptr template_url_service_sub_; base::WeakPtrFactory weak_ptr_factory_; diff --git a/chrome/browser/profile_resetter/profile_resetter_test_base.cc b/chrome/browser/profile_resetter/profile_resetter_test_base.cc index cccd6049479571..ab3296707bf864 100644 --- a/chrome/browser/profile_resetter/profile_resetter_test_base.cc +++ b/chrome/browser/profile_resetter/profile_resetter_test_base.cc @@ -32,7 +32,7 @@ ProfileResetterTestBase::~ProfileResetterTestBase() {} void ProfileResetterTestBase::ResetAndWait( ProfileResetter::ResettableFlags resettable_flags) { - scoped_ptr master_settings( + std::unique_ptr master_settings( new BrandcodedDefaultSettings); resetter_->Reset(resettable_flags, std::move(master_settings), base::Bind(&ProfileResetterMockObject::StopLoop, @@ -43,7 +43,7 @@ void ProfileResetterTestBase::ResetAndWait( void ProfileResetterTestBase::ResetAndWait( ProfileResetter::ResettableFlags resettable_flags, const std::string& prefs) { - scoped_ptr master_settings( + std::unique_ptr master_settings( new BrandcodedDefaultSettings(prefs)); resetter_->Reset(resettable_flags, std::move(master_settings), base::Bind(&ProfileResetterMockObject::StopLoop, diff --git a/chrome/browser/profile_resetter/profile_resetter_test_base.h b/chrome/browser/profile_resetter/profile_resetter_test_base.h index 29322d1497a675..0cb6a760c1a025 100644 --- a/chrome/browser/profile_resetter/profile_resetter_test_base.h +++ b/chrome/browser/profile_resetter/profile_resetter_test_base.h @@ -46,7 +46,7 @@ class ProfileResetterTestBase { const std::string& prefs); protected: testing::StrictMock mock_object_; - scoped_ptr resetter_; + std::unique_ptr resetter_; private: DISALLOW_COPY_AND_ASSIGN(ProfileResetterTestBase); diff --git a/chrome/browser/profile_resetter/profile_resetter_unittest.cc b/chrome/browser/profile_resetter/profile_resetter_unittest.cc index 566b7884b00a16..96a2c0961a5575 100644 --- a/chrome/browser/profile_resetter/profile_resetter_unittest.cc +++ b/chrome/browser/profile_resetter/profile_resetter_unittest.cc @@ -5,10 +5,12 @@ #include "chrome/browser/profile_resetter/profile_resetter.h" #include + +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "base/test/scoped_path_override.h" #include "build/build_config.h" @@ -117,7 +119,7 @@ class ProfileResetterTest : public extensions::ExtensionServiceTestBase, TestingProfile* profile() { return profile_.get(); } - static scoped_ptr CreateTemplateURLService( + static std::unique_ptr CreateTemplateURLService( content::BrowserContext* context); private: @@ -154,15 +156,16 @@ void ProfileResetterTest::SetUp() { } // static -scoped_ptr ProfileResetterTest::CreateTemplateURLService( +std::unique_ptr ProfileResetterTest::CreateTemplateURLService( content::BrowserContext* context) { Profile* profile = static_cast(context); - return make_scoped_ptr(new TemplateURLService( + return base::WrapUnique(new TemplateURLService( profile->GetPrefs(), - scoped_ptr(new UIThreadSearchTermsData(profile)), + std::unique_ptr(new UIThreadSearchTermsData(profile)), WebDataServiceFactory::GetKeywordWebDataForProfile( profile, ServiceAccessType::EXPLICIT_ACCESS), - scoped_ptr(), NULL, NULL, base::Closure())); + std::unique_ptr(), NULL, NULL, + base::Closure())); } @@ -221,12 +224,12 @@ class ConfigParserTest : public testing::Test { ConfigParserTest(); virtual ~ConfigParserTest(); - scoped_ptr WaitForRequest(const GURL& url); + std::unique_ptr WaitForRequest(const GURL& url); net::FakeURLFetcherFactory& factory() { return factory_; } private: - scoped_ptr CreateFakeURLFetcher( + std::unique_ptr CreateFakeURLFetcher( const GURL& url, net::URLFetcherDelegate* fetcher_delegate, const std::string& response_data, @@ -251,14 +254,12 @@ ConfigParserTest::ConfigParserTest() ConfigParserTest::~ConfigParserTest() {} -scoped_ptr ConfigParserTest::WaitForRequest( +std::unique_ptr ConfigParserTest::WaitForRequest( const GURL& url) { EXPECT_CALL(*this, Callback()); - scoped_ptr fetcher( - new BrandcodeConfigFetcher(base::Bind(&ConfigParserTest::Callback, - base::Unretained(this)), - url, - "ABCD")); + std::unique_ptr fetcher(new BrandcodeConfigFetcher( + base::Bind(&ConfigParserTest::Callback, base::Unretained(this)), url, + "ABCD")); base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(fetcher->IsActive()); // Look for the brand code in the request. @@ -266,16 +267,15 @@ scoped_ptr ConfigParserTest::WaitForRequest( return fetcher; } -scoped_ptr ConfigParserTest::CreateFakeURLFetcher( +std::unique_ptr ConfigParserTest::CreateFakeURLFetcher( const GURL& url, net::URLFetcherDelegate* fetcher_delegate, const std::string& response_data, net::HttpStatusCode response_code, net::URLRequestStatus::Status status) { request_listener_.real_delegate = fetcher_delegate; - scoped_ptr fetcher( - new net::FakeURLFetcher( - url, &request_listener_, response_data, response_code, status)); + std::unique_ptr fetcher(new net::FakeURLFetcher( + url, &request_listener_, response_data, response_code, status)); scoped_refptr download_headers = new net::HttpResponseHeaders(""); download_headers->AddHeader("Content-Type: text/xml"); @@ -727,10 +727,10 @@ TEST_F(ProfileResetterTest, ResetStartPagePartially) { } TEST_F(PinnedTabsResetTest, ResetPinnedTabs) { - scoped_ptr contents1(CreateWebContents()); - scoped_ptr contents2(CreateWebContents()); - scoped_ptr contents3(CreateWebContents()); - scoped_ptr contents4(CreateWebContents()); + std::unique_ptr contents1(CreateWebContents()); + std::unique_ptr contents2(CreateWebContents()); + std::unique_ptr contents3(CreateWebContents()); + std::unique_ptr contents4(CreateWebContents()); TabStripModel* tab_strip_model = browser()->tab_strip_model(); tab_strip_model->AppendWebContents(contents4.get(), true); @@ -782,7 +782,7 @@ TEST_F(ConfigParserTest, NoConnectivity) { factory().SetFakeResponse(url, "", net::HTTP_INTERNAL_SERVER_ERROR, net::URLRequestStatus::FAILED); - scoped_ptr fetcher = WaitForRequest(GURL(url)); + std::unique_ptr fetcher = WaitForRequest(GURL(url)); EXPECT_FALSE(fetcher->GetSettings()); } @@ -797,8 +797,8 @@ TEST_F(ConfigParserTest, ParseConfig) { factory().SetFakeResponse(url, xml_config, net::HTTP_OK, net::URLRequestStatus::SUCCESS); - scoped_ptr fetcher = WaitForRequest(GURL(url)); - scoped_ptr settings = fetcher->GetSettings(); + std::unique_ptr fetcher = WaitForRequest(GURL(url)); + std::unique_ptr settings = fetcher->GetSettings(); ASSERT_TRUE(settings); std::vector extension_ids; @@ -810,7 +810,7 @@ TEST_F(ConfigParserTest, ParseConfig) { EXPECT_TRUE(settings->GetHomepage(&homepage)); EXPECT_EQ("http://www.foo.com", homepage); - scoped_ptr startup_list( + std::unique_ptr startup_list( settings->GetUrlsToRestoreOnStartup()); EXPECT_TRUE(startup_list); std::vector startup_pages; @@ -941,7 +941,7 @@ TEST_F(ProfileResetterTest, FeedbackSerializationAsProtoTest) { "this test needs to be expanded"); for (int field_mask = 0; field_mask <= ResettableSettingsSnapshot::ALL_FIELDS; ++field_mask) { - scoped_ptr report = + std::unique_ptr report = SerializeSettingsReportToProto(nonorganic_snap, field_mask); EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::STARTUP_MODE), @@ -977,7 +977,7 @@ struct FeedbackCapture { MOCK_METHOD0(OnUpdatedList, void(void)); - scoped_ptr list_; + std::unique_ptr list_; }; // Make sure GetReadableFeedback handles non-ascii letters. @@ -1020,7 +1020,7 @@ TEST_F(ProfileResetterTest, GetReadableFeedback) { ::testing::Mock::VerifyAndClearExpectations(&capture); // The homepage and the startup page are in punycode. They are unreadable. // Trying to find the extension name. - scoped_ptr list = std::move(capture.list_); + std::unique_ptr list = std::move(capture.list_); ASSERT_TRUE(list); bool checked_extensions = false; bool checked_shortcuts = false; @@ -1048,7 +1048,7 @@ TEST_F(ProfileResetterTest, GetReadableFeedback) { TEST_F(ProfileResetterTest, DestroySnapshotFast) { FeedbackCapture capture; - scoped_ptr deleted_snapshot( + std::unique_ptr deleted_snapshot( new ResettableSettingsSnapshot(profile())); deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, base::Unretained(&capture))); diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc index 42c01873cb67ad..f676734b5999b0 100644 --- a/chrome/browser/profile_resetter/resettable_settings_snapshot.cc +++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.cc @@ -151,11 +151,11 @@ void ResettableSettingsSnapshot::SetShortcutsAndReport( callback.Run(); } -scoped_ptr SerializeSettingsReportToProto( +std::unique_ptr SerializeSettingsReportToProto( const ResettableSettingsSnapshot& snapshot, int field_mask) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - scoped_ptr report( + std::unique_ptr report( new reset_report::ChromeResetReport()); if (field_mask & ResettableSettingsSnapshot::STARTUP_MODE) { @@ -213,12 +213,12 @@ void SendSettingsFeedbackProto(const reset_report::ChromeResetReport& report, ->DispatchReport(report); } -scoped_ptr GetReadableFeedbackForSnapshot( +std::unique_ptr GetReadableFeedbackForSnapshot( Profile* profile, const ResettableSettingsSnapshot& snapshot) { DCHECK(profile); DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - scoped_ptr list(new base::ListValue); + std::unique_ptr list(new base::ListValue); AddPair(list.get(), l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_LOCALE), g_browser_process->GetApplicationLocale()); diff --git a/chrome/browser/profile_resetter/resettable_settings_snapshot.h b/chrome/browser/profile_resetter/resettable_settings_snapshot.h index fecaa4b77820b6..d857fa26ab1c02 100644 --- a/chrome/browser/profile_resetter/resettable_settings_snapshot.h +++ b/chrome/browser/profile_resetter/resettable_settings_snapshot.h @@ -5,12 +5,12 @@ #ifndef CHROME_BROWSER_PROFILE_RESETTER_RESETTABLE_SETTINGS_SNAPSHOT_H_ #define CHROME_BROWSER_PROFILE_RESETTER_RESETTABLE_SETTINGS_SNAPSHOT_H_ +#include #include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/strings/string_split.h" #include "chrome/browser/prefs/session_startup_pref.h" @@ -125,7 +125,7 @@ class ResettableSettingsSnapshot { // Serializes specified |snapshot| members to a protobuf. |field_mask| is a bit // mask of ResettableSettingsSnapshot::Field values. -scoped_ptr SerializeSettingsReportToProto( +std::unique_ptr SerializeSettingsReportToProto( const ResettableSettingsSnapshot& snapshot, int field_mask); @@ -136,7 +136,7 @@ void SendSettingsFeedbackProto(const reset_report::ChromeResetReport& report, // Returns list of key/value pairs for all available reported information // from the |profile| and some additional fields. -scoped_ptr GetReadableFeedbackForSnapshot( +std::unique_ptr GetReadableFeedbackForSnapshot( Profile* profile, const ResettableSettingsSnapshot& snapshot); diff --git a/chrome/browser/profile_resetter/triggered_profile_resetter_win_unittest.cc b/chrome/browser/profile_resetter/triggered_profile_resetter_win_unittest.cc index 8ff5ef7da8eaef..0d1780f6cb0e82 100644 --- a/chrome/browser/profile_resetter/triggered_profile_resetter_win_unittest.cc +++ b/chrome/browser/profile_resetter/triggered_profile_resetter_win_unittest.cc @@ -6,8 +6,9 @@ #include +#include + #include "base/bit_cast.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/field_trial.h" #include "base/test/test_reg_util_win.h" #include "base/win/registry.h" @@ -55,7 +56,7 @@ class TriggeredProfileResetterTest : public testing::Test { private: registry_util::RegistryOverrideManager override_manager_; - scoped_ptr field_trial_list_; + std::unique_ptr field_trial_list_; }; TEST_F(TriggeredProfileResetterTest, HasResetTriggerAndClear) { diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc index ba9a28ec93e6ed..25014739d023f9 100644 --- a/chrome/browser/push_messaging/push_messaging_browsertest.cc +++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc @@ -241,12 +241,12 @@ class PushMessagingBrowserTest : public InProcessBrowserTest { virtual Browser* GetBrowser() const { return browser(); } private: - scoped_ptr https_server_; + std::unique_ptr https_server_; gcm::FakeGCMProfileService* gcm_service_; PushMessagingServiceImpl* push_service_; #if defined(ENABLE_NOTIFICATIONS) - scoped_ptr notification_manager_; + std::unique_ptr notification_manager_; #endif DISALLOW_COPY_AND_ASSIGN(PushMessagingBrowserTest); diff --git a/chrome/browser/push_messaging/push_messaging_service_factory.cc b/chrome/browser/push_messaging/push_messaging_service_factory.cc index 44e1424f7bd7d1..24d667dbb78eb6 100644 --- a/chrome/browser/push_messaging/push_messaging_service_factory.cc +++ b/chrome/browser/push_messaging/push_messaging_service_factory.cc @@ -4,7 +4,8 @@ #include "chrome/browser/push_messaging/push_messaging_service_factory.h" -#include "base/memory/scoped_ptr.h" +#include + #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/permissions/permission_manager_factory.h" #include "chrome/browser/profiles/incognito_helpers.h" @@ -47,7 +48,7 @@ PushMessagingServiceFactory::~PushMessagingServiceFactory() {} void PushMessagingServiceFactory::RestoreFactoryForTests( content::BrowserContext* context) { SetTestingFactory(context, [](content::BrowserContext* context) { - return scoped_ptr( + return std::unique_ptr( GetInstance()->BuildServiceInstanceFor(context)); }); } diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.h b/chrome/browser/push_messaging/push_messaging_service_impl.h index 343548061f38bc..2b0a3b78f4c7d6 100644 --- a/chrome/browser/push_messaging/push_messaging_service_impl.h +++ b/chrome/browser/push_messaging/push_messaging_service_impl.h @@ -6,6 +6,8 @@ #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_ #include + +#include #include #include @@ -13,7 +15,6 @@ #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/background/background_trigger.h" #include "components/content_settings/core/browser/content_settings_observer.h" @@ -240,7 +241,8 @@ class PushMessagingServiceImpl : public content::PushMessagingService, MessageDispatchedCallback message_dispatched_callback_for_testing_; - scoped_ptr push_messaging_service_observer_; + std::unique_ptr + push_messaging_service_observer_; base::WeakPtrFactory weak_factory_; diff --git a/chrome/browser/push_messaging/push_messaging_service_observer.cc b/chrome/browser/push_messaging/push_messaging_service_observer.cc index 5c5c23cf98152f..bcd4ed0cc779c4 100644 --- a/chrome/browser/push_messaging/push_messaging_service_observer.cc +++ b/chrome/browser/push_messaging/push_messaging_service_observer.cc @@ -4,6 +4,7 @@ #include "chrome/browser/push_messaging/push_messaging_service_observer.h" +#include "base/memory/ptr_util.h" #include "build/build_config.h" #if defined(OS_ANDROID) @@ -11,10 +12,10 @@ #endif // static -scoped_ptr +std::unique_ptr PushMessagingServiceObserver::Create() { #if defined(OS_ANDROID) - return make_scoped_ptr(new PushMessagingServiceObserverAndroid()); + return base::WrapUnique(new PushMessagingServiceObserverAndroid()); #endif return nullptr; } diff --git a/chrome/browser/push_messaging/push_messaging_service_observer.h b/chrome/browser/push_messaging/push_messaging_service_observer.h index 80d841d96fd81e..0d1ed78cda010c 100644 --- a/chrome/browser/push_messaging/push_messaging_service_observer.h +++ b/chrome/browser/push_messaging/push_messaging_service_observer.h @@ -5,13 +5,13 @@ #ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_OBSERVER_H_ #define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_OBSERVER_H_ -#include "base/memory/scoped_ptr.h" +#include // Observes events and changes in the PushMessagingService. class PushMessagingServiceObserver { public: // Creates a new PushMessagingServiceObserver. - static scoped_ptr Create(); + static std::unique_ptr Create(); // Called when a push message has been fully handled. virtual void OnMessageHandled() = 0; diff --git a/chrome/browser/push_messaging/push_messaging_service_unittest.cc b/chrome/browser/push_messaging/push_messaging_service_unittest.cc index 303966f4addce4..fb3e4e356e38c9 100644 --- a/chrome/browser/push_messaging/push_messaging_service_unittest.cc +++ b/chrome/browser/push_messaging/push_messaging_service_unittest.cc @@ -75,8 +75,7 @@ class PushMessagingTestingProfile : public TestingProfile { DISALLOW_COPY_AND_ASSIGN(PushMessagingTestingProfile); }; - -scoped_ptr BuildFakeGCMProfileService( +std::unique_ptr BuildFakeGCMProfileService( content::BrowserContext* context) { return gcm::FakeGCMProfileService::Build(static_cast(context)); } diff --git a/chrome/browser/referrer_policy_browsertest.cc b/chrome/browser/referrer_policy_browsertest.cc index 5a433464a0c588..7f343250fbf153 100644 --- a/chrome/browser/referrer_policy_browsertest.cc +++ b/chrome/browser/referrer_policy_browsertest.cc @@ -491,7 +491,7 @@ IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, History) { GetExpectedTitle(start_url, EXPECT_ORIGIN_AS_REFERRER); content::WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); - scoped_ptr title_watcher( + std::unique_ptr title_watcher( new content::TitleWatcher(tab, expected_title)); // Watch for all possible outcomes to avoid timeouts if something breaks. @@ -547,7 +547,7 @@ IN_PROC_BROWSER_TEST_F(ReferrerPolicyTest, IFrame) { content::WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); base::string16 expected_title(base::ASCIIToUTF16("loaded")); - scoped_ptr title_watcher( + std::unique_ptr title_watcher( new content::TitleWatcher(tab, expected_title)); // Load a page that loads an iframe. diff --git a/chrome/browser/renderer_context_menu/context_menu_content_type_unittest.cc b/chrome/browser/renderer_context_menu/context_menu_content_type_unittest.cc index 92ef86dc42697c..89827778361b91 100644 --- a/chrome/browser/renderer_context_menu/context_menu_content_type_unittest.cc +++ b/chrome/browser/renderer_context_menu/context_menu_content_type_unittest.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/memory/scoped_ptr.h" +#include + #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h" #include "chrome/browser/renderer_context_menu/context_menu_content_type_factory.h" +#include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "components/renderer_context_menu/context_menu_content_type.h" #include "testing/gtest/include/gtest/gtest.h" @@ -66,8 +67,8 @@ content::ContextMenuParams CreateParams(int contexts) { TEST_F(ContextMenuContentTypeTest, CheckTypes) { { content::ContextMenuParams params = CreateParams(MenuItem::LINK); - scoped_ptr content_type(Create(web_contents(), - params)); + std::unique_ptr content_type( + Create(web_contents(), params)); EXPECT_TRUE(content_type->SupportsGroup( ContextMenuContentType::ITEM_GROUP_LINK)); EXPECT_TRUE(content_type->SupportsGroup( @@ -78,8 +79,8 @@ TEST_F(ContextMenuContentTypeTest, CheckTypes) { { content::ContextMenuParams params = CreateParams(MenuItem::SELECTION); - scoped_ptr content_type(Create(web_contents(), - params)); + std::unique_ptr content_type( + Create(web_contents(), params)); EXPECT_FALSE(content_type->SupportsGroup( ContextMenuContentType::ITEM_GROUP_LINK)); EXPECT_TRUE(content_type->SupportsGroup( @@ -92,8 +93,8 @@ TEST_F(ContextMenuContentTypeTest, CheckTypes) { { content::ContextMenuParams params = CreateParams(MenuItem::EDITABLE); - scoped_ptr content_type(Create(web_contents(), - params)); + std::unique_ptr content_type( + Create(web_contents(), params)); EXPECT_FALSE(content_type->SupportsGroup( ContextMenuContentType::ITEM_GROUP_LINK)); EXPECT_FALSE(content_type->SupportsGroup( @@ -104,8 +105,8 @@ TEST_F(ContextMenuContentTypeTest, CheckTypes) { { content::ContextMenuParams params = CreateParams(MenuItem::IMAGE); - scoped_ptr content_type(Create(web_contents(), - params)); + std::unique_ptr content_type( + Create(web_contents(), params)); EXPECT_TRUE(content_type->SupportsGroup( ContextMenuContentType::ITEM_GROUP_MEDIA_IMAGE)); EXPECT_TRUE(content_type->SupportsGroup( @@ -123,8 +124,8 @@ TEST_F(ContextMenuContentTypeTest, CheckTypes) { { content::ContextMenuParams params = CreateParams(MenuItem::VIDEO); - scoped_ptr content_type(Create(web_contents(), - params)); + std::unique_ptr content_type( + Create(web_contents(), params)); EXPECT_TRUE(content_type->SupportsGroup( ContextMenuContentType::ITEM_GROUP_MEDIA_VIDEO)); @@ -138,8 +139,8 @@ TEST_F(ContextMenuContentTypeTest, CheckTypes) { { content::ContextMenuParams params = CreateParams(MenuItem::AUDIO); - scoped_ptr content_type(Create(web_contents(), - params)); + std::unique_ptr content_type( + Create(web_contents(), params)); EXPECT_TRUE(content_type->SupportsGroup( ContextMenuContentType::ITEM_GROUP_MEDIA_AUDIO)); @@ -153,8 +154,8 @@ TEST_F(ContextMenuContentTypeTest, CheckTypes) { { content::ContextMenuParams params = CreateParams(MenuItem::FRAME); - scoped_ptr content_type(Create(web_contents(), - params)); + std::unique_ptr content_type( + Create(web_contents(), params)); EXPECT_TRUE(content_type->SupportsGroup( ContextMenuContentType::ITEM_GROUP_FRAME)); EXPECT_TRUE(content_type->SupportsGroup( diff --git a/chrome/browser/renderer_context_menu/mock_render_view_context_menu.h b/chrome/browser/renderer_context_menu/mock_render_view_context_menu.h index a8f8a7be17251b..c172e245b8aba3 100644 --- a/chrome/browser/renderer_context_menu/mock_render_view_context_menu.h +++ b/chrome/browser/renderer_context_menu/mock_render_view_context_menu.h @@ -6,10 +6,10 @@ #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_MOCK_RENDER_VIEW_CONTEXT_MENU_H_ #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "components/renderer_context_menu/render_view_context_menu_proxy.h" #include "ui/base/models/simple_menu_model.h" @@ -85,7 +85,7 @@ class MockRenderViewContextMenu : public ui::SimpleMenuModel::Delegate, // A dummy profile used in this test. Call GetPrefs() when a test needs to // change this profile and use PrefService methods. - scoped_ptr original_profile_; + std::unique_ptr original_profile_; // Either |original_profile_| or its incognito profile. Profile* profile_; diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index 85082a5f8f9062..fb8c8621df3350 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc @@ -1805,7 +1805,7 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { content::Referrer referrer = CreateReferrer(url, params_); DownloadManager* dlm = BrowserContext::GetDownloadManager(browser_context_); - scoped_ptr dl_params( + std::unique_ptr dl_params( DownloadUrlParameters::FromWebContents(source_web_contents_, url)); dl_params->set_referrer(referrer); dl_params->set_referrer_encoding(params_.frame_charset); @@ -2075,7 +2075,7 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { translate::TranslateDownloadManager::GetLanguageCode(target_lang); // Since the user decided to translate for that language and site, clears // any preferences for not translating them. - scoped_ptr prefs( + std::unique_ptr prefs( ChromeTranslateClient::CreateTranslatePrefs( GetPrefs(browser_context_))); prefs->UnblockLanguage(original_lang); diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.h b/chrome/browser/renderer_context_menu/render_view_context_menu.h index 43b95e59527b77..6e09d73714af36 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.h +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.h @@ -6,11 +6,11 @@ #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_H_ #include +#include #include #include #include "base/files/file_path.h" -#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/strings/string16.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h" @@ -184,17 +184,18 @@ class RenderViewContextMenu : public RenderViewContextMenuBase { // An observer that handles spelling suggestions, "Add to dictionary", and // "Ask Google for suggestions" items. - scoped_ptr spelling_suggestions_menu_observer_; + std::unique_ptr spelling_suggestions_menu_observer_; #if !defined(OS_MACOSX) // An observer that handles the submenu for showing spelling options. This // submenu lets users select the spelling language, for example. - scoped_ptr spelling_options_submenu_observer_; + std::unique_ptr + spelling_options_submenu_observer_; #endif #if defined(ENABLE_PRINT_PREVIEW) // An observer that disables menu items when print preview is active. - scoped_ptr print_preview_menu_observer_; + std::unique_ptr print_preview_menu_observer_; #endif // In the case of a MimeHandlerView this will point to the WebContents that diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc index 14e0ed5b8c897d..6e3270c1b12554 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc @@ -5,6 +5,7 @@ #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" #include +#include #include #include #include @@ -13,7 +14,6 @@ #include "base/command_line.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -65,7 +65,7 @@ class ContextMenuBrowserTest : public InProcessBrowserTest { ContextMenuBrowserTest() {} protected: - scoped_ptr CreateContextMenuMediaTypeNone( + std::unique_ptr CreateContextMenuMediaTypeNone( const GURL& unfiltered_url, const GURL& url) { return CreateContextMenu(unfiltered_url, url, base::string16(), @@ -73,14 +73,14 @@ class ContextMenuBrowserTest : public InProcessBrowserTest { ui::MENU_SOURCE_NONE); } - scoped_ptr CreateContextMenuMediaTypeImage( + std::unique_ptr CreateContextMenuMediaTypeImage( const GURL& url) { return CreateContextMenu(GURL(), url, base::string16(), blink::WebContextMenuData::MediaTypeImage, ui::MENU_SOURCE_NONE); } - scoped_ptr CreateContextMenu( + std::unique_ptr CreateContextMenu( const GURL& unfiltered_url, const GURL& url, const base::string16& link_text, @@ -101,7 +101,7 @@ class ContextMenuBrowserTest : public InProcessBrowserTest { params.writing_direction_left_to_right = 0; params.writing_direction_right_to_left = 0; #endif // OS_MACOSX - scoped_ptr menu( + std::unique_ptr menu( new TestRenderViewContextMenu(web_contents->GetMainFrame(), params)); menu->Init(); return menu; @@ -119,8 +119,9 @@ class ContextMenuBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenEntryPresentForNormalURLs) { - scoped_ptr menu = CreateContextMenuMediaTypeNone( - GURL("http://www.google.com/"), GURL("http://www.google.com/")); + std::unique_ptr menu = + CreateContextMenuMediaTypeNone(GURL("http://www.google.com/"), + GURL("http://www.google.com/")); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); @@ -132,7 +133,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenEntryAbsentForFilteredURLs) { - scoped_ptr menu = + std::unique_ptr menu = CreateContextMenuMediaTypeNone(GURL("chrome://history"), GURL()); ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); @@ -157,7 +158,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, ContextMenuForCanvas) { } IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextMouse) { - scoped_ptr menu = CreateContextMenu( + std::unique_ptr menu = CreateContextMenu( GURL("http://www.google.com/"), GURL("http://www.google.com/"), base::ASCIIToUTF16("Google"), blink::WebContextMenuData::MediaTypeNone, ui::MENU_SOURCE_MOUSE); @@ -166,7 +167,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextMouse) { } IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextTouchNoText) { - scoped_ptr menu = CreateContextMenu( + std::unique_ptr menu = CreateContextMenu( GURL("http://www.google.com/"), GURL("http://www.google.com/"), base::ASCIIToUTF16(""), blink::WebContextMenuData::MediaTypeNone, ui::MENU_SOURCE_TOUCH); @@ -175,7 +176,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextTouchNoText) { } IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextTouchTextOnly) { - scoped_ptr menu = CreateContextMenu( + std::unique_ptr menu = CreateContextMenu( GURL("http://www.google.com/"), GURL("http://www.google.com/"), base::ASCIIToUTF16("Google"), blink::WebContextMenuData::MediaTypeNone, ui::MENU_SOURCE_TOUCH); @@ -184,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextTouchTextOnly) { } IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, CopyLinkTextTouchTextImage) { - scoped_ptr menu = CreateContextMenu( + std::unique_ptr menu = CreateContextMenu( GURL("http://www.google.com/"), GURL("http://www.google.com/"), base::ASCIIToUTF16("Google"), blink::WebContextMenuData::MediaTypeImage, ui::MENU_SOURCE_TOUCH); @@ -394,7 +395,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, DataSaverOpenOrigImageInNewTab) { command_line->AppendSwitch( data_reduction_proxy::switches::kEnableDataReductionProxy); - scoped_ptr menu = + std::unique_ptr menu = CreateContextMenuMediaTypeImage(GURL("http://url.com/image.png")); ASSERT_FALSE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB)); @@ -408,7 +409,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, command_line->AppendSwitch( data_reduction_proxy::switches::kEnableDataReductionProxy); - scoped_ptr menu = + std::unique_ptr menu = CreateContextMenuMediaTypeImage(GURL("https://url.com/image.png")); ASSERT_FALSE( @@ -417,7 +418,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, } IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenImageInNewTab) { - scoped_ptr menu = + std::unique_ptr menu = CreateContextMenuMediaTypeImage(GURL("http://url.com/image.png")); ASSERT_FALSE( menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB)); @@ -428,8 +429,9 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenImageInNewTab) { #if !defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenLinkInProfileEntryPresent) { { - scoped_ptr menu(CreateContextMenuMediaTypeNone( - GURL("http://www.google.com/"), GURL("http://www.google.com/"))); + std::unique_ptr menu( + CreateContextMenuMediaTypeNone(GURL("http://www.google.com/"), + GURL("http://www.google.com/"))); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); @@ -445,8 +447,9 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenLinkInProfileEntryPresent) { CreateSecondaryProfile(1); { - scoped_ptr menu(CreateContextMenuMediaTypeNone( - GURL("http://www.google.com/"), GURL("http://www.google.com/"))); + std::unique_ptr menu( + CreateContextMenuMediaTypeNone(GURL("http://www.google.com/"), + GURL("http://www.google.com/"))); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); @@ -460,8 +463,9 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenLinkInProfileEntryPresent) { CreateSecondaryProfile(2); { - scoped_ptr menu(CreateContextMenuMediaTypeNone( - GURL("http://www.google.com/"), GURL("http://www.google.com/"))); + std::unique_ptr menu( + CreateContextMenuMediaTypeNone(GURL("http://www.google.com/"), + GURL("http://www.google.com/"))); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWTAB)); ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKNEWWINDOW)); @@ -522,7 +526,7 @@ IN_PROC_BROWSER_TEST_F(ContextMenuBrowserTest, OpenLinkInProfile) { ASSERT_TRUE(embedded_test_server()->Start()); GURL url(embedded_test_server()->GetURL("/")); - scoped_ptr menu( + std::unique_ptr menu( CreateContextMenuMediaTypeNone(url, url)); // Verify that the size of the menu is correct. @@ -697,7 +701,7 @@ class SearchByImageBrowserTest : public InProcessBrowserTest { menu_observer_.reset(); } - scoped_ptr menu_observer_; + std::unique_ptr menu_observer_; }; IN_PROC_BROWSER_TEST_F(SearchByImageBrowserTest, ImageSearchWithValidImage) { @@ -787,7 +791,7 @@ class LoadImageRequestInterceptor : public net::URLRequestInterceptor { // These are only used on the UI thread. int num_requests_; int requests_to_wait_for_; - scoped_ptr run_loop_; + std::unique_ptr run_loop_; // This prevents any risk of flake if any test doesn't wait for a request // it sent. Mutable so it can be accessed from a const function. @@ -809,7 +813,7 @@ class LoadImageBrowserTest : public InProcessBrowserTest { void AddLoadImageInterceptor(const std::string& image_path) { interceptor_ = new LoadImageRequestInterceptor(); - scoped_ptr owned_interceptor(interceptor_); + std::unique_ptr owned_interceptor(interceptor_); content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, base::Bind(&LoadImageBrowserTest::AddInterceptorForURL, @@ -830,7 +834,8 @@ class LoadImageBrowserTest : public InProcessBrowserTest { } void AddInterceptorForURL( - const GURL& url, scoped_ptr handler) { + const GURL& url, + std::unique_ptr handler) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); net::URLRequestFilter::GetInstance()->AddUrlInterceptor(url, std::move(handler)); @@ -839,7 +844,7 @@ class LoadImageBrowserTest : public InProcessBrowserTest { LoadImageRequestInterceptor* interceptor_; private: - scoped_ptr menu_observer_; + std::unique_ptr menu_observer_; }; IN_PROC_BROWSER_TEST_F(LoadImageBrowserTest, LoadImage) { diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc index d841f650310463..87df18b8802098 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_unittest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" +#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/thread_task_runner_handle.h" @@ -30,7 +31,6 @@ #include "content/public/browser/web_contents.h" #include "content/public/test/test_renderer_host.h" #include "content/public/test/web_contents_tester.h" - #include "extensions/browser/extension_prefs.h" #include "extensions/common/url_pattern.h" #include "testing/gtest/include/gtest/gtest.h" @@ -84,13 +84,13 @@ static content::ContextMenuParams CreateParams(int contexts) { } // Returns a test context menu. -scoped_ptr CreateContextMenu( +std::unique_ptr CreateContextMenu( content::WebContents* web_contents, ProtocolHandlerRegistry* registry) { content::ContextMenuParams params = CreateParams(MenuItem::LINK); params.unfiltered_link_url = params.link_url; - scoped_ptr menu(new TestRenderViewContextMenu( - web_contents->GetMainFrame(), params)); + std::unique_ptr menu( + new TestRenderViewContextMenu(web_contents->GetMainFrame(), params)); menu->set_protocol_handler_registry(registry); menu->Init(); return menu; @@ -321,7 +321,7 @@ class RenderViewContextMenuExtensionsTest : public RenderViewContextMenuTest { protected: extensions::TestExtensionEnvironment environment_; - scoped_ptr registry_; + std::unique_ptr registry_; DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuExtensionsTest); }; @@ -345,8 +345,8 @@ TEST_F(RenderViewContextMenuExtensionsTest, MenuItem* item2 = CreateTestItem(extension2, 2); ASSERT_TRUE(menu_manager->AddContextItem(extension2, item2)); - scoped_ptr web_contents = environment().MakeTab(); - scoped_ptr menu( + std::unique_ptr web_contents = environment().MakeTab(); + std::unique_ptr menu( CreateContextMenu(web_contents.get(), registry_.get())); const ui::MenuModel& model = menu->menu_model(); @@ -375,7 +375,7 @@ class RenderViewContextMenuPrefsTest : public ChromeRenderViewHostTestHarness { ChromeRenderViewHostTestHarness::TearDown(); } - scoped_ptr CreateContextMenu() { + std::unique_ptr CreateContextMenu() { return ::CreateContextMenu(web_contents(), registry_.get()); } @@ -411,7 +411,7 @@ class RenderViewContextMenuPrefsTest : public ChromeRenderViewHostTestHarness { settings->InitDataReductionProxySettings( drp_test_context_->io_data(), drp_test_context_->pref_service(), drp_test_context_->request_context_getter(), - make_scoped_ptr(new data_reduction_proxy::DataStore()), + base::WrapUnique(new data_reduction_proxy::DataStore()), base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get()); } @@ -427,11 +427,11 @@ class RenderViewContextMenuPrefsTest : public ChromeRenderViewHostTestHarness { } protected: - scoped_ptr + std::unique_ptr drp_test_context_; private: - scoped_ptr registry_; + std::unique_ptr registry_; DISALLOW_COPY_AND_ASSIGN(RenderViewContextMenuPrefsTest); }; @@ -440,7 +440,7 @@ class RenderViewContextMenuPrefsTest : public ChromeRenderViewHostTestHarness { // Open Link in Incognito Window link in the context menu is disabled. TEST_F(RenderViewContextMenuPrefsTest, DisableOpenInIncognitoWindowWhenIncognitoIsDisabled) { - scoped_ptr menu(CreateContextMenu()); + std::unique_ptr menu(CreateContextMenu()); // Initially the Incognito mode is be enabled. So is the Open Link in // Incognito Window link. @@ -461,7 +461,7 @@ TEST_F(RenderViewContextMenuPrefsTest, // cause DCHECK failure. TEST_F(RenderViewContextMenuPrefsTest, IsCustomCommandIdEnabled) { - scoped_ptr menu(CreateContextMenu()); + std::unique_ptr menu(CreateContextMenu()); EXPECT_FALSE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_CUSTOM_FIRST)); } @@ -475,7 +475,7 @@ TEST_F(RenderViewContextMenuPrefsTest, DataSaverEnabledSaveImageAs) { content::ContextMenuParams params = CreateParams(MenuItem::IMAGE); params.unfiltered_link_url = params.link_url; content::WebContents* wc = web_contents(); - scoped_ptr menu( + std::unique_ptr menu( new TestRenderViewContextMenu(wc->GetMainFrame(), params)); menu->ExecuteCommand(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 0); @@ -496,7 +496,7 @@ TEST_F(RenderViewContextMenuPrefsTest, DataSaverDisabledSaveImageAs) { content::ContextMenuParams params = CreateParams(MenuItem::IMAGE); params.unfiltered_link_url = params.link_url; content::WebContents* wc = web_contents(); - scoped_ptr menu( + std::unique_ptr menu( new TestRenderViewContextMenu(wc->GetMainFrame(), params)); menu->ExecuteCommand(IDC_CONTENT_CONTEXT_SAVEIMAGEAS, 0); @@ -518,7 +518,7 @@ TEST_F(RenderViewContextMenuPrefsTest, DataSaverLoadImage) { data_reduction_proxy::chrome_proxy_lo_fi_directive(); params.unfiltered_link_url = params.link_url; content::WebContents* wc = web_contents(); - scoped_ptr menu( + std::unique_ptr menu( new TestRenderViewContextMenu(wc->GetMainFrame(), params)); AppendImageItems(menu.get()); diff --git a/chrome/browser/renderer_context_menu/spelling_menu_observer.cc b/chrome/browser/renderer_context_menu/spelling_menu_observer.cc index 9838234f26b5f2..b0c5757dab3ba2 100644 --- a/chrome/browser/renderer_context_menu/spelling_menu_observer.cc +++ b/chrome/browser/renderer_context_menu/spelling_menu_observer.cc @@ -286,7 +286,7 @@ void SpellingMenuObserver::ExecuteCommand(int command_id) { if (!integrate_spelling_service_.GetValue()) { content::RenderViewHost* rvh = proxy_->GetRenderViewHost(); gfx::Rect rect = rvh->GetWidget()->GetView()->GetViewBounds(); - scoped_ptr model( + std::unique_ptr model( new SpellingBubbleModel(profile, proxy_->GetWebContents())); chrome::ShowConfirmBubble( proxy_->GetWebContents()->GetTopLevelNativeWindow(), diff --git a/chrome/browser/renderer_context_menu/spelling_menu_observer.h b/chrome/browser/renderer_context_menu/spelling_menu_observer.h index dac209947b5501..0b4cc0a1353b41 100644 --- a/chrome/browser/renderer_context_menu/spelling_menu_observer.h +++ b/chrome/browser/renderer_context_menu/spelling_menu_observer.h @@ -8,11 +8,11 @@ #include #include +#include #include #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "base/timer/timer.h" #include "chrome/browser/spellchecker/spelling_service_client.h" @@ -105,7 +105,7 @@ class SpellingMenuObserver : public RenderViewContextMenuObserver { base::string16 result_; // The URLFetcher object used for sending a JSON-RPC request. - scoped_ptr client_; + std::unique_ptr client_; // A timer used for loading animation. base::RepeatingTimer animation_timer_; diff --git a/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc b/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc index ffde1c0c7b1d79..700fb55d6804b2 100644 --- a/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc +++ b/chrome/browser/renderer_context_menu/spelling_menu_observer_browsertest.cc @@ -65,8 +65,8 @@ class SpellingMenuObserverTest : public InProcessBrowserTest { MockRenderViewContextMenu* menu() { return menu_.get(); } SpellingMenuObserver* observer() { return observer_.get(); } private: - scoped_ptr observer_; - scoped_ptr menu_; + std::unique_ptr observer_; + std::unique_ptr menu_; DISALLOW_COPY_AND_ASSIGN(SpellingMenuObserverTest); }; diff --git a/chrome/browser/renderer_context_menu/spelling_options_submenu_observer_browsertest.cc b/chrome/browser/renderer_context_menu/spelling_options_submenu_observer_browsertest.cc index efa14dedc5428c..5166a596b47ccd 100644 --- a/chrome/browser/renderer_context_menu/spelling_options_submenu_observer_browsertest.cc +++ b/chrome/browser/renderer_context_menu/spelling_options_submenu_observer_browsertest.cc @@ -4,7 +4,8 @@ #include "chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h" -#include "base/memory/scoped_ptr.h" +#include + #include "base/values.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/renderer_context_menu/mock_render_view_context_menu.h" @@ -62,8 +63,8 @@ class SpellingOptionsSubMenuObserverTest : public InProcessBrowserTest { SpellingOptionsSubMenuObserver* observer() { return observer_.get(); } private: - scoped_ptr menu_; - scoped_ptr observer_; + std::unique_ptr menu_; + std::unique_ptr observer_; DISALLOW_COPY_AND_ASSIGN(SpellingOptionsSubMenuObserverTest); }; diff --git a/chrome/browser/renderer_host/chrome_extension_message_filter.cc b/chrome/browser/renderer_host/chrome_extension_message_filter.cc index 59412fc07d01b6..1b00ed436a5c42 100644 --- a/chrome/browser/renderer_host/chrome_extension_message_filter.cc +++ b/chrome/browser/renderer_host/chrome_extension_message_filter.cc @@ -10,6 +10,7 @@ #include "base/bind_helpers.h" #include "base/files/file_path.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" @@ -276,7 +277,7 @@ void ChromeExtensionMessageFilter::OnGetExtMessageBundleOnBlockingPool( const extensions::ExtensionSet& extension_set = extension_info_map_->extensions(); - scoped_ptr dictionary_map( + std::unique_ptr dictionary_map( extensions::file_util::LoadMessageBundleSubstitutionMapWithImports( extension_id, extension_set)); @@ -291,7 +292,7 @@ void ChromeExtensionMessageFilter::OnAddAPIActionToExtensionActivityLog( scoped_refptr action = new extensions::Action( extension_id, base::Time::Now(), extensions::Action::ACTION_API_CALL, params.api_call); - action->set_args(make_scoped_ptr(params.arguments.DeepCopy())); + action->set_args(base::WrapUnique(params.arguments.DeepCopy())); if (!params.extra.empty()) { action->mutable_other()->SetString( activity_log_constants::kActionExtra, params.extra); @@ -305,7 +306,7 @@ void ChromeExtensionMessageFilter::OnAddDOMActionToExtensionActivityLog( scoped_refptr action = new extensions::Action( extension_id, base::Time::Now(), extensions::Action::ACTION_DOM_ACCESS, params.api_call); - action->set_args(make_scoped_ptr(params.arguments.DeepCopy())); + action->set_args(base::WrapUnique(params.arguments.DeepCopy())); action->set_page_url(params.url); action->set_page_title(base::UTF16ToUTF8(params.url_title)); action->mutable_other()->SetInteger(activity_log_constants::kActionDomVerb, @@ -319,7 +320,7 @@ void ChromeExtensionMessageFilter::OnAddEventToExtensionActivityLog( scoped_refptr action = new extensions::Action( extension_id, base::Time::Now(), extensions::Action::ACTION_API_EVENT, params.api_call); - action->set_args(make_scoped_ptr(params.arguments.DeepCopy())); + action->set_args(base::WrapUnique(params.arguments.DeepCopy())); if (!params.extra.empty()) { action->mutable_other()->SetString(activity_log_constants::kActionExtra, params.extra); diff --git a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.h b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.h index 048446c0daef7e..1f4f5fa50b8061 100644 --- a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.h +++ b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.h @@ -7,8 +7,9 @@ #import +#include + #include "base/mac/scoped_nsobject.h" -#include "base/memory/scoped_ptr.h" #import "content/public/browser/render_widget_host_view_mac_delegate.h" namespace content { @@ -24,7 +25,8 @@ class SpellCheckObserver; : NSObject { @private content::RenderWidgetHost* renderWidgetHost_; // weak - scoped_ptr + std::unique_ptr< + ChromeRenderWidgetHostViewMacDelegateInternal::SpellCheckObserver> spellingObserver_; // Used for continuous spell checking. diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc index b1ee0283b3b175..d42d630f9c8d14 100644 --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc @@ -170,13 +170,14 @@ void UpdatePrerenderNetworkBytesCallback( } #if defined(ENABLE_EXTENSIONS) -void SendExecuteMimeTypeHandlerEvent(scoped_ptr stream, - int64_t expected_content_size, - int render_process_id, - int render_frame_id, - const std::string& extension_id, - const std::string& view_id, - bool embedded) { +void SendExecuteMimeTypeHandlerEvent( + std::unique_ptr stream, + int64_t expected_content_size, + int render_process_id, + int render_frame_id, + const std::string& extension_id, + const std::string& view_id, + bool embedded) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); content::WebContents* web_contents = @@ -510,7 +511,7 @@ void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles( extensions::ExtensionThrottleManager* extension_throttle_manager = io_data->GetExtensionThrottleManager(); if (extension_throttle_manager) { - scoped_ptr extension_throttle = + std::unique_ptr extension_throttle = extension_throttle_manager->MaybeCreateThrottle(request); if (extension_throttle) throttles->push_back(extension_throttle.release()); @@ -595,7 +596,7 @@ bool ChromeResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( void ChromeResourceDispatcherHostDelegate::OnStreamCreated( net::URLRequest* request, - scoped_ptr stream) { + std::unique_ptr stream) { #if defined(ENABLE_EXTENSIONS) const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); std::map::iterator ix = diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h index c20a3eef0b451c..3b580561e71451 100644 --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_RENDERER_HOST_CHROME_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ #include +#include #include #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/external_protocol/external_protocol_handler.h" #include "content/public/browser/resource_dispatcher_host_delegate.h" @@ -73,7 +73,7 @@ class ChromeResourceDispatcherHostDelegate GURL* origin, std::string* payload) override; void OnStreamCreated(net::URLRequest* request, - scoped_ptr stream) override; + std::unique_ptr stream) override; void OnResponseStarted(net::URLRequest* request, content::ResourceContext* resource_context, content::ResourceResponse* response, diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc index 68b6fded333494..1026d5c4169b15 100644 --- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc +++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate_browsertest.cc @@ -33,7 +33,7 @@ namespace { static const char kTestPolicyHeader[] = "test_header"; static const char kServerRedirectUrl[] = "/server-redirect"; -scoped_ptr HandleTestRequest( +std::unique_ptr HandleTestRequest( const net::test_server::HttpRequest& request) { if (base::StartsWith(request.relative_url, kServerRedirectUrl, base::CompareCase::SENSITIVE)) { @@ -42,13 +42,13 @@ scoped_ptr HandleTestRequest( std::string redirect_target = request.relative_url.substr(query_string_pos + 1); - scoped_ptr http_response( + std::unique_ptr http_response( new net::test_server::BasicHttpResponse); http_response->set_code(net::HTTP_MOVED_PERMANENTLY); http_response->AddCustomHeader("Location", redirect_target); return std::move(http_response); } else { - scoped_ptr http_response( + std::unique_ptr http_response( new net::test_server::BasicHttpResponse); http_response->set_code(net::HTTP_OK); http_response->set_content("Success"); @@ -138,7 +138,7 @@ class ChromeResourceDispatcherHostDelegateBrowserTest : protected: // The fake URL for DMServer we are using. GURL dm_url_; - scoped_ptr dispatcher_host_delegate_; + std::unique_ptr dispatcher_host_delegate_; private: DISALLOW_COPY_AND_ASSIGN(ChromeResourceDispatcherHostDelegateBrowserTest); diff --git a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc index 72a9745609c913..98934dab9a2e4a 100644 --- a/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc +++ b/chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.cc @@ -29,7 +29,8 @@ ChromeBrowserPepperHostFactory::ChromeBrowserPepperHostFactory( ChromeBrowserPepperHostFactory::~ChromeBrowserPepperHostFactory() {} -scoped_ptr ChromeBrowserPepperHostFactory::CreateResourceHost( +std::unique_ptr +ChromeBrowserPepperHostFactory::CreateResourceHost( ppapi::host::PpapiHost* host, PP_Resource resource, PP_Instance instance, @@ -38,7 +39,7 @@ scoped_ptr ChromeBrowserPepperHostFactory::CreateResourceHost( // Make sure the plugin is giving us a valid instance for this resource. if (!host_->IsValidInstance(instance)) - return scoped_ptr(); + return std::unique_ptr(); // Private interfaces. if (host_->GetPpapiHost()->permissions().HasPermission( @@ -47,7 +48,7 @@ scoped_ptr ChromeBrowserPepperHostFactory::CreateResourceHost( case PpapiHostMsg_Broker_Create::ID: { scoped_refptr broker_filter( new chrome::PepperBrokerMessageFilter(instance, host_)); - return scoped_ptr(new MessageFilterHost( + return std::unique_ptr(new MessageFilterHost( host_->GetPpapiHost(), instance, resource, broker_filter)); } #if defined(OS_CHROMEOS) @@ -55,7 +56,7 @@ scoped_ptr ChromeBrowserPepperHostFactory::CreateResourceHost( scoped_refptr pv_filter( new chrome::PepperPlatformVerificationMessageFilter(host_, instance)); - return scoped_ptr(new MessageFilterHost( + return std::unique_ptr(new MessageFilterHost( host_->GetPpapiHost(), instance, resource, pv_filter)); } #endif @@ -63,7 +64,7 @@ scoped_ptr ChromeBrowserPepperHostFactory::CreateResourceHost( case PpapiHostMsg_OutputProtection_Create::ID: { scoped_refptr output_protection_filter( new chrome::PepperOutputProtectionMessageFilter(host_, instance)); - return scoped_ptr( + return std::unique_ptr( new MessageFilterHost(host_->GetPpapiHost(), instance, resource, output_protection_filter)); } @@ -76,16 +77,16 @@ scoped_ptr ChromeBrowserPepperHostFactory::CreateResourceHost( ppapi::PERMISSION_FLASH)) { switch (message.type()) { case PpapiHostMsg_Flash_Create::ID: - return scoped_ptr( + return std::unique_ptr( new chrome::PepperFlashBrowserHost(host_, instance, resource)); case PpapiHostMsg_FlashClipboard_Create::ID: { scoped_refptr clipboard_filter( new chrome::PepperFlashClipboardMessageFilter); - return scoped_ptr(new MessageFilterHost( + return std::unique_ptr(new MessageFilterHost( host_->GetPpapiHost(), instance, resource, clipboard_filter)); } case PpapiHostMsg_FlashDRM_Create::ID: - return scoped_ptr( + return std::unique_ptr( new chrome::PepperFlashDRMHost(host_, instance, resource)); } } @@ -100,10 +101,10 @@ scoped_ptr ChromeBrowserPepperHostFactory::CreateResourceHost( chrome::PepperIsolatedFileSystemMessageFilter* isolated_fs_filter = chrome::PepperIsolatedFileSystemMessageFilter::Create(instance, host_); if (!isolated_fs_filter) - return scoped_ptr(); - return scoped_ptr( + return std::unique_ptr(); + return std::unique_ptr( new MessageFilterHost(host, instance, resource, isolated_fs_filter)); } - return scoped_ptr(); + return std::unique_ptr(); } diff --git a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc index fa089eee5d75c7..5f5a1c72c38aa7 100644 --- a/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc +++ b/chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc @@ -51,7 +51,7 @@ int RenderProcessHostCount() { } WebContents* FindFirstDevToolsContents() { - scoped_ptr widgets( + std::unique_ptr widgets( RenderWidgetHost::GetRenderWidgetHosts()); while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { if (!widget->GetProcess()->HasConnection()) diff --git a/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc b/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc index 891ee982b500db..bc07dc3b3a1df9 100644 --- a/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc +++ b/chrome/browser/renderer_host/safe_browsing_resource_throttle.cc @@ -42,13 +42,14 @@ void RecordHistogramResourceTypeSafe(content::ResourceType resource_type) { // Return a dictionary with "url"=|url-spec| and optionally // |name|=|value| (if not null), for netlogging. // This will also add a reference to the original request's net_log ID. -scoped_ptr NetLogUrlCallback( +std::unique_ptr NetLogUrlCallback( const net::URLRequest* request, const GURL& url, const char* name, const char* value, net::NetLogCaptureMode /* capture_mode */) { - scoped_ptr event_params(new base::DictionaryValue()); + std::unique_ptr event_params( + new base::DictionaryValue()); event_params->SetString("url", url.spec()); if (name && value) event_params->SetString(name, value); @@ -57,11 +58,11 @@ scoped_ptr NetLogUrlCallback( } // Return a dictionary with |name|=|value|, for netlogging. -scoped_ptr NetLogStringCallback( - const char* name, - const char* value, - net::NetLogCaptureMode) { - scoped_ptr event_params(new base::DictionaryValue()); +std::unique_ptr NetLogStringCallback(const char* name, + const char* value, + net::NetLogCaptureMode) { + std::unique_ptr event_params( + new base::DictionaryValue()); if (name && value) event_params->SetString(name, value); return std::move(event_params); diff --git a/chrome/browser/rlz/chrome_rlz_tracker_delegate.h b/chrome/browser/rlz/chrome_rlz_tracker_delegate.h index 0e48175f0c5ec6..1fdc71aafa598e 100644 --- a/chrome/browser/rlz/chrome_rlz_tracker_delegate.h +++ b/chrome/browser/rlz/chrome_rlz_tracker_delegate.h @@ -56,7 +56,7 @@ class ChromeRLZTrackerDelegate : public rlz::RLZTrackerDelegate, // Subscription for receiving callbacks that a URL was opened from the // omnibox. - scoped_ptr::Subscription> + std::unique_ptr::Subscription> omnibox_url_opened_subscription_; DISALLOW_COPY_AND_ASSIGN(ChromeRLZTrackerDelegate); diff --git a/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc b/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc index fd7d6e00a24e0a..d300626710f1c8 100644 --- a/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc +++ b/chrome/browser/rlz/chrome_rlz_tracker_delegate_unittest.cc @@ -4,7 +4,8 @@ #include "chrome/browser/rlz/chrome_rlz_tracker_delegate.h" -#include "base/memory/scoped_ptr.h" +#include + #include "chrome/browser/chrome_notification_types.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/navigation_entry.h" @@ -28,13 +29,13 @@ class ChromeRLZTrackerDelegateTest : public testing::Test { } private: - scoped_ptr delegate_; + std::unique_ptr delegate_; }; TEST_F(ChromeRLZTrackerDelegateTest, ObserveHandlesBadArgs) { - scoped_ptr details( + std::unique_ptr details( new content::LoadCommittedDetails()); - scoped_ptr entry( + std::unique_ptr entry( content::NavigationEntry::Create()); details->entry = entry.get(); details->entry->SetPageID(0); diff --git a/chrome/browser/safe_json_parser_browsertest.cc b/chrome/browser/safe_json_parser_browsertest.cc index ec45551edae584..b37873029e75fe 100644 --- a/chrome/browser/safe_json_parser_browsertest.cc +++ b/chrome/browser/safe_json_parser_browsertest.cc @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include "base/bind.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" -#include "base/memory/scoped_ptr.h" #include "base/values.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/safe_json/safe_json_parser.h" @@ -37,7 +38,7 @@ class SafeJsonParserTest : public InProcessBrowserTest { message_loop_runner_ = new content::MessageLoopRunner; std::string error; - scoped_ptr value = base::JSONReader::ReadAndReturnError( + std::unique_ptr value = base::JSONReader::ReadAndReturnError( json, base::JSON_PARSE_RFC, nullptr, &error); SafeJsonParser::SuccessCallback success_callback; @@ -61,8 +62,8 @@ class SafeJsonParserTest : public InProcessBrowserTest { } private: - void ExpectValue(scoped_ptr expected_value, - scoped_ptr actual_value) { + void ExpectValue(std::unique_ptr expected_value, + std::unique_ptr actual_value) { EXPECT_TRUE(base::Value::Equals(actual_value.get(), expected_value.get())) << "Expected: " << MaybeToJson(expected_value.get()) << " Actual: " << MaybeToJson(actual_value.get()); @@ -75,7 +76,7 @@ class SafeJsonParserTest : public InProcessBrowserTest { message_loop_runner_->Quit(); } - void FailWithValue(scoped_ptr value) { + void FailWithValue(std::unique_ptr value) { ADD_FAILURE() << MaybeToJson(value.get()); message_loop_runner_->Quit(); } diff --git a/chrome/browser/search/hotword_installer_browsertest.cc b/chrome/browser/search/hotword_installer_browsertest.cc index 94a02da72948d3..6fbe83c7ec62af 100644 --- a/chrome/browser/search/hotword_installer_browsertest.cc +++ b/chrome/browser/search/hotword_installer_browsertest.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/webstore_startup_installer.h" #include "chrome/browser/profiles/profile.h" @@ -69,9 +71,9 @@ class MockHotwordService : public HotwordService { base::WeakPtrFactory weak_factory_; }; -scoped_ptr BuildMockHotwordService( +std::unique_ptr BuildMockHotwordService( content::BrowserContext* context) { - return make_scoped_ptr( + return base::WrapUnique( new MockHotwordService(static_cast(context))); } diff --git a/chrome/browser/search/hotword_service.h b/chrome/browser/search/hotword_service.h index c90ea7bd721c0f..cc4f2ebe17ba68 100644 --- a/chrome/browser/search/hotword_service.h +++ b/chrome/browser/search/hotword_service.h @@ -214,7 +214,7 @@ class HotwordService : public MediaCaptureDevicesDispatcher::Observer, extensions::ExtensionRegistryObserver> extension_registry_observer_; - scoped_ptr audio_history_handler_; + std::unique_ptr audio_history_handler_; bool microphone_available_; @@ -228,7 +228,7 @@ class HotwordService : public MediaCaptureDevicesDispatcher::Observer, bool reinstall_pending_; // Whether we are currently in the process of training the speaker model. bool training_; - scoped_ptr session_observer_; + std::unique_ptr session_observer_; // Stores the launch mode for the Hotword Audio Verification App. LaunchMode hotword_audio_verification_launch_mode_; diff --git a/chrome/browser/search/hotword_service_unittest.cc b/chrome/browser/search/hotword_service_unittest.cc index e5887df78dce1c..bff640f46d7abf 100644 --- a/chrome/browser/search/hotword_service_unittest.cc +++ b/chrome/browser/search/hotword_service_unittest.cc @@ -4,10 +4,11 @@ #include "chrome/browser/search/hotword_service.h" +#include #include #include "base/command_line.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "base/metrics/field_trial.h" #include "base/test/test_simple_task_runner.h" #include "build/build_config.h" @@ -64,7 +65,7 @@ class MockAudioHistoryHandler : public HotwordAudioHistoryHandler { private: int get_audio_history_calls_; - scoped_ptr web_history_; + std::unique_ptr web_history_; }; class MockHotwordService : public HotwordService { @@ -80,12 +81,12 @@ class MockHotwordService : public HotwordService { } void InstallHotwordExtensionFromWebstore(int num_tries) override { - scoped_ptr manifest = + std::unique_ptr manifest = extensions::DictionaryBuilder() - .Set("name", "Hotword Test Extension") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Build(); + .Set("name", "Hotword Test Extension") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Build(); scoped_refptr extension = extensions::ExtensionBuilder() .SetManifest(std::move(manifest)) @@ -114,9 +115,9 @@ class MockHotwordService : public HotwordService { std::string extension_id_; }; -scoped_ptr BuildMockHotwordService( +std::unique_ptr BuildMockHotwordService( content::BrowserContext* context) { - return make_scoped_ptr( + return base::WrapUnique( new MockHotwordService(static_cast(context))); } @@ -166,7 +167,7 @@ INSTANTIATE_TEST_CASE_P(HotwordServiceTests, // Disabled due to http://crbug.com/503963. TEST_P(HotwordServiceTest, DISABLED_IsHotwordAllowedLocale) { TestingProfile::Builder profile_builder; - scoped_ptr profile = profile_builder.Build(); + std::unique_ptr profile = profile_builder.Build(); #if defined(ENABLE_HOTWORDING) bool hotwording_enabled = true; diff --git a/chrome/browser/search/iframe_source_unittest.cc b/chrome/browser/search/iframe_source_unittest.cc index ceaeeafe208f5e..9a87bd313170a0 100644 --- a/chrome/browser/search/iframe_source_unittest.cc +++ b/chrome/browser/search/iframe_source_unittest.cc @@ -4,9 +4,10 @@ #include "chrome/browser/search/iframe_source.h" +#include + #include "base/bind.h" #include "base/memory/ref_counted_memory.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "chrome/browser/search/instant_io_context.h" #include "content/public/browser/browser_thread.h" @@ -89,16 +90,13 @@ class IframeSourceTest : public testing::Test { return ""; } - scoped_ptr MockRequest( - const std::string& url, - bool allocate_info, - int render_process_id, - int render_frame_id) { - scoped_ptr request( + std::unique_ptr MockRequest(const std::string& url, + bool allocate_info, + int render_process_id, + int render_frame_id) { + std::unique_ptr request( resource_context_.GetRequestContext()->CreateRequest( - GURL(url), - net::DEFAULT_PRIORITY, - NULL)); + GURL(url), net::DEFAULT_PRIORITY, NULL)); if (allocate_info) { content::ResourceRequestInfo::AllocateForTesting( request.get(), @@ -150,14 +148,14 @@ class IframeSourceTest : public testing::Test { net::TestURLRequestContext test_url_request_context_; content::MockResourceContext resource_context_; - scoped_ptr source_; + std::unique_ptr source_; content::URLDataSource::GotDataCallback callback_; scoped_refptr instant_io_context_; scoped_refptr response_; }; TEST_F(IframeSourceTest, ShouldServiceRequest) { - scoped_ptr request; + std::unique_ptr request; request = MockRequest("http://test/loader.js", true, kNonInstantRendererPID, 0); EXPECT_FALSE(source()->ShouldServiceRequest(request.get())); diff --git a/chrome/browser/search/instant_service.h b/chrome/browser/search/instant_service.h index dccf4e7cc58f26..b48c84452005db 100644 --- a/chrome/browser/search/instant_service.h +++ b/chrome/browser/search/instant_service.h @@ -5,12 +5,12 @@ #ifndef CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ #define CHROME_BROWSER_SEARCH_INSTANT_SERVICE_H_ +#include #include #include #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "components/history/core/browser/history_types.h" @@ -166,7 +166,7 @@ class InstantService : public KeyedService, std::vector suggestions_items_; // Theme-related data for NTP overlay to adopt themes. - scoped_ptr theme_info_; + std::unique_ptr theme_info_; base::ObserverList observers_; @@ -175,18 +175,18 @@ class InstantService : public KeyedService, scoped_refptr instant_io_context_; // Set to NULL if the default search provider does not support Instant. - scoped_ptr instant_prerenderer_; + std::unique_ptr instant_prerenderer_; // Used to check whether notifications from TemplateURLService indicate a // change that affects the default search provider. - scoped_ptr previous_default_search_provider_; + std::unique_ptr previous_default_search_provider_; GURL previous_google_base_url_; // Suggestions Service to fetch server suggestions. suggestions::SuggestionsService* suggestions_service_; // Subscription to the SuggestionsService. - scoped_ptr< + std::unique_ptr< suggestions::SuggestionsService::ResponseCallbackList::Subscription> suggestions_subscription_; diff --git a/chrome/browser/search/instant_service_unittest.cc b/chrome/browser/search/instant_service_unittest.cc index 92d88bc3bbd969..82fbd3714a5338 100644 --- a/chrome/browser/search/instant_service_unittest.cc +++ b/chrome/browser/search/instant_service_unittest.cc @@ -2,15 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/search/instant_service.h" + +#include #include #include #include -#include "base/memory/scoped_ptr.h" #include "base/metrics/field_trial.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/search/instant_service.h" #include "chrome/browser/search/instant_service_observer.h" #include "chrome/browser/search/instant_unittest_base.h" #include "chrome/browser/search/search.h" @@ -58,7 +59,7 @@ class InstantServiceTest : public InstantUnitTestBase { return instant_service_->suggestions_items_; } - scoped_ptr instant_service_observer_; + std::unique_ptr instant_service_observer_; }; class InstantServiceEnabledTest : public InstantServiceTest { @@ -100,7 +101,7 @@ TEST_F(InstantServiceTest, DispatchGoogleURLUpdated) { } TEST_F(InstantServiceEnabledTest, SendsSearchURLsToRenderer) { - scoped_ptr rph( + std::unique_ptr rph( new content::MockRenderProcessHost(profile())); rph->sink().ClearMessages(); instant_service_->Observe( diff --git a/chrome/browser/search/instant_unittest_base.h b/chrome/browser/search/instant_unittest_base.h index 1a13a10798028b..e6bebf588c5bbb 100644 --- a/chrome/browser/search/instant_unittest_base.h +++ b/chrome/browser/search/instant_unittest_base.h @@ -47,7 +47,7 @@ class InstantUnitTestBase : public BrowserWithTestWindowTest { InstantService* instant_service_; TemplateURLService* template_url_service_; - scoped_ptr field_trial_list_; + std::unique_ptr field_trial_list_; private: // BrowserWithTestWindowTest override: diff --git a/chrome/browser/search/local_files_ntp_source.cc b/chrome/browser/search/local_files_ntp_source.cc index 4c141672b7c071..5cce98f71feb53 100644 --- a/chrome/browser/search/local_files_ntp_source.cc +++ b/chrome/browser/search/local_files_ntp_source.cc @@ -4,6 +4,8 @@ #include "chrome/browser/search/local_files_ntp_source.h" +#include + #if !defined(GOOGLE_CHROME_BUILD) #include "base/bind.h" @@ -11,7 +13,6 @@ #include "base/files/file_util.h" #include "base/location.h" #include "base/memory/ref_counted_memory.h" -#include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/strings/string_util.h" #include "base/threading/thread_restrictions.h" diff --git a/chrome/browser/search/local_ntp_source.cc b/chrome/browser/search/local_ntp_source.cc index 108e6279c09665..bf6bfa99023333 100644 --- a/chrome/browser/search/local_ntp_source.cc +++ b/chrome/browser/search/local_ntp_source.cc @@ -6,12 +6,13 @@ #include +#include + #include "base/command_line.h" #include "base/json/json_string_value_serializer.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted_memory.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/field_trial.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -124,8 +125,8 @@ void AddGoogleSearchboxPlaceholderString(base::DictionaryValue* dictionary) { // Populates |translated_strings| dictionary for the local NTP. |is_google| // indicates that this page is the Google Local NTP. -scoped_ptr GetTranslatedStrings(bool is_google) { - scoped_ptr translated_strings( +std::unique_ptr GetTranslatedStrings(bool is_google) { + std::unique_ptr translated_strings( new base::DictionaryValue()); AddString(translated_strings.get(), "thumbnailRemovedNotification", diff --git a/chrome/browser/search/search_unittest.cc b/chrome/browser/search/search_unittest.cc index 4108dfd8f1e392..3d96e1e311568b 100644 --- a/chrome/browser/search/search_unittest.cc +++ b/chrome/browser/search/search_unittest.cc @@ -111,7 +111,7 @@ class SearchTest : public BrowserWithTestWindowTest { contents->GetRenderProcessHost()->GetID()); } - scoped_ptr field_trial_list_; + std::unique_ptr field_trial_list_; }; struct SearchTestCase { diff --git a/chrome/browser/search/suggestions/image_fetcher_impl_browsertest.cc b/chrome/browser/search/suggestions/image_fetcher_impl_browsertest.cc index 2388f4eaa7ecd4..04e9b3fb69bddc 100644 --- a/chrome/browser/search/suggestions/image_fetcher_impl_browsertest.cc +++ b/chrome/browser/search/suggestions/image_fetcher_impl_browsertest.cc @@ -4,10 +4,11 @@ #include "chrome/browser/search/suggestions/image_fetcher_impl.h" +#include + #include "base/bind.h" #include "base/files/file_path.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -87,7 +88,7 @@ class ImageFetcherImplBrowserTest : public InProcessBrowserTest { } void StartOrQueueNetworkRequestHelper(const GURL& image_url) { - scoped_ptr image_fetcher_(CreateImageFetcher()); + std::unique_ptr image_fetcher_(CreateImageFetcher()); base::RunLoop run_loop; image_fetcher_->StartOrQueueNetworkRequest( diff --git a/chrome/browser/search/suggestions/suggestions_service_factory.cc b/chrome/browser/search/suggestions/suggestions_service_factory.cc index 4edfcfa4b84c0c..34db255941cf32 100644 --- a/chrome/browser/search/suggestions/suggestions_service_factory.cc +++ b/chrome/browser/search/suggestions/suggestions_service_factory.cc @@ -4,9 +4,9 @@ #include "chrome/browser/search/suggestions/suggestions_service_factory.h" +#include #include -#include "base/memory/scoped_ptr.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search/suggestions/image_fetcher_impl.h" @@ -71,23 +71,22 @@ KeyedService* SuggestionsServiceFactory::BuildServiceInstanceFor( ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile(profile); - scoped_ptr suggestions_store( + std::unique_ptr suggestions_store( new SuggestionsStore(profile->GetPrefs())); - scoped_ptr blacklist_store( + std::unique_ptr blacklist_store( new BlacklistStore(profile->GetPrefs())); - scoped_ptr > db( + std::unique_ptr> db( new leveldb_proto::ProtoDatabaseImpl(background_task_runner)); base::FilePath database_dir( profile->GetPath().Append(FILE_PATH_LITERAL("Thumbnails"))); - scoped_ptr image_fetcher( + std::unique_ptr image_fetcher( new ImageFetcherImpl(profile->GetRequestContext())); - scoped_ptr thumbnail_manager( - new ImageManager( - std::move(image_fetcher), std::move(db), database_dir, - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); + std::unique_ptr thumbnail_manager(new ImageManager( + std::move(image_fetcher), std::move(db), database_dir, + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); return new SuggestionsService( signin_manager, token_service, sync_service, profile->GetRequestContext(), std::move(suggestions_store), std::move(thumbnail_manager), diff --git a/chrome/browser/search/suggestions/suggestions_source.cc b/chrome/browser/search/suggestions/suggestions_source.cc index e8804f7528d302..7c237d1d325a06 100644 --- a/chrome/browser/search/suggestions/suggestions_source.cc +++ b/chrome/browser/search/suggestions/suggestions_source.cc @@ -188,7 +188,7 @@ base::MessageLoop* SuggestionsSource::MessageLoopForRequestPath( } void SuggestionsSource::OnThumbnailsFetched(RequestContext* context) { - scoped_ptr context_deleter(context); + std::unique_ptr context_deleter(context); std::string output = RenderOutputHtml(context->is_refresh, context->suggestions_profile, diff --git a/chrome/browser/search/thumbnail_source.h b/chrome/browser/search/thumbnail_source.h index f9c9dae0c17aa1..9e645c50246ce4 100644 --- a/chrome/browser/search/thumbnail_source.h +++ b/chrome/browser/search/thumbnail_source.h @@ -5,11 +5,11 @@ #ifndef CHROME_BROWSER_SEARCH_THUMBNAIL_SOURCE_H_ #define CHROME_BROWSER_SEARCH_THUMBNAIL_SOURCE_H_ +#include #include #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/url_data_source.h" #include "url/gurl.h" @@ -71,7 +71,7 @@ class ThumbnailSource : public content::URLDataSource { scoped_refptr thumbnail_service_; // ImageFetcher. - scoped_ptr image_fetcher_; + std::unique_ptr image_fetcher_; // Indicate that, when a URL for which we don't have a thumbnail is requested // from this source, then Chrome should capture a thumbnail next time it diff --git a/chrome/browser/search/thumbnail_source_unittest.cc b/chrome/browser/search/thumbnail_source_unittest.cc index 923b4bf190c960..31183733a2caeb 100644 --- a/chrome/browser/search/thumbnail_source_unittest.cc +++ b/chrome/browser/search/thumbnail_source_unittest.cc @@ -27,7 +27,7 @@ class ThumbnailSourceTest : public testing::Test { private: content::TestBrowserThreadBundle thread_bundle_; - scoped_ptr profile_manager_; + std::unique_ptr profile_manager_; TestingProfile* profile_; // Owned by TestingProfileManager. }; diff --git a/chrome/browser/service_process/service_process_control.cc b/chrome/browser/service_process/service_process_control.cc index 533f765c27f342..606f629f496237 100644 --- a/chrome/browser/service_process/service_process_control.cc +++ b/chrome/browser/service_process/service_process_control.cc @@ -58,7 +58,8 @@ void ServiceProcessControl::ConnectInternal() { BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get())); } -void ServiceProcessControl::SetChannel(scoped_ptr channel) { +void ServiceProcessControl::SetChannel( + std::unique_ptr channel) { channel_ = std::move(channel); } @@ -118,7 +119,8 @@ void ServiceProcessControl::Launch(const base::Closure& success_task, UMA_HISTOGRAM_ENUMERATION("CloudPrint.ServiceEvents", SERVICE_EVENT_LAUNCH, SERVICE_EVENT_MAX); - scoped_ptr cmd_line(CreateServiceProcessCommandLine()); + std::unique_ptr cmd_line( + CreateServiceProcessCommandLine()); // And then start the process asynchronously. launcher_ = new Launcher(std::move(cmd_line)); launcher_->Run(base::Bind(&ServiceProcessControl::OnProcessLaunched, @@ -324,7 +326,7 @@ ServiceProcessControl* ServiceProcessControl::GetInstance() { } ServiceProcessControl::Launcher::Launcher( - scoped_ptr cmd_line) + std::unique_ptr cmd_line) : cmd_line_(std::move(cmd_line)), launched_(false), retry_count_(0) {} // Execute the command line to start the process asynchronously. diff --git a/chrome/browser/service_process/service_process_control.h b/chrome/browser/service_process/service_process_control.h index 80e18b6b86fc27..9fc7e019cc9e02 100644 --- a/chrome/browser/service_process/service_process_control.h +++ b/chrome/browser/service_process/service_process_control.h @@ -7,6 +7,7 @@ #include +#include #include #include #include @@ -15,7 +16,6 @@ #include "base/callback.h" #include "base/cancelable_callback.h" #include "base/id_map.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/process/process.h" #include "build/build_config.h" @@ -147,7 +147,7 @@ class ServiceProcessControl : public IPC::Sender, class Launcher : public base::RefCountedThreadSafe { public: - explicit Launcher(scoped_ptr cmd_line); + explicit Launcher(std::unique_ptr cmd_line); // Execute the command line to start the process asynchronously. After the // command is executed |task| is called with the process handle on the UI // thread. @@ -165,7 +165,7 @@ class ServiceProcessControl : public IPC::Sender, void DoRun(); void Notify(); - scoped_ptr cmd_line_; + std::unique_ptr cmd_line_; base::Closure notify_task_; bool launched_; uint32_t retry_count_; @@ -201,12 +201,12 @@ class ServiceProcessControl : public IPC::Sender, void ConnectInternal(); // Takes ownership of the pointer. Split out for testing. - void SetChannel(scoped_ptr channel); + void SetChannel(std::unique_ptr channel); static void RunAllTasksHelper(TaskList* task_list); // IPC channel to the service process. - scoped_ptr channel_; + std::unique_ptr channel_; // Service process launcher. scoped_refptr launcher_; diff --git a/chrome/browser/services/gcm/fake_gcm_profile_service.cc b/chrome/browser/services/gcm/fake_gcm_profile_service.cc index ba20c64b36c2ec..bb68fb5a29e549 100644 --- a/chrome/browser/services/gcm/fake_gcm_profile_service.cc +++ b/chrome/browser/services/gcm/fake_gcm_profile_service.cc @@ -119,10 +119,11 @@ void CustomFakeGCMDriver::OnDispatchMessage(const std::string& app_id, } // namespace // static -scoped_ptr FakeGCMProfileService::Build( +std::unique_ptr FakeGCMProfileService::Build( content::BrowserContext* context) { Profile* profile = static_cast(context); - scoped_ptr service(new FakeGCMProfileService(profile)); + std::unique_ptr service( + new FakeGCMProfileService(profile)); service->SetDriverForTesting(new CustomFakeGCMDriver(service.get())); return std::move(service); } diff --git a/chrome/browser/services/gcm/fake_gcm_profile_service.h b/chrome/browser/services/gcm/fake_gcm_profile_service.h index 57d114a1b72b8b..aabba5e5aaf0b6 100644 --- a/chrome/browser/services/gcm/fake_gcm_profile_service.h +++ b/chrome/browser/services/gcm/fake_gcm_profile_service.h @@ -6,10 +6,10 @@ #define CHROME_BROWSER_SERVICES_GCM_FAKE_GCM_PROFILE_SERVICE_H_ #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/gcm_driver/gcm_driver.h" #include "components/gcm_driver/gcm_profile_service.h" @@ -28,7 +28,7 @@ class FakeGCMProfileService : public GCMProfileService { // Helper function to be used with // KeyedService::SetTestingFactory(). - static scoped_ptr Build(content::BrowserContext* context); + static std::unique_ptr Build(content::BrowserContext* context); explicit FakeGCMProfileService(Profile* profile); ~FakeGCMProfileService() override; diff --git a/chrome/browser/services/gcm/gcm_profile_service_factory.cc b/chrome/browser/services/gcm/gcm_profile_service_factory.cc index 7e506fe06f1159..1ea2058554d18a 100644 --- a/chrome/browser/services/gcm/gcm_profile_service_factory.cc +++ b/chrome/browser/services/gcm/gcm_profile_service_factory.cc @@ -4,7 +4,8 @@ #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" -#include "base/memory/scoped_ptr.h" +#include + #include "build/build_config.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" @@ -71,11 +72,11 @@ KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor( return new GCMProfileService( profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), chrome::GetChannel(), - scoped_ptr(new ProfileIdentityProvider( + std::unique_ptr(new ProfileIdentityProvider( SigninManagerFactory::GetForProfile(profile), ProfileOAuth2TokenServiceFactory::GetForProfile(profile), LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))), - scoped_ptr(new GCMClientFactory), + std::unique_ptr(new GCMClientFactory), content::BrowserThread::GetMessageLoopProxyForThread( content::BrowserThread::UI), content::BrowserThread::GetMessageLoopProxyForThread( diff --git a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc index 33a68cde4621eb..3247467039243c 100644 --- a/chrome/browser/services/gcm/gcm_profile_service_unittest.cc +++ b/chrome/browser/services/gcm/gcm_profile_service_unittest.cc @@ -2,15 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/gcm_driver/gcm_profile_service.h" - +#include #include #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "build/build_config.h" #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" @@ -19,6 +18,7 @@ #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" #include "chrome/common/channel_info.h" #include "chrome/test/base/testing_profile.h" +#include "components/gcm_driver/gcm_profile_service.h" #if defined(OS_CHROMEOS) #include "chromeos/dbus/dbus_thread_manager.h" #endif @@ -42,7 +42,7 @@ namespace { const char kTestAppID[] = "TestApp"; const char kUserID[] = "user"; -scoped_ptr BuildGCMProfileService( +std::unique_ptr BuildGCMProfileService( content::BrowserContext* context) { Profile* profile = Profile::FromBrowserContext(context); base::SequencedWorkerPool* worker_pool = @@ -51,14 +51,14 @@ scoped_ptr BuildGCMProfileService( worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( worker_pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); - return make_scoped_ptr(new gcm::GCMProfileService( + return base::WrapUnique(new gcm::GCMProfileService( profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), chrome::GetChannel(), - scoped_ptr(new ProfileIdentityProvider( + std::unique_ptr(new ProfileIdentityProvider( SigninManagerFactory::GetForProfile(profile), ProfileOAuth2TokenServiceFactory::GetForProfile(profile), LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(profile))), - scoped_ptr(new gcm::FakeGCMClientFactory( + std::unique_ptr(new gcm::FakeGCMClientFactory( content::BrowserThread::GetMessageLoopProxyForThread( content::BrowserThread::UI), content::BrowserThread::GetMessageLoopProxyForThread( @@ -109,9 +109,9 @@ class GCMProfileServiceTest : public testing::Test { private: content::TestBrowserThreadBundle thread_bundle_; - scoped_ptr profile_; + std::unique_ptr profile_; GCMProfileService* gcm_profile_service_; - scoped_ptr gcm_app_handler_; + std::unique_ptr gcm_app_handler_; std::string registration_id_; GCMClient::Result registration_result_; diff --git a/chrome/browser/services/gcm/instance_id/instance_id_profile_service.h b/chrome/browser/services/gcm/instance_id/instance_id_profile_service.h index c243378770b6ea..ff83531f15e08f 100644 --- a/chrome/browser/services/gcm/instance_id/instance_id_profile_service.h +++ b/chrome/browser/services/gcm/instance_id/instance_id_profile_service.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_SERVICES_GCM_INSTANCE_ID_INSTANCE_ID_PROFILE_SERVICE_H_ #define CHROME_BROWSER_SERVICES_GCM_INSTANCE_ID_INSTANCE_ID_PROFILE_SERVICE_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/keyed_service/core/keyed_service.h" class Profile; @@ -27,7 +28,7 @@ class InstanceIDProfileService : public KeyedService { InstanceIDDriver* driver() const { return driver_.get(); } private: - scoped_ptr driver_; + std::unique_ptr driver_; DISALLOW_COPY_AND_ASSIGN(InstanceIDProfileService); }; diff --git a/chrome/browser/services/gcm/instance_id/instance_id_profile_service_factory.cc b/chrome/browser/services/gcm/instance_id/instance_id_profile_service_factory.cc index 1bc848f4c4f4ed..408c1e919fbeaf 100644 --- a/chrome/browser/services/gcm/instance_id/instance_id_profile_service_factory.cc +++ b/chrome/browser/services/gcm/instance_id/instance_id_profile_service_factory.cc @@ -4,7 +4,8 @@ #include "chrome/browser/services/gcm/instance_id/instance_id_profile_service_factory.h" -#include "base/memory/scoped_ptr.h" +#include + #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" diff --git a/chrome/browser/sessions/better_session_restore_browsertest.cc b/chrome/browser/sessions/better_session_restore_browsertest.cc index 7723014cc8cb3a..07a97238305435 100644 --- a/chrome/browser/sessions/better_session_restore_browsertest.cc +++ b/chrome/browser/sessions/better_session_restore_browsertest.cc @@ -102,7 +102,7 @@ class URLRequestFakerForPostRequestsInterceptor const net::UploadDataStream* upload_data = request->get_upload(); last_upload_bytes_.clear(); if (upload_data) { - const std::vector>* readers = + const std::vector>* readers = upload_data->GetElementReaders(); if (readers) { for (size_t i = 0; i < readers->size(); ++i) { @@ -187,13 +187,13 @@ class BetterSessionRestoreTest : public InProcessBrowserTest { CHECK(base::ReadFileToString(path, &contents)); net::URLRequestFilter::GetInstance()->AddUrlInterceptor( GURL(fake_server_address_ + test_path_ + *it), - scoped_ptr( + std::unique_ptr( new URLRequestFakerInterceptor(contents))); } post_interceptor_ = new URLRequestFakerForPostRequestsInterceptor(); net::URLRequestFilter::GetInstance()->AddUrlInterceptor( GURL(fake_server_address_ + test_path_ + "posted.php"), - scoped_ptr(post_interceptor_)); + std::unique_ptr(post_interceptor_)); } protected: @@ -203,7 +203,7 @@ class BetterSessionRestoreTest : public InProcessBrowserTest { helper.SetForceBrowserNotAliveWithNoWindows(true); helper.ReleaseService(); g_browser_process->set_background_mode_manager_for_test( - scoped_ptr(new FakeBackgroundModeManager)); + std::unique_ptr(new FakeBackgroundModeManager)); } void StoreDataWithPage(const std::string& filename) { diff --git a/chrome/browser/sessions/persistent_tab_restore_service_unittest.cc b/chrome/browser/sessions/persistent_tab_restore_service_unittest.cc index 17e99a10bb28e9..2e0825b4b952e0 100644 --- a/chrome/browser/sessions/persistent_tab_restore_service_unittest.cc +++ b/chrome/browser/sessions/persistent_tab_restore_service_unittest.cc @@ -5,11 +5,13 @@ #include "components/sessions/core/persistent_tab_restore_service.h" #include + #include #include #include "base/compiler_specific.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -84,10 +86,10 @@ class PersistentTabRestoreServiceTest : public ChromeRenderViewHostTestHarness { // testing::Test: void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); - live_tab_ = make_scoped_ptr(new sessions::ContentLiveTab(web_contents())); + live_tab_ = base::WrapUnique(new sessions::ContentLiveTab(web_contents())); time_factory_ = new PersistentTabRestoreTimeFactory(); service_.reset(new sessions::PersistentTabRestoreService( - make_scoped_ptr(new ChromeTabRestoreServiceClient(profile())), + base::WrapUnique(new ChromeTabRestoreServiceClient(profile())), time_factory_)); } @@ -127,7 +129,7 @@ class PersistentTabRestoreServiceTest : public ChromeRenderViewHostTestHarness { content::RunAllBlockingPoolTasksUntilIdle(); service_.reset(); service_.reset(new sessions::PersistentTabRestoreService( - make_scoped_ptr(new ChromeTabRestoreServiceClient(profile())), + base::WrapUnique(new ChromeTabRestoreServiceClient(profile())), time_factory_)); SynchronousLoadTabsFromLastSession(); } @@ -158,7 +160,8 @@ class PersistentTabRestoreServiceTest : public ChromeRenderViewHostTestHarness { // way of AddWindowWithOneTabToSessionService. If |pinned| is true, the // tab is marked as pinned in the session service. void CreateSessionServiceWithOneWindow(bool pinned) { - scoped_ptr session_service(new SessionService(profile())); + std::unique_ptr session_service( + new SessionService(profile())); SessionServiceFactory::SetForTestProfile(profile(), std::move(session_service)); @@ -180,8 +183,8 @@ class PersistentTabRestoreServiceTest : public ChromeRenderViewHostTestHarness { GURL url2_; GURL url3_; std::string user_agent_override_; - scoped_ptr live_tab_; - scoped_ptr service_; + std::unique_ptr live_tab_; + std::unique_ptr service_; PersistentTabRestoreTimeFactory* time_factory_; }; diff --git a/chrome/browser/sessions/restore_on_startup_policy_handler_unittest.cc b/chrome/browser/sessions/restore_on_startup_policy_handler_unittest.cc index 9833a897cf4335..d9d3d2ac24524b 100644 --- a/chrome/browser/sessions/restore_on_startup_policy_handler_unittest.cc +++ b/chrome/browser/sessions/restore_on_startup_policy_handler_unittest.cc @@ -2,15 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/sessions/restore_on_startup_policy_handler.h" + +#include #include #include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/prefs/session_startup_pref.h" -#include "chrome/browser/sessions/restore_on_startup_policy_handler.h" #include "chrome/common/pref_names.h" #include "components/policy/core/browser/configuration_policy_handler.h" #include "components/policy/core/browser/policy_error_map.h" @@ -102,7 +103,7 @@ TEST_F(RestoreOnStartupPolicyHandlerTest, SetPolicyValue( key::kRestoreOnStartup, new base::FundamentalValue(SessionStartupPref::kPrefValueLast)); - scoped_ptr urls(new base::ListValue); + std::unique_ptr urls(new base::ListValue); urls->AppendString("http://foo.com"); SetPolicyValue(key::kCookiesSessionOnlyForUrls, urls.release()); // Checking should succeed but add an error to the error map. diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index ada8811e02d6cc..19abe46125faca 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -17,7 +18,6 @@ #include "base/command_line.h" #include "base/debug/alias.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram.h" @@ -719,7 +719,7 @@ class SessionRestoreImpl : public content::NotificationObserver { // When asynchronous it's possible for there to be no windows. To make sure // Chrome doesn't prematurely exit we register a KeepAlive for the lifetime // of this object. - scoped_ptr keep_alive_; + std::unique_ptr keep_alive_; // The time we started the restore. base::TimeTicks restore_started_; diff --git a/chrome/browser/sessions/session_restore.h b/chrome/browser/sessions/session_restore.h index 5f9c9016894884..c37666a37748e2 100644 --- a/chrome/browser/sessions/session_restore.h +++ b/chrome/browser/sessions/session_restore.h @@ -46,7 +46,7 @@ class SessionRestore { // Used by objects calling RegisterOnSessionRestoredCallback() to de-register // themselves when they are destroyed. using CallbackSubscription = - scoped_ptr::Subscription>; + std::unique_ptr::Subscription>; // Restores the last session. |behavior| is a bitmask of Behaviors, see it // for details. If |browser| is non-null the tabs for the first window are diff --git a/chrome/browser/sessions/session_restore_android.cc b/chrome/browser/sessions/session_restore_android.cc index 0c4d42c6161163..812d85b233fba9 100644 --- a/chrome/browser/sessions/session_restore_android.cc +++ b/chrome/browser/sessions/session_restore_android.cc @@ -30,7 +30,7 @@ content::WebContents* SessionRestore::RestoreForeignSessionTab( Profile* profile = Profile::FromBrowserContext(context); TabModel* tab_model = TabModelList::GetTabModelForWebContents(web_contents); DCHECK(tab_model); - std::vector> entries = + std::vector> entries = sessions::ContentSerializedNavigationBuilder::ToNavigationEntries( session_tab.navigations, profile); content::WebContents* new_web_contents = content::WebContents::Create( diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index 35277adf6eeb02..a40d9bf9b85905 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc @@ -129,7 +129,7 @@ class SessionRestoreTest : public InProcessBrowserTest { Profile* profile = browser->profile(); // Close the browser. - scoped_ptr keep_alive(new ScopedKeepAlive( + std::unique_ptr keep_alive(new ScopedKeepAlive( KeepAliveOrigin::SESSION_RESTORE, KeepAliveRestartOption::DISABLED)); CloseBrowserSynchronously(browser); @@ -1361,15 +1361,15 @@ IN_PROC_BROWSER_TEST_F(SessionRestoreTest, SessionStorageAfterTabReplace) { content::SessionStorageNamespaceMap session_storage_namespace_map; session_storage_namespace_map[std::string()] = controller->GetDefaultSessionStorageNamespace(); - scoped_ptr web_contents( + std::unique_ptr web_contents( content::WebContents::CreateWithSessionStorage( content::WebContents::CreateParams(browser()->profile()), session_storage_namespace_map)); TabStripModel* tab_strip_model = browser()->tab_strip_model(); - scoped_ptr old_web_contents( - tab_strip_model->ReplaceWebContentsAt( - tab_strip_model->active_index(), web_contents.release())); + std::unique_ptr old_web_contents( + tab_strip_model->ReplaceWebContentsAt(tab_strip_model->active_index(), + web_contents.release())); // Navigate with the new tab. ui_test_utils::NavigateToURL(browser(), url2_); // old_web_contents goes out of scope. @@ -1408,7 +1408,7 @@ IN_PROC_BROWSER_TEST_F(SmartSessionRestoreTest, PRE_CorrectLoadingOrder) { browser()->tab_strip_model()->ActivateTabAt(i, true); // Close the browser. - scoped_ptr keep_alive(new ScopedKeepAlive( + std::unique_ptr keep_alive(new ScopedKeepAlive( KeepAliveOrigin::SESSION_RESTORE, KeepAliveRestartOption::DISABLED)); CloseBrowserSynchronously(browser()); @@ -1452,7 +1452,7 @@ IN_PROC_BROWSER_TEST_F(SmartSessionRestoreTest, MAYBE_CorrectLoadingOrder) { // Close the browser that gets opened automatically so we can track the order // of loading of the tabs. - scoped_ptr keep_alive(new ScopedKeepAlive( + std::unique_ptr keep_alive(new ScopedKeepAlive( KeepAliveOrigin::SESSION_RESTORE, KeepAliveRestartOption::DISABLED)); CloseBrowserSynchronously(browser()); // We have an extra tab that is added when the test starts, which gets ignored diff --git a/chrome/browser/sessions/session_restore_stats_collector.cc b/chrome/browser/sessions/session_restore_stats_collector.cc index 41c03973e4b195..023106212d28d3 100644 --- a/chrome/browser/sessions/session_restore_stats_collector.cc +++ b/chrome/browser/sessions/session_restore_stats_collector.cc @@ -111,7 +111,7 @@ SessionRestoreStatsCollector::TabState::TabState( SessionRestoreStatsCollector::SessionRestoreStatsCollector( const base::TimeTicks& restore_started, - scoped_ptr reporting_delegate) + std::unique_ptr reporting_delegate) : done_tracking_non_deferred_tabs_(false), got_first_foreground_load_(false), got_first_paint_(false), diff --git a/chrome/browser/sessions/session_restore_stats_collector.h b/chrome/browser/sessions/session_restore_stats_collector.h index dbcb69f4ef01bb..e7e3a883721f03 100644 --- a/chrome/browser/sessions/session_restore_stats_collector.h +++ b/chrome/browser/sessions/session_restore_stats_collector.h @@ -119,7 +119,7 @@ class SessionRestoreStatsCollector // Constructs a SessionRestoreStatsCollector. SessionRestoreStatsCollector( const base::TimeTicks& restore_started, - scoped_ptr reporting_delegate); + std::unique_ptr reporting_delegate); // Adds new tabs to the list of tracked tabs. void TrackTabs(const std::vector& tabs); @@ -186,7 +186,7 @@ class SessionRestoreStatsCollector void ReleaseIfDoneTracking(); // Testing seam for configuring the tick clock in use. - void set_tick_clock(scoped_ptr tick_clock) { + void set_tick_clock(std::unique_ptr tick_clock) { tick_clock_ = std::move(tick_clock); } @@ -225,10 +225,10 @@ class SessionRestoreStatsCollector // The source of ticks used for taking timing information. This is // configurable as a testing seam. Defaults to using base::DefaultTickClock, // which in turn uses base::TimeTicks. - scoped_ptr tick_clock_; + std::unique_ptr tick_clock_; // The reporting delegate used to report gathered statistics. - scoped_ptr reporting_delegate_; + std::unique_ptr reporting_delegate_; // For keeping SessionRestoreStatsCollector alive while it is still working // even if no TabLoader references it. The object only lives on if it still diff --git a/chrome/browser/sessions/session_restore_stats_collector_unittest.cc b/chrome/browser/sessions/session_restore_stats_collector_unittest.cc index 45d1c0cfcb5d6e..26e25db2146de3 100644 --- a/chrome/browser/sessions/session_restore_stats_collector_unittest.cc +++ b/chrome/browser/sessions/session_restore_stats_collector_unittest.cc @@ -160,8 +160,8 @@ class TestSessionRestoreStatsCollector : public SessionRestoreStatsCollector { using SessionRestoreStatsCollector::Observe; TestSessionRestoreStatsCollector( - scoped_ptr tick_clock, - scoped_ptr reporting_delegate) + std::unique_ptr tick_clock, + std::unique_ptr reporting_delegate) : SessionRestoreStatsCollector(tick_clock->NowTicks(), std::move(reporting_delegate)) { set_tick_clock(std::move(tick_clock)); @@ -203,8 +203,8 @@ class SessionRestoreStatsCollectorTest : public testing::Test { // its job, and will clean itself up when done. scoped_refptr stats_collector = new TestSessionRestoreStatsCollector( - scoped_ptr(test_tick_clock_), - scoped_ptr( + std::unique_ptr(test_tick_clock_), + std::unique_ptr( passthrough_reporting_delegate_)); stats_collector_ = stats_collector.get(); stats_collector = nullptr; @@ -301,7 +301,7 @@ class SessionRestoreStatsCollectorTest : public testing::Test { // A new web contents factory is generated per test. This automatically cleans // up any tabs created by previous tests. - scoped_ptr test_web_contents_factory_; + std::unique_ptr test_web_contents_factory_; // These are recreated for each test. The reporting delegate allows the test // to observe the behaviour of the SessionRestoreStatsCollector under test. diff --git a/chrome/browser/sessions/session_restore_test_helper.h b/chrome/browser/sessions/session_restore_test_helper.h index 26f32d9c29e8d0..b72f1b863c3dac 100644 --- a/chrome/browser/sessions/session_restore_test_helper.h +++ b/chrome/browser/sessions/session_restore_test_helper.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_TEST_HELPER_H_ #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_TEST_HELPER_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/sessions/session_restore.h" diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 43ed6e30d4961c..74fcfae78ae450 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -869,7 +869,7 @@ void SessionService::ScheduleResetCommands() { } void SessionService::ScheduleCommand( - scoped_ptr command) { + std::unique_ptr command) { DCHECK(command); if (ReplacePendingCommand(base_session_service_.get(), &command)) return; diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h index 0986a6e76b3595..3653df1840a43b 100644 --- a/chrome/browser/sessions/session_service.h +++ b/chrome/browser/sessions/session_service.h @@ -293,7 +293,7 @@ class SessionService : public sessions::BaseSessionServiceDelegate, void ScheduleResetCommands(); // Schedules the specified command. - void ScheduleCommand(scoped_ptr command); + void ScheduleCommand(std::unique_ptr command); // Converts all pending tab/window closes to commands and schedules them. void CommitPendingCloses(); @@ -342,7 +342,7 @@ class SessionService : public sessions::BaseSessionServiceDelegate, bool should_use_delayed_save_; // The owned BaseSessionService. - scoped_ptr base_session_service_; + std::unique_ptr base_session_service_; content::NotificationRegistrar registrar_; diff --git a/chrome/browser/sessions/session_service_factory.h b/chrome/browser/sessions/session_service_factory.h index 852a9559dc8c44..0be6e27ec602d7 100644 --- a/chrome/browser/sessions/session_service_factory.h +++ b/chrome/browser/sessions/session_service_factory.h @@ -48,7 +48,7 @@ class SessionServiceFactory : public BrowserContextKeyedServiceFactory { // For test use: force setting of the session service for a given profile. // This will delete a previous session service for this profile if it exists. static void SetForTestProfile(Profile* profile, - scoped_ptr service) { + std::unique_ptr service) { GetInstance()->BrowserContextShutdown(profile); GetInstance()->BrowserContextDestroyed(profile); GetInstance()->Associate(profile, std::move(service)); diff --git a/chrome/browser/sessions/session_service_test_helper.h b/chrome/browser/sessions/session_service_test_helper.h index 036e9a41d1b314..8ecd40530f3bf0 100644 --- a/chrome/browser/sessions/session_service_test_helper.h +++ b/chrome/browser/sessions/session_service_test_helper.h @@ -7,11 +7,11 @@ #include +#include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "components/sessions/core/session_id.h" @@ -84,7 +84,7 @@ class SessionServiceTestHelper { const base::Closure& task); private: - scoped_ptr service_; + std::unique_ptr service_; DISALLOW_COPY_AND_ASSIGN(SessionServiceTestHelper); }; diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc index dfa5f3bd1195d8..661b652bb0fbbe 100644 --- a/chrome/browser/sessions/session_service_unittest.cc +++ b/chrome/browser/sessions/session_service_unittest.cc @@ -2,14 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/sessions/session_service.h" + #include +#include + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/location.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" @@ -25,7 +28,6 @@ #include "chrome/browser/profiles/profile_attributes_entry.h" #include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/profiles/profile_manager.h" -#include "chrome/browser/sessions/session_service.h" #include "chrome/browser/sessions/session_service_test_helper.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/url_constants.h" @@ -185,7 +187,7 @@ class SessionServiceTest : public BrowserWithTestWindowTest, base::FilePath path_; SessionServiceTestHelper helper_; - scoped_ptr profile_manager_; + std::unique_ptr profile_manager_; }; TEST_F(SessionServiceTest, Basic) { diff --git a/chrome/browser/sessions/tab_loader.cc b/chrome/browser/sessions/tab_loader.cc index 676db802f58f34..5f47db8a02761c 100644 --- a/chrome/browser/sessions/tab_loader.cc +++ b/chrome/browser/sessions/tab_loader.cc @@ -8,6 +8,7 @@ #include #include "base/memory/memory_pressure_monitor.h" +#include "base/memory/ptr_util.h" #include "base/metrics/histogram.h" #include "base/strings/stringprintf.h" #include "build/build_config.h" @@ -83,7 +84,7 @@ TabLoader::TabLoader(base::TimeTicks restore_started) restore_started_(restore_started) { stats_collector_ = new SessionRestoreStatsCollector( restore_started, - make_scoped_ptr( + base::WrapUnique( new SessionRestoreStatsCollector::UmaStatsReportingDelegate())); shared_tab_loader_ = this; this_retainer_ = this; diff --git a/chrome/browser/sessions/tab_loader.h b/chrome/browser/sessions/tab_loader.h index 8a064481fef0a8..1ae274c7ef7f74 100644 --- a/chrome/browser/sessions/tab_loader.h +++ b/chrome/browser/sessions/tab_loader.h @@ -8,11 +8,11 @@ #include #include +#include #include #include "base/macros.h" #include "base/memory/memory_pressure_listener.h" -#include "base/memory/scoped_ptr.h" #include "base/timer/timer.h" #include "chrome/browser/sessions/session_restore_delegate.h" #include "chrome/browser/sessions/tab_loader_delegate.h" @@ -111,7 +111,7 @@ class TabLoader : public content::NotificationObserver, void OnMemoryPressure( base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); - scoped_ptr delegate_; + std::unique_ptr delegate_; // Listens for system under memory pressure notifications and stops loading // of tabs when we start running out of memory. diff --git a/chrome/browser/sessions/tab_loader_delegate.cc b/chrome/browser/sessions/tab_loader_delegate.cc index 598996e4ee3973..72ba8ddde30167 100644 --- a/chrome/browser/sessions/tab_loader_delegate.cc +++ b/chrome/browser/sessions/tab_loader_delegate.cc @@ -82,8 +82,8 @@ void TabLoaderDelegateImpl::OnConnectionTypeChanged( } // namespace // static -scoped_ptr TabLoaderDelegate::Create( +std::unique_ptr TabLoaderDelegate::Create( TabLoaderCallback* callback) { - return scoped_ptr( + return std::unique_ptr( new TabLoaderDelegateImpl(callback)); } diff --git a/chrome/browser/sessions/tab_loader_delegate.h b/chrome/browser/sessions/tab_loader_delegate.h index e396ac5ab97cb0..19837abb4ce4e5 100644 --- a/chrome/browser/sessions/tab_loader_delegate.h +++ b/chrome/browser/sessions/tab_loader_delegate.h @@ -5,7 +5,8 @@ #ifndef CHROME_BROWSER_SESSIONS_TAB_LOADER_DELEGATE_H_ #define CHROME_BROWSER_SESSIONS_TAB_LOADER_DELEGATE_H_ -#include "base/memory/scoped_ptr.h" +#include + #include "base/time/time.h" class TabLoaderCallback { @@ -25,7 +26,7 @@ class TabLoaderDelegate { // Create a tab loader delegate. |TabLoaderCallback::SetTabLoadingEnabled| can // get called to disable / enable tab loading. // The callback object is valid as long as this object exists. - static scoped_ptr Create(TabLoaderCallback* callback); + static std::unique_ptr Create(TabLoaderCallback* callback); // Returns the default timeout time after which the first non-visible tab // gets loaded if the first (visible) tab did not finish loading. diff --git a/chrome/browser/sessions/tab_restore_service_factory.cc b/chrome/browser/sessions/tab_restore_service_factory.cc index 8ccb1ffd9db3db..44ea403d3d24a7 100644 --- a/chrome/browser/sessions/tab_restore_service_factory.cc +++ b/chrome/browser/sessions/tab_restore_service_factory.cc @@ -58,7 +58,7 @@ KeyedService* TabRestoreServiceFactory::BuildServiceInstanceFor( content::BrowserContext* browser_context) const { Profile* profile = Profile::FromBrowserContext(browser_context); DCHECK(!profile->IsOffTheRecord()); - scoped_ptr client( + std::unique_ptr client( new ChromeTabRestoreServiceClient(profile)); #if defined(OS_ANDROID) diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index 020c33acfe0750..d6f5c6509ba51f 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -7,6 +7,8 @@ #include #include +#include + #if defined(USE_GLIB) #include #endif @@ -28,7 +30,6 @@ #include "base/files/scoped_temp_dir.h" #include "base/i18n/file_util_icu.h" #include "base/memory/ref_counted_memory.h" -#include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/nix/xdg_util.h" #include "base/path_service.h" @@ -137,7 +138,7 @@ bool SetDefaultWebClient(const std::string& protocol) { #if defined(OS_CHROMEOS) return true; #else - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); std::vector argv; argv.push_back(kXdgSettings); @@ -171,7 +172,7 @@ DefaultWebClientState GetIsDefaultWebClient(const std::string& protocol) { #else base::ThreadRestrictions::AssertIOAllowed(); - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); std::vector argv; argv.push_back(kXdgSettings); @@ -528,7 +529,7 @@ bool GetNoDisplayFromDesktopFile(const std::string& shortcut_contents) { // never happen. base::FilePath GetChromeExePath() { // Try to get the name of the wrapper script that launched Chrome. - scoped_ptr environment(base::Environment::Create()); + std::unique_ptr environment(base::Environment::Create()); std::string wrapper_script; if (environment->GetVar("CHROME_WRAPPER", &wrapper_script)) return base::FilePath(wrapper_script); @@ -570,7 +571,7 @@ std::vector GetDataSearchLocations(base::Environment* env) { } std::string GetProgramClassName() { - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); std::string desktop_file(GetDesktopName(env.get())); std::size_t last = desktop_file.find(".desktop"); if (last != std::string::npos) @@ -1031,7 +1032,7 @@ void DeleteDesktopShortcuts(const base::FilePath& profile_path, void DeleteAllDesktopShortcuts(const base::FilePath& profile_path) { DCHECK_CURRENTLY_ON(BrowserThread::FILE); - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); // Delete shortcuts from Desktop. base::FilePath desktop_path; diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index e4fecf52ac8f3b..a23aaa426a79e4 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -19,6 +19,7 @@ #include "base/files/file_enumerator.h" #include "base/files/file_util.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/histogram_macros.h" @@ -304,7 +305,7 @@ class OpenSystemSettingsHelper { // Helper function to create a registry watcher for a given |key_path|. Do // nothing on initialization failure. void AddRegistryKeyWatcher(const wchar_t* key_path) { - auto reg_key = make_scoped_ptr( + auto reg_key = base::WrapUnique( new base::win::RegKey(HKEY_CURRENT_USER, key_path, KEY_NOTIFY)); if (reg_key->Valid() && @@ -325,7 +326,7 @@ class OpenSystemSettingsHelper { // There can be multiple registry key watchers as some settings modify // multiple protocol associations. e.g. Changing the default browser modifies // the http and https associations. - std::vector> registry_key_watchers_; + std::vector> registry_key_watchers_; base::OneShotTimer timer_; diff --git a/chrome/browser/signin/account_reconcilor_unittest.cc b/chrome/browser/signin/account_reconcilor_unittest.cc index 9e06da435665b0..35e10e5ecdff9b 100644 --- a/chrome/browser/signin/account_reconcilor_unittest.cc +++ b/chrome/browser/signin/account_reconcilor_unittest.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 #include #include "base/command_line.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/test/histogram_tester.h" @@ -47,7 +47,7 @@ namespace { class MockAccountReconcilor : public testing::StrictMock { public: - static scoped_ptr Build(content::BrowserContext* context); + static std::unique_ptr Build(content::BrowserContext* context); MockAccountReconcilor(ProfileOAuth2TokenService* token_service, SigninManagerBase* signin_manager, @@ -60,10 +60,10 @@ class MockAccountReconcilor : public testing::StrictMock { }; // static -scoped_ptr MockAccountReconcilor::Build( +std::unique_ptr MockAccountReconcilor::Build( content::BrowserContext* context) { Profile* profile = Profile::FromBrowserContext(context); - scoped_ptr reconcilor(new MockAccountReconcilor( + std::unique_ptr reconcilor(new MockAccountReconcilor( ProfileOAuth2TokenServiceFactory::GetForProfile(profile), SigninManagerFactory::GetForProfile(profile), ChromeSigninClientFactory::GetForProfile(profile), @@ -141,7 +141,7 @@ class AccountReconcilorTest : public ::testing::TestWithParam { FakeGaiaCookieManagerService* cookie_manager_service_; MockAccountReconcilor* mock_reconcilor_; net::FakeURLFetcherFactory url_fetcher_factory_; - scoped_ptr testing_profile_manager_; + std::unique_ptr testing_profile_manager_; base::HistogramTester histogram_tester_; GURL get_check_connection_info_url_; @@ -186,10 +186,9 @@ void AccountReconcilorTest::SetUp() { factories.push_back(std::make_pair(AccountReconcilorFactory::GetInstance(), MockAccountReconcilor::Build)); - profile_ = testing_profile_manager_.get()->CreateTestingProfile("name", - scoped_ptr(), - base::UTF8ToUTF16("name"), 0, std::string(), - factories); + profile_ = testing_profile_manager_.get()->CreateTestingProfile( + "name", std::unique_ptr(), + base::UTF8ToUTF16("name"), 0, std::string(), factories); test_signin_client_ = static_cast( @@ -473,8 +472,8 @@ TEST_P(AccountReconcilorTest, StartReconcileContentSettingsInvalidPattern) { AccountReconcilorFactory::GetForProfile(profile()); ASSERT_TRUE(reconcilor); - scoped_ptr - builder(ContentSettingsPattern::CreateBuilder(false)); + std::unique_ptr builder( + ContentSettingsPattern::CreateBuilder(false)); builder->Invalid(); SimulateCookieContentSettingsChanged(reconcilor, builder->Build()); diff --git a/chrome/browser/signin/account_tracker_service_factory.cc b/chrome/browser/signin/account_tracker_service_factory.cc index 2b2a35964b10b2..bb9784fb53678b 100644 --- a/chrome/browser/signin/account_tracker_service_factory.cc +++ b/chrome/browser/signin/account_tracker_service_factory.cc @@ -4,7 +4,8 @@ #include "chrome/browser/signin/account_tracker_service_factory.h" -#include "base/memory/scoped_ptr.h" +#include + #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/chrome_signin_client_factory.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" diff --git a/chrome/browser/signin/chrome_proximity_auth_client.cc b/chrome/browser/signin/chrome_proximity_auth_client.cc index ed40a709a464bd..caa128bd30f657 100644 --- a/chrome/browser/signin/chrome_proximity_auth_client.cc +++ b/chrome/browser/signin/chrome_proximity_auth_client.cc @@ -7,6 +7,7 @@ #include #include "base/logging.h" +#include "base/memory/ptr_util.h" #include "base/sys_info.h" #include "base/version.h" #include "build/build_config.h" @@ -93,18 +94,18 @@ PrefService* ChromeProximityAuthClient::GetPrefService() { return profile_->GetPrefs(); } -scoped_ptr +std::unique_ptr ChromeProximityAuthClient::CreateSecureMessageDelegate() { #if defined(OS_CHROMEOS) - return make_scoped_ptr(new chromeos::SecureMessageDelegateChromeOS()); + return base::WrapUnique(new chromeos::SecureMessageDelegateChromeOS()); #else return nullptr; #endif } -scoped_ptr +std::unique_ptr ChromeProximityAuthClient::CreateCryptAuthClientFactory() { - return make_scoped_ptr(new proximity_auth::CryptAuthClientFactoryImpl( + return base::WrapUnique(new proximity_auth::CryptAuthClientFactoryImpl( ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), GetAccountId(), profile_->GetRequestContext(), GetDeviceClassifier())); } diff --git a/chrome/browser/signin/chrome_proximity_auth_client.h b/chrome/browser/signin/chrome_proximity_auth_client.h index 0380d3f6c7d561..e0c6e0511d7e17 100644 --- a/chrome/browser/signin/chrome_proximity_auth_client.h +++ b/chrome/browser/signin/chrome_proximity_auth_client.h @@ -24,9 +24,9 @@ class ChromeProximityAuthClient : public proximity_auth::ProximityAuthClient { void UpdateScreenlockState(proximity_auth::ScreenlockState state) override; void FinalizeUnlock(bool success) override; PrefService* GetPrefService() override; - scoped_ptr + std::unique_ptr CreateSecureMessageDelegate() override; - scoped_ptr + std::unique_ptr CreateCryptAuthClientFactory() override; cryptauth::DeviceClassifier GetDeviceClassifier() override; std::string GetAccountId() override; diff --git a/chrome/browser/signin/chrome_signin_client.cc b/chrome/browser/signin/chrome_signin_client.cc index a49ebed9db73f2..ea632b03f96ad4 100644 --- a/chrome/browser/signin/chrome_signin_client.cc +++ b/chrome/browser/signin/chrome_signin_client.cc @@ -223,7 +223,7 @@ void ChromeSigninClient::RemoveContentSettingsObserver( ->RemoveObserver(observer); } -scoped_ptr +std::unique_ptr ChromeSigninClient::AddCookieChangedCallback( const GURL& url, const std::string& name, @@ -231,7 +231,7 @@ ChromeSigninClient::AddCookieChangedCallback( scoped_refptr context_getter = profile_->GetRequestContext(); DCHECK(context_getter.get()); - scoped_ptr subscription( + std::unique_ptr subscription( new SigninCookieChangedSubscription(context_getter, url, name, callback)); return std::move(subscription); } @@ -275,7 +275,7 @@ void ChromeSigninClient::OnErrorChanged() { } void ChromeSigninClient::OnGetTokenInfoResponse( - scoped_ptr token_info) { + std::unique_ptr token_info) { if (!token_info->HasKey("error")) { std::string handle; if (token_info->GetString("token_handle", &handle)) { diff --git a/chrome/browser/signin/chrome_signin_client.h b/chrome/browser/signin/chrome_signin_client.h index cbf3c60663fea8..5f9e089edbcd42 100644 --- a/chrome/browser/signin/chrome_signin_client.h +++ b/chrome/browser/signin/chrome_signin_client.h @@ -66,7 +66,7 @@ class ChromeSigninClient // () // If version information is unavailable, returns "invalid." std::string GetProductVersion() override; - scoped_ptr AddCookieChangedCallback( + std::unique_ptr AddCookieChangedCallback( const GURL& url, const std::string& name, const net::CookieStore::CookieChangedCallback& callback) override; @@ -83,7 +83,7 @@ class ChromeSigninClient // gaia::GaiaOAuthClient::Delegate implementation. void OnGetTokenInfoResponse( - scoped_ptr token_info) override; + std::unique_ptr token_info) override; void OnOAuthError() override; void OnNetworkError(int response_code) override; @@ -110,8 +110,8 @@ class ChromeSigninClient std::list delayed_callbacks_; #endif - scoped_ptr oauth_client_; - scoped_ptr oauth_request_; + std::unique_ptr oauth_client_; + std::unique_ptr oauth_request_; DISALLOW_COPY_AND_ASSIGN(ChromeSigninClient); }; diff --git a/chrome/browser/signin/chrome_signin_client_unittest.cc b/chrome/browser/signin/chrome_signin_client_unittest.cc index c39cd4b12abcb8..b9ab35bd6bf136 100644 --- a/chrome/browser/signin/chrome_signin_client_unittest.cc +++ b/chrome/browser/signin/chrome_signin_client_unittest.cc @@ -79,7 +79,7 @@ class ChromeSigninClientTest : public testing::Test { SigninClient* signin_client() { return signin_client_; } private: - scoped_ptr profile_; + std::unique_ptr profile_; SigninClient* signin_client_; content::TestBrowserThreadBundle thread_bundle_; }; @@ -93,8 +93,8 @@ void ChromeSigninClientTest::SetUp() { } TEST_F(ChromeSigninClientTest, DelayNetworkCallRunsImmediatelyWithNetwork) { - scoped_ptr - mock(new MockNetworkChangeNotifierNeverOffline); + std::unique_ptr mock( + new MockNetworkChangeNotifierNeverOffline); CallbackTester tester; signin_client()->DelayNetworkCall(base::Bind(&CallbackTester::Increment, base::Unretained(&tester))); @@ -102,8 +102,8 @@ TEST_F(ChromeSigninClientTest, DelayNetworkCallRunsImmediatelyWithNetwork) { } TEST_F(ChromeSigninClientTest, DelayNetworkCallRunsAfterNetworkFound) { - scoped_ptr - mock(new MockNetworkChangeNotifierOfflineUntilChange()); + std::unique_ptr mock( + new MockNetworkChangeNotifierOfflineUntilChange()); // Install a SigninClient after the NetworkChangeNotifier's created. SetUp(); diff --git a/chrome/browser/signin/chrome_signin_status_metrics_provider_delegate_unittest.cc b/chrome/browser/signin/chrome_signin_status_metrics_provider_delegate_unittest.cc index 2f5aeccef41519..962c98fb8e9e48 100644 --- a/chrome/browser/signin/chrome_signin_status_metrics_provider_delegate_unittest.cc +++ b/chrome/browser/signin/chrome_signin_status_metrics_provider_delegate_unittest.cc @@ -16,10 +16,10 @@ TEST(ChromeSigninStatusMetricsProviderDelegateTest, UpdateStatusWhenBrowserAdded) { content::TestBrowserThreadBundle thread_bundle; - scoped_ptr delegate( + std::unique_ptr delegate( new ChromeSigninStatusMetricsProviderDelegate); ChromeSigninStatusMetricsProviderDelegate* raw_delegate = delegate.get(); - scoped_ptr metrics_provider( + std::unique_ptr metrics_provider( SigninStatusMetricsProvider::CreateInstance(std::move(delegate))); // Initial status is all signed in and then a signed-in browser is opened. diff --git a/chrome/browser/signin/cross_device_promo.h b/chrome/browser/signin/cross_device_promo.h index 5990a948858df5..e49bf0596636fd 100644 --- a/chrome/browser/signin/cross_device_promo.h +++ b/chrome/browser/signin/cross_device_promo.h @@ -195,7 +195,7 @@ class CrossDevicePromo : public KeyedService, PrefService* prefs_; SigninClient* signin_client_; - scoped_ptr device_activity_fetcher_; + std::unique_ptr device_activity_fetcher_; base::ObserverList observer_list_; // Initialized from the |kParamMinutesMaxContextSwitchDuration| field trial diff --git a/chrome/browser/signin/cross_device_promo_unittest.cc b/chrome/browser/signin/cross_device_promo_unittest.cc index 39eff0a472d2f8..1d7fdd84bad714 100644 --- a/chrome/browser/signin/cross_device_promo_unittest.cc +++ b/chrome/browser/signin/cross_device_promo_unittest.cc @@ -11,6 +11,7 @@ #include #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/metrics/field_trial.h" #include "base/run_loop.h" #include "base/test/histogram_tester.h" @@ -112,9 +113,9 @@ class CrossDevicePromoTest : public ::testing::Test { FakeSigninManagerForTesting* signin_manager_; FakeGaiaCookieManagerService* cookie_manager_service_; syncable_prefs::TestingPrefServiceSyncable* pref_service_; - scoped_ptr testing_profile_manager_; + std::unique_ptr testing_profile_manager_; base::HistogramTester histogram_tester_; - scoped_ptr field_trial_list_; + std::unique_ptr field_trial_list_; net::FakeURLFetcherFactory fake_url_fetcher_factory_; DISALLOW_COPY_AND_ASSIGN(CrossDevicePromoTest); @@ -143,7 +144,7 @@ void CrossDevicePromoTest::SetUp() { profile_ = testing_profile_manager_.get()->CreateTestingProfile( "name", - make_scoped_ptr(pref_service_), + base::WrapUnique(pref_service_), base::UTF8ToUTF16("name"), 0, std::string(), factories); cookie_manager_service_ = static_cast( diff --git a/chrome/browser/signin/easy_unlock_app_manager.cc b/chrome/browser/signin/easy_unlock_app_manager.cc index 062b3a7d42c9df..a3c59c9ee72cda 100644 --- a/chrome/browser/signin/easy_unlock_app_manager.cc +++ b/chrome/browser/signin/easy_unlock_app_manager.cc @@ -165,10 +165,10 @@ bool EasyUnlockAppManagerImpl::SendUserUpdatedEvent(const std::string& user_id, info.logged_in = is_logged_in; info.data_ready = data_ready; - scoped_ptr args(new base::ListValue()); + std::unique_ptr args(new base::ListValue()); args->Append(info.ToValue().release()); - scoped_ptr event( + std::unique_ptr event( new extensions::Event(histogram_value, event_name, std::move(args))); event_router->DispatchEventToExtension(app_id_, std::move(event)); @@ -194,10 +194,10 @@ EasyUnlockAppManager::~EasyUnlockAppManager() { } // static -scoped_ptr EasyUnlockAppManager::Create( +std::unique_ptr EasyUnlockAppManager::Create( extensions::ExtensionSystem* extension_system, int manifest_id, const base::FilePath& app_path) { - return scoped_ptr( + return std::unique_ptr( new EasyUnlockAppManagerImpl(extension_system, manifest_id, app_path)); } diff --git a/chrome/browser/signin/easy_unlock_app_manager.h b/chrome/browser/signin/easy_unlock_app_manager.h index ba6bb4cf8bef33..42372e9ed7eee9 100644 --- a/chrome/browser/signin/easy_unlock_app_manager.h +++ b/chrome/browser/signin/easy_unlock_app_manager.h @@ -5,12 +5,12 @@ #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_APP_MANAGER_H_ #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_APP_MANAGER_H_ +#include #include #include "base/callback.h" #include "base/files/file_path.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" namespace extensions { class ExtensionSystem; @@ -24,7 +24,7 @@ class EasyUnlockAppManager { virtual ~EasyUnlockAppManager(); // Creates EasyUnlockAppManager object that should be used in production. - static scoped_ptr Create( + static std::unique_ptr Create( extensions::ExtensionSystem* extension_system, int manifest_id, const base::FilePath& app_path); diff --git a/chrome/browser/signin/easy_unlock_app_manager_unittest.cc b/chrome/browser/signin/easy_unlock_app_manager_unittest.cc index 51113a14d9e6d0..eb3a02e587a589 100644 --- a/chrome/browser/signin/easy_unlock_app_manager_unittest.cc +++ b/chrome/browser/signin/easy_unlock_app_manager_unittest.cc @@ -6,11 +6,12 @@ #include +#include #include #include "base/command_line.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "build/build_config.h" #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h" @@ -74,14 +75,15 @@ class TestProcessManager : public extensions::ProcessManager { DISALLOW_COPY_AND_ASSIGN(TestProcessManager); }; -scoped_ptr CreateTestProcessManager( +std::unique_ptr CreateTestProcessManager( content::BrowserContext* context) { - return make_scoped_ptr(new TestProcessManager(context)); + return base::WrapUnique(new TestProcessManager(context)); } -scoped_ptr CreateScreenlockPrivateEventRouter( +std::unique_ptr CreateScreenlockPrivateEventRouter( content::BrowserContext* context) { - return make_scoped_ptr(new extensions::ScreenlockPrivateEventRouter(context)); + return base::WrapUnique( + new extensions::ScreenlockPrivateEventRouter(context)); } // Observes extension registry for unload and load events (in that order) of an @@ -248,15 +250,16 @@ class TestEventRouter : public extensions::EventRouter { ~TestEventRouter() override {} // extensions::EventRouter implementation: - void BroadcastEvent(scoped_ptr event) override { + void BroadcastEvent(std::unique_ptr event) override { ASSERT_EQ(screenlock_private_api::OnAuthAttempted::kEventName, event->event_name); EXPECT_TRUE(event_consumer_->ConsumeEvent(event->event_name, event->event_args.get())); } - void DispatchEventToExtension(const std::string& extension_id, - scoped_ptr event) override { + void DispatchEventToExtension( + const std::string& extension_id, + std::unique_ptr event) override { ASSERT_EQ(extension_misc::kEasyUnlockAppId, extension_id); EXPECT_TRUE(event_consumer_->ConsumeEvent(event->event_name, event->event_args.get())); @@ -273,9 +276,9 @@ class TestEventRouter : public extensions::EventRouter { }; // TestEventRouter factory function -scoped_ptr TestEventRouterFactoryFunction( +std::unique_ptr TestEventRouterFactoryFunction( content::BrowserContext* context) { - return make_scoped_ptr( + return base::WrapUnique( new TestEventRouter(static_cast(context), extensions::ExtensionPrefs::Get(context))); } @@ -337,7 +340,7 @@ class EasyUnlockAppManagerTest : public testing::Test { } protected: - scoped_ptr app_manager_; + std::unique_ptr app_manager_; // Needed by extension system. content::TestBrowserThreadBundle thread_bundle_; diff --git a/chrome/browser/signin/easy_unlock_auth_attempt.cc b/chrome/browser/signin/easy_unlock_auth_attempt.cc index c15bafbb2ba4dd..345e1d1871e086 100644 --- a/chrome/browser/signin/easy_unlock_auth_attempt.cc +++ b/chrome/browser/signin/easy_unlock_auth_attempt.cc @@ -29,8 +29,8 @@ std::string UnwrapSecret(const std::string& wrapped_secret, return std::string(); // Import the key structure. - scoped_ptr key( - crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, raw_key)); + std::unique_ptr key( + crypto::SymmetricKey::Import(crypto::SymmetricKey::AES, raw_key)); if (!key) return std::string(); diff --git a/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc b/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc index f7971f51f54fdf..9affe469ea21d6 100644 --- a/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc +++ b/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc @@ -232,9 +232,9 @@ class EasyUnlockAuthAttemptUnlockTest : public testing::Test { lock_handler_.get()); } - scoped_ptr auth_attempt_; - scoped_ptr app_manager_; - scoped_ptr lock_handler_; + std::unique_ptr auth_attempt_; + std::unique_ptr app_manager_; + std::unique_ptr lock_handler_; const AccountId test_account_id1_ = AccountId::FromUserEmail(kTestUser1); const AccountId test_account_id2_ = AccountId::FromUserEmail(kTestUser2); @@ -390,9 +390,9 @@ class EasyUnlockAuthAttemptSigninTest : public testing::Test { lock_handler_.get()); } - scoped_ptr auth_attempt_; - scoped_ptr app_manager_; - scoped_ptr lock_handler_; + std::unique_ptr auth_attempt_; + std::unique_ptr app_manager_; + std::unique_ptr lock_handler_; const AccountId test_account_id1_ = AccountId::FromUserEmail(kTestUser1); const AccountId test_account_id2_ = AccountId::FromUserEmail(kTestUser2); diff --git a/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc b/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc index 4a449b1239eb4f..f12f19ad188ce0 100644 --- a/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc +++ b/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc @@ -203,7 +203,7 @@ class TestLockHandler : public proximity_auth::ScreenlockBridge::LockHandler { // The last icon set using |SetUserPodCustomIcon|. Call to // |HideUserPodcustomIcon| resets it. - scoped_ptr last_custom_icon_; + std::unique_ptr last_custom_icon_; size_t show_icon_count_; // Auth type and value set using |SetAuthType|. @@ -239,14 +239,14 @@ class EasyUnlockScreenlockStateHandlerTest : public testing::Test { protected: // The state handler that is being tested. - scoped_ptr state_handler_; + std::unique_ptr state_handler_; // The user associated with |state_handler_|. const AccountId account_id_ = AccountId::FromUserEmail("test_user@gmail.com"); // Faked lock handler given to proximity_auth::ScreenlockBridge during the // test. Abstracts the screen lock UI. - scoped_ptr lock_handler_; + std::unique_ptr lock_handler_; }; TEST_F(EasyUnlockScreenlockStateHandlerTest, AuthenticatedTrialRun) { diff --git a/chrome/browser/signin/easy_unlock_service.cc b/chrome/browser/signin/easy_unlock_service.cc index 57bbe8c72e3330..233174a3474149 100644 --- a/chrome/browser/signin/easy_unlock_service.cc +++ b/chrome/browser/signin/easy_unlock_service.cc @@ -364,7 +364,7 @@ std::string EasyUnlockService::GetDeviceId() { } void EasyUnlockService::Initialize( - scoped_ptr app_manager) { + std::unique_ptr app_manager) { app_manager_ = std::move(app_manager); app_manager_->EnsureReady( base::Bind(&EasyUnlockService::InitializeOnAppManagerReady, diff --git a/chrome/browser/signin/easy_unlock_service.h b/chrome/browser/signin/easy_unlock_service.h index e59977d2bfb19f..e32c6e41af8ddc 100644 --- a/chrome/browser/signin/easy_unlock_service.h +++ b/chrome/browser/signin/easy_unlock_service.h @@ -5,12 +5,12 @@ #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_H_ +#include #include #include #include "base/callback_forward.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "build/build_config.h" @@ -150,7 +150,7 @@ class EasyUnlockService : public KeyedService { virtual void SetAutoPairingResult(bool success, const std::string& error) = 0; // Sets the service up and schedules service initialization. - void Initialize(scoped_ptr app_manager); + void Initialize(std::unique_ptr app_manager); // Whether easy unlock is allowed to be used. If the controlling preference // is set (from policy), this returns the preference value. Otherwise, it is @@ -343,17 +343,17 @@ class EasyUnlockService : public KeyedService { ChromeProximityAuthClient proximity_auth_client_; - scoped_ptr app_manager_; + std::unique_ptr app_manager_; // Created lazily in |GetScreenlockStateHandler|. - scoped_ptr screenlock_state_handler_; + std::unique_ptr screenlock_state_handler_; // The handler for the current auth attempt. Set iff an auth attempt is in // progress. - scoped_ptr auth_attempt_; + std::unique_ptr auth_attempt_; // Detects when the system Bluetooth adapter status changes. - scoped_ptr bluetooth_detector_; + std::unique_ptr bluetooth_detector_; // Handles connecting, authenticating, and updating the UI on the lock/sign-in // screen. After a |RemoteDevice| instance is provided, this object will @@ -361,12 +361,12 @@ class EasyUnlockService : public KeyedService { // TODO(tengs): This object is intended as a replacement of the background // page of the easy_unlock Chrome app. We are in the process of removing the // app in favor of |proximity_auth_system_|. - scoped_ptr proximity_auth_system_; + std::unique_ptr proximity_auth_system_; #if defined(OS_CHROMEOS) // Monitors suspend and wake state of ChromeOS. class PowerMonitor; - scoped_ptr power_monitor_; + std::unique_ptr power_monitor_; #endif // Whether the service has been shut down. diff --git a/chrome/browser/signin/easy_unlock_service_regular.cc b/chrome/browser/signin/easy_unlock_service_regular.cc index 85e60da0e7ae29..81367b88ae2ba7 100644 --- a/chrome/browser/signin/easy_unlock_service_regular.cc +++ b/chrome/browser/signin/easy_unlock_service_regular.cc @@ -5,12 +5,14 @@ #include "chrome/browser/signin/easy_unlock_service_regular.h" #include + #include #include "base/base64url.h" #include "base/bind.h" #include "base/command_line.h" #include "base/logging.h" +#include "base/memory/ptr_util.h" #include "base/sys_info.h" #include "base/time/default_clock.h" #include "base/values.h" @@ -125,9 +127,9 @@ void EasyUnlockServiceRegular::OnRemoteDevicesLoaded( // We need to store a copy of |remote devices_| in the TPM, so it can be // retrieved on the sign-in screen when a user session has not been started // yet. - scoped_ptr device_list(new base::ListValue()); + std::unique_ptr device_list(new base::ListValue()); for (const auto& device : remote_devices) { - scoped_ptr dict(new base::DictionaryValue()); + std::unique_ptr dict(new base::DictionaryValue()); std::string b64_public_key, b64_psk; base::Base64UrlEncode(device.public_key, base::Base64UrlEncodePolicy::INCLUDE_PADDING, @@ -343,7 +345,7 @@ void EasyUnlockServiceRegular::RunTurnOffFlow() { SetTurnOffFlowStatus(PENDING); - scoped_ptr factory = + std::unique_ptr factory = proximity_auth_client()->CreateCryptAuthClientFactory(); cryptauth_client_ = factory->CreateInstance(); @@ -398,8 +400,8 @@ void EasyUnlockServiceRegular::StartAutoPairing( auto_pairing_callback_ = callback; - scoped_ptr args(new base::ListValue()); - scoped_ptr event(new extensions::Event( + std::unique_ptr args(new base::ListValue()); + std::unique_ptr event(new extensions::Event( extensions::events::EASY_UNLOCK_PRIVATE_ON_START_AUTO_PAIRING, extensions::api::easy_unlock_private::OnStartAutoPairing::kEventName, std::move(args))); @@ -589,7 +591,7 @@ void EasyUnlockServiceRegular::SyncProfilePrefsToLocalState() { // Create the dictionary of Easy Unlock preferences for the current user. The // items in the dictionary are the same profile prefs used for Easy Unlock. - scoped_ptr user_prefs_dict( + std::unique_ptr user_prefs_dict( new base::DictionaryValue()); user_prefs_dict->SetBooleanWithoutPathExpansion( prefs::kEasyUnlockProximityRequired, @@ -659,8 +661,8 @@ void EasyUnlockServiceRegular::InitializeCryptAuth() { // Initialize enrollment manager. cryptauth::GcmDeviceInfo device_info; enrollment_manager_.reset(new proximity_auth::CryptAuthEnrollmentManager( - make_scoped_ptr(new base::DefaultClock()), - make_scoped_ptr(new proximity_auth::CryptAuthEnrollerFactoryImpl( + base::WrapUnique(new base::DefaultClock()), + base::WrapUnique(new proximity_auth::CryptAuthEnrollerFactoryImpl( proximity_auth_client())), proximity_auth_client()->CreateSecureMessageDelegate(), GetGcmDeviceInfo(), gcm_manager_.get(), @@ -668,7 +670,7 @@ void EasyUnlockServiceRegular::InitializeCryptAuth() { // Initialize device manager. device_manager_.reset(new proximity_auth::CryptAuthDeviceManager( - make_scoped_ptr(new base::DefaultClock()), + base::WrapUnique(new base::DefaultClock()), proximity_auth_client()->CreateCryptAuthClientFactory(), gcm_manager_.get(), proximity_auth_client()->GetPrefService())); diff --git a/chrome/browser/signin/easy_unlock_service_regular.h b/chrome/browser/signin/easy_unlock_service_regular.h index fba8813f41281b..d69787c6296f57 100644 --- a/chrome/browser/signin/easy_unlock_service_regular.h +++ b/chrome/browser/signin/easy_unlock_service_regular.h @@ -5,11 +5,11 @@ #ifndef CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_REGULAR_H_ +#include #include #include "base/callback.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "build/build_config.h" #include "chrome/browser/signin/easy_unlock_service.h" @@ -144,7 +144,7 @@ class EasyUnlockServiceRegular // Initializes the managers that communicate with CryptAuth. void InitializeCryptAuth(); - scoped_ptr short_lived_user_context_; + std::unique_ptr short_lived_user_context_; #endif // Updates local state with the preference from the user's profile, so they @@ -158,7 +158,7 @@ class EasyUnlockServiceRegular PrefChangeRegistrar registrar_; TurnOffFlowStatus turn_off_flow_status_; - scoped_ptr cryptauth_client_; + std::unique_ptr cryptauth_client_; AutoPairingResultCallback auto_pairing_callback_; @@ -175,15 +175,16 @@ class EasyUnlockServiceRegular // Managers responsible for handling syncing and communications with // CryptAuth. - scoped_ptr gcm_manager_; - scoped_ptr enrollment_manager_; - scoped_ptr device_manager_; + std::unique_ptr gcm_manager_; + std::unique_ptr + enrollment_manager_; + std::unique_ptr device_manager_; // Manager responsible for handling the prefs used by proximity_auth classes. - scoped_ptr pref_manager_; + std::unique_ptr pref_manager_; // Loads the RemoteDevice instances from CryptAuth and local data. - scoped_ptr remote_device_loader_; + std::unique_ptr remote_device_loader_; // If a new RemoteDevice was synced while the screen is locked, we defer // loading the RemoteDevice until the screen is unlocked. For security, diff --git a/chrome/browser/signin/easy_unlock_service_signin_chromeos.h b/chrome/browser/signin/easy_unlock_service_signin_chromeos.h index 9496f893d39619..ad997cda520dd1 100644 --- a/chrome/browser/signin/easy_unlock_service_signin_chromeos.h +++ b/chrome/browser/signin/easy_unlock_service_signin_chromeos.h @@ -6,10 +6,10 @@ #define CHROME_BROWSER_SIGNIN_EASY_UNLOCK_SERVICE_SIGNIN_CHROMEOS_H_ #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "base/values.h" @@ -147,7 +147,7 @@ class EasyUnlockServiceSignin base::TimeTicks user_pod_last_focused_timestamp_; // Handles wrapping the user's challenge with the TPM. - scoped_ptr challenge_wrapper_; + std::unique_ptr challenge_wrapper_; base::WeakPtrFactory weak_ptr_factory_; diff --git a/chrome/browser/signin/easy_unlock_service_unittest_chromeos.cc b/chrome/browser/signin/easy_unlock_service_unittest_chromeos.cc index 73050841931c64..fdc0e44837abd3 100644 --- a/chrome/browser/signin/easy_unlock_service_unittest_chromeos.cc +++ b/chrome/browser/signin/easy_unlock_service_unittest_chromeos.cc @@ -5,12 +5,13 @@ #include "chrome/browser/signin/easy_unlock_service.h" #include + #include +#include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/values.h" #include "chrome/browser/chromeos/login/users/mock_user_manager.h" @@ -143,10 +144,10 @@ class TestAppManagerFactory { // Creates a TestAppManager for the provided browser context. If a // TestAppManager was already created for the context, returns NULL. - scoped_ptr Create(content::BrowserContext* context) { + std::unique_ptr Create(content::BrowserContext* context) { if (Find(context)) - return scoped_ptr(); - scoped_ptr app_manager(new TestAppManager()); + return std::unique_ptr(); + std::unique_ptr app_manager(new TestAppManager()); mapping_[context] = app_manager.get(); return app_manager; } @@ -176,19 +177,19 @@ TestAppManagerFactory* app_manager_factory = NULL; // EasyUnlockService factory function injected into testing profiles. // It creates an EasyUnlockService with test AppManager. -scoped_ptr CreateEasyUnlockServiceForTest( +std::unique_ptr CreateEasyUnlockServiceForTest( content::BrowserContext* context) { EXPECT_TRUE(app_manager_factory); if (!app_manager_factory) return nullptr; - scoped_ptr app_manager = + std::unique_ptr app_manager = app_manager_factory->Create(context); EXPECT_TRUE(app_manager.get()); if (!app_manager.get()) return nullptr; - scoped_ptr service( + std::unique_ptr service( new EasyUnlockServiceRegular(Profile::FromBrowserContext(context))); service->Initialize(std::move(app_manager)); return std::move(service); @@ -212,11 +213,11 @@ class EasyUnlockServiceTest : public testing::Test { .WillRepeatedly(testing::Invoke( this, &EasyUnlockServiceTest::is_bluetooth_adapter_present)); - scoped_ptr dbus_setter = + std::unique_ptr dbus_setter = chromeos::DBusThreadManager::GetSetterForTesting(); power_manager_client_ = new FakePowerManagerClient; dbus_setter->SetPowerManagerClient( - scoped_ptr(power_manager_client_)); + std::unique_ptr(power_manager_client_)); ON_CALL(*mock_user_manager_, Shutdown()).WillByDefault(Return()); ON_CALL(*mock_user_manager_, IsLoggedInAsUserWithGaiaAccount()) @@ -276,7 +277,7 @@ class EasyUnlockServiceTest : public testing::Test { private: // Sets up a test profile with a user id. - void SetUpProfile(scoped_ptr* profile, + void SetUpProfile(std::unique_ptr* profile, const AccountId& account_id) { ASSERT_TRUE(profile); ASSERT_FALSE(profile->get()); @@ -296,8 +297,8 @@ class EasyUnlockServiceTest : public testing::Test { } protected: - scoped_ptr profile_; - scoped_ptr secondary_profile_; + std::unique_ptr profile_; + std::unique_ptr secondary_profile_; chromeos::MockUserManager* mock_user_manager_; private: diff --git a/chrome/browser/signin/fake_account_fetcher_service_builder.cc b/chrome/browser/signin/fake_account_fetcher_service_builder.cc index d1f492b9ae091f..36605c83e93c1f 100644 --- a/chrome/browser/signin/fake_account_fetcher_service_builder.cc +++ b/chrome/browser/signin/fake_account_fetcher_service_builder.cc @@ -12,12 +12,12 @@ #include "components/signin/core/browser/profile_oauth2_token_service.h" // static -scoped_ptr FakeAccountFetcherServiceBuilder::BuildForTests( +std::unique_ptr FakeAccountFetcherServiceBuilder::BuildForTests( content::BrowserContext* context) { FakeAccountFetcherService* service = new FakeAccountFetcherService(); Profile* profile = Profile::FromBrowserContext(context); service->Initialize(ChromeSigninClientFactory::GetForProfile(profile), ProfileOAuth2TokenServiceFactory::GetForProfile(profile), AccountTrackerServiceFactory::GetForProfile(profile)); - return scoped_ptr(service); + return std::unique_ptr(service); } diff --git a/chrome/browser/signin/fake_account_fetcher_service_builder.h b/chrome/browser/signin/fake_account_fetcher_service_builder.h index 243a0183a8414e..4a399a61bdd81f 100644 --- a/chrome/browser/signin/fake_account_fetcher_service_builder.h +++ b/chrome/browser/signin/fake_account_fetcher_service_builder.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_SIGNIN_FAKE_ACCOUNT_FETCHER_SERVICE_BUILDER_H_ #define CHROME_BROWSER_SIGNIN_FAKE_ACCOUNT_FETCHER_SERVICE_BUILDER_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" namespace content { class BrowserContext; @@ -15,7 +16,7 @@ class KeyedService; class FakeAccountFetcherServiceBuilder { public: - static scoped_ptr BuildForTests( + static std::unique_ptr BuildForTests( content::BrowserContext* context); private: diff --git a/chrome/browser/signin/fake_gaia_cookie_manager_service.cc b/chrome/browser/signin/fake_gaia_cookie_manager_service.cc index 304e40fca14bf6..51844388d35778 100644 --- a/chrome/browser/signin/fake_gaia_cookie_manager_service.cc +++ b/chrome/browser/signin/fake_gaia_cookie_manager_service.cc @@ -4,6 +4,7 @@ #include "chrome/browser/signin/fake_gaia_cookie_manager_service.h" +#include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/chrome_signin_client_factory.h" @@ -115,10 +116,10 @@ void FakeGaiaCookieManagerService::SetListAccountsResponseTwoAccountsWithExpiry( } // static -scoped_ptr FakeGaiaCookieManagerService::Build( +std::unique_ptr FakeGaiaCookieManagerService::Build( content::BrowserContext* context) { Profile* profile = Profile::FromBrowserContext(context); - return make_scoped_ptr(new FakeGaiaCookieManagerService( + return base::WrapUnique(new FakeGaiaCookieManagerService( ProfileOAuth2TokenServiceFactory::GetForProfile(profile), GaiaConstants::kChromeSource, ChromeSigninClientFactory::GetForProfile(profile))); diff --git a/chrome/browser/signin/fake_gaia_cookie_manager_service.h b/chrome/browser/signin/fake_gaia_cookie_manager_service.h index fbb7c79b8e7749..3f152bf0340f75 100644 --- a/chrome/browser/signin/fake_gaia_cookie_manager_service.h +++ b/chrome/browser/signin/fake_gaia_cookie_manager_service.h @@ -6,8 +6,9 @@ #include "components/signin/core/browser/gaia_cookie_manager_service.h" +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "net/url_request/test_url_fetcher_factory.h" namespace content { @@ -40,7 +41,7 @@ class FakeGaiaCookieManagerService : public GaiaCookieManagerService { bool account2_expired); // Helper function to be used with KeyedService::SetTestingFactory(). - static scoped_ptr Build(content::BrowserContext* context); + static std::unique_ptr Build(content::BrowserContext* context); private: // Provide a fake response for calls to /ListAccounts. diff --git a/chrome/browser/signin/fake_profile_oauth2_token_service_builder.cc b/chrome/browser/signin/fake_profile_oauth2_token_service_builder.cc index 4f9789559afde7..f47f1c91fafbf3 100644 --- a/chrome/browser/signin/fake_profile_oauth2_token_service_builder.cc +++ b/chrome/browser/signin/fake_profile_oauth2_token_service_builder.cc @@ -9,16 +9,16 @@ #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" // TODO(blundell): Should these be namespaced? -scoped_ptr BuildFakeProfileOAuth2TokenService( +std::unique_ptr BuildFakeProfileOAuth2TokenService( content::BrowserContext* context) { - scoped_ptr service( + std::unique_ptr service( new FakeProfileOAuth2TokenService()); return std::move(service); } -scoped_ptr BuildAutoIssuingFakeProfileOAuth2TokenService( +std::unique_ptr BuildAutoIssuingFakeProfileOAuth2TokenService( content::BrowserContext* context) { - scoped_ptr service( + std::unique_ptr service( new FakeProfileOAuth2TokenService()); service->set_auto_post_fetch_response_on_message_loop(true); return std::move(service); diff --git a/chrome/browser/signin/fake_profile_oauth2_token_service_builder.h b/chrome/browser/signin/fake_profile_oauth2_token_service_builder.h index d9cd4bdab7deed..7cb1d0d1d12e35 100644 --- a/chrome/browser/signin/fake_profile_oauth2_token_service_builder.h +++ b/chrome/browser/signin/fake_profile_oauth2_token_service_builder.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_BUILDER_H_ #define CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_BUILDER_H_ -#include "base/memory/scoped_ptr.h" +#include class KeyedService; @@ -16,14 +16,14 @@ class BrowserContext; // Helper function to be used with // BrowserContextKeyedServiceFactory::SetTestingFactory() that returns a // FakeProfileOAuth2TokenService object. -scoped_ptr BuildFakeProfileOAuth2TokenService( +std::unique_ptr BuildFakeProfileOAuth2TokenService( content::BrowserContext* context); // Helper function to be used with // BrowserContextKeyedServiceFactory::SetTestingFactory() that creates a // FakeProfileOAuth2TokenService object that posts fetch responses on the // current message loop. -scoped_ptr BuildAutoIssuingFakeProfileOAuth2TokenService( +std::unique_ptr BuildAutoIssuingFakeProfileOAuth2TokenService( content::BrowserContext* context); #endif // CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_BUILDER_H_ diff --git a/chrome/browser/signin/fake_signin_manager_builder.cc b/chrome/browser/signin/fake_signin_manager_builder.cc index b393755091ab1b..256a5855b2a553 100644 --- a/chrome/browser/signin/fake_signin_manager_builder.cc +++ b/chrome/browser/signin/fake_signin_manager_builder.cc @@ -14,9 +14,9 @@ #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/signin_manager_factory.h" -scoped_ptr BuildFakeSigninManagerBase( +std::unique_ptr BuildFakeSigninManagerBase( content::BrowserContext* context) { - scoped_ptr manager; + std::unique_ptr manager; Profile* profile = static_cast(context); manager.reset(new FakeSigninManagerForTesting(profile)); manager->Initialize(nullptr); diff --git a/chrome/browser/signin/fake_signin_manager_builder.h b/chrome/browser/signin/fake_signin_manager_builder.h index 31ee5cb420b6c2..a7f59ef2bbd443 100644 --- a/chrome/browser/signin/fake_signin_manager_builder.h +++ b/chrome/browser/signin/fake_signin_manager_builder.h @@ -5,10 +5,9 @@ #ifndef CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_BUILDER_H_ #define CHROME_BROWSER_SIGNIN_FAKE_SIGNIN_MANAGER_BUILDER_H_ +#include #include -#include "base/memory/scoped_ptr.h" - #include "build/build_config.h" #include "components/signin/core/browser/fake_signin_manager.h" @@ -23,7 +22,7 @@ class Profile; // In order to match the API of SigninManagerFactory::GetForProfile(), returns a // FakeSigninManagerBase* on ChromeOS, and a FakeSigninManager* on all other // platforms. The returned instance is initialized. -scoped_ptr BuildFakeSigninManagerBase( +std::unique_ptr BuildFakeSigninManagerBase( content::BrowserContext* context); class FakeSigninManagerForTesting diff --git a/chrome/browser/signin/local_auth.cc b/chrome/browser/signin/local_auth.cc index 5ddb1e69dc2ef7..3e8ce7001fd741 100644 --- a/chrome/browser/signin/local_auth.cc +++ b/chrome/browser/signin/local_auth.cc @@ -4,10 +4,11 @@ #include "chrome/browser/signin/local_auth.h" +#include + #include "base/base64.h" #include "base/files/file_path.h" #include "base/logging.h" -#include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" #include "base/strings/string_util.h" #include "chrome/browser/browser_process.h" @@ -103,11 +104,10 @@ std::string CreateSecurePasswordHash(const std::string& salt, base::Time start_time = base::Time::Now(); // Library call to create secure password hash as SymmetricKey (uses PBKDF2). - scoped_ptr password_key( + std::unique_ptr password_key( crypto::SymmetricKey::DeriveKeyFromPassword( - crypto::SymmetricKey::AES, - password, salt, - encoding.iteration_count, encoding.hash_bits)); + crypto::SymmetricKey::AES, password, salt, encoding.iteration_count, + encoding.hash_bits)); std::string password_hash; const bool success = password_key->GetRawKey(&password_hash); DCHECK(success); diff --git a/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc index 10f210cef528f3..66c0760b54aa29 100644 --- a/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc +++ b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc @@ -150,8 +150,9 @@ class MutableProfileOAuth2TokenServiceDelegateTest protected: base::MessageLoop message_loop_; net::FakeURLFetcherFactory factory_; - scoped_ptr client_; - scoped_ptr oauth2_service_delegate_; + std::unique_ptr client_; + std::unique_ptr + oauth2_service_delegate_; TestingOAuth2TokenServiceConsumer consumer_; SigninErrorController signin_error_controller_; TestingPrefServiceSimple pref_service_; @@ -380,7 +381,7 @@ TEST_F(MutableProfileOAuth2TokenServiceDelegateTest, FetchPersistentError) { EXPECT_EQ(0, access_token_failure_count_); std::vector scope_list; scope_list.push_back("scope"); - scoped_ptr fetcher( + std::unique_ptr fetcher( oauth2_service_delegate_->CreateAccessTokenFetcher( kEmail, oauth2_service_delegate_->GetRequestContext(), this)); fetcher->Start("foo", "bar", scope_list); @@ -409,7 +410,7 @@ TEST_F(MutableProfileOAuth2TokenServiceDelegateTest, RetryBackoff) { EXPECT_EQ(0, access_token_failure_count_); std::vector scope_list; scope_list.push_back("scope"); - scoped_ptr fetcher1( + std::unique_ptr fetcher1( oauth2_service_delegate_->CreateAccessTokenFetcher( kEmail, oauth2_service_delegate_->GetRequestContext(), this)); fetcher1->Start("foo", "bar", scope_list); @@ -423,7 +424,7 @@ TEST_F(MutableProfileOAuth2TokenServiceDelegateTest, RetryBackoff) { // Pretend that backoff has expired and try again. oauth2_service_delegate_->backoff_entry_.SetCustomReleaseTime( base::TimeTicks()); - scoped_ptr fetcher2( + std::unique_ptr fetcher2( oauth2_service_delegate_->CreateAccessTokenFetcher( kEmail, oauth2_service_delegate_->GetRequestContext(), this)); fetcher2->Start("foo", "bar", scope_list); @@ -452,7 +453,7 @@ TEST_F(MutableProfileOAuth2TokenServiceDelegateTest, ResetBackoff) { EXPECT_EQ(0, access_token_failure_count_); std::vector scope_list; scope_list.push_back("scope"); - scoped_ptr fetcher1( + std::unique_ptr fetcher1( oauth2_service_delegate_->CreateAccessTokenFetcher( kEmail, oauth2_service_delegate_->GetRequestContext(), this)); fetcher1->Start("foo", "bar", scope_list); @@ -463,7 +464,7 @@ TEST_F(MutableProfileOAuth2TokenServiceDelegateTest, ResetBackoff) { // Notify of network change and ensure that request now runs. oauth2_service_delegate_->OnNetworkChanged( net::NetworkChangeNotifier::CONNECTION_WIFI); - scoped_ptr fetcher2( + std::unique_ptr fetcher2( oauth2_service_delegate_->CreateAccessTokenFetcher( kEmail, oauth2_service_delegate_->GetRequestContext(), this)); fetcher2->Start("foo", "bar", scope_list); diff --git a/chrome/browser/signin/oauth2_token_service_delegate_android.cc b/chrome/browser/signin/oauth2_token_service_delegate_android.cc index 5d8f0f811c3b08..9508b3ec31df94 100644 --- a/chrome/browser/signin/oauth2_token_service_delegate_android.cc +++ b/chrome/browser/signin/oauth2_token_service_delegate_android.cc @@ -87,7 +87,7 @@ void AndroidAccessTokenFetcher::Start(const std::string& client_id, ScopedJavaLocalRef j_username = ConvertUTF8ToJavaString(env, account_id_); ScopedJavaLocalRef j_scope = ConvertUTF8ToJavaString(env, scope); - scoped_ptr heap_callback( + std::unique_ptr heap_callback( new FetchOAuth2TokenCallback( base::Bind(&AndroidAccessTokenFetcher::OnAccessTokenResponse, weak_factory_.GetWeakPtr()))); @@ -563,7 +563,7 @@ void OAuth2TokenFetched(JNIEnv* env, std::string token; if (authToken) token = ConvertJavaStringToUTF8(env, authToken); - scoped_ptr heap_callback( + std::unique_ptr heap_callback( reinterpret_cast(nativeCallback)); GoogleServiceAuthError err(authToken diff --git a/chrome/browser/signin/oauth2_token_service_delegate_android.h b/chrome/browser/signin/oauth2_token_service_delegate_android.h index dc098347e9c653..e7b34fb0c5d0f9 100644 --- a/chrome/browser/signin/oauth2_token_service_delegate_android.h +++ b/chrome/browser/signin/oauth2_token_service_delegate_android.h @@ -6,14 +6,15 @@ #define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_DELEGATE_ANDROID_H_ #include + #include +#include #include #include "base/android/jni_weak_ref.h" #include "base/android/scoped_java_ref.h" #include "base/callback.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" diff --git a/chrome/browser/signin/signin_error_notifier_ash_unittest.cc b/chrome/browser/signin/signin_error_notifier_ash_unittest.cc index 8fe2d437f8bea7..322195a93e8726 100644 --- a/chrome/browser/signin/signin_error_notifier_ash_unittest.cc +++ b/chrome/browser/signin/signin_error_notifier_ash_unittest.cc @@ -6,9 +6,10 @@ #include +#include + #include "ash/test/ash_test_base.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/notifications/notification.h" @@ -96,10 +97,10 @@ class SigninErrorNotifierTest : public AshTestBase { } #if defined(OS_WIN) - scoped_ptr test_screen_; + std::unique_ptr test_screen_; #endif - scoped_ptr profile_manager_; - scoped_ptr profile_; + std::unique_ptr profile_manager_; + std::unique_ptr profile_; SigninErrorController* error_controller_; NotificationUIManager* notification_ui_manager_; }; diff --git a/chrome/browser/signin/signin_global_error_unittest.cc b/chrome/browser/signin/signin_global_error_unittest.cc index ae4fc48a147243..610273a993e106 100644 --- a/chrome/browser/signin/signin_global_error_unittest.cc +++ b/chrome/browser/signin/signin_global_error_unittest.cc @@ -6,10 +6,10 @@ #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/utf_string_conversions.h" #include "base/test/histogram_tester.h" #include "chrome/browser/profiles/profile_attributes_entry.h" @@ -56,7 +56,7 @@ class SigninGlobalErrorTest : public testing::Test { testing_factories.push_back(std::make_pair( SigninManagerFactory::GetInstance(), BuildFakeSigninManagerBase)); profile_ = profile_manager_.CreateTestingProfile( - "Person 1", scoped_ptr(), + "Person 1", std::unique_ptr(), base::UTF8ToUTF16("Person 1"), 0, std::string(), testing_factories); SigninManagerFactory::GetForProfile(profile()) @@ -86,7 +86,7 @@ class SigninGlobalErrorTest : public testing::Test { }; TEST_F(SigninGlobalErrorTest, NoErrorAuthStatusProviders) { - scoped_ptr provider; + std::unique_ptr provider; ASSERT_FALSE(global_error()->HasMenuItem()); @@ -100,8 +100,8 @@ TEST_F(SigninGlobalErrorTest, NoErrorAuthStatusProviders) { } TEST_F(SigninGlobalErrorTest, ErrorAuthStatusProvider) { - scoped_ptr provider; - scoped_ptr error_provider; + std::unique_ptr provider; + std::unique_ptr error_provider; provider.reset(new FakeAuthStatusProvider(error_controller())); ASSERT_FALSE(global_error()->HasMenuItem()); diff --git a/chrome/browser/signin/signin_manager_unittest.cc b/chrome/browser/signin/signin_manager_unittest.cc index 7e17107f1d3dde..a8b3e883183a45 100644 --- a/chrome/browser/signin/signin_manager_unittest.cc +++ b/chrome/browser/signin/signin_manager_unittest.cc @@ -4,13 +4,13 @@ #include "components/signin/core/browser/signin_manager.h" +#include #include #include #include "base/bind.h" #include "base/bind_helpers.h" #include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "chrome/browser/browser_process.h" @@ -54,9 +54,10 @@ namespace { -scoped_ptr SigninManagerBuild(content::BrowserContext* context) { +std::unique_ptr SigninManagerBuild( + content::BrowserContext* context) { Profile* profile = static_cast(context); - scoped_ptr service(new SigninManager( + std::unique_ptr service(new SigninManager( ChromeSigninClientFactory::GetInstance()->GetForProfile(profile), ProfileOAuth2TokenServiceFactory::GetForProfile(profile), AccountTrackerServiceFactory::GetForProfile(profile), @@ -218,12 +219,12 @@ class SigninManagerTest : public testing::Test { content::TestBrowserThreadBundle thread_bundle_; net::TestURLFetcherFactory factory_; - scoped_ptr naked_manager_; + std::unique_ptr naked_manager_; SigninManager* manager_; TestSigninManagerObserver test_observer_; - scoped_ptr profile_; + std::unique_ptr profile_; std::vector oauth_tokens_fetched_; - scoped_ptr prefs_; + std::unique_ptr prefs_; std::vector cookies_; }; diff --git a/chrome/browser/signin/signin_tracker_factory.cc b/chrome/browser/signin/signin_tracker_factory.cc index 0e1a5372695221..c7f4ddf59aa203 100644 --- a/chrome/browser/signin/signin_tracker_factory.cc +++ b/chrome/browser/signin/signin_tracker_factory.cc @@ -14,13 +14,12 @@ SigninTrackerFactory::SigninTrackerFactory() {} SigninTrackerFactory::~SigninTrackerFactory() {} // static -scoped_ptr SigninTrackerFactory::CreateForProfile( +std::unique_ptr SigninTrackerFactory::CreateForProfile( Profile* profile, SigninTracker::Observer* observer) { - return scoped_ptr(new SigninTracker( + return std::unique_ptr(new SigninTracker( ProfileOAuth2TokenServiceFactory::GetForProfile(profile), SigninManagerFactory::GetForProfile(profile), GaiaCookieManagerServiceFactory::GetForProfile(profile), - ChromeSigninClientFactory::GetForProfile(profile), - observer)); + ChromeSigninClientFactory::GetForProfile(profile), observer)); } diff --git a/chrome/browser/signin/signin_tracker_factory.h b/chrome/browser/signin/signin_tracker_factory.h index c159e879fe2abb..b3d6c9f7cf8252 100644 --- a/chrome/browser/signin/signin_tracker_factory.h +++ b/chrome/browser/signin/signin_tracker_factory.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_TRACKER_FACTORY_H_ #define CHROME_BROWSER_SIGNIN_SIGNIN_TRACKER_FACTORY_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/signin/core/browser/signin_tracker.h" class Profile; @@ -17,7 +18,7 @@ class SigninTrackerFactory { // Creates a SigninTracker instance that tracks signin for |profile| on // behalf of |observer|. - static scoped_ptr CreateForProfile( + static std::unique_ptr CreateForProfile( Profile* profile, SigninTracker::Observer* observer); diff --git a/chrome/browser/signin/signin_tracker_unittest.cc b/chrome/browser/signin/signin_tracker_unittest.cc index 0f72fb98544f9e..c1b69175122c7e 100644 --- a/chrome/browser/signin/signin_tracker_unittest.cc +++ b/chrome/browser/signin/signin_tracker_unittest.cc @@ -89,8 +89,8 @@ class SigninTrackerTest : public testing::Test { } content::TestBrowserThreadBundle thread_bundle_; - scoped_ptr tracker_; - scoped_ptr profile_; + std::unique_ptr tracker_; + std::unique_ptr profile_; FakeSigninManagerForTesting* mock_signin_manager_; FakeProfileOAuth2TokenService* fake_oauth2_token_service_; MockObserver observer_; diff --git a/chrome/browser/signin/test_signin_client_builder.cc b/chrome/browser/signin/test_signin_client_builder.cc index ef66af9ce74c6f..890abef29f1cc5 100644 --- a/chrome/browser/signin/test_signin_client_builder.cc +++ b/chrome/browser/signin/test_signin_client_builder.cc @@ -4,14 +4,15 @@ #include "chrome/browser/signin/test_signin_client_builder.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/profiles/profile.h" #include "components/signin/core/browser/test_signin_client.h" namespace signin { -scoped_ptr BuildTestSigninClient( +std::unique_ptr BuildTestSigninClient( content::BrowserContext* context) { - return make_scoped_ptr( + return base::WrapUnique( new TestSigninClient(static_cast(context)->GetPrefs())); } diff --git a/chrome/browser/signin/test_signin_client_builder.h b/chrome/browser/signin/test_signin_client_builder.h index 54bb6eb886e383..3863c51015009f 100644 --- a/chrome/browser/signin/test_signin_client_builder.h +++ b/chrome/browser/signin/test_signin_client_builder.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_SIGNIN_TEST_SIGNIN_CLIENT_BUILDER_H_ #define CHROME_BROWSER_SIGNIN_TEST_SIGNIN_CLIENT_BUILDER_H_ -#include "base/memory/scoped_ptr.h" +#include class KeyedService; @@ -17,7 +17,7 @@ namespace signin { // Method to be used by the |ChromeSigninClientFactory| to create a test version // of the SigninClient -scoped_ptr BuildTestSigninClient( +std::unique_ptr BuildTestSigninClient( content::BrowserContext* context); } // namespace signin diff --git a/chrome/browser/site_details_browsertest.cc b/chrome/browser/site_details_browsertest.cc index 2c9ebf9f903c2f..bfade006d6ea56 100644 --- a/chrome/browser/site_details_browsertest.cc +++ b/chrome/browser/site_details_browsertest.cc @@ -92,7 +92,7 @@ class TestMemoryDetails : public MetricsMemoryDetails { base::MessageLoop::current()->QuitWhenIdle(); } - scoped_ptr uma_; + std::unique_ptr uma_; DISALLOW_COPY_AND_ASSIGN(TestMemoryDetails); }; @@ -185,7 +185,7 @@ class SiteDetailsBrowserTest : public ExtensionBrowserTest { // resources and, optionally, a background process. const Extension* CreateExtension(const std::string& name, bool has_background_process) { - scoped_ptr dir(new TestExtensionDir); + std::unique_ptr dir(new TestExtensionDir); DictionaryBuilder manifest; manifest.Set("name", name) @@ -243,7 +243,7 @@ class SiteDetailsBrowserTest : public ExtensionBrowserTest { const Extension* CreateHostedApp(const std::string& name, const GURL& app_url) { - scoped_ptr dir(new TestExtensionDir); + std::unique_ptr dir(new TestExtensionDir); DictionaryBuilder manifest; manifest.Set("name", name) diff --git a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc index a33835120cced1..3e8bb906f413fb 100644 --- a/chrome/browser/speech/extension_api/tts_engine_extension_api.cc +++ b/chrome/browser/speech/extension_api/tts_engine_extension_api.cc @@ -145,13 +145,13 @@ void TtsExtensionEngine::Speak(Utterance* utterance, // utterance now. bool sends_end_event = voice.events.find(TTS_EVENT_END) != voice.events.end(); - scoped_ptr args(new base::ListValue()); + std::unique_ptr args(new base::ListValue()); args->AppendString(utterance->text()); // Pass through most options to the speech engine, but remove some // that are handled internally. - scoped_ptr options(static_cast( - utterance->options()->DeepCopy())); + std::unique_ptr options( + static_cast(utterance->options()->DeepCopy())); if (options->HasKey(constants::kRequiredEventTypesKey)) options->Remove(constants::kRequiredEventTypesKey, NULL); if (options->HasKey(constants::kDesiredEventTypesKey)) @@ -195,7 +195,7 @@ void TtsExtensionEngine::Speak(Utterance* utterance, std::string json; base::JSONWriter::Write(*args, &json); - scoped_ptr event( + std::unique_ptr event( new extensions::Event(extensions::events::TTS_ENGINE_ON_SPEAK, tts_engine_events::kOnSpeak, std::move(args))); Profile* profile = Profile::FromBrowserContext(utterance->browser_context()); @@ -205,8 +205,8 @@ void TtsExtensionEngine::Speak(Utterance* utterance, } void TtsExtensionEngine::Stop(Utterance* utterance) { - scoped_ptr args(new base::ListValue()); - scoped_ptr event( + std::unique_ptr args(new base::ListValue()); + std::unique_ptr event( new extensions::Event(extensions::events::TTS_ENGINE_ON_STOP, tts_engine_events::kOnStop, std::move(args))); Profile* profile = Profile::FromBrowserContext(utterance->browser_context()); @@ -216,8 +216,8 @@ void TtsExtensionEngine::Stop(Utterance* utterance) { } void TtsExtensionEngine::Pause(Utterance* utterance) { - scoped_ptr args(new base::ListValue()); - scoped_ptr event( + std::unique_ptr args(new base::ListValue()); + std::unique_ptr event( new extensions::Event(extensions::events::TTS_ENGINE_ON_PAUSE, tts_engine_events::kOnPause, std::move(args))); Profile* profile = Profile::FromBrowserContext(utterance->browser_context()); @@ -229,8 +229,8 @@ void TtsExtensionEngine::Pause(Utterance* utterance) { } void TtsExtensionEngine::Resume(Utterance* utterance) { - scoped_ptr args(new base::ListValue()); - scoped_ptr event( + std::unique_ptr args(new base::ListValue()); + std::unique_ptr event( new extensions::Event(extensions::events::TTS_ENGINE_ON_RESUME, tts_engine_events::kOnResume, std::move(args))); Profile* profile = Profile::FromBrowserContext(utterance->browser_context()); diff --git a/chrome/browser/speech/extension_api/tts_extension_api.cc b/chrome/browser/speech/extension_api/tts_extension_api.cc index 410b67252fab27..be3eabfddd723e 100644 --- a/chrome/browser/speech/extension_api/tts_extension_api.cc +++ b/chrome/browser/speech/extension_api/tts_extension_api.cc @@ -124,7 +124,7 @@ void TtsExtensionEventHandler::OnTtsEvent(Utterance* utterance, } const char *event_type_string = TtsEventTypeToString(event_type); - scoped_ptr details(new base::DictionaryValue()); + std::unique_ptr details(new base::DictionaryValue()); if (char_index >= 0) details->SetInteger(constants::kCharIndexKey, char_index); details->SetString(constants::kEventTypeKey, event_type_string); @@ -134,10 +134,10 @@ void TtsExtensionEventHandler::OnTtsEvent(Utterance* utterance, details->SetInteger(constants::kSrcIdKey, utterance->src_id()); details->SetBoolean(constants::kIsFinalEventKey, utterance->finished()); - scoped_ptr arguments(new base::ListValue()); + std::unique_ptr arguments(new base::ListValue()); arguments->Set(0, details.release()); - scoped_ptr event( + std::unique_ptr event( new extensions::Event(::extensions::events::TTS_ON_EVENT, ::events::kOnEvent, std::move(arguments))); event->restrict_to_browser_context = utterance->browser_context(); @@ -157,7 +157,7 @@ bool TtsSpeakFunction::RunAsync() { return false; } - scoped_ptr options(new base::DictionaryValue()); + std::unique_ptr options(new base::DictionaryValue()); if (args_->GetSize() >= 2) { base::DictionaryValue* temp_options = NULL; if (args_->GetDictionary(1, &temp_options)) @@ -317,7 +317,7 @@ bool TtsGetVoicesFunction::RunSync() { std::vector voices; TtsController::GetInstance()->GetVoices(GetProfile(), &voices); - scoped_ptr result_voices(new base::ListValue()); + std::unique_ptr result_voices(new base::ListValue()); for (size_t i = 0; i < voices.size(); ++i) { const VoiceData& voice = voices[i]; base::DictionaryValue* result_voice = new base::DictionaryValue(); diff --git a/chrome/browser/speech/speech_recognition_browsertest.cc b/chrome/browser/speech/speech_recognition_browsertest.cc index d110ebdf1016aa..3e7a0eb0bcd255 100644 --- a/chrome/browser/speech/speech_recognition_browsertest.cc +++ b/chrome/browser/speech/speech_recognition_browsertest.cc @@ -45,7 +45,7 @@ class ChromeSpeechRecognitionTest : public InProcessBrowserTest { } protected: - scoped_ptr + std::unique_ptr fake_speech_recognition_manager_; private: @@ -90,7 +90,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSpeechRecognitionTest, BasicTearDown) { embedded_test_server()->GetURL("/speech/web_speech_test.html"); GURL https_url(https_server.GetURL("/speech/web_speech_test.html")); - scoped_ptr delegate( + std::unique_ptr delegate( new ChromeSpeechRecognitionManagerDelegate()); static_cast( fake_speech_recognition_manager_.get())->SetDelegate(delegate.get()); diff --git a/chrome/browser/speech/tts_controller.h b/chrome/browser/speech/tts_controller.h index 087045d5b75303..9ae2f32930dcb2 100644 --- a/chrome/browser/speech/tts_controller.h +++ b/chrome/browser/speech/tts_controller.h @@ -5,12 +5,12 @@ #ifndef CHROME_BROWSER_SPEECH_TTS_CONTROLLER_H_ #define CHROME_BROWSER_SPEECH_TTS_CONTROLLER_H_ +#include #include #include #include #include -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/memory/weak_ptr.h" #include "url/gurl.h" @@ -239,7 +239,7 @@ class Utterance { // The full options arg passed to tts.speak, which may include fields // other than the ones we explicitly parse, below. - scoped_ptr options_; + std::unique_ptr options_; // The source extension's ID of this utterance, so that it can associate // events with the appropriate callback. diff --git a/chrome/browser/speech/tts_controller_impl.h b/chrome/browser/speech/tts_controller_impl.h index 23bb86c734706e..b63df0950e23fe 100644 --- a/chrome/browser/speech/tts_controller_impl.h +++ b/chrome/browser/speech/tts_controller_impl.h @@ -5,13 +5,13 @@ #ifndef CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ #define CHROME_BROWSER_SPEECH_TTS_CONTROLLER_IMPL_H_ +#include #include #include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "chrome/browser/speech/tts_controller.h" #include "url/gurl.h" diff --git a/chrome/browser/speech/tts_linux.cc b/chrome/browser/speech/tts_linux.cc index 93803d1e4687fe..416c897b70ed8e 100644 --- a/chrome/browser/speech/tts_linux.cc +++ b/chrome/browser/speech/tts_linux.cc @@ -6,17 +6,16 @@ #include #include +#include #include "base/command_line.h" #include "base/debug/leak_annotations.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/synchronization/lock.h" #include "chrome/browser/speech/tts_platform.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" - #include "library_loaders/libspeechd.h" using content::BrowserThread; @@ -83,7 +82,7 @@ class TtsPlatformImplLinux : public TtsPlatformImpl { // Map a string composed of a voicename and module to the voicename. Used to // uniquely identify a voice across all available modules. - scoped_ptr > all_native_voices_; + std::unique_ptr> all_native_voices_; friend struct base::DefaultSingletonTraits; diff --git a/chrome/browser/speech/tts_message_filter.cc b/chrome/browser/speech/tts_message_filter.cc index 3b398fcdb414f9..013c7a9c60f954 100644 --- a/chrome/browser/speech/tts_message_filter.cc +++ b/chrome/browser/speech/tts_message_filter.cc @@ -115,7 +115,7 @@ void TtsMessageFilter::OnSpeak(const TtsUtteranceRequest& request) { if (!browser_context_) return; - scoped_ptr utterance(new Utterance(browser_context_)); + std::unique_ptr utterance(new Utterance(browser_context_)); utterance->set_src_id(request.id); utterance->set_text(request.text); utterance->set_lang(request.lang); diff --git a/chrome/browser/ssl/bad_clock_blocking_page.cc b/chrome/browser/ssl/bad_clock_blocking_page.cc index dcdfae4d86b293..105c52ee4ce911 100644 --- a/chrome/browser/ssl/bad_clock_blocking_page.cc +++ b/chrome/browser/ssl/bad_clock_blocking_page.cc @@ -55,21 +55,20 @@ BadClockBlockingPage::BadClockBlockingPage( const GURL& request_url, const base::Time& time_triggered, ssl_errors::ClockState clock_state, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const base::Callback& callback) : SecurityInterstitialPage(web_contents, request_url), callback_(callback), ssl_info_(ssl_info), time_triggered_(time_triggered), controller_(new ChromeControllerClient(web_contents)) { - // Set up the metrics helper for the BadClockUI. security_interstitials::MetricsHelper::ReportDetails reporting_info; reporting_info.metric_prefix = kMetricsName; ChromeMetricsHelper* chrome_metrics_helper = new ChromeMetricsHelper( web_contents, request_url, reporting_info, kMetricsName); chrome_metrics_helper->StartRecordingCaptivePortalMetrics(false); - scoped_ptr metrics_helper( + std::unique_ptr metrics_helper( chrome_metrics_helper); controller_->set_metrics_helper(std::move(metrics_helper)); @@ -131,7 +130,7 @@ void BadClockBlockingPage::OverrideEntry(NavigationEntry* entry) { } void BadClockBlockingPage::SetSSLCertReporterForTesting( - scoped_ptr ssl_cert_reporter) { + std::unique_ptr ssl_cert_reporter) { cert_report_helper_->SetSSLCertReporterForTesting( std::move(ssl_cert_reporter)); } diff --git a/chrome/browser/ssl/bad_clock_blocking_page.h b/chrome/browser/ssl/bad_clock_blocking_page.h index 5b630793877120..ee5edfb06ed303 100644 --- a/chrome/browser/ssl/bad_clock_blocking_page.h +++ b/chrome/browser/ssl/bad_clock_blocking_page.h @@ -41,7 +41,7 @@ class BadClockBlockingPage : public SecurityInterstitialPage { const GURL& request_url, const base::Time& time_triggered, ssl_errors::ClockState clock_state, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const base::Callback& callback); ~BadClockBlockingPage() override; @@ -50,7 +50,7 @@ class BadClockBlockingPage : public SecurityInterstitialPage { InterstitialPageDelegate::TypeID GetTypeForTesting() const override; void SetSSLCertReporterForTesting( - scoped_ptr ssl_cert_reporter); + std::unique_ptr ssl_cert_reporter); protected: // InterstitialPageDelegate implementation: @@ -71,10 +71,10 @@ class BadClockBlockingPage : public SecurityInterstitialPage { base::Callback callback_; const net::SSLInfo ssl_info_; const base::Time time_triggered_; - scoped_ptr controller_; + std::unique_ptr controller_; - scoped_ptr bad_clock_ui_; - scoped_ptr cert_report_helper_; + std::unique_ptr bad_clock_ui_; + std::unique_ptr cert_report_helper_; DISALLOW_COPY_AND_ASSIGN(BadClockBlockingPage); }; diff --git a/chrome/browser/ssl/captive_portal_blocking_page.cc b/chrome/browser/ssl/captive_portal_blocking_page.cc index 27c08dbaf4aede..cf610aa48ef62d 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page.cc +++ b/chrome/browser/ssl/captive_portal_blocking_page.cc @@ -52,7 +52,7 @@ CaptivePortalBlockingPage::CaptivePortalBlockingPage( content::WebContents* web_contents, const GURL& request_url, const GURL& login_url, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const net::SSLInfo& ssl_info, const base::Callback& callback) : SecurityInterstitialPage(web_contents, request_url), @@ -92,7 +92,7 @@ std::string CaptivePortalBlockingPage::GetWiFiSSID() const { // Linux so |net::GetWifiSSID| is used instead. std::string ssid; #if defined(OS_WIN) || defined(OS_MACOSX) - scoped_ptr wifi_service(wifi::WiFiService::Create()); + std::unique_ptr wifi_service(wifi::WiFiService::Create()); wifi_service->Initialize(nullptr); std::string error; wifi_service->GetConnectedNetworkSSID(&ssid, &error); diff --git a/chrome/browser/ssl/captive_portal_blocking_page.h b/chrome/browser/ssl/captive_portal_blocking_page.h index ec7e0cb1910523..ce185d9a406e76 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page.h +++ b/chrome/browser/ssl/captive_portal_blocking_page.h @@ -5,11 +5,11 @@ #ifndef CHROME_BROWSER_SSL_CAPTIVE_PORTAL_BLOCKING_PAGE_H_ #define CHROME_BROWSER_SSL_CAPTIVE_PORTAL_BLOCKING_PAGE_H_ +#include #include #include "base/callback.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/interstitials/security_interstitial_page.h" #include "url/gurl.h" @@ -43,7 +43,7 @@ class CaptivePortalBlockingPage : public SecurityInterstitialPage { CaptivePortalBlockingPage(content::WebContents* web_contents, const GURL& request_url, const GURL& login_url, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const net::SSLInfo& ssl_info, const base::Callback& callback); ~CaptivePortalBlockingPage() override; @@ -71,7 +71,7 @@ class CaptivePortalBlockingPage : public SecurityInterstitialPage { private: // URL of the login page, opened when the user clicks the "Connect" button. const GURL login_url_; - scoped_ptr cert_report_helper_; + std::unique_ptr cert_report_helper_; base::Callback callback_; DISALLOW_COPY_AND_ASSIGN(CaptivePortalBlockingPage); diff --git a/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc b/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc index e913d420080c12..555b1e4f8fbe32 100644 --- a/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc +++ b/chrome/browser/ssl/captive_portal_blocking_page_browsertest.cc @@ -63,7 +63,7 @@ class CaptivePortalBlockingPageForTesting : public CaptivePortalBlockingPage { content::WebContents* web_contents, const GURL& request_url, const GURL& login_url, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const net::SSLInfo& ssl_info, const base::Callback& callback, bool is_wifi, @@ -95,7 +95,7 @@ class CaptivePortalBlockingPageTest ExpectWiFi expect_wifi, ExpectWiFiSSID expect_wifi_ssid, ExpectLoginURL expect_login_url, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const std::string& expected_login_hostname); void TestInterstitial(bool is_wifi_connection, @@ -111,7 +111,7 @@ class CaptivePortalBlockingPageTest ExpectWiFi expect_wifi, ExpectWiFiSSID expect_wifi_ssid, ExpectLoginURL expect_login_url, - scoped_ptr ssl_cert_reporter); + std::unique_ptr ssl_cert_reporter); void TestCertReporting(certificate_reporting_test_utils::OptIn opt_in); @@ -126,7 +126,7 @@ void CaptivePortalBlockingPageTest::TestInterstitial( ExpectWiFi expect_wifi, ExpectWiFiSSID expect_wifi_ssid, ExpectLoginURL expect_login_url, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const std::string& expected_login_hostname) { content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); @@ -180,7 +180,7 @@ void CaptivePortalBlockingPageTest::TestInterstitial( ExpectWiFi expect_wifi, ExpectWiFiSSID expect_wifi_ssid, ExpectLoginURL expect_login_url, - scoped_ptr ssl_cert_reporter) { + std::unique_ptr ssl_cert_reporter) { TestInterstitial(is_wifi_connection, wifi_ssid, login_url, expect_wifi, expect_wifi_ssid, expect_login_url, std::move(ssl_cert_reporter), login_url.host()); @@ -192,7 +192,7 @@ void CaptivePortalBlockingPageTest::TestCertReporting( certificate_reporting_test_utils::SetCertReportingOptIn(browser(), opt_in); base::RunLoop run_loop; - scoped_ptr ssl_cert_reporter = + std::unique_ptr ssl_cert_reporter = certificate_reporting_test_utils::SetUpMockSSLCertReporter( &run_loop, opt_in == certificate_reporting_test_utils::EXTENDED_REPORTING_OPT_IN diff --git a/chrome/browser/ssl/cert_report_helper.cc b/chrome/browser/ssl/cert_report_helper.cc index 49cc7416382f3e..08d57718d0d0a5 100644 --- a/chrome/browser/ssl/cert_report_helper.cc +++ b/chrome/browser/ssl/cert_report_helper.cc @@ -34,7 +34,7 @@ const char CertReportHelper::kFinchGroupDontShowDontSend[] = const char CertReportHelper::kFinchParamName[] = "sendingThreshold"; CertReportHelper::CertReportHelper( - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, content::WebContents* web_contents, const GURL& request_url, const net::SSLInfo& ssl_info, @@ -112,7 +112,7 @@ void CertReportHelper::FinishCertCollection( } void CertReportHelper::SetSSLCertReporterForTesting( - scoped_ptr ssl_cert_reporter) { + std::unique_ptr ssl_cert_reporter) { ssl_cert_reporter_ = std::move(ssl_cert_reporter); } diff --git a/chrome/browser/ssl/cert_report_helper.h b/chrome/browser/ssl/cert_report_helper.h index a9b15355517ae3..868a3c90c427ab 100644 --- a/chrome/browser/ssl/cert_report_helper.h +++ b/chrome/browser/ssl/cert_report_helper.h @@ -37,7 +37,7 @@ class CertReportHelper { static const char kFinchGroupDontShowDontSend[]; static const char kFinchParamName[]; - CertReportHelper(scoped_ptr ssl_cert_reporter, + CertReportHelper(std::unique_ptr ssl_cert_reporter, content::WebContents* web_contents, const GURL& request_url, const net::SSLInfo& ssl_info, @@ -60,7 +60,7 @@ class CertReportHelper { // Allows tests to inject a mock reporter. void SetSSLCertReporterForTesting( - scoped_ptr ssl_cert_reporter); + std::unique_ptr ssl_cert_reporter); private: // Checks whether a checkbox should be shown on the page that allows @@ -76,7 +76,7 @@ class CertReportHelper { bool IsPrefEnabled(const char* pref); // Handles reports of invalid SSL certificates. - scoped_ptr ssl_cert_reporter_; + std::unique_ptr ssl_cert_reporter_; // The WebContents for which this helper sends reports. content::WebContents* web_contents_; // The URL for which this helper sends reports. diff --git a/chrome/browser/ssl/cert_verifier_browser_test.h b/chrome/browser/ssl/cert_verifier_browser_test.h index d5d977ccae9e46..38ddcdf3d8262b 100644 --- a/chrome/browser/ssl/cert_verifier_browser_test.h +++ b/chrome/browser/ssl/cert_verifier_browser_test.h @@ -5,7 +5,8 @@ #ifndef CHROME_BROWSER_SSL_CERT_VERIFIER_BROWSER_TEST_H_ #define CHROME_BROWSER_SSL_CERT_VERIFIER_BROWSER_TEST_H_ -#include "base/memory/scoped_ptr.h" +#include + #include "chrome/test/base/in_process_browser_test.h" namespace net { @@ -31,7 +32,7 @@ class CertVerifierBrowserTest : public InProcessBrowserTest { net::MockCertVerifier* mock_cert_verifier(); private: - scoped_ptr mock_cert_verifier_; + std::unique_ptr mock_cert_verifier_; }; #endif // CHROME_BROWSER_SSL_CERT_VERIFIER_BROWSER_TEST_H_ diff --git a/chrome/browser/ssl/certificate_reporting_test_utils.cc b/chrome/browser/ssl/certificate_reporting_test_utils.cc index 82b78b64cea404..013cdf26cf2e39 100644 --- a/chrome/browser/ssl/certificate_reporting_test_utils.cc +++ b/chrome/browser/ssl/certificate_reporting_test_utils.cc @@ -37,7 +37,7 @@ namespace { void SetMockReporter( SafeBrowsingService* safe_browsing_service, - scoped_ptr reporter) { + std::unique_ptr reporter) { safe_browsing_service->ping_manager()->SetCertificateErrorReporterForTesting( std::move(reporter)); } @@ -140,9 +140,10 @@ void CertificateReportingTest::SetUpMockReporter() { content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, - base::Bind(SetMockReporter, base::RetainedRef(safe_browsing_service), - base::Passed(scoped_ptr( - reporter_)))); + base::Bind( + SetMockReporter, base::RetainedRef(safe_browsing_service), + base::Passed(std::unique_ptr( + reporter_)))); } const std::string& CertificateReportingTest::GetLatestHostnameReported() const { @@ -155,7 +156,7 @@ void SetCertReportingOptIn(Browser* browser, OptIn opt_in) { opt_in == EXTENDED_REPORTING_OPT_IN); } -scoped_ptr SetUpMockSSLCertReporter( +std::unique_ptr SetUpMockSSLCertReporter( base::RunLoop* run_loop, ExpectReport expect_report) { // Set up a MockSSLCertReporter to keep track of when the blocking @@ -165,10 +166,11 @@ scoped_ptr SetUpMockSSLCertReporter( if (!sb_service) return nullptr; - scoped_ptr ssl_cert_reporter(new MockSSLCertReporter( - sb_service->ui_manager(), expect_report == CERT_REPORT_EXPECTED - ? run_loop->QuitClosure() - : base::Bind(&base::DoNothing))); + std::unique_ptr ssl_cert_reporter( + new MockSSLCertReporter(sb_service->ui_manager(), + expect_report == CERT_REPORT_EXPECTED + ? run_loop->QuitClosure() + : base::Bind(&base::DoNothing))); ssl_cert_reporter->set_expect_report(expect_report == CERT_REPORT_EXPECTED); return std::move(ssl_cert_reporter); } diff --git a/chrome/browser/ssl/certificate_reporting_test_utils.h b/chrome/browser/ssl/certificate_reporting_test_utils.h index 60f4549859ddf8..1136c5d67d132d 100644 --- a/chrome/browser/ssl/certificate_reporting_test_utils.h +++ b/chrome/browser/ssl/certificate_reporting_test_utils.h @@ -49,7 +49,7 @@ void SetCertReportingOptIn(Browser* browser, OptIn opt_in); // be owned by the caller. The mock SSLCertReporter will call // |run_loop|'s QuitClosure when a report is sent. It also checks that a // report is sent or not sent according to |expect_report|. -scoped_ptr SetUpMockSSLCertReporter( +std::unique_ptr SetUpMockSSLCertReporter( base::RunLoop* run_loop, ExpectReport expect_report); diff --git a/chrome/browser/ssl/chrome_expect_ct_reporter.cc b/chrome/browser/ssl/chrome_expect_ct_reporter.cc index 983a2cadfd4ac0..3fb07890569fa0 100644 --- a/chrome/browser/ssl/chrome_expect_ct_reporter.cc +++ b/chrome/browser/ssl/chrome_expect_ct_reporter.cc @@ -10,6 +10,7 @@ #include "base/command_line.h" #include "base/feature_list.h" #include "base/json/json_writer.h" +#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/sparse_histogram.h" #include "base/strings/string_number_conversions.h" @@ -29,16 +30,16 @@ std::string TimeToISO8601(const base::Time& t) { exploded.millisecond); } -scoped_ptr GetPEMEncodedChainAsList( +std::unique_ptr GetPEMEncodedChainAsList( const net::X509Certificate* cert_chain) { if (!cert_chain) - return make_scoped_ptr(new base::ListValue()); + return base::WrapUnique(new base::ListValue()); - scoped_ptr result(new base::ListValue()); + std::unique_ptr result(new base::ListValue()); std::vector pem_encoded_chain; cert_chain->GetPEMEncodedChain(&pem_encoded_chain); for (const std::string& cert : pem_encoded_chain) - result->Append(make_scoped_ptr(new base::StringValue(cert))); + result->Append(base::WrapUnique(new base::StringValue(cert))); return result; } @@ -61,7 +62,7 @@ std::string SCTOriginToString( void AddUnknownSCT( const net::SignedCertificateTimestampAndStatus& sct_and_status, base::ListValue* list) { - scoped_ptr list_item(new base::DictionaryValue()); + std::unique_ptr list_item(new base::DictionaryValue()); list_item->SetString("origin", SCTOriginToString(sct_and_status.sct->origin)); list->Append(std::move(list_item)); } @@ -69,7 +70,7 @@ void AddUnknownSCT( void AddInvalidSCT( const net::SignedCertificateTimestampAndStatus& sct_and_status, base::ListValue* list) { - scoped_ptr list_item(new base::DictionaryValue()); + std::unique_ptr list_item(new base::DictionaryValue()); list_item->SetString("origin", SCTOriginToString(sct_and_status.sct->origin)); std::string log_id; base::Base64Encode(sct_and_status.sct->log_id, &log_id); @@ -79,12 +80,12 @@ void AddInvalidSCT( void AddValidSCT(const net::SignedCertificateTimestampAndStatus& sct_and_status, base::ListValue* list) { - scoped_ptr list_item(new base::DictionaryValue()); + std::unique_ptr list_item(new base::DictionaryValue()); list_item->SetString("origin", SCTOriginToString(sct_and_status.sct->origin)); // The structure of the SCT object is defined in // http://tools.ietf.org/html/rfc6962#section-4.1. - scoped_ptr sct(new base::DictionaryValue()); + std::unique_ptr sct(new base::DictionaryValue()); sct->SetInteger("sct_version", sct_and_status.sct->version); std::string log_id; base::Base64Encode(sct_and_status.sct->log_id, &log_id); @@ -142,9 +143,9 @@ void ChromeExpectCTReporter::OnExpectCTFailed( report.Set("validated-certificate-chain", GetPEMEncodedChainAsList(ssl_info.cert.get())); - scoped_ptr unknown_scts(new base::ListValue()); - scoped_ptr invalid_scts(new base::ListValue()); - scoped_ptr valid_scts(new base::ListValue()); + std::unique_ptr unknown_scts(new base::ListValue()); + std::unique_ptr invalid_scts(new base::ListValue()); + std::unique_ptr valid_scts(new base::ListValue()); for (const auto& sct_and_status : ssl_info.signed_certificate_timestamps) { switch (sct_and_status.status) { diff --git a/chrome/browser/ssl/chrome_expect_ct_reporter.h b/chrome/browser/ssl/chrome_expect_ct_reporter.h index 7ceb441c02970e..e5be865e552040 100644 --- a/chrome/browser/ssl/chrome_expect_ct_reporter.h +++ b/chrome/browser/ssl/chrome_expect_ct_reporter.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_SSL_CHROME_EXPECT_CT_REPORTER_H_ #define CHROME_BROWSER_SSL_CHROME_EXPECT_CT_REPORTER_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "net/http/transport_security_state.h" namespace net { @@ -34,7 +35,7 @@ class ChromeExpectCTReporter FRIEND_TEST_ALL_PREFIXES(ChromeExpectCTReporterTest, EmptyReportURI); FRIEND_TEST_ALL_PREFIXES(ChromeExpectCTReporterTest, SendReport); - scoped_ptr report_sender_; + std::unique_ptr report_sender_; DISALLOW_COPY_AND_ASSIGN(ChromeExpectCTReporter); }; diff --git a/chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc b/chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc index bebe06f8def1d7..6ca03f5530208f 100644 --- a/chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc +++ b/chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc @@ -217,7 +217,7 @@ void CheckReportSCTs( void CheckExpectCTReport(const std::string& serialized_report, const net::HostPortPair& host_port, const net::SSLInfo& ssl_info) { - scoped_ptr value(base::JSONReader::Read(serialized_report)); + std::unique_ptr value(base::JSONReader::Read(serialized_report)); ASSERT_TRUE(value); ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); diff --git a/chrome/browser/ssl/chrome_security_state_model_client.h b/chrome/browser/ssl/chrome_security_state_model_client.h index 1c3296fc15f019..4ea52792f4d845 100644 --- a/chrome/browser/ssl/chrome_security_state_model_client.h +++ b/chrome/browser/ssl/chrome_security_state_model_client.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_ #define CHROME_BROWSER_SSL_CHROME_SECURITY_STATE_MODEL_CLIENT_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "components/security_state/security_state_model.h" #include "components/security_state/security_state_model_client.h" #include "content/public/browser/web_contents_user_data.h" @@ -38,7 +39,7 @@ class ChromeSecurityStateModelClient friend class content::WebContentsUserData; content::WebContents* web_contents_; - scoped_ptr security_state_model_; + std::unique_ptr security_state_model_; DISALLOW_COPY_AND_ASSIGN(ChromeSecurityStateModelClient); }; diff --git a/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc b/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc index fc46b36b51a32e..d2c41d7c1bcc7e 100644 --- a/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc +++ b/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc @@ -458,7 +458,7 @@ void InstallLoadingInterceptor(const std::string& host) { net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); filter->AddHostnameInterceptor( "http", host, - scoped_ptr(new PendingJobInterceptor())); + std::unique_ptr(new PendingJobInterceptor())); } class SecurityStateModelLoadingTest diff --git a/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc b/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc index 30a0ce36723ad7..e45257f432bfe8 100644 --- a/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc +++ b/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc @@ -118,7 +118,7 @@ void MigrateOldSettings(HostContentSettingsMap* map) { // Pull out the value of the old-format setting. Only do this if the // patterns are as we expect them to be, otherwise the setting will just // be removed for safety. - scoped_ptr value; + std::unique_ptr value; if (setting.primary_pattern == setting.secondary_pattern && url.is_valid()) { value = map->GetWebsiteSetting(url, url, @@ -283,7 +283,7 @@ void ChromeSSLHostStateDelegate::AllowCert(const std::string& host, GURL url = GetSecureGURLForHost(host); HostContentSettingsMap* map = HostContentSettingsMapFactory::GetForProfile(profile_); - scoped_ptr value(map->GetWebsiteSetting( + std::unique_ptr value(map->GetWebsiteSetting( url, url, CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, std::string(), NULL)); if (!value.get() || !value->IsType(base::Value::TYPE_DICTIONARY)) @@ -326,7 +326,7 @@ ChromeSSLHostStateDelegate::QueryPolicy(const std::string& host, HostContentSettingsMap* map = HostContentSettingsMapFactory::GetForProfile(profile_); GURL url = GetSecureGURLForHost(host); - scoped_ptr value(map->GetWebsiteSetting( + std::unique_ptr value(map->GetWebsiteSetting( url, url, CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, std::string(), NULL)); // Set a default value in case this method is short circuited and doesn't do a @@ -414,7 +414,7 @@ bool ChromeSSLHostStateDelegate::HasAllowException( HostContentSettingsMap* map = HostContentSettingsMapFactory::GetForProfile(profile_); - scoped_ptr value(map->GetWebsiteSetting( + std::unique_ptr value(map->GetWebsiteSetting( url, url, CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, std::string(), NULL)); if (!value.get() || !value->IsType(base::Value::TYPE_DICTIONARY)) @@ -444,6 +444,6 @@ bool ChromeSSLHostStateDelegate::DidHostRunInsecureContent( int pid) const { return !!ran_insecure_content_hosts_.count(BrokenHostEntry(host, pid)); } -void ChromeSSLHostStateDelegate::SetClock(scoped_ptr clock) { +void ChromeSSLHostStateDelegate::SetClock(std::unique_ptr clock) { clock_.reset(clock.release()); } diff --git a/chrome/browser/ssl/chrome_ssl_host_state_delegate.h b/chrome/browser/ssl/chrome_ssl_host_state_delegate.h index 374403a910abfa..8a01205cdb47cd 100644 --- a/chrome/browser/ssl/chrome_ssl_host_state_delegate.h +++ b/chrome/browser/ssl/chrome_ssl_host_state_delegate.h @@ -5,9 +5,10 @@ #ifndef CHROME_BROWSER_SSL_CHROME_SSL_HOST_STATE_DELEGATE_H_ #define CHROME_BROWSER_SSL_CHROME_SSL_HOST_STATE_DELEGATE_H_ +#include + #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "content/public/browser/ssl_host_state_delegate.h" @@ -58,7 +59,7 @@ class ChromeSSLHostStateDelegate : public content::SSLHostStateDelegate { protected: // SetClock takes ownership of the passed in clock. - void SetClock(scoped_ptr clock); + void SetClock(std::unique_ptr clock); private: FRIEND_TEST_ALL_PREFIXES(DefaultMemorySSLHostStateDelegateTest, AfterRestart); @@ -101,7 +102,7 @@ class ChromeSSLHostStateDelegate : public content::SSLHostStateDelegate { CreateDictionaryEntriesDisposition create_entries, bool* expired_previous_decision); - scoped_ptr clock_; + std::unique_ptr clock_; RememberSSLExceptionDecisionsDisposition should_remember_ssl_decisions_; Profile* profile_; diff --git a/chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.cc b/chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.cc index f4567402e3fa33..b2aa1d67fd053c 100644 --- a/chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.cc +++ b/chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.cc @@ -4,8 +4,9 @@ #include "chrome/browser/ssl/chrome_ssl_host_state_delegate_factory.h" +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" @@ -25,7 +26,7 @@ class Service : public KeyedService { void Shutdown() override {} private: - scoped_ptr decisions_; + std::unique_ptr decisions_; DISALLOW_COPY_AND_ASSIGN(Service); }; diff --git a/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc b/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc index c3f99e8fa42215..2db96c9eb83d06 100644 --- a/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc +++ b/chrome/browser/ssl/chrome_ssl_host_state_delegate_test.cc @@ -232,7 +232,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSSLHostStateDelegateTest, Migrate) { HostContentSettingsMap* map = HostContentSettingsMapFactory::GetForProfile(profile); GURL url(std::string("https://") + kWWWGoogleHost); - scoped_ptr new_format = + std::unique_ptr new_format = map->GetWebsiteSetting(url, url, CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, std::string(), nullptr); // Delete the new-format setting. @@ -254,7 +254,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSSLHostStateDelegateTest, Migrate) { // Trigger the migration code that happens on construction. { - scoped_ptr temp_delegate( + std::unique_ptr temp_delegate( new ChromeSSLHostStateDelegate(profile)); } @@ -361,7 +361,7 @@ IN_PROC_BROWSER_TEST_F(IncognitoSSLHostStateDelegateTest, PRE_AfterRestart) { // in the incognito profile. state->AllowCert(kWWWGoogleHost, *cert, net::CERT_STATUS_DATE_INVALID); - scoped_ptr incognito(profile->CreateOffTheRecordProfile()); + std::unique_ptr incognito(profile->CreateOffTheRecordProfile()); content::SSLHostStateDelegate* incognito_state = incognito->GetSSLHostStateDelegate(); @@ -401,7 +401,7 @@ IN_PROC_BROWSER_TEST_F(IncognitoSSLHostStateDelegateTest, AfterRestart) { state->QueryPolicy(kWWWGoogleHost, *cert, net::CERT_STATUS_DATE_INVALID, &unused_value)); - scoped_ptr incognito(profile->CreateOffTheRecordProfile()); + std::unique_ptr incognito(profile->CreateOffTheRecordProfile()); content::SSLHostStateDelegate* incognito_state = incognito->GetSSLHostStateDelegate(); @@ -444,7 +444,7 @@ IN_PROC_BROWSER_TEST_F(DefaultMemorySSLHostStateDelegateTest, AfterRestart) { base::SimpleTestClock* clock = new base::SimpleTestClock(); ChromeSSLHostStateDelegate* chrome_state = static_cast(state); - chrome_state->SetClock(scoped_ptr(clock)); + chrome_state->SetClock(std::unique_ptr(clock)); // Start the clock at standard system time. clock->SetNow(base::Time::NowFromSystemTime()); @@ -493,7 +493,7 @@ IN_PROC_BROWSER_TEST_F(DefaultMemorySSLHostStateDelegateTest, base::SimpleTestClock* clock = new base::SimpleTestClock(); ChromeSSLHostStateDelegate* chrome_state = static_cast(state); - chrome_state->SetClock(scoped_ptr(clock)); + chrome_state->SetClock(std::unique_ptr(clock)); // Start the clock at standard system time but do not advance at all to // emphasize that instant forget works. diff --git a/chrome/browser/ssl/common_name_mismatch_handler.h b/chrome/browser/ssl/common_name_mismatch_handler.h index 95801d2e447253..f1567c2f82f6ff 100644 --- a/chrome/browser/ssl/common_name_mismatch_handler.h +++ b/chrome/browser/ssl/common_name_mismatch_handler.h @@ -5,10 +5,11 @@ #ifndef CHROME_BROWSER_SSL_COMMON_NAME_MISMATCH_HANDLER_H_ #define CHROME_BROWSER_SSL_COMMON_NAME_MISMATCH_HANDLER_H_ +#include + #include "base/callback.h" #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/time/time.h" #include "net/url_request/url_fetcher.h" @@ -82,7 +83,7 @@ class CommonNameMismatchHandler : public net::URLFetcherDelegate, const GURL request_url_; scoped_refptr request_context_; CheckUrlCallback check_url_callback_; - scoped_ptr url_fetcher_; + std::unique_ptr url_fetcher_; DISALLOW_COPY_AND_ASSIGN(CommonNameMismatchHandler); }; diff --git a/chrome/browser/ssl/ssl_add_certificate.cc b/chrome/browser/ssl/ssl_add_certificate.cc index a0388732bbb6e9..67452cee8f6bb5 100644 --- a/chrome/browser/ssl/ssl_add_certificate.cc +++ b/chrome/browser/ssl/ssl_add_certificate.cc @@ -64,7 +64,7 @@ class SSLAddCertificateInfoBarDelegate : public ConfirmInfoBarDelegate { void SSLAddCertificateInfoBarDelegate::Create(InfoBarService* infobar_service, net::X509Certificate* cert) { infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( - scoped_ptr( + std::unique_ptr( new SSLAddCertificateInfoBarDelegate(cert)))); } diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc index 19b5c802bd725c..0d275561cf6956 100644 --- a/chrome/browser/ssl/ssl_blocking_page.cc +++ b/chrome/browser/ssl/ssl_blocking_page.cc @@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback_helpers.h" +#include "base/memory/ptr_util.h" #include "base/metrics/histogram.h" #include "base/strings/string_number_conversions.h" #include "base/time/time.h" @@ -106,14 +107,15 @@ InterstitialPageDelegate::TypeID SSLBlockingPage::kTypeForTesting = // Note that we always create a navigation entry with SSL errors. // No error happening loading a sub-resource triggers an interstitial so far. -SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents, - int cert_error, - const net::SSLInfo& ssl_info, - const GURL& request_url, - int options_mask, - const base::Time& time_triggered, - scoped_ptr ssl_cert_reporter, - const base::Callback& callback) +SSLBlockingPage::SSLBlockingPage( + content::WebContents* web_contents, + int cert_error, + const net::SSLInfo& ssl_info, + const GURL& request_url, + int options_mask, + const base::Time& time_triggered, + std::unique_ptr ssl_cert_reporter, + const base::Callback& callback) : SecurityInterstitialPage(web_contents, request_url), callback_(callback), ssl_info_(ssl_info), @@ -145,7 +147,7 @@ SSLBlockingPage::SSLBlockingPage(content::WebContents* web_contents, new ChromeMetricsHelper(web_contents, request_url, reporting_info, GetSamplingEventName(overridable_, cert_error)); chrome_metrics_helper->StartRecordingCaptivePortalMetrics(overridable_); - controller_->set_metrics_helper(make_scoped_ptr(chrome_metrics_helper)); + controller_->set_metrics_helper(base::WrapUnique(chrome_metrics_helper)); cert_report_helper_.reset(new CertReportHelper( std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, @@ -210,7 +212,7 @@ void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { } void SSLBlockingPage::SetSSLCertReporterForTesting( - scoped_ptr ssl_cert_reporter) { + std::unique_ptr ssl_cert_reporter) { cert_report_helper_->SetSSLCertReporterForTesting( std::move(ssl_cert_reporter)); } diff --git a/chrome/browser/ssl/ssl_blocking_page.h b/chrome/browser/ssl/ssl_blocking_page.h index f3906acbf7a6c7..f60a66fdfd32cb 100644 --- a/chrome/browser/ssl/ssl_blocking_page.h +++ b/chrome/browser/ssl/ssl_blocking_page.h @@ -58,7 +58,7 @@ class SSLBlockingPage : public SecurityInterstitialPage { const GURL& request_url, int options_mask, const base::Time& time_triggered, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const base::Callback& callback); // InterstitialPageDelegate method: @@ -69,7 +69,7 @@ class SSLBlockingPage : public SecurityInterstitialPage { static bool IsOverridable(int options_mask, const Profile* const profile); void SetSSLCertReporterForTesting( - scoped_ptr ssl_cert_reporter); + std::unique_ptr ssl_cert_reporter); protected: friend class policy::PolicyTest_SSLErrorOverridingDisallowed_Test; @@ -99,9 +99,9 @@ class SSLBlockingPage : public SecurityInterstitialPage { // expired. const bool expired_but_previously_allowed_; - scoped_ptr controller_; - scoped_ptr ssl_error_ui_; - scoped_ptr cert_report_helper_; + std::unique_ptr controller_; + std::unique_ptr ssl_error_ui_; + std::unique_ptr cert_report_helper_; DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); }; diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc index 218fe3f5360f44..ec6d2fcbc2841f 100644 --- a/chrome/browser/ssl/ssl_browser_tests.cc +++ b/chrome/browser/ssl/ssl_browser_tests.cc @@ -248,7 +248,7 @@ class SSLInterstitialTimerObserver { const content::WebContents* web_contents_; SSLErrorHandler::TimerStartedCallback callback_; - scoped_ptr message_loop_runner_; + std::unique_ptr message_loop_runner_; DISALLOW_COPY_AND_ASSIGN(SSLInterstitialTimerObserver); }; @@ -479,7 +479,7 @@ class SSLUITest CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); - scoped_ptr ssl_cert_reporter = + std::unique_ptr ssl_cert_reporter = certificate_reporting_test_utils::SetUpMockSSLCertReporter( &run_loop, expect_report); @@ -541,7 +541,7 @@ class SSLUITest CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); - scoped_ptr ssl_cert_reporter = + std::unique_ptr ssl_cert_reporter = certificate_reporting_test_utils::SetUpMockSSLCertReporter( &run_loop, expect_report); @@ -904,7 +904,8 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorCausedByClockUsingBuildTime) { ASSERT_TRUE(https_server_expired_.Start()); // Set up the build and current clock times to be more than a year apart. - scoped_ptr mock_clock(new base::SimpleTestClock()); + std::unique_ptr mock_clock( + new base::SimpleTestClock()); mock_clock->SetNow(base::Time::NowFromSystemTime()); mock_clock->Advance(base::TimeDelta::FromDays(367)); SSLErrorHandler::SetClockForTest(mock_clock.get()); @@ -1286,7 +1287,7 @@ IN_PROC_BROWSER_TEST_F(SSLUITestWithClientCert, TestWSSClientCert) { // cert selection. Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); DCHECK(profile); - scoped_ptr dict(new base::DictionaryValue()); + std::unique_ptr dict(new base::DictionaryValue()); dict->SetString("ISSUER.CN", "pywebsocket"); HostContentSettingsMapFactory::GetForProfile(profile) ->SetWebsiteSettingDefaultScope( diff --git a/chrome/browser/ssl/ssl_client_auth_observer.cc b/chrome/browser/ssl/ssl_client_auth_observer.cc index fd9fa66b693525..e071c68d5a27f4 100644 --- a/chrome/browser/ssl/ssl_client_auth_observer.cc +++ b/chrome/browser/ssl/ssl_client_auth_observer.cc @@ -22,7 +22,7 @@ typedef std::pair CertDetails; SSLClientAuthObserver::SSLClientAuthObserver( const content::BrowserContext* browser_context, const scoped_refptr& cert_request_info, - scoped_ptr delegate) + std::unique_ptr delegate) : browser_context_(browser_context), cert_request_info_(cert_request_info), delegate_(std::move(delegate)) {} diff --git a/chrome/browser/ssl/ssl_client_auth_observer.h b/chrome/browser/ssl/ssl_client_auth_observer.h index e62992d2ec3c14..96f19301e02551 100644 --- a/chrome/browser/ssl/ssl_client_auth_observer.h +++ b/chrome/browser/ssl/ssl_client_auth_observer.h @@ -5,10 +5,11 @@ #ifndef CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ #define CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_OBSERVER_H_ +#include + #include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -31,7 +32,7 @@ class SSLClientAuthObserver : public content::NotificationObserver { SSLClientAuthObserver( const content::BrowserContext* browser_context, const scoped_refptr& cert_request_info, - scoped_ptr delegate); + std::unique_ptr delegate); ~SSLClientAuthObserver() override; // UI should implement this to close the dialog. @@ -67,7 +68,7 @@ class SSLClientAuthObserver : public content::NotificationObserver { const content::BrowserContext* browser_context_; scoped_refptr cert_request_info_; - scoped_ptr delegate_; + std::unique_ptr delegate_; content::NotificationRegistrar notification_registrar_; DISALLOW_COPY_AND_ASSIGN(SSLClientAuthObserver); diff --git a/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc b/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc index ef114b4821dcdd..d0d1da5fff73fa 100644 --- a/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc +++ b/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "content/public/browser/client_certificate_delegate.h" #include "net/ssl/ssl_cert_request_info.h" #include "net/url_request/url_request.h" @@ -44,7 +45,7 @@ SSLClientAuthRequestorMock::SSLClientAuthRequestorMock( SSLClientAuthRequestorMock::~SSLClientAuthRequestorMock() {} -scoped_ptr +std::unique_ptr SSLClientAuthRequestorMock::CreateDelegate() { - return make_scoped_ptr(new FakeClientCertificateDelegate(this)); + return base::WrapUnique(new FakeClientCertificateDelegate(this)); } diff --git a/chrome/browser/ssl/ssl_client_auth_requestor_mock.h b/chrome/browser/ssl/ssl_client_auth_requestor_mock.h index 6801d1a04961f3..115f2ad30a2725 100644 --- a/chrome/browser/ssl/ssl_client_auth_requestor_mock.h +++ b/chrome/browser/ssl/ssl_client_auth_requestor_mock.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_REQUESTOR_MOCK_H_ #define CHROME_BROWSER_SSL_SSL_CLIENT_AUTH_REQUESTOR_MOCK_H_ +#include + #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "testing/gmock/include/gmock/gmock.h" namespace content { @@ -27,7 +28,7 @@ class SSLClientAuthRequestorMock net::URLRequest* request, const scoped_refptr& cert_request_info); - scoped_ptr CreateDelegate(); + std::unique_ptr CreateDelegate(); MOCK_METHOD1(CertificateSelected, void(net::X509Certificate* cert)); MOCK_METHOD0(CancelCertificateSelection, void()); diff --git a/chrome/browser/ssl/ssl_client_certificate_selector.h b/chrome/browser/ssl/ssl_client_certificate_selector.h index 7c73479da78c35..fcbb6243484015 100644 --- a/chrome/browser/ssl/ssl_client_certificate_selector.h +++ b/chrome/browser/ssl/ssl_client_certificate_selector.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_SSL_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ #define CHROME_BROWSER_SSL_SSL_CLIENT_CERTIFICATE_SELECTOR_H_ +#include + #include "base/callback_forward.h" -#include "base/memory/scoped_ptr.h" namespace content { class ClientCertificateDelegate; @@ -27,7 +28,7 @@ namespace chrome { void ShowSSLClientCertificateSelector( content::WebContents* contents, net::SSLCertRequestInfo* cert_request_info, - scoped_ptr delegate); + std::unique_ptr delegate); } // namespace chrome diff --git a/chrome/browser/ssl/ssl_client_certificate_selector_test.cc b/chrome/browser/ssl/ssl_client_certificate_selector_test.cc index e61b34fc837468..5f045f9442a690 100644 --- a/chrome/browser/ssl/ssl_client_certificate_selector_test.cc +++ b/chrome/browser/ssl/ssl_client_certificate_selector_test.cc @@ -93,10 +93,10 @@ void SSLClientCertificateSelectorTestBase::TearDownOnIOThread() { io_loop_finished_event_.Signal(); } -scoped_ptr +std::unique_ptr SSLClientCertificateSelectorTestBase::MakeURLRequest( net::URLRequestContextGetter* context_getter) { - scoped_ptr request = + std::unique_ptr request = context_getter->GetURLRequestContext()->CreateRequest( GURL("https://example"), net::DEFAULT_PRIORITY, NULL); return request; diff --git a/chrome/browser/ssl/ssl_client_certificate_selector_test.h b/chrome/browser/ssl/ssl_client_certificate_selector_test.h index d646c49f598cfb..98f2527eb47208 100644 --- a/chrome/browser/ssl/ssl_client_certificate_selector_test.h +++ b/chrome/browser/ssl/ssl_client_certificate_selector_test.h @@ -5,7 +5,8 @@ #ifndef CHROME_BROWSER_SSL_SSL_CLIENT_CERTIFICATE_SELECTOR_TEST_H_ #define CHROME_BROWSER_SSL_SSL_CLIENT_CERTIFICATE_SELECTOR_TEST_H_ -#include "base/memory/scoped_ptr.h" +#include + #include "base/synchronization/waitable_event.h" #include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h" #include "chrome/test/base/in_process_browser_test.h" @@ -29,7 +30,7 @@ class SSLClientCertificateSelectorTestBase : public InProcessBrowserTest { virtual void TearDownOnIOThread(); protected: - scoped_ptr MakeURLRequest( + std::unique_ptr MakeURLRequest( net::URLRequestContextGetter* context_getter); base::WaitableEvent io_loop_finished_event_; diff --git a/chrome/browser/ssl/ssl_error_handler.cc b/chrome/browser/ssl/ssl_error_handler.cc index 079ab8749acc43..4f58013e0632ef 100644 --- a/chrome/browser/ssl/ssl_error_handler.cc +++ b/chrome/browser/ssl/ssl_error_handler.cc @@ -154,7 +154,7 @@ void SSLErrorHandler::HandleSSLError( const net::SSLInfo& ssl_info, const GURL& request_url, int options_mask, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const base::Callback& callback) { DCHECK(!FromWebContents(web_contents)); SSLErrorHandler* error_handler = @@ -181,13 +181,14 @@ void SSLErrorHandler::SetClockForTest(base::Clock* testing_clock) { g_testing_clock = testing_clock; } -SSLErrorHandler::SSLErrorHandler(content::WebContents* web_contents, - int cert_error, - const net::SSLInfo& ssl_info, - const GURL& request_url, - int options_mask, - scoped_ptr ssl_cert_reporter, - const base::Callback& callback) +SSLErrorHandler::SSLErrorHandler( + content::WebContents* web_contents, + int cert_error, + const net::SSLInfo& ssl_info, + const GURL& request_url, + int options_mask, + std::unique_ptr ssl_cert_reporter, + const base::Callback& callback) : content::WebContentsObserver(web_contents), web_contents_(web_contents), cert_error_(cert_error), diff --git a/chrome/browser/ssl/ssl_error_handler.h b/chrome/browser/ssl/ssl_error_handler.h index dd69364a44643c..f86c487e3116d9 100644 --- a/chrome/browser/ssl/ssl_error_handler.h +++ b/chrome/browser/ssl/ssl_error_handler.h @@ -61,7 +61,7 @@ class SSLErrorHandler : public content::WebContentsUserData, const net::SSLInfo& ssl_info, const GURL& request_url, int options_mask, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const base::Callback& callback); // Testing methods. @@ -78,7 +78,7 @@ class SSLErrorHandler : public content::WebContentsUserData, const net::SSLInfo& ssl_info, const GURL& request_url, int options_mask, - scoped_ptr ssl_cert_reporter, + std::unique_ptr ssl_cert_reporter, const base::Callback& callback); ~SSLErrorHandler() override; @@ -138,9 +138,9 @@ class SSLErrorHandler : public content::WebContentsUserData, content::NotificationRegistrar registrar_; base::OneShotTimer timer_; - scoped_ptr common_name_mismatch_handler_; + std::unique_ptr common_name_mismatch_handler_; - scoped_ptr ssl_cert_reporter_; + std::unique_ptr ssl_cert_reporter_; DISALLOW_COPY_AND_ASSIGN(SSLErrorHandler); }; diff --git a/chrome/browser/ssl/ssl_error_handler_unittest.cc b/chrome/browser/ssl/ssl_error_handler_unittest.cc index 21f583039154b5..e09d521fa8c388 100644 --- a/chrome/browser/ssl/ssl_error_handler_unittest.cc +++ b/chrome/browser/ssl/ssl_error_handler_unittest.cc @@ -159,7 +159,7 @@ class SSLErrorHandlerTest : public ChromeRenderViewHostTestHarness { private: net::SSLInfo ssl_info_; - scoped_ptr error_handler_; + std::unique_ptr error_handler_; base::FieldTrialList field_trial_list_; }; diff --git a/chrome/browser/status_icons/desktop_notification_balloon.h b/chrome/browser/status_icons/desktop_notification_balloon.h index cd04be058f6a04..5164be19e76152 100644 --- a/chrome/browser/status_icons/desktop_notification_balloon.h +++ b/chrome/browser/status_icons/desktop_notification_balloon.h @@ -5,9 +5,10 @@ #ifndef CHROME_BROWSER_STATUS_ICONS_DESKTOP_NOTIFICATION_BALLOON_H_ #define CHROME_BROWSER_STATUS_ICONS_DESKTOP_NOTIFICATION_BALLOON_H_ +#include + #include "base/compiler_specific.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" class Notification; diff --git a/chrome/browser/status_icons/status_icon.cc b/chrome/browser/status_icons/status_icon.cc index 572263946eee06..a05a88e6a7b155 100644 --- a/chrome/browser/status_icons/status_icon.cc +++ b/chrome/browser/status_icons/status_icon.cc @@ -39,10 +39,11 @@ void StatusIcon::DispatchBalloonClickEvent() { void StatusIcon::ForceVisible() {} -void StatusIcon::SetContextMenu(scoped_ptr menu) { +void StatusIcon::SetContextMenu(std::unique_ptr menu) { // The UI may been showing a menu for the current model, don't destroy it // until we've notified the UI of the change. - scoped_ptr old_menu = std::move(context_menu_contents_); + std::unique_ptr old_menu = + std::move(context_menu_contents_); context_menu_contents_ = std::move(menu); UpdatePlatformContextMenu(context_menu_contents_.get()); } diff --git a/chrome/browser/status_icons/status_icon.h b/chrome/browser/status_icons/status_icon.h index 13985cc5680bcd..0eaaf247f9733e 100644 --- a/chrome/browser/status_icons/status_icon.h +++ b/chrome/browser/status_icons/status_icon.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_ #define CHROME_BROWSER_STATUS_ICONS_STATUS_ICON_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/strings/string16.h" #include "build/build_config.h" @@ -46,7 +47,7 @@ class StatusIcon { // Set the context menu for this icon. The icon takes ownership of the passed // context menu. Passing NULL results in no menu at all. - void SetContextMenu(scoped_ptr menu); + void SetContextMenu(std::unique_ptr menu); // Adds/Removes an observer for clicks on the status icon. If an observer is // registered, then left clicks on the status icon will result in the observer @@ -81,7 +82,7 @@ class StatusIcon { base::ObserverList observers_; // Context menu, if any. - scoped_ptr context_menu_contents_; + std::unique_ptr context_menu_contents_; DISALLOW_COPY_AND_ASSIGN(StatusIcon); }; diff --git a/chrome/browser/status_icons/status_icon_menu_model_unittest.cc b/chrome/browser/status_icons/status_icon_menu_model_unittest.cc index 19b9c75779117b..f6dbaa19cdb893 100644 --- a/chrome/browser/status_icons/status_icon_menu_model_unittest.cc +++ b/chrome/browser/status_icons/status_icon_menu_model_unittest.cc @@ -38,7 +38,7 @@ class StatusIconMenuModelTest : public testing::Test, private: void OnMenuStateChanged() override { ++changed_count_; } - scoped_ptr menu_; + std::unique_ptr menu_; int changed_count_; }; diff --git a/chrome/browser/task_management/providers/arc/arc_process_task_provider.cc b/chrome/browser/task_management/providers/arc/arc_process_task_provider.cc index 5e4083857b26eb..9169ef3888fbb7 100644 --- a/chrome/browser/task_management/providers/arc/arc_process_task_provider.cc +++ b/chrome/browser/task_management/providers/arc/arc_process_task_provider.cc @@ -61,7 +61,7 @@ void ArcProcessTaskProvider::OnUpdateProcessList( for (const auto& it : processes) { if (nspid_to_remove.erase(it.nspid) == 0) { // New arc process. - scoped_ptr& task = nspid_to_task_[it.nspid]; + std::unique_ptr& task = nspid_to_task_[it.nspid]; // After calling NotifyObserverTaskAdded(), the raw pointer of |task| is // remebered somewhere else. One should not (implicitly) delete the // referenced object before calling NotifyObserverTaskRemoved() first diff --git a/chrome/browser/task_management/providers/arc/arc_process_task_provider.h b/chrome/browser/task_management/providers/arc/arc_process_task_provider.h index 70c1d7d32937f3..49aea04da738d1 100644 --- a/chrome/browser/task_management/providers/arc/arc_process_task_provider.h +++ b/chrome/browser/task_management/providers/arc/arc_process_task_provider.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_ARC_ARC_PROCESS_TASK_PROVIDER_H_ #include +#include #include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/process/process.h" #include "chrome/browser/chromeos/arc/arc_process.h" @@ -51,7 +51,7 @@ class ArcProcessTaskProvider : public TaskProvider { void ScheduleNextRequest(); - std::map> nspid_to_task_; + std::map> nspid_to_task_; // Whether to continue the periodical polling. bool is_updating_; diff --git a/chrome/browser/task_management/providers/child_process_task.h b/chrome/browser/task_management/providers/child_process_task.h index c8be4a5ec056d3..e64be511c04b46 100644 --- a/chrome/browser/task_management/providers/child_process_task.h +++ b/chrome/browser/task_management/providers/child_process_task.h @@ -7,8 +7,9 @@ #include +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/task_management/providers/task.h" class ProcessResourceUsage; @@ -41,7 +42,7 @@ class ChildProcessTask : public Task { private: // The Mojo service wrapper that will provide us with the V8 memory usage of // the browser child process represented by this object. - scoped_ptr process_resources_sampler_; + std::unique_ptr process_resources_sampler_; // The allocated and used V8 memory (in bytes). int64_t v8_memory_allocated_; diff --git a/chrome/browser/task_management/providers/child_process_task_provider.cc b/chrome/browser/task_management/providers/child_process_task_provider.cc index a6202d7d56160c..884310b9359583 100644 --- a/chrome/browser/task_management/providers/child_process_task_provider.cc +++ b/chrome/browser/task_management/providers/child_process_task_provider.cc @@ -22,11 +22,11 @@ namespace { // Collects and returns the child processes data on the IO thread to get all the // pre-existing child process before we start observing // |BrowserChildProcessObserver|. -scoped_ptr> CollectChildProcessData() { +std::unique_ptr> CollectChildProcessData() { // The |BrowserChildProcessHostIterator| must only be used on the IO thread. DCHECK_CURRENTLY_ON(BrowserThread::IO); - scoped_ptr> child_processes( + std::unique_ptr> child_processes( new std::vector()); for (BrowserChildProcessHostIterator itr; !itr.Done(); ++itr) { const ChildProcessData& process_data = itr.GetData(); @@ -109,7 +109,8 @@ void ChildProcessTaskProvider::StopUpdating() { } void ChildProcessTaskProvider::ChildProcessDataCollected( - scoped_ptr> child_processes) { + std::unique_ptr> + child_processes) { DCHECK_CURRENTLY_ON(BrowserThread::UI); for (const auto& process_data : *child_processes) diff --git a/chrome/browser/task_management/providers/child_process_task_provider.h b/chrome/browser/task_management/providers/child_process_task_provider.h index c3673088dd2d24..0c61b68b92520b 100644 --- a/chrome/browser/task_management/providers/child_process_task_provider.h +++ b/chrome/browser/task_management/providers/child_process_task_provider.h @@ -6,10 +6,10 @@ #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_CHILD_PROCESS_TASK_PROVIDER_H_ #include +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/task_management/providers/task_provider.h" #include "content/public/browser/browser_child_process_observer.h" @@ -53,7 +53,8 @@ class ChildProcessTaskProvider // When that is done, we will be notified on the UI thread by receiving a call // to this method. void ChildProcessDataCollected( - scoped_ptr> child_processes); + std::unique_ptr> + child_processes); // Creates a ChildProcessTask from the given |data| and notifies the observer // of its addition. diff --git a/chrome/browser/task_management/providers/web_contents/extension_task.h b/chrome/browser/task_management/providers/web_contents/extension_task.h index d23335276d958f..cf7a818a329292 100644 --- a/chrome/browser/task_management/providers/web_contents/extension_task.h +++ b/chrome/browser/task_management/providers/web_contents/extension_task.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_EXTENSION_TASK_H_ #define CHROME_BROWSER_TASK_MANAGEMENT_PROVIDERS_WEB_CONTENTS_EXTENSION_TASK_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/task_management/providers/web_contents/renderer_task.h" #include "extensions/browser/extension_icon_image.h" #include "extensions/common/view_type.h" @@ -48,7 +49,7 @@ class ExtensionTask void LoadExtensionIcon(const extensions::Extension* extension); // The favicon of the extension represented by this task. - scoped_ptr extension_icon_; + std::unique_ptr extension_icon_; DISALLOW_COPY_AND_ASSIGN(ExtensionTask); }; diff --git a/chrome/browser/task_management/providers/web_contents/renderer_task.h b/chrome/browser/task_management/providers/web_contents/renderer_task.h index 1dac95017472c2..71693b9a856bf9 100644 --- a/chrome/browser/task_management/providers/web_contents/renderer_task.h +++ b/chrome/browser/task_management/providers/web_contents/renderer_task.h @@ -7,8 +7,9 @@ #include +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/task_management/providers/task.h" #include "components/favicon/core/favicon_driver_observer.h" #include "content/public/browser/navigation_entry.h" @@ -110,7 +111,7 @@ class RendererTask : public Task, // The Mojo service wrapper that will provide us with the V8 memory usage and // the WebCache resource stats of the render process represented by this // object. - scoped_ptr renderer_resources_sampler_; + std::unique_ptr renderer_resources_sampler_; // The unique ID of the RenderProcessHost. const int render_process_id_; diff --git a/chrome/browser/task_management/sampling/task_group_sampler.h b/chrome/browser/task_management/sampling/task_group_sampler.h index 4b3b9450878c69..718119eef92e0c 100644 --- a/chrome/browser/task_management/sampling/task_group_sampler.h +++ b/chrome/browser/task_management/sampling/task_group_sampler.h @@ -7,10 +7,11 @@ #include +#include + #include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/process/process.h" #include "base/process/process_handle.h" #include "base/process/process_metrics.h" @@ -81,7 +82,7 @@ class TaskGroupSampler : public base::RefCountedThreadSafe { // creating the ProcessMetrics. base::Process process_; - scoped_ptr process_metrics_; + std::unique_ptr process_metrics_; // The specific blocking pool SequencedTaskRunner that will be used to post // the refresh tasks onto serially. diff --git a/chrome/browser/task_management/sampling/task_manager_impl.h b/chrome/browser/task_management/sampling/task_manager_impl.h index 109ab6887f9908..5dd5d2ec279993 100644 --- a/chrome/browser/task_management/sampling/task_manager_impl.h +++ b/chrome/browser/task_management/sampling/task_manager_impl.h @@ -133,7 +133,7 @@ class TaskManagerImpl : // The manager of the IO thread helper used to handle network bytes // notifications on IO thread. The manager itself lives on the UI thread, but // the IO thread helper lives entirely on the IO thread. - scoped_ptr io_thread_helper_manager_; + std::unique_ptr io_thread_helper_manager_; // The list of the task providers that are owned and observed by this task // manager implementation. diff --git a/chrome/browser/task_management/task_manager_interface.h b/chrome/browser/task_management/task_manager_interface.h index 4eccc70ac7b0e7..b35145c5a17bcb 100644 --- a/chrome/browser/task_management/task_manager_interface.h +++ b/chrome/browser/task_management/task_manager_interface.h @@ -7,10 +7,11 @@ #include #include + +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/observer_list.h" #include "base/process/kill.h" #include "base/process/process_handle.h" @@ -217,7 +218,7 @@ class TaskManagerInterface { int64_t enabled_resources_flags() const { return enabled_resources_flags_; } - void set_timer_for_testing(scoped_ptr timer) { + void set_timer_for_testing(std::unique_ptr timer) { refresh_timer_ = std::move(timer); } @@ -242,7 +243,7 @@ class TaskManagerInterface { base::ObserverList observers_; // The timer that will be used to schedule the successive refreshes. - scoped_ptr refresh_timer_; + std::unique_ptr refresh_timer_; // The flags containing the enabled resources types calculations. int64_t enabled_resources_flags_; diff --git a/chrome/browser/task_management/test_task_manager.cc b/chrome/browser/task_management/test_task_manager.cc index 5a27ab9d9fc106..7626d0d41e6f25 100644 --- a/chrome/browser/task_management/test_task_manager.cc +++ b/chrome/browser/task_management/test_task_manager.cc @@ -9,8 +9,8 @@ namespace task_management { TestTaskManager::TestTaskManager() : handle_(base::kNullProcessHandle), pid_(base::kNullProcessId) { - set_timer_for_testing(scoped_ptr(new base::MockTimer(true, - true))); + set_timer_for_testing( + std::unique_ptr(new base::MockTimer(true, true))); } TestTaskManager::~TestTaskManager() { diff --git a/chrome/browser/task_manager/background_information.cc b/chrome/browser/task_manager/background_information.cc index a1b5d864abd05f..c68aa40258d7b9 100644 --- a/chrome/browser/task_manager/background_information.cc +++ b/chrome/browser/task_manager/background_information.cc @@ -143,7 +143,7 @@ void BackgroundInformation::GetAll(const NewWebContentsCallback& callback) { } } -scoped_ptr BackgroundInformation::MakeResource( +std::unique_ptr BackgroundInformation::MakeResource( WebContents* web_contents) { Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); @@ -165,12 +165,12 @@ scoped_ptr BackgroundInformation::MakeResource( extensions_set.GetByID(base::UTF16ToUTF8(application_id)); if (extension) application_name = base::UTF8ToUTF16(extension->name()); - return scoped_ptr( + return std::unique_ptr( new BackgroundContentsResource(*iterator, application_name)); } } NOTREACHED(); - return scoped_ptr(); + return std::unique_ptr(); } } // namespace task_manager diff --git a/chrome/browser/task_manager/background_information.h b/chrome/browser/task_manager/background_information.h index 929eb7dff41af7..1de6fe54c16666 100644 --- a/chrome/browser/task_manager/background_information.h +++ b/chrome/browser/task_manager/background_information.h @@ -20,7 +20,7 @@ class BackgroundInformation // WebContentsInformation implementation. bool CheckOwnership(content::WebContents* web_contents) override; void GetAll(const NewWebContentsCallback& callback) override; - scoped_ptr MakeResource( + std::unique_ptr MakeResource( content::WebContents* web_contents) override; private: diff --git a/chrome/browser/task_manager/child_process_resource_provider.cc b/chrome/browser/task_manager/child_process_resource_provider.cc index 5f37428e190b11..b9d28890f6360d 100644 --- a/chrome/browser/task_manager/child_process_resource_provider.cc +++ b/chrome/browser/task_manager/child_process_resource_provider.cc @@ -74,7 +74,7 @@ class ChildProcessResource : public Resource { int unique_process_id_; mutable base::string16 title_; bool network_usage_support_; - scoped_ptr resource_usage_; + std::unique_ptr resource_usage_; // The icon painted for the child processs. // TODO(jcampan): we should have plugin specific icons for well-known diff --git a/chrome/browser/task_manager/extension_information.cc b/chrome/browser/task_manager/extension_information.cc index 66e39d02709285..06eeac55cd004d 100644 --- a/chrome/browser/task_manager/extension_information.cc +++ b/chrome/browser/task_manager/extension_information.cc @@ -159,14 +159,14 @@ bool ExtensionInformation::CheckOwnership(WebContents* web_contents) { view_type != extensions::VIEW_TYPE_PANEL); } -scoped_ptr ExtensionInformation::MakeResource( +std::unique_ptr ExtensionInformation::MakeResource( WebContents* web_contents) { const Extension* extension = GetExtensionForWebContents(web_contents); if (!extension) { NOTREACHED(); - return scoped_ptr(); + return std::unique_ptr(); } - return scoped_ptr(new ExtensionProcessResource( + return std::unique_ptr(new ExtensionProcessResource( extension, web_contents->GetRenderViewHost())); } diff --git a/chrome/browser/task_manager/extension_information.h b/chrome/browser/task_manager/extension_information.h index fc2e76835025bf..c1868250017575 100644 --- a/chrome/browser/task_manager/extension_information.h +++ b/chrome/browser/task_manager/extension_information.h @@ -23,7 +23,7 @@ class ExtensionInformation // WebContentsInformation implementation. bool CheckOwnership(content::WebContents* web_contents) override; void GetAll(const NewWebContentsCallback& callback) override; - scoped_ptr MakeResource( + std::unique_ptr MakeResource( content::WebContents* web_contents) override; private: diff --git a/chrome/browser/task_manager/guest_information.cc b/chrome/browser/task_manager/guest_information.cc index 6299c6651b3797..ad0cbd3e29c943 100644 --- a/chrome/browser/task_manager/guest_information.cc +++ b/chrome/browser/task_manager/guest_information.cc @@ -106,7 +106,7 @@ bool GuestInformation::CheckOwnership(WebContents* web_contents) { } void GuestInformation::GetAll(const NewWebContentsCallback& callback) { - scoped_ptr widgets( + std::unique_ptr widgets( content::RenderWidgetHost::GetRenderWidgetHosts()); while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { content::RenderViewHost* rvh = content::RenderViewHost::From(widget); @@ -116,9 +116,9 @@ void GuestInformation::GetAll(const NewWebContentsCallback& callback) { } } -scoped_ptr GuestInformation::MakeResource( +std::unique_ptr GuestInformation::MakeResource( WebContents* web_contents) { - return scoped_ptr( + return std::unique_ptr( new GuestResource(web_contents->GetRenderViewHost())); } diff --git a/chrome/browser/task_manager/guest_information.h b/chrome/browser/task_manager/guest_information.h index 0d47cdf305c7d0..01c57370907c54 100644 --- a/chrome/browser/task_manager/guest_information.h +++ b/chrome/browser/task_manager/guest_information.h @@ -21,7 +21,7 @@ class GuestInformation : public NotificationObservingWebContentsInformation { // WebContentsInformation implementation. bool CheckOwnership(content::WebContents* web_contents) override; void GetAll(const NewWebContentsCallback& callback) override; - scoped_ptr MakeResource( + std::unique_ptr MakeResource( content::WebContents* web_contents) override; private: diff --git a/chrome/browser/task_manager/panel_information.cc b/chrome/browser/task_manager/panel_information.cc index 262c842c37bb52..3711ca073cc13f 100644 --- a/chrome/browser/task_manager/panel_information.cc +++ b/chrome/browser/task_manager/panel_information.cc @@ -123,16 +123,16 @@ void PanelInformation::GetAll(const NewWebContentsCallback& callback) { callback.Run(panels[i]->GetWebContents()); } -scoped_ptr PanelInformation::MakeResource( +std::unique_ptr PanelInformation::MakeResource( WebContents* web_contents) { std::vector panels = PanelManager::GetInstance()->panels(); for (size_t i = 0; i < panels.size(); ++i) { if (panels[i]->GetWebContents() == web_contents) { - return scoped_ptr(new PanelResource(panels[i])); + return std::unique_ptr(new PanelResource(panels[i])); } } NOTREACHED(); - return scoped_ptr(); + return std::unique_ptr(); } } // namespace task_manager diff --git a/chrome/browser/task_manager/panel_information.h b/chrome/browser/task_manager/panel_information.h index 38b4f263af581c..d17274ec6bcb56 100644 --- a/chrome/browser/task_manager/panel_information.h +++ b/chrome/browser/task_manager/panel_information.h @@ -21,7 +21,7 @@ class PanelInformation : public NotificationObservingWebContentsInformation { // WebContentsInformation implementation. bool CheckOwnership(content::WebContents* web_contents) override; void GetAll(const NewWebContentsCallback& callback) override; - scoped_ptr MakeResource( + std::unique_ptr MakeResource( content::WebContents* web_contents) override; private: diff --git a/chrome/browser/task_manager/printing_information.cc b/chrome/browser/task_manager/printing_information.cc index 01fb7f90d7ecab..4256e4e2397703 100644 --- a/chrome/browser/task_manager/printing_information.cc +++ b/chrome/browser/task_manager/printing_information.cc @@ -109,9 +109,9 @@ void PrintingInformation::GetAll(const NewWebContentsCallback& callback) { callback); } -scoped_ptr PrintingInformation::MakeResource( +std::unique_ptr PrintingInformation::MakeResource( WebContents* web_contents) { - return scoped_ptr(new PrintingResource(web_contents)); + return std::unique_ptr(new PrintingResource(web_contents)); } } // namespace task_manager diff --git a/chrome/browser/task_manager/printing_information.h b/chrome/browser/task_manager/printing_information.h index 41b58fe7022ab1..a520cc86615017 100644 --- a/chrome/browser/task_manager/printing_information.h +++ b/chrome/browser/task_manager/printing_information.h @@ -23,7 +23,7 @@ class PrintingInformation : public NotificationObservingWebContentsInformation { bool CheckOwnership(content::WebContents* web_contents) override; void GetAll(const NewWebContentsCallback& callback) override; - scoped_ptr MakeResource( + std::unique_ptr MakeResource( content::WebContents* web_contents) override; private: diff --git a/chrome/browser/task_manager/renderer_resource.h b/chrome/browser/task_manager/renderer_resource.h index 8c3ee00b0f73be..e2de894ed68455 100644 --- a/chrome/browser/task_manager/renderer_resource.h +++ b/chrome/browser/task_manager/renderer_resource.h @@ -7,8 +7,9 @@ #include +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/task_manager/resource_provider.h" class ProcessResourceUsage; @@ -57,7 +58,7 @@ class RendererResource : public Resource { // RenderViewHost we use to fetch stats. content::RenderViewHost* render_view_host_; - scoped_ptr process_resource_usage_; + std::unique_ptr process_resource_usage_; DISALLOW_COPY_AND_ASSIGN(RendererResource); }; diff --git a/chrome/browser/task_manager/tab_contents_information.cc b/chrome/browser/task_manager/tab_contents_information.cc index 90700e4472a9ef..757d4a257f0139 100644 --- a/chrome/browser/task_manager/tab_contents_information.cc +++ b/chrome/browser/task_manager/tab_contents_information.cc @@ -173,9 +173,10 @@ void TabContentsInformation::GetAll(const NewWebContentsCallback& callback) { } } -scoped_ptr TabContentsInformation::MakeResource( +std::unique_ptr TabContentsInformation::MakeResource( content::WebContents* web_contents) { - return scoped_ptr(new TabContentsResource(web_contents)); + return std::unique_ptr( + new TabContentsResource(web_contents)); } } // namespace task_manager diff --git a/chrome/browser/task_manager/tab_contents_information.h b/chrome/browser/task_manager/tab_contents_information.h index fefc8addc0f815..c616a4e656e063 100644 --- a/chrome/browser/task_manager/tab_contents_information.h +++ b/chrome/browser/task_manager/tab_contents_information.h @@ -23,7 +23,7 @@ class TabContentsInformation // WebContentsInformation implementation. bool CheckOwnership(content::WebContents* web_contents) override; void GetAll(const NewWebContentsCallback& callback) override; - scoped_ptr MakeResource( + std::unique_ptr MakeResource( content::WebContents* web_contents) override; private: diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc index f179f70a994626..aac13080989e4d 100644 --- a/chrome/browser/task_manager/task_manager.cc +++ b/chrome/browser/task_manager/task_manager.cc @@ -257,33 +257,27 @@ TaskManagerModel::TaskManagerModel(TaskManager* task_manager) AddResourceProvider( new task_manager::BrowserProcessResourceProvider(task_manager)); AddResourceProvider(new task_manager::WebContentsResourceProvider( - task_manager, - scoped_ptr( - new task_manager::BackgroundInformation()))); + task_manager, std::unique_ptr( + new task_manager::BackgroundInformation()))); AddResourceProvider(new task_manager::WebContentsResourceProvider( - task_manager, - scoped_ptr( - new task_manager::TabContentsInformation()))); + task_manager, std::unique_ptr( + new task_manager::TabContentsInformation()))); #if defined(ENABLE_PRINT_PREVIEW) AddResourceProvider(new task_manager::WebContentsResourceProvider( - task_manager, - scoped_ptr( - new task_manager::PrintingInformation()))); + task_manager, std::unique_ptr( + new task_manager::PrintingInformation()))); #endif // ENABLE_PRINT_PREVIEW AddResourceProvider(new task_manager::WebContentsResourceProvider( - task_manager, - scoped_ptr( - new task_manager::PanelInformation()))); + task_manager, std::unique_ptr( + new task_manager::PanelInformation()))); AddResourceProvider( new task_manager::ChildProcessResourceProvider(task_manager)); AddResourceProvider(new task_manager::WebContentsResourceProvider( - task_manager, - scoped_ptr( - new task_manager::ExtensionInformation()))); + task_manager, std::unique_ptr( + new task_manager::ExtensionInformation()))); AddResourceProvider(new task_manager::WebContentsResourceProvider( - task_manager, - scoped_ptr( - new task_manager::GuestInformation()))); + task_manager, std::unique_ptr( + new task_manager::GuestInformation()))); #if defined(OS_WIN) working_set_snapshot_.reset(new PrivateWorkingSetSnapshot); working_set_snapshot_->AddToMonitorList("chrome"); diff --git a/chrome/browser/task_manager/task_manager.h b/chrome/browser/task_manager/task_manager.h index 71c0257ff5000f..a8178cb1f3ae98 100644 --- a/chrome/browser/task_manager/task_manager.h +++ b/chrome/browser/task_manager/task_manager.h @@ -9,13 +9,13 @@ #include #include +#include #include #include "base/callback_forward.h" #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/observer_list.h" #include "base/strings/string16.h" @@ -516,7 +516,7 @@ class TaskManagerModel : public base::RefCountedThreadSafe { // An observer waiting for video memory usage stats updates from the GPU // process - scoped_ptr + std::unique_ptr video_memory_usage_stats_observer_; base::ObserverList observer_list_; @@ -543,7 +543,7 @@ class TaskManagerModel : public base::RefCountedThreadSafe { std::vector on_data_ready_callbacks_; #if defined(OS_WIN) - scoped_ptr working_set_snapshot_; + std::unique_ptr working_set_snapshot_; #endif // All per-Resource values are stored here. diff --git a/chrome/browser/task_manager/web_contents_information.h b/chrome/browser/task_manager/web_contents_information.h index a1fcdc13e22fdc..cfa50760fd73fe 100644 --- a/chrome/browser/task_manager/web_contents_information.h +++ b/chrome/browser/task_manager/web_contents_information.h @@ -5,9 +5,10 @@ #ifndef CHROME_BROWSER_TASK_MANAGER_WEB_CONTENTS_INFORMATION_H_ #define CHROME_BROWSER_TASK_MANAGER_WEB_CONTENTS_INFORMATION_H_ +#include + #include "base/callback.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -46,7 +47,7 @@ class WebContentsInformation { virtual void StopObservingCreation() = 0; // Create a new task manager resource for the given WebContents instance. - virtual scoped_ptr MakeResource( + virtual std::unique_ptr MakeResource( content::WebContents* web_contents) = 0; private: diff --git a/chrome/browser/task_manager/web_contents_resource_provider.cc b/chrome/browser/task_manager/web_contents_resource_provider.cc index e19a8aa12491dc..5b3b3cb8ac69c4 100644 --- a/chrome/browser/task_manager/web_contents_resource_provider.cc +++ b/chrome/browser/task_manager/web_contents_resource_provider.cc @@ -235,7 +235,7 @@ class TaskManagerWebContentsEntry : public content::WebContentsObserver, (existing_resource_range.first != existing_resource_range.second); bool is_main_frame = (render_frame_host == web_contents()->GetMainFrame()); bool site_instance_is_main = (site_instance == main_frame_site_instance_); - scoped_ptr new_resource; + std::unique_ptr new_resource; if (!existing_resource || (is_main_frame && !site_instance_is_main)) { if (is_main_frame) { new_resource = info()->MakeResource(web_contents()); @@ -326,7 +326,7 @@ class TaskManagerWebContentsEntry : public content::WebContentsObserver, WebContentsResourceProvider::WebContentsResourceProvider( TaskManager* task_manager, - scoped_ptr info) + std::unique_ptr info) : task_manager_(task_manager), info_(std::move(info)) {} WebContentsResourceProvider::~WebContentsResourceProvider() {} @@ -384,7 +384,7 @@ void WebContentsResourceProvider::OnWebContentsCreated( // are already observing this WebContents and just ignore it. return; } - scoped_ptr entry( + std::unique_ptr entry( new TaskManagerWebContentsEntry(web_contents, this)); entry->CreateAllResources(); entries_[web_contents] = entry.release(); diff --git a/chrome/browser/task_manager/web_contents_resource_provider.h b/chrome/browser/task_manager/web_contents_resource_provider.h index ea0e262ada204d..49565115489204 100644 --- a/chrome/browser/task_manager/web_contents_resource_provider.h +++ b/chrome/browser/task_manager/web_contents_resource_provider.h @@ -6,9 +6,9 @@ #define CHROME_BROWSER_TASK_MANAGER_WEB_CONTENTS_RESOURCE_PROVIDER_H_ #include +#include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/task_manager/renderer_resource.h" #include "chrome/browser/task_manager/resource_provider.h" @@ -35,7 +35,7 @@ class WebContentsInformation; class WebContentsResourceProvider : public ResourceProvider { public: WebContentsResourceProvider(TaskManager* task_manager, - scoped_ptr info); + std::unique_ptr info); // ResourceProvider implementation. RendererResource* GetResource(int origin_pid, @@ -71,7 +71,7 @@ class WebContentsResourceProvider : public ResourceProvider { // The WebContentsInformation that informs us when a new WebContents* is // created, and which serves as a RendererResource factory for our type. - scoped_ptr info_; + std::unique_ptr info_; DISALLOW_COPY_AND_ASSIGN(WebContentsResourceProvider); }; diff --git a/chrome/browser/task_profiler/task_profiler_data_serializer.cc b/chrome/browser/task_profiler/task_profiler_data_serializer.cc index 34d9ed04d6f2e6..c9f3b5e0f6ce6b 100644 --- a/chrome/browser/task_profiler/task_profiler_data_serializer.cc +++ b/chrome/browser/task_profiler/task_profiler_data_serializer.cc @@ -4,10 +4,11 @@ #include "chrome/browser/task_profiler/task_profiler_data_serializer.h" +#include + #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/json/json_string_value_serializer.h" -#include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "base/tracked_objects.h" #include "chrome/common/chrome_content_client.h" @@ -44,7 +45,8 @@ void BirthOnThreadSnapshotToValue(const BirthOnThreadSnapshot& birth, base::DictionaryValue* dictionary) { DCHECK(!prefix.empty()); - scoped_ptr location_value(new base::DictionaryValue); + std::unique_ptr location_value( + new base::DictionaryValue); LocationSnapshotToValue(birth.location, location_value.get()); dictionary->Set(prefix + "_location", location_value.release()); @@ -68,7 +70,7 @@ void TaskSnapshotToValue(const TaskSnapshot& snapshot, base::DictionaryValue* dictionary) { BirthOnThreadSnapshotToValue(snapshot.birth, "birth", dictionary); - scoped_ptr death_data(new base::DictionaryValue); + std::unique_ptr death_data(new base::DictionaryValue); DeathDataSnapshotToValue(snapshot.death_data, death_data.get()); dictionary->Set("death_data", death_data.release()); @@ -120,9 +122,9 @@ void TaskProfilerDataSerializer::ToValue( base::ProcessId process_id, metrics::ProfilerEventProto::TrackedObject::ProcessType process_type, base::DictionaryValue* dictionary) { - scoped_ptr tasks_list(new base::ListValue); + std::unique_ptr tasks_list(new base::ListValue); for (const auto& task : process_data_phase.tasks) { - scoped_ptr snapshot(new base::DictionaryValue); + std::unique_ptr snapshot(new base::DictionaryValue); TaskSnapshotToValue(task, snapshot.get()); tasks_list->Append(snapshot.release()); } diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index 7741d5a6892363..61301e251bf674 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -8,11 +8,11 @@ #include #include +#include #include "base/files/file.h" #include "base/macros.h" #include "base/memory/ref_counted_memory.h" -#include "base/memory/scoped_ptr.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -229,7 +229,7 @@ bool InputScalesValid(const base::StringPiece& input, size_t scales_size = static_cast(input.size() / sizeof(float)); if (scales_size != expected.size()) return false; - scoped_ptr scales(new float[scales_size]); + std::unique_ptr scales(new float[scales_size]); // Do a memcpy to avoid misaligned memory access. memcpy(scales.get(), input.data(), input.size()); for (size_t index = 0; index < scales_size; ++index) { @@ -242,7 +242,7 @@ bool InputScalesValid(const base::StringPiece& input, // Returns |scale_factors| as a string to be written to disk. std::string GetScaleFactorsAsString( const std::vector& scale_factors) { - scoped_ptr scales(new float[scale_factors.size()]); + std::unique_ptr scales(new float[scale_factors.size()]); for (size_t i = 0; i < scale_factors.size(); ++i) scales[i] = ui::GetScaleForScaleFactor(scale_factors[i]); std::string out_string = std::string( diff --git a/chrome/browser/themes/browser_theme_pack.h b/chrome/browser/themes/browser_theme_pack.h index b7f567eb15f2f7..5d5d09269aa84b 100644 --- a/chrome/browser/themes/browser_theme_pack.h +++ b/chrome/browser/themes/browser_theme_pack.h @@ -8,11 +8,11 @@ #include #include +#include #include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/sequenced_task_runner_helpers.h" #include "chrome/browser/themes/custom_theme_supplier.h" #include "extensions/common/extension.h" @@ -211,7 +211,7 @@ class BrowserThemePack : public CustomThemeSupplier { void GenerateRawImageForAllSupportedScales(int prs_id); // Data pack, if we have one. - scoped_ptr data_pack_; + std::unique_ptr data_pack_; // All structs written to disk need to be packed; no alignment tricks here, // please. diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc index f80f50e3af0690..c79c6c2031c1cf 100644 --- a/chrome/browser/themes/browser_theme_pack_unittest.cc +++ b/chrome/browser/themes/browser_theme_pack_unittest.cc @@ -98,7 +98,7 @@ class BrowserThemePackTest : public ::testing::Test { } void LoadColorJSON(const std::string& json) { - scoped_ptr value = base::JSONReader::Read(json); + std::unique_ptr value = base::JSONReader::Read(json); ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); LoadColorDictionary(static_cast(value.get())); } @@ -108,7 +108,7 @@ class BrowserThemePackTest : public ::testing::Test { } void LoadTintJSON(const std::string& json) { - scoped_ptr value = base::JSONReader::Read(json); + std::unique_ptr value = base::JSONReader::Read(json); ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); LoadTintDictionary(static_cast(value.get())); } @@ -118,7 +118,7 @@ class BrowserThemePackTest : public ::testing::Test { } void LoadDisplayPropertiesJSON(const std::string& json) { - scoped_ptr value = base::JSONReader::Read(json); + std::unique_ptr value = base::JSONReader::Read(json); ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); LoadDisplayPropertiesDictionary( static_cast(value.get())); @@ -130,7 +130,7 @@ class BrowserThemePackTest : public ::testing::Test { void ParseImageNamesJSON(const std::string& json, TestFilePathMap* out_file_paths) { - scoped_ptr value = base::JSONReader::Read(json); + std::unique_ptr value = base::JSONReader::Read(json); ASSERT_TRUE(value->IsType(base::Value::TYPE_DICTIONARY)); ParseImageNamesDictionary(static_cast(value.get()), out_file_paths); @@ -159,7 +159,7 @@ class BrowserThemePackTest : public ::testing::Test { extension_path.AppendASCII("manifest.json"); std::string error; JSONFileValueDeserializer deserializer(manifest_path); - scoped_ptr valid_value = + std::unique_ptr valid_value = base::DictionaryValue::From(deserializer.Deserialize(NULL, &error)); EXPECT_EQ("", error); ASSERT_TRUE(valid_value.get()); @@ -364,7 +364,7 @@ class BrowserThemePackTest : public ::testing::Test { content::TestBrowserThread fake_ui_thread; content::TestBrowserThread fake_file_thread; - typedef scoped_ptr + typedef std::unique_ptr ScopedSetSupportedScaleFactors; ScopedSetSupportedScaleFactors scoped_set_supported_scale_factors_; scoped_refptr theme_pack_; diff --git a/chrome/browser/themes/theme_properties.cc b/chrome/browser/themes/theme_properties.cc index 8d5a8effd608e6..9bcb64198c8711 100644 --- a/chrome/browser/themes/theme_properties.cc +++ b/chrome/browser/themes/theme_properties.cc @@ -4,8 +4,9 @@ #include "chrome/browser/themes/theme_properties.h" +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "build/build_config.h" diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index a8be0886e82a16..11e8f1767a9b9a 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc @@ -355,7 +355,7 @@ void ThemeService::RemoveUnusedThemes(bool ignore_infobars) { std::string current_theme = GetThemeID(); std::vector remove_list; - scoped_ptr extensions( + std::unique_ptr extensions( extensions::ExtensionRegistry::Get(profile_) ->GenerateInstalledExtensionsSet()); extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); diff --git a/chrome/browser/themes/theme_service.h b/chrome/browser/themes/theme_service.h index 19163890706ba5..d8e02262b2cd2f 100644 --- a/chrome/browser/themes/theme_service.h +++ b/chrome/browser/themes/theme_service.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_THEMES_THEME_SERVICE_H_ #include +#include #include #include #include @@ -13,7 +14,6 @@ #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/threading/non_thread_safe.h" #include "build/build_config.h" @@ -315,11 +315,11 @@ class ThemeService : public base::NonThreadSafe, content::NotificationRegistrar registrar_; - scoped_ptr theme_syncable_service_; + std::unique_ptr theme_syncable_service_; #if defined(ENABLE_EXTENSIONS) class ThemeObserver; - scoped_ptr theme_observer_; + std::unique_ptr theme_observer_; #endif BrowserThemeProvider original_theme_provider_; diff --git a/chrome/browser/themes/theme_service_win.h b/chrome/browser/themes/theme_service_win.h index 0f0473df7d8937..a702f389417d92 100644 --- a/chrome/browser/themes/theme_service_win.h +++ b/chrome/browser/themes/theme_service_win.h @@ -28,7 +28,7 @@ class ThemeServiceWin : public ThemeService { // Registry key containing the params that determine the DWM frame color. // This is only initialized on Windows 10. - scoped_ptr dwm_key_; + std::unique_ptr dwm_key_; // The DWM frame color, if available; white otherwise. SkColor dwm_frame_color_; diff --git a/chrome/browser/themes/theme_syncable_service.cc b/chrome/browser/themes/theme_syncable_service.cc index 1bbaaae8a442b3..79b0e27ddb718b 100644 --- a/chrome/browser/themes/theme_syncable_service.cc +++ b/chrome/browser/themes/theme_syncable_service.cc @@ -59,8 +59,8 @@ void ThemeSyncableService::OnThemeChange() { syncer::SyncMergeResult ThemeSyncableService::MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data, - scoped_ptr sync_processor, - scoped_ptr error_handler) { + std::unique_ptr sync_processor, + std::unique_ptr error_handler) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(!sync_processor_.get()); DCHECK(sync_processor.get()); diff --git a/chrome/browser/themes/theme_syncable_service.h b/chrome/browser/themes/theme_syncable_service.h index f2ead919121cef..8b94e372a8fba5 100644 --- a/chrome/browser/themes/theme_syncable_service.h +++ b/chrome/browser/themes/theme_syncable_service.h @@ -5,9 +5,10 @@ #ifndef CHROME_BROWSER_THEMES_THEME_SYNCABLE_SERVICE_H_ #define CHROME_BROWSER_THEMES_THEME_SYNCABLE_SERVICE_H_ +#include + #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/threading/thread_checker.h" #include "sync/api/sync_change.h" #include "sync/api/sync_data.h" @@ -38,8 +39,8 @@ class ThemeSyncableService : public syncer::SyncableService { syncer::SyncMergeResult MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data, - scoped_ptr sync_processor, - scoped_ptr error_handler) override; + std::unique_ptr sync_processor, + std::unique_ptr error_handler) override; void StopSyncing(syncer::ModelType type) override; syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; syncer::SyncError ProcessSyncChanges( @@ -78,8 +79,8 @@ class ThemeSyncableService : public syncer::SyncableService { Profile* const profile_; ThemeService* const theme_service_; - scoped_ptr sync_processor_; - scoped_ptr sync_error_handler_; + std::unique_ptr sync_processor_; + std::unique_ptr sync_error_handler_; // Persist use_system_theme_by_default for platforms that use it, even if // we're not on one. diff --git a/chrome/browser/themes/theme_syncable_service_unittest.cc b/chrome/browser/themes/theme_syncable_service_unittest.cc index cab0fc959c22c7..e8714d9159c9a1 100644 --- a/chrome/browser/themes/theme_syncable_service_unittest.cc +++ b/chrome/browser/themes/theme_syncable_service_unittest.cc @@ -4,10 +4,12 @@ #include "chrome/browser/themes/theme_syncable_service.h" +#include + #include "base/command_line.h" #include "base/compiler_specific.h" #include "base/files/file_path.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "base/time/time.h" #include "build/build_config.h" #include "chrome/browser/extensions/extension_service.h" @@ -125,9 +127,9 @@ class FakeThemeService : public ThemeService { bool is_dirty_; }; -scoped_ptr BuildMockThemeService( +std::unique_ptr BuildMockThemeService( content::BrowserContext* profile) { - return make_scoped_ptr(new FakeThemeService); + return base::WrapUnique(new FakeThemeService); } scoped_refptr MakeThemeExtension( @@ -240,11 +242,11 @@ class ThemeSyncableServiceTest : public testing::Test { chromeos::ScopedTestUserManager test_user_manager_; #endif - scoped_ptr profile_; + std::unique_ptr profile_; FakeThemeService* fake_theme_service_; scoped_refptr theme_extension_; - scoped_ptr theme_sync_service_; - scoped_ptr fake_change_processor_; + std::unique_ptr theme_sync_service_; + std::unique_ptr fake_change_processor_; }; class PolicyInstalledThemeTest : public ThemeSyncableServiceTest { @@ -309,13 +311,12 @@ TEST_F(ThemeSyncableServiceTest, SetCurrentThemeDefaultTheme) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - MakeThemeDataList(sync_pb::ThemeSpecifics()), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); EXPECT_FALSE(error.IsSet()) << error.message(); EXPECT_FALSE(fake_theme_service_->UsingDefaultTheme()); @@ -331,13 +332,12 @@ TEST_F(ThemeSyncableServiceTest, SetCurrentThemeSystemTheme) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - MakeThemeDataList(theme_specifics), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, MakeThemeDataList(theme_specifics), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); EXPECT_FALSE(error.IsSet()) << error.message(); EXPECT_FALSE(fake_theme_service_->UsingSystemTheme()); @@ -356,13 +356,12 @@ TEST_F(ThemeSyncableServiceTest, SetCurrentThemeCustomTheme) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - MakeThemeDataList(theme_specifics), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, MakeThemeDataList(theme_specifics), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); EXPECT_FALSE(error.IsSet()) << error.message(); EXPECT_EQ(fake_theme_service_->theme_extension(), theme_extension_.get()); @@ -375,13 +374,12 @@ TEST_F(ThemeSyncableServiceTest, DontResetThemeWhenSpecificsAreEqual) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - MakeThemeDataList(sync_pb::ThemeSpecifics()), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); EXPECT_FALSE(error.IsSet()) << error.message(); EXPECT_FALSE(fake_theme_service_->is_dirty()); @@ -394,13 +392,12 @@ TEST_F(ThemeSyncableServiceTest, UpdateThemeSpecificsFromCurrentTheme) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - syncer::SyncDataList(), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, syncer::SyncDataList(), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); EXPECT_FALSE(error.IsSet()) << error.message(); const syncer::SyncChangeList& changes = fake_change_processor_->changes(); @@ -446,13 +443,12 @@ TEST_F(ThemeSyncableServiceTest, ProcessSyncThemeChange) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - MakeThemeDataList(sync_pb::ThemeSpecifics()), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); EXPECT_FALSE(error.IsSet()) << error.message(); // Don't expect theme change initially because specifics are equal. @@ -489,13 +485,12 @@ TEST_F(ThemeSyncableServiceTest, OnThemeChangeByUser) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - MakeThemeDataList(sync_pb::ThemeSpecifics()), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); EXPECT_FALSE(error.IsSet()) << error.message(); const syncer::SyncChangeList& changes = fake_change_processor_->changes(); @@ -523,13 +518,12 @@ TEST_F(ThemeSyncableServiceTest, StopSync) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - MakeThemeDataList(sync_pb::ThemeSpecifics()), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, MakeThemeDataList(sync_pb::ThemeSpecifics()), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); EXPECT_FALSE(error.IsSet()) << error.message(); const syncer::SyncChangeList& changes = fake_change_processor_->changes(); @@ -559,13 +553,12 @@ TEST_F(ThemeSyncableServiceTest, RestoreSystemThemeBitWhenChangeToCustomTheme) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - MakeThemeDataList(theme_specifics), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, MakeThemeDataList(theme_specifics), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); // Change to custom theme and notify theme_sync_service_. @@ -590,13 +583,12 @@ TEST_F(ThemeSyncableServiceTest, DistinctSystemTheme) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - MakeThemeDataList(theme_specifics), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, MakeThemeDataList(theme_specifics), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); EXPECT_FALSE(fake_theme_service_->is_dirty()); @@ -641,13 +633,12 @@ TEST_F(ThemeSyncableServiceTest, SystemThemeSameAsDefaultTheme) { syncer::SyncError error = theme_sync_service_ ->MergeDataAndStartSyncing( - syncer::THEMES, - MakeThemeDataList(theme_specifics), - scoped_ptr( - new syncer::SyncChangeProcessorWrapperForTest( - fake_change_processor_.get())), - scoped_ptr( - new syncer::SyncErrorFactoryMock())) + syncer::THEMES, MakeThemeDataList(theme_specifics), + std::unique_ptr( + new syncer::SyncChangeProcessorWrapperForTest( + fake_change_processor_.get())), + std::unique_ptr( + new syncer::SyncErrorFactoryMock())) .error(); EXPECT_EQ(fake_theme_service_->theme_extension(), theme_extension_.get()); diff --git a/chrome/browser/thumbnails/content_analysis_unittest.cc b/chrome/browser/thumbnails/content_analysis_unittest.cc index 23161efd4e5070..96c223a6749447 100644 --- a/chrome/browser/thumbnails/content_analysis_unittest.cc +++ b/chrome/browser/thumbnails/content_analysis_unittest.cc @@ -12,10 +12,10 @@ #include #include #include +#include #include #include -#include "base/memory/scoped_ptr.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkColor.h" diff --git a/chrome/browser/tracing/background_tracing_field_trial.cc b/chrome/browser/tracing/background_tracing_field_trial.cc index 2e0549d2137cb0..970cfddb6ca30a 100644 --- a/chrome/browser/tracing/background_tracing_field_trial.cc +++ b/chrome/browser/tracing/background_tracing_field_trial.cc @@ -38,7 +38,7 @@ void OnUploadComplete(TraceCrashServiceUploader* uploader, void UploadCallback(const std::string& upload_url, const scoped_refptr& file_contents, - scoped_ptr metadata, + std::unique_ptr metadata, base::Closure callback) { TraceCrashServiceUploader* uploader = new TraceCrashServiceUploader( g_browser_process->system_request_context()); @@ -70,7 +70,7 @@ void SetupBackgroundTracingFieldTrial() { if (g_config_text_filter_for_testing) (*g_config_text_filter_for_testing)(&config_text); - scoped_ptr value = base::JSONReader::Read(config_text); + std::unique_ptr value = base::JSONReader::Read(config_text); if (!value) return; @@ -78,7 +78,7 @@ void SetupBackgroundTracingFieldTrial() { if (!value->GetAsDictionary(&dict)) return; - scoped_ptr config = + std::unique_ptr config = content::BackgroundTracingConfig::FromDict(dict); if (!config) return; diff --git a/chrome/browser/tracing/chrome_tracing_delegate.cc b/chrome/browser/tracing/chrome_tracing_delegate.cc index 7544b72533bc6b..0b85007b4e3f23 100644 --- a/chrome/browser/tracing/chrome_tracing_delegate.cc +++ b/chrome/browser/tracing/chrome_tracing_delegate.cc @@ -49,9 +49,9 @@ void ChromeTracingDelegate::OnBrowserAdded(Browser* browser) { incognito_launched_ = true; } -scoped_ptr ChromeTracingDelegate::GetTraceUploader( +std::unique_ptr ChromeTracingDelegate::GetTraceUploader( net::URLRequestContextGetter* request_context) { - return scoped_ptr( + return std::unique_ptr( new TraceCrashServiceUploader(request_context)); } @@ -148,7 +148,7 @@ void ChromeTracingDelegate::GenerateMetadataDict( std::vector variations; variations::GetFieldTrialActiveGroupIdsAsStrings(&variations); - scoped_ptr variations_list(new base::ListValue()); + std::unique_ptr variations_list(new base::ListValue()); for (const auto& it : variations) variations_list->Append(new base::StringValue(it)); diff --git a/chrome/browser/tracing/chrome_tracing_delegate.h b/chrome/browser/tracing/chrome_tracing_delegate.h index d745eff9b7b20e..d1b933a4a620fe 100644 --- a/chrome/browser/tracing/chrome_tracing_delegate.h +++ b/chrome/browser/tracing/chrome_tracing_delegate.h @@ -5,7 +5,8 @@ #ifndef CHROME_BROWSER_TRACING_CHROME_TRACING_DELEGATE_H_ #define CHROME_BROWSER_TRACING_CHROME_TRACING_DELEGATE_H_ -#include "base/memory/scoped_ptr.h" +#include + #include "chrome/browser/ui/browser_list_observer.h" #include "content/public/browser/tracing_delegate.h" @@ -19,7 +20,7 @@ class ChromeTracingDelegate : public content::TracingDelegate, static void RegisterPrefs(PrefRegistrySimple* registry); - scoped_ptr GetTraceUploader( + std::unique_ptr GetTraceUploader( net::URLRequestContextGetter* request_context) override; bool IsAllowedToBeginBackgroundScenario( diff --git a/chrome/browser/tracing/chrome_tracing_delegate_browsertest.cc b/chrome/browser/tracing/chrome_tracing_delegate_browsertest.cc index a61d164a252f0e..316fe0ff094fb3 100644 --- a/chrome/browser/tracing/chrome_tracing_delegate_browsertest.cc +++ b/chrome/browser/tracing/chrome_tracing_delegate_browsertest.cc @@ -50,16 +50,17 @@ class ChromeTracingDelegateBrowserTest : public InProcessBrowserTest { dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); dict.SetString("category", "BENCHMARK"); - scoped_ptr rules_list(new base::ListValue()); + std::unique_ptr rules_list(new base::ListValue()); { - scoped_ptr rules_dict(new base::DictionaryValue()); + std::unique_ptr rules_dict( + new base::DictionaryValue()); rules_dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED"); rules_dict->SetString("trigger_name", "test"); rules_list->Append(std::move(rules_dict)); } dict.Set("configs", std::move(rules_list)); - scoped_ptr config( + std::unique_ptr config( content::BackgroundTracingConfig::FromDict(&dict)); DCHECK(config); @@ -96,7 +97,7 @@ class ChromeTracingDelegateBrowserTest : public InProcessBrowserTest { private: void OnUpload(const scoped_refptr& file_contents, - scoped_ptr metadata, + std::unique_ptr metadata, base::Callback done_callback) { receive_count_ += 1; diff --git a/chrome/browser/tracing/crash_service_uploader.cc b/chrome/browser/tracing/crash_service_uploader.cc index 9f98e99255df27..4aec392378bccf 100644 --- a/chrome/browser/tracing/crash_service_uploader.cc +++ b/chrome/browser/tracing/crash_service_uploader.cc @@ -110,7 +110,7 @@ void TraceCrashServiceUploader::OnURLFetchUploadProgress( void TraceCrashServiceUploader::DoUpload( const std::string& file_contents, UploadMode upload_mode, - scoped_ptr metadata, + std::unique_ptr metadata, const UploadProgressCallback& progress_callback, const UploadDoneCallback& done_callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -126,7 +126,7 @@ void TraceCrashServiceUploader::DoUploadOnFileThread( const std::string& file_contents, UploadMode upload_mode, const std::string& upload_url, - scoped_ptr metadata, + std::unique_ptr metadata, const UploadProgressCallback& progress_callback, const UploadDoneCallback& done_callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); @@ -174,7 +174,7 @@ void TraceCrashServiceUploader::DoUploadOnFileThread( std::string compressed_contents; if (upload_mode == COMPRESSED_UPLOAD) { - scoped_ptr compressed_buffer(new char[kMaxUploadBytes]); + std::unique_ptr compressed_buffer(new char[kMaxUploadBytes]); int compressed_bytes; if (!Compress(file_contents, kMaxUploadBytes, compressed_buffer.get(), &compressed_bytes)) { @@ -212,7 +212,7 @@ void TraceCrashServiceUploader::OnUploadError( void TraceCrashServiceUploader::SetupMultipart( const std::string& product, const std::string& version, - scoped_ptr metadata, + std::unique_ptr metadata, const std::string& trace_filename, const std::string& trace_contents, std::string* post_data) { diff --git a/chrome/browser/tracing/crash_service_uploader.h b/chrome/browser/tracing/crash_service_uploader.h index 55d3204e46aff0..cfff0933d116c8 100644 --- a/chrome/browser/tracing/crash_service_uploader.h +++ b/chrome/browser/tracing/crash_service_uploader.h @@ -7,12 +7,12 @@ #include +#include #include #include #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/thread_checker.h" #include "content/public/browser/trace_uploader.h" @@ -42,22 +42,23 @@ class TraceCrashServiceUploader : public content::TraceUploader, // content::TraceUploader void DoUpload(const std::string& file_contents, UploadMode upload_mode, - scoped_ptr metadata, + std::unique_ptr metadata, const UploadProgressCallback& progress_callback, const UploadDoneCallback& done_callback) override; private: - void DoUploadOnFileThread(const std::string& file_contents, - UploadMode upload_mode, - const std::string& upload_url, - scoped_ptr metadata, - const UploadProgressCallback& progress_callback, - const UploadDoneCallback& done_callback); + void DoUploadOnFileThread( + const std::string& file_contents, + UploadMode upload_mode, + const std::string& upload_url, + std::unique_ptr metadata, + const UploadProgressCallback& progress_callback, + const UploadDoneCallback& done_callback); // Sets up a multipart body to be uploaded. The body is produced according // to RFC 2046. void SetupMultipart(const std::string& product, const std::string& version, - scoped_ptr metadata, + std::unique_ptr metadata, const std::string& trace_filename, const std::string& trace_contents, std::string* post_data); @@ -73,7 +74,7 @@ class TraceCrashServiceUploader : public content::TraceUploader, const std::string& post_data); void OnUploadError(const std::string& error_message); - scoped_ptr url_fetcher_; + std::unique_ptr url_fetcher_; UploadProgressCallback progress_callback_; UploadDoneCallback done_callback_; diff --git a/chrome/browser/tracing/navigation_tracing.cc b/chrome/browser/tracing/navigation_tracing.cc index 07ee42e86efc04..197ecc2195dae5 100644 --- a/chrome/browser/tracing/navigation_tracing.cc +++ b/chrome/browser/tracing/navigation_tracing.cc @@ -36,7 +36,7 @@ void OnUploadComplete(TraceCrashServiceUploader* uploader, } void UploadCallback(const scoped_refptr& file_contents, - scoped_ptr metadata, + std::unique_ptr metadata, base::Closure callback) { TraceCrashServiceUploader* uploader = new TraceCrashServiceUploader( g_browser_process->system_request_context()); @@ -61,9 +61,10 @@ void SetupNavigationTracing() { base::DictionaryValue dict; dict.SetString("mode", "REACTIVE_TRACING_MODE"); - scoped_ptr rules_list(new base::ListValue()); + std::unique_ptr rules_list(new base::ListValue()); { - scoped_ptr rules_dict(new base::DictionaryValue()); + std::unique_ptr rules_dict( + new base::DictionaryValue()); rules_dict->SetString("rule", "TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL"); rules_dict->SetString("trigger_name", kNavigationTracingConfig); rules_dict->SetString("category", "BENCHMARK_DEEP"); @@ -71,7 +72,7 @@ void SetupNavigationTracing() { } dict.Set("configs", std::move(rules_list)); - scoped_ptr config( + std::unique_ptr config( content::BackgroundTracingConfig::FromDict(&dict)); DCHECK(config); diff --git a/chrome/browser/translate/chrome_translate_client.cc b/chrome/browser/translate/chrome_translate_client.cc index d43dab077c9408..ce32fe0cfdbbcd 100644 --- a/chrome/browser/translate/chrome_translate_client.cc +++ b/chrome/browser/translate/chrome_translate_client.cc @@ -92,14 +92,14 @@ translate::LanguageState& ChromeTranslateClient::GetLanguageState() { } // static -scoped_ptr +std::unique_ptr ChromeTranslateClient::CreateTranslatePrefs(PrefService* prefs) { #if defined(OS_CHROMEOS) const char* preferred_languages_prefs = prefs::kLanguagePreferredLanguages; #else const char* preferred_languages_prefs = NULL; #endif - scoped_ptr translate_prefs( + std::unique_ptr translate_prefs( new translate::TranslatePrefs(prefs, prefs::kAcceptLanguages, preferred_languages_prefs)); @@ -153,7 +153,7 @@ void ChromeTranslateClient::GetTranslateLanguages( Profile::FromBrowserContext(web_contents->GetBrowserContext()); Profile* original_profile = profile->GetOriginalProfile(); PrefService* prefs = original_profile->GetPrefs(); - scoped_ptr translate_prefs = + std::unique_ptr translate_prefs = CreateTranslatePrefs(prefs); if (!web_contents->GetBrowserContext()->IsOffTheRecord()) { std::string auto_translate_language = @@ -228,7 +228,7 @@ PrefService* ChromeTranslateClient::GetPrefs() { return profile->GetOriginalProfile()->GetPrefs(); } -scoped_ptr +std::unique_ptr ChromeTranslateClient::GetTranslatePrefs() { DCHECK(web_contents()); Profile* profile = diff --git a/chrome/browser/translate/chrome_translate_client.h b/chrome/browser/translate/chrome_translate_client.h index 2bf67d0d779951..d21629528d37d6 100644 --- a/chrome/browser/translate/chrome_translate_client.h +++ b/chrome/browser/translate/chrome_translate_client.h @@ -5,10 +5,10 @@ #ifndef CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ #define CHROME_BROWSER_TRANSLATE_CHROME_TRANSLATE_CLIENT_H_ +#include #include #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/ui/translate/translate_bubble_model.h" #include "components/translate/content/browser/content_translate_driver.h" #include "components/translate/core/browser/translate_client.h" @@ -53,7 +53,7 @@ class ChromeTranslateClient } // Helper method to return a new TranslatePrefs instance. - static scoped_ptr CreateTranslatePrefs( + static std::unique_ptr CreateTranslatePrefs( PrefService* prefs); // Helper method to return the TranslateAcceptLanguages instance associated @@ -81,12 +81,13 @@ class ChromeTranslateClient // TranslateClient implementation. translate::TranslateDriver* GetTranslateDriver() override; PrefService* GetPrefs() override; - scoped_ptr GetTranslatePrefs() override; + std::unique_ptr GetTranslatePrefs() override; translate::TranslateAcceptLanguages* GetTranslateAcceptLanguages() override; int GetInfobarIconID() const override; #if !defined(USE_AURA) - scoped_ptr CreateInfoBar( - scoped_ptr delegate) const override; + std::unique_ptr CreateInfoBar( + std::unique_ptr delegate) + const override; #endif void ShowTranslateUI(translate::TranslateStep step, const std::string& source_language, @@ -115,7 +116,7 @@ class ChromeTranslateClient translate::TranslateErrors::Type error_type); translate::ContentTranslateDriver translate_driver_; - scoped_ptr translate_manager_; + std::unique_ptr translate_manager_; DISALLOW_COPY_AND_ASSIGN(ChromeTranslateClient); }; diff --git a/chrome/browser/translate/cld_data_harness.cc b/chrome/browser/translate/cld_data_harness.cc index 35ab020a510a23..bc7631e4b267ea 100644 --- a/chrome/browser/translate/cld_data_harness.cc +++ b/chrome/browser/translate/cld_data_harness.cc @@ -48,21 +48,18 @@ void CldDataHarness::GetTestDataSourceDirectory(base::FilePath* out_path) { } // static -scoped_ptr -CldDataHarness::CreateStaticDataHarness() { - return scoped_ptr(new StaticCldDataHarness()); +std::unique_ptr CldDataHarness::CreateStaticDataHarness() { + return std::unique_ptr(new StaticCldDataHarness()); } // static -scoped_ptr -CldDataHarness::CreateStandaloneDataHarness() { - return scoped_ptr(new StandaloneCldDataHarness()); +std::unique_ptr CldDataHarness::CreateStandaloneDataHarness() { + return std::unique_ptr(new StandaloneCldDataHarness()); } // static -scoped_ptr -CldDataHarness::CreateComponentDataHarness() { - return scoped_ptr(new ComponentCldDataHarness()); +std::unique_ptr CldDataHarness::CreateComponentDataHarness() { + return std::unique_ptr(new ComponentCldDataHarness()); } } // namespace test diff --git a/chrome/browser/translate/cld_data_harness.h b/chrome/browser/translate/cld_data_harness.h index 6a78d78d8142d4..da2bc738e69370 100644 --- a/chrome/browser/translate/cld_data_harness.h +++ b/chrome/browser/translate/cld_data_harness.h @@ -5,9 +5,10 @@ #ifndef CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_H_ #define CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_H_ +#include + #include "base/files/file_path.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" namespace test { @@ -28,7 +29,7 @@ namespace test { // Sample usage: // // IN_PROC_BROWSER_TEST_F(BrowserTest, PageLanguageDetection) { -// scoped_ptr cld_data_scope = +// std::unique_ptr cld_data_scope = // test::CldDataHarnessFactory::Get()->CreateCldDataHarness(); // ASSERT_NO_FATAL_FAILURE(cld_data_scope->Init()); // // ... your code that depends on language detection goes here @@ -51,7 +52,7 @@ namespace test { // InProcessBrowserTest::SetUpOnMainThread(); // } // private: -// scoped_ptr cld_data_scope; +// std::unique_ptr cld_data_scope; // }; // class CldDataHarness { @@ -76,19 +77,19 @@ class CldDataHarness { // Create and return a new instance of a data harness whose Init() method // will configure the "static" CldDataSource. - static scoped_ptr CreateStaticDataHarness(); + static std::unique_ptr CreateStaticDataHarness(); // Create and return a new instance of a data harness whose Init() method // will configure the "standalone" CldDataSource. // Unlike NONE() and STATIC(), this data hardness will perform work to allow // CLD to load data from a file. - static scoped_ptr CreateStandaloneDataHarness(); + static std::unique_ptr CreateStandaloneDataHarness(); // Create and return a new instance of a data harness whose Init() method // will configure the "component" CldDataSource. // Unlike NONE() and STATIC(), this data hardness will perform work to allow // CLD to load data from a file. - static scoped_ptr CreateComponentDataHarness(); + static std::unique_ptr CreateComponentDataHarness(); protected: // Returns the version number of the Component Updater "extension" in the diff --git a/chrome/browser/translate/cld_data_harness_factory.cc b/chrome/browser/translate/cld_data_harness_factory.cc index 6ceafc53483c62..607e941932ab40 100644 --- a/chrome/browser/translate/cld_data_harness_factory.cc +++ b/chrome/browser/translate/cld_data_harness_factory.cc @@ -35,7 +35,7 @@ base::LazyInstance::Leaky g_wrapped_static = namespace test { -scoped_ptr CldDataHarnessFactory::CreateCldDataHarness() { +std::unique_ptr CldDataHarnessFactory::CreateCldDataHarness() { // Cheat: Since the three "canned" implementations are all well-known, just // check to see if "this" points to one of the singletons and then return // the right answer. Embedder-provided CldDataHarnessFactory implementations diff --git a/chrome/browser/translate/cld_data_harness_factory.h b/chrome/browser/translate/cld_data_harness_factory.h index 52e13237f4557a..508b97c8629917 100644 --- a/chrome/browser/translate/cld_data_harness_factory.h +++ b/chrome/browser/translate/cld_data_harness_factory.h @@ -5,8 +5,9 @@ #ifndef CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_FACTORY_H_ #define CHROME_BROWSER_TRANSLATE_CLD_DATA_HARNESS_FACTORY_H_ +#include + #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/translate/cld_data_harness.h" namespace test { @@ -34,7 +35,7 @@ class CldDataHarnessFactory { // Create a new CldDataHarness. // The default implementation returns a simple CldDataHarness, which is // likely to be incorrect for most non-static CLD use cases. - virtual scoped_ptr CreateCldDataHarness(); + virtual std::unique_ptr CreateCldDataHarness(); // Unconditionally sets the factory for this process, overwriting any // previously-configured value. Open-source Chromium test code should almost diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index 2b83e4db986835..46e6fdde775734 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc @@ -4,7 +4,8 @@ #include "components/translate/core/browser/translate_manager.h" -#include "base/memory/scoped_ptr.h" +#include + #include "build/build_config.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/prefs/session_startup_pref.h" @@ -35,7 +36,7 @@ class TranslateManagerBrowserTest : public InProcessBrowserTest { protected: // InProcessBrowserTest members. void SetUp() override { - scoped_ptr cld_data_harness = + std::unique_ptr cld_data_harness = test::CldDataHarnessFactory::Get()->CreateCldDataHarness(); ASSERT_NO_FATAL_FAILURE(cld_data_harness->Init()); InProcessBrowserTest::SetUp(); @@ -50,7 +51,7 @@ class TranslateManagerBrowserTest : public InProcessBrowserTest { ui_test_utils::WindowedNotificationObserverWithDetails< translate::LanguageDetectionDetails>; - scoped_ptr language_detected_signal_; + std::unique_ptr language_detected_signal_; }; // Tests that the CLD (Compact Language Detection) works properly. diff --git a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc index c5f4ac3e1211fd..aff1aacecc838e 100644 --- a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc +++ b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc @@ -3,7 +3,9 @@ // found in the LICENSE file. #include + #include +#include #include #include #include @@ -11,7 +13,6 @@ #include "base/command_line.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/stringprintf.h" #include "build/build_config.h" #include "chrome/app/chrome_command_ids.h" @@ -89,11 +90,10 @@ class MockTranslateBubbleFactory : public TranslateBubbleFactory { translate::TranslateDownloadManager::GetLanguageCode( g_browser_process->GetApplicationLocale()); - scoped_ptr ui_delegate( + std::unique_ptr ui_delegate( new translate::TranslateUIDelegate( chrome_translate_client->GetTranslateManager()->GetWeakPtr(), - source_language, - target_language)); + source_language, target_language)); model_.reset(new TranslateBubbleModelImpl(step, std::move(ui_delegate))); } @@ -109,7 +109,7 @@ class MockTranslateBubbleFactory : public TranslateBubbleFactory { TranslateBubbleModel* model() { return model_.get(); } private: - scoped_ptr model_; + std::unique_ptr model_; DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory); }; @@ -490,7 +490,7 @@ class TranslateManagerRenderViewHostTest // WARNING: the pointers point to deleted objects, use only for comparison. std::set removed_infobars_; - scoped_ptr bubble_factory_; + std::unique_ptr bubble_factory_; DISALLOW_COPY_AND_ASSIGN(TranslateManagerRenderViewHostTest); }; @@ -732,7 +732,7 @@ TEST_F(TranslateManagerRenderViewHostTest, TranslateUnknownLanguage) { ASSERT_TRUE(GetTranslateInfoBar() == NULL); // Translate the page anyway throught the context menu. - scoped_ptr menu(CreateContextMenu()); + std::unique_ptr menu(CreateContextMenu()); menu->Init(); menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); @@ -1151,7 +1151,7 @@ TEST_F(TranslateManagerRenderViewHostTest, UnsupportedUILanguage) { EXPECT_TRUE(GetTranslateInfoBar() == NULL); // And the context menu option should be disabled too. - scoped_ptr menu(CreateContextMenu()); + std::unique_ptr menu(CreateContextMenu()); menu->Init(); EXPECT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_TRANSLATE)); EXPECT_FALSE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_TRANSLATE)); @@ -1247,7 +1247,7 @@ TEST_F(TranslateManagerRenderViewHostTest, NeverTranslateLanguagePref) { registrar.Init(prefs); registrar.Add(translate::TranslatePrefs::kPrefTranslateBlockedLanguages, pref_callback_); - scoped_ptr translate_prefs( + std::unique_ptr translate_prefs( ChromeTranslateClient::CreateTranslatePrefs(prefs)); EXPECT_FALSE(translate_prefs->IsBlockedLanguage("fr")); translate::TranslateAcceptLanguages* accept_languages = @@ -1304,7 +1304,7 @@ TEST_F(TranslateManagerRenderViewHostTest, NeverTranslateSitePref) { registrar.Init(prefs); registrar.Add(translate::TranslatePrefs::kPrefTranslateSiteBlacklist, pref_callback_); - scoped_ptr translate_prefs( + std::unique_ptr translate_prefs( ChromeTranslateClient::CreateTranslatePrefs(prefs)); EXPECT_FALSE(translate_prefs->IsSiteBlacklisted(host)); translate::TranslateAcceptLanguages* accept_languages = @@ -1352,7 +1352,7 @@ TEST_F(TranslateManagerRenderViewHostTest, AlwaysTranslateLanguagePref) { registrar.Init(prefs); registrar.Add(translate::TranslatePrefs::kPrefTranslateWhitelists, pref_callback_); - scoped_ptr translate_prefs( + std::unique_ptr translate_prefs( ChromeTranslateClient::CreateTranslatePrefs(prefs)); SetPrefObserverExpectation( translate::TranslatePrefs::kPrefTranslateWhitelists); @@ -1414,7 +1414,7 @@ TEST_F(TranslateManagerRenderViewHostTest, ContextMenu) { GURL url("http://www.google.fr"); Profile* profile = Profile::FromBrowserContext(web_contents()->GetBrowserContext()); - scoped_ptr translate_prefs( + std::unique_ptr translate_prefs( ChromeTranslateClient::CreateTranslatePrefs(profile->GetPrefs())); translate_prefs->BlockLanguage("fr"); translate_prefs->BlacklistSite(url.host()); @@ -1424,7 +1424,7 @@ TEST_F(TranslateManagerRenderViewHostTest, ContextMenu) { // Simulate navigating to a page in French. The translate menu should show but // should only be enabled when the page language has been received. NavigateAndCommit(url); - scoped_ptr menu(CreateContextMenu()); + std::unique_ptr menu(CreateContextMenu()); menu->Init(); EXPECT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_TRANSLATE)); EXPECT_FALSE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_TRANSLATE)); @@ -1523,7 +1523,7 @@ TEST_F(TranslateManagerRenderViewHostTest, BeforeTranslateExtraButtons) { Profile* profile = Profile::FromBrowserContext(web_contents()->GetBrowserContext()); - scoped_ptr translate_prefs( + std::unique_ptr translate_prefs( ChromeTranslateClient::CreateTranslatePrefs(profile->GetPrefs())); translate_prefs->ResetTranslationAcceptedCount("fr"); translate_prefs->ResetTranslationDeniedCount("fr"); @@ -1607,7 +1607,7 @@ TEST_F(TranslateManagerRenderViewHostTest, NonTranslatablePage) { EXPECT_TRUE(GetTranslateInfoBar() == NULL); // The context menu is enabled to allow users to force translation. - scoped_ptr menu(CreateContextMenu()); + std::unique_ptr menu(CreateContextMenu()); menu->Init(); EXPECT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_TRANSLATE)); EXPECT_TRUE(menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_TRANSLATE)); @@ -1664,7 +1664,7 @@ TEST_F(TranslateManagerRenderViewHostTest, BubbleNormalTranslate) { return; MockTranslateBubbleFactory* factory = new MockTranslateBubbleFactory; - scoped_ptr factory_ptr(factory); + std::unique_ptr factory_ptr(factory); TranslateBubbleFactory::SetFactory(factory); SimulateNavigation(GURL("http://www.google.fr"), "fr", true); @@ -1707,7 +1707,7 @@ TEST_F(TranslateManagerRenderViewHostTest, BubbleTranslateScriptNotAvailable) { return; MockTranslateBubbleFactory* factory = new MockTranslateBubbleFactory; - scoped_ptr factory_ptr(factory); + std::unique_ptr factory_ptr(factory); TranslateBubbleFactory::SetFactory(factory); SimulateNavigation(GURL("http://www.google.fr"), "fr", true); @@ -1740,7 +1740,7 @@ TEST_F(TranslateManagerRenderViewHostTest, BubbleUnknownLanguage) { return; MockTranslateBubbleFactory* factory = new MockTranslateBubbleFactory; - scoped_ptr factory_ptr(factory); + std::unique_ptr factory_ptr(factory); TranslateBubbleFactory::SetFactory(factory); // Simulate navigating to a page ("und" is the string returned by the CLD for @@ -1751,7 +1751,7 @@ TEST_F(TranslateManagerRenderViewHostTest, BubbleUnknownLanguage) { ASSERT_TRUE(factory->model() == NULL); // Translate the page anyway throught the context menu. - scoped_ptr menu(CreateContextMenu()); + std::unique_ptr menu(CreateContextMenu()); menu->Init(); menu->ExecuteCommand(IDC_CONTENT_CONTEXT_TRANSLATE, 0); diff --git a/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc b/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc index dacf3e822f219e..1a813c6f1ff5d4 100644 --- a/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.cc @@ -79,7 +79,8 @@ void ChromeMashShelfController::Init() { ResourceBundle& rb = ResourceBundle::GetSharedInstance(); const gfx::Image& image = rb.GetImageNamed(IDR_PRODUCT_LOGO_32); item->image = skia::mojom::Bitmap::From(*image.ToSkBitmap()); - scoped_ptr delegate(new ChromeShelfItemDelegate()); + std::unique_ptr delegate( + new ChromeShelfItemDelegate()); shelf_controller_->AddItem(std::move(item), delegate->CreateInterfacePtrInfoAndBind( shelf_controller_.associated_group())); diff --git a/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h b/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h index 1a10ef28dd48f0..b458fa369f8cd0 100644 --- a/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h +++ b/chrome/browser/ui/ash/launcher/chrome_mash_shelf_controller.h @@ -6,9 +6,9 @@ #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_MASH_SHELF_CONTROLLER_H_ #include +#include #include -#include "base/memory/scoped_ptr.h" #include "mash/shelf/public/interfaces/shelf.mojom.h" #include "mojo/public/cpp/bindings/associated_binding.h" @@ -39,7 +39,7 @@ class ChromeMashShelfController : public mash::shelf::mojom::ShelfObserver { mash::shelf::mojom::ShelfControllerPtr shelf_controller_; mojo::AssociatedBinding observer_binding_; - std::map> + std::map> app_id_to_item_delegate_; DISALLOW_COPY_AND_ASSIGN(ChromeMashShelfController); diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc index 8d1391fc99b0a2..fc1b661bcd49c6 100644 --- a/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu_unittest.cc @@ -146,7 +146,8 @@ TEST_F(LauncherContextMenuTest, DesktopShellLauncherContextMenuItemCheck) { // Verifies contextmenu items for Arc app #if defined(OS_CHROMEOS) TEST_F(LauncherContextMenuTest, ArcLauncherContextMenuItemCheck) { - scoped_ptr menu(CreateLauncherContextMenuForArcApp()); + std::unique_ptr menu( + CreateLauncherContextMenuForArcApp()); EXPECT_TRUE( IsItemPresentInMenu(menu.get(), LauncherContextMenu::MENU_OPEN_NEW)); EXPECT_TRUE(menu->IsCommandIdEnabled(LauncherContextMenu::MENU_OPEN_NEW)); diff --git a/chrome/browser/ui/passwords/password_manager_presenter.cc b/chrome/browser/ui/passwords/password_manager_presenter.cc index f31826a1c967cd..3c8a5129982653 100644 --- a/chrome/browser/ui/passwords/password_manager_presenter.cc +++ b/chrome/browser/ui/passwords/password_manager_presenter.cc @@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/command_line.h" +#include "base/memory/ptr_util.h" #include "base/metrics/user_metrics_action.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h" @@ -252,12 +253,12 @@ void PasswordManagerPresenter::RequestShowPassword(size_t index) { #endif } -std::vector> +std::vector> PasswordManagerPresenter::GetAllPasswords() { - std::vector> ret_val; + std::vector> ret_val; for (const auto& form : password_list_) { - ret_val.push_back(make_scoped_ptr(new autofill::PasswordForm(*form))); + ret_val.push_back(base::WrapUnique(new autofill::PasswordForm(*form))); } return ret_val; diff --git a/chrome/browser/ui/views/settings_api_bubble_helper_views.cc b/chrome/browser/ui/views/settings_api_bubble_helper_views.cc index 6bda4f619537e1..589e53fb2453df 100644 --- a/chrome/browser/ui/views/settings_api_bubble_helper_views.cc +++ b/chrome/browser/ui/views/settings_api_bubble_helper_views.cc @@ -38,12 +38,10 @@ void ShowSettingsApiBubble(SettingsApiOverrideType type, return; // TODO(devlin): This should go through the ToolbarActionsBar. - ToolbarActionsBarBubbleViews* bubble = - new ToolbarActionsBarBubbleViews( - anchor_view, - scoped_ptr( - new ExtensionMessageBubbleBridge( - std::move(settings_api_bubble)))); + ToolbarActionsBarBubbleViews* bubble = new ToolbarActionsBarBubbleViews( + anchor_view, + std::unique_ptr( + new ExtensionMessageBubbleBridge(std::move(settings_api_bubble)))); bubble->set_arrow(arrow); views::BubbleDialogDelegateView::CreateBubble(bubble); bubble->Show(); diff --git a/chrome/browser/ui/views/sync/one_click_signin_dialog_view.cc b/chrome/browser/ui/views/sync/one_click_signin_dialog_view.cc index e47fcd2a278b15..c464684bb82b04 100644 --- a/chrome/browser/ui/views/sync/one_click_signin_dialog_view.cc +++ b/chrome/browser/ui/views/sync/one_click_signin_dialog_view.cc @@ -41,7 +41,7 @@ OneClickSigninDialogView* OneClickSigninDialogView::dialog_view_ = NULL; // static void OneClickSigninDialogView::ShowDialog( const base::string16& email, - scoped_ptr delegate, + std::unique_ptr delegate, gfx::NativeWindow window, const BrowserWindow::StartSyncCallback& start_sync) { if (IsShowing()) @@ -67,7 +67,7 @@ void OneClickSigninDialogView::Hide() { OneClickSigninDialogView::OneClickSigninDialogView( const base::string16& email, - scoped_ptr delegate, + std::unique_ptr delegate, const BrowserWindow::StartSyncCallback& start_sync_callback) : delegate_(std::move(delegate)), email_(email), diff --git a/chrome/browser/ui/views/sync/one_click_signin_dialog_view.h b/chrome/browser/ui/views/sync/one_click_signin_dialog_view.h index bea76830a48752..c5eb67daa334a7 100644 --- a/chrome/browser/ui/views/sync/one_click_signin_dialog_view.h +++ b/chrome/browser/ui/views/sync/one_click_signin_dialog_view.h @@ -5,11 +5,12 @@ #ifndef CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_DIALOG_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_SYNC_ONE_CLICK_SIGNIN_DIALOG_VIEW_H_ +#include + #include "base/callback.h" #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/sync/one_click_signin_links_delegate.h" @@ -32,7 +33,7 @@ class OneClickSigninDialogView : public views::DialogDelegateView, // Show the one-click signin dialog if not already showing. |start_sync| is // called to start sync. static void ShowDialog(const base::string16& email, - scoped_ptr delegate, + std::unique_ptr delegate, gfx::NativeWindow window, const BrowserWindow::StartSyncCallback& start_sync); @@ -48,7 +49,7 @@ class OneClickSigninDialogView : public views::DialogDelegateView, // Creates a OneClickSigninDialogView. OneClickSigninDialogView( const base::string16& email, - scoped_ptr delegate, + std::unique_ptr delegate, const BrowserWindow::StartSyncCallback& start_sync_callback); ~OneClickSigninDialogView() override; @@ -73,7 +74,7 @@ class OneClickSigninDialogView : public views::DialogDelegateView, void LinkClicked(views::Link* source, int event_flags) override; // Delegate to handle clicking on links in the bubble. - scoped_ptr delegate_; + std::unique_ptr delegate_; // The user's email address to be used for sync. const base::string16 email_; diff --git a/chrome/browser/ui/views/sync/one_click_signin_dialog_view_unittest.cc b/chrome/browser/ui/views/sync/one_click_signin_dialog_view_unittest.cc index d1ab41ebc44b75..693c7b3722ff41 100644 --- a/chrome/browser/ui/views/sync/one_click_signin_dialog_view_unittest.cc +++ b/chrome/browser/ui/views/sync/one_click_signin_dialog_view_unittest.cc @@ -4,12 +4,13 @@ #include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h" +#include #include #include "base/bind.h" #include "base/bind_helpers.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" +#include "base/memory/ptr_util.h" #include "chrome/browser/ui/sync/one_click_signin_links_delegate.h" #include "chrome/browser/ui/views/chrome_constrained_window_views_client.h" #include "components/constrained_window/constrained_window_views.h" @@ -49,7 +50,7 @@ class OneClickSigninDialogViewTest : public views::ViewsTestBase, OneClickSigninDialogView* ShowOneClickSigninDialog() { OneClickSigninDialogView::ShowDialog( base::string16(), - make_scoped_ptr(new TestOneClickSigninLinksDelegate(this)), + base::WrapUnique(new TestOneClickSigninLinksDelegate(this)), anchor_widget_->GetNativeWindow(), base::Bind(&OneClickSigninDialogViewTest::OnStartSync, base::Unretained(this))); diff --git a/chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views_unittest.cc b/chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views_unittest.cc index 46ffe167ac28a5..d5d1f6cbcb1c9d 100644 --- a/chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views_unittest.cc +++ b/chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views_unittest.cc @@ -4,7 +4,8 @@ #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h" -#include "base/memory/scoped_ptr.h" +#include + #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/ui/toolbar/test_toolbar_actions_bar_bubble_delegate.h" diff --git a/chrome/browser/ui/webui/options/password_manager_handler.cc b/chrome/browser/ui/webui/options/password_manager_handler.cc index f4698d8ee84589..404018f310c9fe 100644 --- a/chrome/browser/ui/webui/options/password_manager_handler.cc +++ b/chrome/browser/ui/webui/options/password_manager_handler.cc @@ -93,7 +93,7 @@ PasswordManagerHandler::PasswordManagerHandler() { } PasswordManagerHandler::PasswordManagerHandler( - scoped_ptr presenter) + std::unique_ptr presenter) : password_manager_presenter_(std::move(presenter)) {} PasswordManagerHandler::~PasswordManagerHandler() {} @@ -405,7 +405,7 @@ void PasswordManagerHandler::HandlePasswordExport(const base::ListValue* args) { void PasswordManagerHandler::ExportPasswordFileSelected( const base::FilePath& path) { - std::vector> password_list = + std::vector> password_list = password_manager_presenter_->GetAllPasswords(); UMA_HISTOGRAM_COUNTS("PasswordManager.ExportedPasswordsPerUserInCSV", password_list.size()); diff --git a/chrome/browser/ui/webui/options/password_manager_handler.h b/chrome/browser/ui/webui/options/password_manager_handler.h index aa5525ceef3b96..c2f06514261a3f 100644 --- a/chrome/browser/ui/webui/options/password_manager_handler.h +++ b/chrome/browser/ui/webui/options/password_manager_handler.h @@ -70,7 +70,7 @@ class PasswordManagerHandler : public OptionsPageUIHandler, protected: // This constructor is used for testing only. explicit PasswordManagerHandler( - scoped_ptr presenter); + std::unique_ptr presenter); private: // Clears and then populates the list of passwords and password exceptions. @@ -127,7 +127,7 @@ class PasswordManagerHandler : public OptionsPageUIHandler, // User pref for storing accept languages. std::string languages_; - scoped_ptr password_manager_presenter_; + std::unique_ptr password_manager_presenter_; // File picker to import/export file path. scoped_refptr select_file_dialog_; diff --git a/chrome/browser/ui/webui/options/password_manager_handler_unittest.cc b/chrome/browser/ui/webui/options/password_manager_handler_unittest.cc index 8ba4583e12a0b3..e3bf45990c51ae 100644 --- a/chrome/browser/ui/webui/options/password_manager_handler_unittest.cc +++ b/chrome/browser/ui/webui/options/password_manager_handler_unittest.cc @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/browser/ui/webui/options/password_manager_handler.h" + +#include "base/memory/ptr_util.h" #include "base/metrics/histogram.h" #include "base/metrics/statistics_recorder.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/ui/passwords/password_manager_presenter.h" -#include "chrome/browser/ui/webui/options/password_manager_handler.h" #include "chrome/test/base/testing_profile.h" #include "components/password_manager/core/browser/mock_password_store.h" #include "components/password_manager/core/browser/password_manager_test_utils.h" @@ -98,8 +100,9 @@ void CallbackTestWebUI::ProcessWebUIMessage(const GURL& source_url, class TestPasswordManagerHandler : public options::PasswordManagerHandler { public: - TestPasswordManagerHandler(scoped_ptr presenter, - CallbackTestWebUI* web_ui) + TestPasswordManagerHandler( + std::unique_ptr presenter, + CallbackTestWebUI* web_ui) : PasswordManagerHandler(std::move(presenter)) { set_web_ui(web_ui); } @@ -141,9 +144,9 @@ class DummyPasswordManagerHandler : public PasswordUIView { const std::string&, const base::string16&) override {} void SetPasswordList( - const std::vector>&) override {} + const std::vector>&) override {} void SetPasswordExceptionList( - const std::vector>&) override {} + const std::vector>&) override {} #if !defined(OS_ANDROID) gfx::NativeWindow GetNativeWindow() const override; @@ -176,7 +179,7 @@ class PasswordManagerHandlerTest : public testing::Test { content::WebContentsTester::CreateTestWebContents(&profile_, NULL); web_ui_.set_web_contents(web_contents_); handler_.reset(new TestPasswordManagerHandler( - make_scoped_ptr(presenter_raw_), &web_ui_)); + base::WrapUnique(presenter_raw_), &web_ui_)); handler_->RegisterMessages(); ui::SelectFileDialog::SetFactory(new TestSelectFileDialogFactory); handler_->InitializeHandler(); @@ -197,8 +200,8 @@ class PasswordManagerHandlerTest : public testing::Test { PasswordManagerPresenter* presenter_raw_; CallbackTestWebUI web_ui_; content::WebContents* web_contents_; - scoped_ptr dummy_handler_; - scoped_ptr handler_; + std::unique_ptr dummy_handler_; + std::unique_ptr handler_; private: content::TestBrowserThreadBundle thread_bundle_; diff --git a/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc b/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc index bb6d8e03eb6214..892ff5583d5b7c 100644 --- a/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc +++ b/chrome/browser/ui/webui/settings/settings_manage_profile_handler.cc @@ -94,8 +94,8 @@ void ManageProfileHandler::HandleGetAvailableIcons( ResolveJavascriptCallback(*callback_id, *GetAvailableIcons()); } -scoped_ptr ManageProfileHandler::GetAvailableIcons() { - scoped_ptr image_url_list(new base::ListValue()); +std::unique_ptr ManageProfileHandler::GetAvailableIcons() { + std::unique_ptr image_url_list(new base::ListValue()); // First add the GAIA picture if it is available. ProfileAttributesEntry* entry; diff --git a/chrome/browser/ui/webui/settings/settings_manage_profile_handler.h b/chrome/browser/ui/webui/settings/settings_manage_profile_handler.h index f51b4e2b314c8d..ba4e3d50adb89f 100644 --- a/chrome/browser/ui/webui/settings/settings_manage_profile_handler.h +++ b/chrome/browser/ui/webui/settings/settings_manage_profile_handler.h @@ -5,9 +5,9 @@ #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_MANAGE_PROFILE_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_SETTINGS_SETTINGS_MANAGE_PROFILE_HANDLER_H_ +#include #include -#include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observer.h" #include "chrome/browser/profiles/profile_attributes_storage.h" @@ -44,7 +44,7 @@ class ManageProfileHandler : public settings::SettingsPageUIHandler, void HandleGetAvailableIcons(const base::ListValue* args); // Get all the available profile icons to choose from. - scoped_ptr GetAvailableIcons(); + std::unique_ptr GetAvailableIcons(); // Callback for the "setProfileIconAndName" message. Sets the name and icon // of a given profile. diff --git a/chrome/browser/upgrade_detector_impl.cc b/chrome/browser/upgrade_detector_impl.cc index b7471dcf96def6..cd9668de8fa2ec 100644 --- a/chrome/browser/upgrade_detector_impl.cc +++ b/chrome/browser/upgrade_detector_impl.cc @@ -6,13 +6,13 @@ #include +#include #include #include "base/bind.h" #include "base/build_time.h" #include "base/command_line.h" #include "base/files/file_path.h" -#include "base/memory/scoped_ptr.h" #include "base/memory/singleton.h" #include "base/path_service.h" #include "base/process/launch.h" diff --git a/chrome/browser/usb/usb_chooser_context.cc b/chrome/browser/usb/usb_chooser_context.cc index c55fe7d8b434b4..5a32788db7a7b1 100644 --- a/chrome/browser/usb/usb_chooser_context.cc +++ b/chrome/browser/usb/usb_chooser_context.cc @@ -7,6 +7,7 @@ #include #include +#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/stl_util.h" #include "base/strings/utf_string_conversions.h" @@ -61,10 +62,10 @@ UsbChooserContext::UsbChooserContext(Profile* profile) UsbChooserContext::~UsbChooserContext() {} -std::vector> +std::vector> UsbChooserContext::GetGrantedObjects(const GURL& requesting_origin, const GURL& embedding_origin) { - std::vector> objects = + std::vector> objects = ChooserContextBase::GetGrantedObjects(requesting_origin, embedding_origin); @@ -74,7 +75,8 @@ UsbChooserContext::GetGrantedObjects(const GURL& requesting_origin, for (const std::string& guid : it->second) { scoped_refptr device = usb_service_->GetDevice(guid); DCHECK(device); - scoped_ptr object(new base::DictionaryValue()); + std::unique_ptr object( + new base::DictionaryValue()); object->SetString(kDeviceNameKey, device->product_string()); object->SetString(kGuidKey, device->guid()); objects.push_back(std::move(object)); @@ -84,9 +86,9 @@ UsbChooserContext::GetGrantedObjects(const GURL& requesting_origin, return objects; } -std::vector> +std::vector> UsbChooserContext::GetAllGrantedObjects() { - std::vector> objects = + std::vector> objects = ChooserContextBase::GetAllGrantedObjects(); for (const auto& map_entry : ephemeral_devices_) { @@ -98,7 +100,7 @@ UsbChooserContext::GetAllGrantedObjects() { base::DictionaryValue object; object.SetString(kDeviceNameKey, device->product_string()); object.SetString(kGuidKey, device->guid()); - objects.push_back(make_scoped_ptr(new ChooserContextBase::Object( + objects.push_back(base::WrapUnique(new ChooserContextBase::Object( requesting_origin, embedding_origin, &object, "preference", is_off_the_record_))); } @@ -136,7 +138,8 @@ void UsbChooserContext::GrantDevicePermission(const GURL& requesting_origin, return; if (CanStorePersistentEntry(device)) { - scoped_ptr device_dict(new base::DictionaryValue()); + std::unique_ptr device_dict( + new base::DictionaryValue()); device_dict->SetString(kDeviceNameKey, device->product_string()); device_dict->SetInteger(kVendorIdKey, device->vendor_id()); device_dict->SetInteger(kProductIdKey, device->product_id()); @@ -160,9 +163,10 @@ bool UsbChooserContext::HasDevicePermission( return true; } - std::vector> device_list = + std::vector> device_list = GetGrantedObjects(requesting_origin, embedding_origin); - for (const scoped_ptr& device_dict : device_list) { + for (const std::unique_ptr& device_dict : + device_list) { int vendor_id; int product_id; base::string16 serial_number; diff --git a/chrome/browser/usb/usb_chooser_context.h b/chrome/browser/usb/usb_chooser_context.h index 61147f5e87239f..39d66056c0cda8 100644 --- a/chrome/browser/usb/usb_chooser_context.h +++ b/chrome/browser/usb/usb_chooser_context.h @@ -28,11 +28,11 @@ class UsbChooserContext : public ChooserContextBase, // These methods from ChooserContextBase are overridden in order to expose // ephemeral devices through the public interface. - std::vector> GetGrantedObjects( + std::vector> GetGrantedObjects( const GURL& requesting_origin, const GURL& embedding_origin) override; - std::vector> GetAllGrantedObjects() - override; + std::vector> + GetAllGrantedObjects() override; void RevokeObjectPermission(const GURL& requesting_origin, const GURL& embedding_origin, const base::DictionaryValue& object) override; diff --git a/chrome/browser/usb/usb_chooser_context_unittest.cc b/chrome/browser/usb/usb_chooser_context_unittest.cc index 40b9a32d147a82..1dc9eed6938d47 100644 --- a/chrome/browser/usb/usb_chooser_context_unittest.cc +++ b/chrome/browser/usb/usb_chooser_context_unittest.cc @@ -46,11 +46,11 @@ TEST_F(UsbChooserContextTest, CheckGrantAndRevokePermission) { EXPECT_FALSE(store->HasDevicePermission(origin, origin, device)); store->GrantDevicePermission(origin, origin, device->guid()); EXPECT_TRUE(store->HasDevicePermission(origin, origin, device)); - std::vector> objects = + std::vector> objects = store->GetGrantedObjects(origin, origin); ASSERT_EQ(1u, objects.size()); EXPECT_TRUE(object_dict.Equals(objects[0].get())); - std::vector> all_origin_objects = + std::vector> all_origin_objects = store->GetAllGrantedObjects(); ASSERT_EQ(1u, all_origin_objects.size()); EXPECT_EQ(origin, all_origin_objects[0]->requesting_origin); @@ -83,11 +83,11 @@ TEST_F(UsbChooserContextTest, CheckGrantAndRevokeEphemeralPermission) { store->GrantDevicePermission(origin, origin, device->guid()); EXPECT_TRUE(store->HasDevicePermission(origin, origin, device)); EXPECT_FALSE(store->HasDevicePermission(origin, origin, other_device)); - std::vector> objects = + std::vector> objects = store->GetGrantedObjects(origin, origin); EXPECT_EQ(1u, objects.size()); EXPECT_TRUE(object_dict.Equals(objects[0].get())); - std::vector> all_origin_objects = + std::vector> all_origin_objects = store->GetAllGrantedObjects(); EXPECT_EQ(1u, all_origin_objects.size()); EXPECT_EQ(origin, all_origin_objects[0]->requesting_origin); @@ -113,10 +113,10 @@ TEST_F(UsbChooserContextTest, DisconnectDeviceWithPermission) { EXPECT_FALSE(store->HasDevicePermission(origin, origin, device)); store->GrantDevicePermission(origin, origin, device->guid()); EXPECT_TRUE(store->HasDevicePermission(origin, origin, device)); - std::vector> objects = + std::vector> objects = store->GetGrantedObjects(origin, origin); EXPECT_EQ(1u, objects.size()); - std::vector> all_origin_objects = + std::vector> all_origin_objects = store->GetAllGrantedObjects(); EXPECT_EQ(1u, all_origin_objects.size()); @@ -147,10 +147,10 @@ TEST_F(UsbChooserContextTest, DisconnectDeviceWithEphemeralPermission) { EXPECT_FALSE(store->HasDevicePermission(origin, origin, device)); store->GrantDevicePermission(origin, origin, device->guid()); EXPECT_TRUE(store->HasDevicePermission(origin, origin, device)); - std::vector> objects = + std::vector> objects = store->GetGrantedObjects(origin, origin); EXPECT_EQ(1u, objects.size()); - std::vector> all_origin_objects = + std::vector> all_origin_objects = store->GetAllGrantedObjects(); EXPECT_EQ(1u, all_origin_objects.size()); @@ -195,20 +195,20 @@ TEST_F(UsbChooserContextTest, GrantPermissionInIncognito) { EXPECT_TRUE(incognito_store->HasDevicePermission(origin, origin, device2)); { - std::vector> objects = + std::vector> objects = store->GetGrantedObjects(origin, origin); EXPECT_EQ(1u, objects.size()); - std::vector> all_origin_objects = - store->GetAllGrantedObjects(); + std::vector> + all_origin_objects = store->GetAllGrantedObjects(); ASSERT_EQ(1u, all_origin_objects.size()); EXPECT_FALSE(all_origin_objects[0]->incognito); } { - std::vector> objects = + std::vector> objects = incognito_store->GetGrantedObjects(origin, origin); EXPECT_EQ(1u, objects.size()); - std::vector> all_origin_objects = - incognito_store->GetAllGrantedObjects(); + std::vector> + all_origin_objects = incognito_store->GetAllGrantedObjects(); ASSERT_EQ(1u, all_origin_objects.size()); EXPECT_TRUE(all_origin_objects[0]->incognito); } diff --git a/chrome/browser/usb/usb_tab_helper.cc b/chrome/browser/usb/usb_tab_helper.cc index 7276b6e3f11c0a..538cb19013da2a 100644 --- a/chrome/browser/usb/usb_tab_helper.cc +++ b/chrome/browser/usb/usb_tab_helper.cc @@ -4,9 +4,9 @@ #include "chrome/browser/usb/usb_tab_helper.h" +#include #include -#include "base/memory/scoped_ptr.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/usb/web_usb_permission_provider.h" @@ -24,11 +24,11 @@ using content::WebContents; DEFINE_WEB_CONTENTS_USER_DATA_KEY(UsbTabHelper); struct FrameUsbServices { - scoped_ptr permission_provider; + std::unique_ptr permission_provider; #if defined(OS_ANDROID) - scoped_ptr chooser_service; + std::unique_ptr chooser_service; #else - scoped_ptr chooser_service; + std::unique_ptr chooser_service; #endif // defined(OS_ANDROID) int device_connection_count_ = 0; }; @@ -98,7 +98,8 @@ FrameUsbServices* UsbTabHelper::GetFrameUsbService( FrameUsbServicesMap::const_iterator it = frame_usb_services_.find(render_frame_host); if (it == frame_usb_services_.end()) { - scoped_ptr frame_usb_services(new FrameUsbServices()); + std::unique_ptr frame_usb_services( + new FrameUsbServices()); it = (frame_usb_services_.insert( std::make_pair(render_frame_host, std::move(frame_usb_services)))) .first; diff --git a/chrome/browser/usb/usb_tab_helper.h b/chrome/browser/usb/usb_tab_helper.h index 21ca986a78810e..022a05e56df9f7 100644 --- a/chrome/browser/usb/usb_tab_helper.h +++ b/chrome/browser/usb/usb_tab_helper.h @@ -22,7 +22,7 @@ class PermissionProvider; struct FrameUsbServices; -typedef std::map> +typedef std::map> FrameUsbServicesMap; // Per-tab owner of USB services provided to render frames within that tab. diff --git a/chrome/browser/usb/web_usb_chooser_service.cc b/chrome/browser/usb/web_usb_chooser_service.cc index b035b48119ecfc..1acb7a7e97dbaf 100644 --- a/chrome/browser/usb/web_usb_chooser_service.cc +++ b/chrome/browser/usb/web_usb_chooser_service.cc @@ -33,7 +33,7 @@ void WebUsbChooserService::GetPermission( content::WebContents* web_contents = content::WebContents::FromRenderFrameHost(render_frame_host_); Browser* browser = chrome::FindBrowserWithWebContents(web_contents); - scoped_ptr bubble_controller( + std::unique_ptr bubble_controller( new UsbChooserBubbleController(render_frame_host_, std::move(device_filters), render_frame_host_, callback)); diff --git a/chrome/browser/web_applications/update_shortcut_worker_win.h b/chrome/browser/web_applications/update_shortcut_worker_win.h index 1aae4dda30798d..52857b187c33a3 100644 --- a/chrome/browser/web_applications/update_shortcut_worker_win.h +++ b/chrome/browser/web_applications/update_shortcut_worker_win.h @@ -72,7 +72,7 @@ class UpdateShortcutWorker : public content::NotificationObserver { web_app::IconInfoList unprocessed_icons_; // Cached shortcut data from the web_contents_. - scoped_ptr shortcut_info_; + std::unique_ptr shortcut_info_; // Our copy of profile path. base::FilePath profile_path_; diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc index e6ae0263d65b17..ee28b485c97eaf 100644 --- a/chrome/browser/web_applications/web_app.cc +++ b/chrome/browser/web_applications/web_app.cc @@ -88,7 +88,7 @@ base::FilePath GetShortcutDataDir(const web_app::ShortcutInfo& shortcut_info) { void UpdateAllShortcutsForShortcutInfo( const base::string16& old_app_title, const base::Closure& callback, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info) { base::FilePath shortcut_data_dir = GetShortcutDataDir(*shortcut_info); base::Closure task = base::Bind( @@ -102,7 +102,7 @@ void UpdateAllShortcutsForShortcutInfo( } } -void OnImageLoaded(scoped_ptr shortcut_info, +void OnImageLoaded(std::unique_ptr shortcut_info, extensions::FileHandlersInfo file_handlers_info, web_app::InfoCallback callback, const gfx::ImageFamily& image_family) { @@ -129,7 +129,7 @@ void OnImageLoaded(scoped_ptr shortcut_info, void IgnoreFileHandlersInfo( const web_app::ShortcutInfoCallback& shortcut_info_callback, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info) { shortcut_info_callback.Run(std::move(shortcut_info)); } @@ -137,7 +137,7 @@ void IgnoreFileHandlersInfo( void ScheduleCreatePlatformShortcut( web_app::ShortcutCreationReason reason, const web_app::ShortcutLocations& locations, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info) { base::FilePath shortcut_data_dir = GetShortcutDataDir(*shortcut_info); BrowserThread::PostTask( @@ -184,7 +184,7 @@ ShortcutLocations::ShortcutLocations() } #if defined(TOOLKIT_VIEWS) -scoped_ptr GetShortcutInfoForTab( +std::unique_ptr GetShortcutInfoForTab( content::WebContents* web_contents) { const favicon::FaviconDriver* favicon_driver = favicon::ContentFaviconDriver::FromWebContents(web_contents); @@ -192,7 +192,7 @@ scoped_ptr GetShortcutInfoForTab( extensions::TabHelper::FromWebContents(web_contents); const WebApplicationInfo& app_info = extensions_tab_helper->web_app_info(); - scoped_ptr info(new ShortcutInfo); + std::unique_ptr info(new ShortcutInfo); info->url = app_info.app_url.is_empty() ? web_contents->GetURL() : app_info.app_url; info->title = app_info.title.empty() ? @@ -214,10 +214,10 @@ scoped_ptr GetShortcutInfoForTab( void UpdateShortcutForTabContents(content::WebContents* web_contents) {} #endif -scoped_ptr ShortcutInfoForExtensionAndProfile( +std::unique_ptr ShortcutInfoForExtensionAndProfile( const extensions::Extension* app, Profile* profile) { - scoped_ptr shortcut_info(new ShortcutInfo); + std::unique_ptr shortcut_info(new ShortcutInfo); shortcut_info->extension_id = app->id(); shortcut_info->is_platform_app = app->is_platform_app(); @@ -241,7 +241,7 @@ scoped_ptr ShortcutInfoForExtensionAndProfile( void GetInfoForApp(const extensions::Extension* extension, Profile* profile, const InfoCallback& callback) { - scoped_ptr shortcut_info( + std::unique_ptr shortcut_info( web_app::ShortcutInfoForExtensionAndProfile(extension, profile)); const std::vector* file_handlers = extensions::FileHandlers::GetFileHandlers(extension); @@ -410,7 +410,7 @@ std::string GetExtensionIdFromApplicationName(const std::string& app_name) { void CreateShortcutsWithInfo( ShortcutCreationReason reason, const ShortcutLocations& locations, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -438,7 +438,7 @@ void CreateShortcutsWithInfo( } void CreateNonAppShortcut(const ShortcutLocations& locations, - scoped_ptr shortcut_info) { + std::unique_ptr shortcut_info) { ScheduleCreatePlatformShortcut(SHORTCUT_CREATION_AUTOMATED, locations, std::move(shortcut_info), extensions::FileHandlersInfo()); @@ -460,7 +460,7 @@ void CreateShortcuts(ShortcutCreationReason reason, void DeleteAllShortcuts(Profile* profile, const extensions::Extension* app) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - scoped_ptr shortcut_info( + std::unique_ptr shortcut_info( ShortcutInfoForExtensionAndProfile(app, profile)); base::FilePath shortcut_data_dir = GetShortcutDataDir(*shortcut_info); BrowserThread::PostTask( diff --git a/chrome/browser/web_applications/web_app.h b/chrome/browser/web_applications/web_app.h index 6a4ccb02a57b36..61d099c130995f 100644 --- a/chrome/browser/web_applications/web_app.h +++ b/chrome/browser/web_applications/web_app.h @@ -5,13 +5,13 @@ #ifndef CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ #define CHROME_BROWSER_WEB_APPLICATIONS_WEB_APP_H_ +#include #include #include #include "base/callback.h" #include "base/files/file_path.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "build/build_config.h" #include "chrome/browser/shell_integration.h" @@ -107,15 +107,17 @@ enum ShortcutCreationReason { }; // Called by GetInfoForApp after fetching the ShortcutInfo and FileHandlersInfo. -typedef base::Callback, - const extensions::FileHandlersInfo&)> InfoCallback; +typedef base::Callback, + const extensions::FileHandlersInfo&)> + InfoCallback; // Called by GetShortcutInfoForApp after fetching the ShortcutInfo. -typedef base::Callback)> ShortcutInfoCallback; +typedef base::Callback)> + ShortcutInfoCallback; #if defined(TOOLKIT_VIEWS) // Extracts shortcut info of the given WebContents. -scoped_ptr GetShortcutInfoForTab( +std::unique_ptr GetShortcutInfoForTab( content::WebContents* web_contents); #endif @@ -126,7 +128,7 @@ scoped_ptr GetShortcutInfoForTab( // updates (recreates) them if they exits. void UpdateShortcutForTabContents(content::WebContents* web_contents); -scoped_ptr ShortcutInfoForExtensionAndProfile( +std::unique_ptr ShortcutInfoForExtensionAndProfile( const extensions::Extension* app, Profile* profile); @@ -182,13 +184,13 @@ std::string GetExtensionIdFromApplicationName(const std::string& app_name); void CreateShortcutsWithInfo( ShortcutCreationReason reason, const ShortcutLocations& locations, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info); // Currently only called by app_list_service_mac to create a shim for the // app launcher. void CreateNonAppShortcut(const ShortcutLocations& locations, - scoped_ptr shortcut_info); + std::unique_ptr shortcut_info); // Creates shortcuts for an app. This loads the app's icon from disk, and calls // CreateShortcutsWithInfo(). If you already have a ShortcutInfo with the app's @@ -251,7 +253,7 @@ std::vector GetShortcutPaths( // |creation_locations| contains information about where to create them. bool CreatePlatformShortcuts( const base::FilePath& shortcut_data_path, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info, const ShortcutLocations& creation_locations, ShortcutCreationReason creation_reason); @@ -260,7 +262,7 @@ bool CreatePlatformShortcuts( // platform specific implementation of the DeleteAllShortcuts function, and // is executed on the FILE thread. void DeletePlatformShortcuts(const base::FilePath& shortcut_data_path, - scoped_ptr shortcut_info); + std::unique_ptr shortcut_info); // Updates all the shortcuts we have added for this extension. This is the // platform specific implementation of the UpdateAllShortcuts function, and @@ -268,7 +270,7 @@ void DeletePlatformShortcuts(const base::FilePath& shortcut_data_path, void UpdatePlatformShortcuts( const base::FilePath& shortcut_data_path, const base::string16& old_app_title, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info); // Delete all the shortcuts for an entire profile. diff --git a/chrome/browser/web_applications/web_app_chromeos.cc b/chrome/browser/web_applications/web_app_chromeos.cc index e86b9eb5999b8c..4c660f4057f0c0 100644 --- a/chrome/browser/web_applications/web_app_chromeos.cc +++ b/chrome/browser/web_applications/web_app_chromeos.cc @@ -15,7 +15,7 @@ namespace internals { bool CreatePlatformShortcuts( const base::FilePath& web_app_path, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info, const ShortcutLocations& creation_locations, ShortcutCreationReason creation_reason) { @@ -23,12 +23,12 @@ bool CreatePlatformShortcuts( } void DeletePlatformShortcuts(const base::FilePath& web_app_path, - scoped_ptr shortcut_info) {} + std::unique_ptr shortcut_info) {} void UpdatePlatformShortcuts( const base::FilePath& web_app_path, const base::string16& old_app_title, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info) {} void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) {} diff --git a/chrome/browser/web_applications/web_app_linux.cc b/chrome/browser/web_applications/web_app_linux.cc index 2a6e81363e39d0..f1b1b5ecf1afea 100644 --- a/chrome/browser/web_applications/web_app_linux.cc +++ b/chrome/browser/web_applications/web_app_linux.cc @@ -23,7 +23,7 @@ namespace internals { bool CreatePlatformShortcuts( const base::FilePath& web_app_path, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info, const ShortcutLocations& creation_locations, ShortcutCreationReason /*creation_reason*/) { @@ -37,7 +37,7 @@ bool CreatePlatformShortcuts( } void DeletePlatformShortcuts(const base::FilePath& web_app_path, - scoped_ptr shortcut_info) { + std::unique_ptr shortcut_info) { #if !defined(OS_CHROMEOS) shell_integration_linux::DeleteDesktopShortcuts(shortcut_info->profile_path, shortcut_info->extension_id); @@ -47,11 +47,11 @@ void DeletePlatformShortcuts(const base::FilePath& web_app_path, void UpdatePlatformShortcuts( const base::FilePath& web_app_path, const base::string16& /*old_app_title*/, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info) { DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); // Find out whether shortcuts are already installed. ShortcutLocations creation_locations = diff --git a/chrome/browser/web_applications/web_app_mac.h b/chrome/browser/web_applications/web_app_mac.h index 3e5a1a97f9ff76..791ab22c787020 100644 --- a/chrome/browser/web_applications/web_app_mac.h +++ b/chrome/browser/web_applications/web_app_mac.h @@ -7,13 +7,13 @@ #include +#include #include #include #include "base/files/file_path.h" #include "base/gtest_prod_util.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "chrome/browser/web_applications/web_app.h" #include "extensions/common/manifest_handlers/file_handler_info.h" @@ -33,7 +33,7 @@ namespace web_app { base::FilePath GetAppInstallPath(const ShortcutInfo& shortcut_info); // If necessary, launch the shortcut for an app. -void MaybeLaunchShortcut(scoped_ptr shortcut_info); +void MaybeLaunchShortcut(std::unique_ptr shortcut_info); // Rebuild the shortcut and relaunch it. bool MaybeRebuildShortcut(const base::CommandLine& command_line); diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index 48b5a5d85096be..71f7d2ae0d2719 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -255,8 +255,9 @@ bool HasSameUserDataDir(const base::FilePath& bundle_path) { user_data_dir.value(), base::CompareCase::SENSITIVE); } -void LaunchShimOnFileThread(scoped_ptr shortcut_info, - bool launched_after_rebuild) { +void LaunchShimOnFileThread( + std::unique_ptr shortcut_info, + bool launched_after_rebuild) { DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); base::FilePath shim_path = web_app::GetAppInstallPath(*shortcut_info); @@ -306,7 +307,7 @@ void UpdatePlatformShortcutsInternal( } void UpdateAndLaunchShimOnFileThread( - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info) { base::FilePath shortcut_data_dir = web_app::GetWebAppDataDirectory( shortcut_info->profile_path, shortcut_info->extension_id, GURL()); @@ -316,7 +317,7 @@ void UpdateAndLaunchShimOnFileThread( } void UpdateAndLaunchShim( - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info) { content::BrowserThread::PostTask( content::BrowserThread::FILE, FROM_HERE, @@ -324,7 +325,7 @@ void UpdateAndLaunchShim( file_handlers_info)); } -void RebuildAppAndLaunch(scoped_ptr shortcut_info) { +void RebuildAppAndLaunch(std::unique_ptr shortcut_info) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (shortcut_info->extension_id == app_mode::kAppListModeId) { AppListService* app_list_service = AppListService::Get(); @@ -520,11 +521,12 @@ bool IsShimForProfile(const base::FilePath& base_name, return bundle_paths; } -scoped_ptr BuildShortcutInfoFromBundle( +std::unique_ptr BuildShortcutInfoFromBundle( const base::FilePath& bundle_path) { NSDictionary* plist = ReadPlist(GetPlistPath(bundle_path)); - scoped_ptr shortcut_info(new web_app::ShortcutInfo); + std::unique_ptr shortcut_info( + new web_app::ShortcutInfo); shortcut_info->extension_id = base::SysNSStringToUTF8( [plist valueForKey:app_mode::kCrAppModeShortcutIDKey]); shortcut_info->is_platform_app = true; @@ -549,7 +551,7 @@ bool IsShimForProfile(const base::FilePath& base_name, return shortcut_info; } -scoped_ptr RecordAppShimErrorAndBuildShortcutInfo( +std::unique_ptr RecordAppShimErrorAndBuildShortcutInfo( const base::FilePath& bundle_path) { NSDictionary* plist = ReadPlist(GetPlistPath(bundle_path)); NSString* version_string = [plist valueForKey:app_mode::kCrBundleVersionKey]; @@ -611,7 +613,7 @@ void UpdateFileTypes(NSMutableDictionary* plist, } void RevealAppShimInFinderForAppOnFileThread( - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const base::FilePath& app_path) { web_app::WebAppShortcutCreator shortcut_creator( app_path, shortcut_info.get(), extensions::FileHandlersInfo()); @@ -1119,7 +1121,7 @@ WebAppShortcutCreator shortcut_creator(base::FilePath(), &shortcut_info, return shortcut_creator.GetApplicationsShortcutPath(); } -void MaybeLaunchShortcut(scoped_ptr shortcut_info) { +void MaybeLaunchShortcut(std::unique_ptr shortcut_info) { if (AppShimsDisabledForTest() && !g_app_shims_allow_update_and_launch_in_tests) { return; @@ -1149,7 +1151,7 @@ void CreateAppShortcutInfoLoaded( Profile* profile, const extensions::Extension* app, const base::Callback& close_callback, - scoped_ptr shortcut_info) { + std::unique_ptr shortcut_info) { base::scoped_nsobject alert([[NSAlert alloc] init]); NSButton* continue_button = [alert @@ -1217,7 +1219,7 @@ void UpdateShortcutsForAllApps(Profile* profile, scoped_refptr latch = new Latch(callback); // Update all apps. - scoped_ptr candidates = + std::unique_ptr candidates = registry->GenerateInstalledExtensionsSet(); for (auto& extension_refptr : *candidates) { const extensions::Extension* extension = extension_refptr.get(); @@ -1230,7 +1232,7 @@ void UpdateShortcutsForAllApps(Profile* profile, void RevealAppShimInFinderForApp(Profile* profile, const extensions::Extension* app) { - scoped_ptr shortcut_info = + std::unique_ptr shortcut_info = ShortcutInfoForExtensionAndProfile(app, profile); content::BrowserThread::PostTask( content::BrowserThread::FILE, FROM_HERE, @@ -1242,7 +1244,7 @@ void RevealAppShimInFinderForApp(Profile* profile, bool CreatePlatformShortcuts( const base::FilePath& app_data_path, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info, const ShortcutLocations& creation_locations, ShortcutCreationReason creation_reason) { @@ -1256,7 +1258,7 @@ WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info.get(), } void DeletePlatformShortcuts(const base::FilePath& app_data_path, - scoped_ptr shortcut_info) { + std::unique_ptr shortcut_info) { DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info.get(), extensions::FileHandlersInfo()); @@ -1266,7 +1268,7 @@ WebAppShortcutCreator shortcut_creator(app_data_path, shortcut_info.get(), void UpdatePlatformShortcuts( const base::FilePath& app_data_path, const base::string16& old_app_title, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info) { UpdatePlatformShortcutsInternal(app_data_path, old_app_title, *shortcut_info, file_handlers_info); @@ -1279,7 +1281,7 @@ void DeleteAllShortcutsForProfile(const base::FilePath& profile_path) { for (std::vector::const_iterator it = bundles.begin(); it != bundles.end(); ++it) { - scoped_ptr shortcut_info = + std::unique_ptr shortcut_info = BuildShortcutInfoFromBundle(*it); WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info.get(), extensions::FileHandlersInfo()); diff --git a/chrome/browser/web_applications/web_app_mac_unittest.mm b/chrome/browser/web_applications/web_app_mac_unittest.mm index 7a8815dcb8bdd1..0be32b80f8a2d5 100644 --- a/chrome/browser/web_applications/web_app_mac_unittest.mm +++ b/chrome/browser/web_applications/web_app_mac_unittest.mm @@ -9,13 +9,14 @@ #include #include +#include + #include "base/command_line.h" #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/mac/foundation_util.h" #include "base/mac/scoped_nsobject.h" #include "base/macros.h" -#include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" @@ -63,8 +64,8 @@ DISALLOW_COPY_AND_ASSIGN(WebAppShortcutCreatorMock); }; -scoped_ptr GetShortcutInfo() { - scoped_ptr info(new web_app::ShortcutInfo); +std::unique_ptr GetShortcutInfo() { + std::unique_ptr info(new web_app::ShortcutInfo); info->extension_id = "extensionid"; info->extension_path = base::FilePath("/fake/extension/path"); info->title = base::ASCIIToUTF16("Shortcut Title"); @@ -100,7 +101,7 @@ void SetUp() override { base::FilePath app_data_dir_; base::FilePath destination_dir_; - scoped_ptr info_; + std::unique_ptr info_; base::FilePath shim_base_name_; base::FilePath internal_shim_path_; base::FilePath shim_path_; diff --git a/chrome/browser/web_applications/web_app_unittest.cc b/chrome/browser/web_applications/web_app_unittest.cc index 2cf437ba0069a6..d88ed6b4778c36 100644 --- a/chrome/browser/web_applications/web_app_unittest.cc +++ b/chrome/browser/web_applications/web_app_unittest.cc @@ -4,8 +4,9 @@ #include "chrome/browser/web_applications/web_app.h" +#include + #include "base/files/file_path.h" -#include "base/memory/scoped_ptr.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/web_applications/web_app.h" @@ -46,7 +47,7 @@ TEST_F(WebApplicationTest, GetShortcutInfoForTab) { ->InitializeRenderFrameIfNeeded(); RenderViewHostTester::TestOnMessageReceived( rvh(), ChromeViewHostMsg_DidGetWebApplicationInfo(0, web_app_info)); - scoped_ptr info = + std::unique_ptr info = web_app::GetShortcutInfoForTab(web_contents()); EXPECT_EQ(title, info->title); diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index bd267ef818d9c1..cee81b33dc3deb 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -7,13 +7,14 @@ #include #include +#include + #include "base/command_line.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" #include "base/logging.h" #include "base/macros.h" #include "base/md5.h" -#include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/strings/string16.h" #include "base/strings/string_piece.h" @@ -337,7 +338,7 @@ void GetShortcutLocationsAndDeleteShortcuts( void CreateIconAndSetRelaunchDetails( const base::FilePath& web_app_path, const base::FilePath& icon_file, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, HWND hwnd) { DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); @@ -364,7 +365,7 @@ void CreateIconAndSetRelaunchDetails( void OnShortcutInfoLoadedForSetRelaunchDetails( HWND hwnd, - scoped_ptr shortcut_info) { + std::unique_ptr shortcut_info) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); // Set window's icon to the one we're about to create/update in the web app @@ -385,7 +386,7 @@ namespace web_app { base::FilePath CreateShortcutInWebAppDir( const base::FilePath& web_app_dir, - scoped_ptr shortcut_info) { + std::unique_ptr shortcut_info) { std::vector paths; paths.push_back(web_app_dir); std::vector out_filenames; @@ -442,7 +443,7 @@ bool CheckAndSaveIcon(const base::FilePath& icon_file, bool CreatePlatformShortcuts( const base::FilePath& web_app_path, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info, const ShortcutLocations& creation_locations, ShortcutCreationReason creation_reason) { @@ -489,7 +490,7 @@ bool CreatePlatformShortcuts( void UpdatePlatformShortcuts( const base::FilePath& web_app_path, const base::string16& old_app_title, - scoped_ptr shortcut_info, + std::unique_ptr shortcut_info, const extensions::FileHandlersInfo& file_handlers_info) { DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); @@ -528,7 +529,7 @@ void UpdatePlatformShortcuts( } void DeletePlatformShortcuts(const base::FilePath& web_app_path, - scoped_ptr shortcut_info) { + std::unique_ptr shortcut_info) { GetShortcutLocationsAndDeleteShortcuts(web_app_path, shortcut_info->profile_path, shortcut_info->title, NULL, NULL); diff --git a/chrome/browser/web_applications/web_app_win.h b/chrome/browser/web_applications/web_app_win.h index 08bb7047310b4b..414d058642de62 100644 --- a/chrome/browser/web_applications/web_app_win.h +++ b/chrome/browser/web_applications/web_app_win.h @@ -28,7 +28,7 @@ namespace web_app { // created shortcut. base::FilePath CreateShortcutInWebAppDir( const base::FilePath& web_app_path, - scoped_ptr shortcut_info); + std::unique_ptr shortcut_info); // Update the relaunch details for the given app's window, making the taskbar // group's "Pin to the taskbar" button function correctly.