diff --git a/atom/app/atom_main_delegate.cc b/atom/app/atom_main_delegate.cc index 655ccce2e35b..82337dc5f6a6 100644 --- a/atom/app/atom_main_delegate.cc +++ b/atom/app/atom_main_delegate.cc @@ -61,7 +61,7 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { #endif // !defined(OS_WIN) // Only enable logging when --enable-logging is specified. - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); if (!command_line->HasSwitch(switches::kEnableLogging) && !env->HasVar("ELECTRON_ENABLE_LOGGING")) { settings.logging_dest = logging::LOG_NONE; @@ -94,7 +94,7 @@ void AtomMainDelegate::PreSandboxStartup() { brightray::MainDelegate::PreSandboxStartup(); // Set google API key. - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); if (!env->HasVar("GOOGLE_API_KEY")) env->SetVar("GOOGLE_API_KEY", GOOGLEAPIS_API_KEY); @@ -134,8 +134,8 @@ content::ContentUtilityClient* AtomMainDelegate::CreateContentUtilityClient() { return utility_client_.get(); } -scoped_ptr AtomMainDelegate::CreateContentClient() { - return scoped_ptr(new AtomContentClient); +std::unique_ptr AtomMainDelegate::CreateContentClient() { + return std::unique_ptr(new AtomContentClient); } } // namespace atom diff --git a/atom/app/atom_main_delegate.h b/atom/app/atom_main_delegate.h index 8f2976a9cd1b..2f9474cff563 100644 --- a/atom/app/atom_main_delegate.h +++ b/atom/app/atom_main_delegate.h @@ -24,7 +24,7 @@ class AtomMainDelegate : public brightray::MainDelegate { content::ContentUtilityClient* CreateContentUtilityClient() override; // brightray::MainDelegate: - scoped_ptr CreateContentClient() override; + std::unique_ptr CreateContentClient() override; #if defined(OS_MACOSX) void OverrideChildProcessPath() override; void OverrideFrameworkBundlePath() override; @@ -36,9 +36,9 @@ class AtomMainDelegate : public brightray::MainDelegate { #endif brightray::ContentClient content_client_; - scoped_ptr browser_client_; - scoped_ptr renderer_client_; - scoped_ptr utility_client_; + std::unique_ptr browser_client_; + std::unique_ptr renderer_client_; + std::unique_ptr utility_client_; DISALLOW_COPY_AND_ASSIGN(AtomMainDelegate); }; diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index d74dd671e903..b4c0fb6f217e 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -319,7 +319,7 @@ void App::AllowCertificateError( void App::SelectClientCertificate( content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, - scoped_ptr delegate) { + std::unique_ptr delegate) { std::shared_ptr shared_delegate(delegate.release()); bool prevent_default = @@ -370,7 +370,7 @@ void App::SetPath(mate::Arguments* args, void App::SetDesktopName(const std::string& desktop_name) { #if defined(OS_LINUX) - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); env->SetVar("CHROME_DESKTOP", desktop_name); #endif } @@ -413,7 +413,7 @@ void App::ImportCertificate( const net::CompletionCallback& callback) { auto browser_context = AtomBrowserMainParts::Get()->browser_context(); if (!certificate_manager_model_) { - scoped_ptr copy = options.CreateDeepCopy(); + std::unique_ptr copy = options.CreateDeepCopy(); CertificateManagerModel::Create(browser_context, base::Bind(&App::OnCertificateManagerModelCreated, base::Unretained(this), @@ -427,9 +427,9 @@ void App::ImportCertificate( } void App::OnCertificateManagerModelCreated( - scoped_ptr options, + std::unique_ptr options, const net::CompletionCallback& callback, - scoped_ptr model) { + std::unique_ptr model) { certificate_manager_model_ = std::move(model); int rv = ImportIntoCertStore(certificate_manager_model_.get(), *(options.get())); diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index edfd09c4d289..1c6406c54ba4 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -51,9 +51,9 @@ class App : public AtomBrowserClient::Delegate, #if defined(USE_NSS_CERTS) void OnCertificateManagerModelCreated( - scoped_ptr options, + std::unique_ptr options, const net::CompletionCallback& callback, - scoped_ptr model); + std::unique_ptr model); #endif protected: @@ -93,7 +93,7 @@ class App : public AtomBrowserClient::Delegate, void SelectClientCertificate( content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, - scoped_ptr delegate) override; + std::unique_ptr delegate) override; // content::GpuDataManagerObserver: void OnGpuProcessCrashed(base::TerminationStatus exit_code) override; @@ -116,10 +116,10 @@ class App : public AtomBrowserClient::Delegate, const net::CompletionCallback& callback); #endif - scoped_ptr process_singleton_; + std::unique_ptr process_singleton_; #if defined(USE_NSS_CERTS) - scoped_ptr certificate_manager_model_; + std::unique_ptr certificate_manager_model_; #endif DISALLOW_COPY_AND_ASSIGN(App); diff --git a/atom/browser/api/atom_api_cookies.cc b/atom/browser/api/atom_api_cookies.cc index 22c57c97d6cf..6ee15a6cba90 100644 --- a/atom/browser/api/atom_api_cookies.cc +++ b/atom/browser/api/atom_api_cookies.cc @@ -112,7 +112,7 @@ void RunCallbackInUI(const base::Closure& callback) { } // Remove cookies from |list| not matching |filter|, and pass it to |callback|. -void FilterCookies(scoped_ptr filter, +void FilterCookies(std::unique_ptr filter, const Cookies::GetCallback& callback, const net::CookieList& list) { net::CookieList result; @@ -125,7 +125,7 @@ void FilterCookies(scoped_ptr filter, // Receives cookies matching |filter| in IO thread. void GetCookiesOnIO(scoped_refptr getter, - scoped_ptr filter, + std::unique_ptr filter, const Cookies::GetCallback& callback) { std::string url; filter->GetString("url", &url); @@ -157,7 +157,7 @@ void OnSetCookie(const Cookies::SetCallback& callback, bool success) { // Sets cookie with |details| in IO thread. void SetCookieOnIO(scoped_refptr getter, - scoped_ptr details, + std::unique_ptr details, const Cookies::SetCallback& callback) { std::string url, name, value, domain, path; bool secure = false; @@ -197,8 +197,8 @@ void SetCookieOnIO(scoped_refptr getter, GetCookieStore(getter)->SetCookieWithDetailsAsync( GURL(url), name, value, domain, path, creation_time, expiration_time, last_access_time, secure, http_only, - false, false, net::COOKIE_PRIORITY_DEFAULT, - base::Bind(OnSetCookie, callback)); + net::CookieSameSite::DEFAULT_MODE, false, + net::COOKIE_PRIORITY_DEFAULT, base::Bind(OnSetCookie, callback)); } } // namespace @@ -214,7 +214,7 @@ Cookies::~Cookies() { void Cookies::Get(const base::DictionaryValue& filter, const GetCallback& callback) { - scoped_ptr copied(filter.CreateDeepCopy()); + std::unique_ptr copied(filter.CreateDeepCopy()); auto getter = make_scoped_refptr(request_context_getter_); content::BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, @@ -231,7 +231,7 @@ void Cookies::Remove(const GURL& url, const std::string& name, void Cookies::Set(const base::DictionaryValue& details, const SetCallback& callback) { - scoped_ptr copied(details.CreateDeepCopy()); + std::unique_ptr copied(details.CreateDeepCopy()); auto getter = make_scoped_refptr(request_context_getter_); content::BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, diff --git a/atom/browser/api/atom_api_debugger.cc b/atom/browser/api/atom_api_debugger.cc index 03490360133a..48b7a6f70c0b 100644 --- a/atom/browser/api/atom_api_debugger.cc +++ b/atom/browser/api/atom_api_debugger.cc @@ -52,7 +52,7 @@ void Debugger::DispatchProtocolMessage(DevToolsAgentHost* agent_host, const std::string& message) { DCHECK(agent_host == agent_host_.get()); - scoped_ptr parsed_message(base::JSONReader::Read(message)); + std::unique_ptr parsed_message(base::JSONReader::Read(message)); if (!parsed_message->IsType(base::Value::TYPE_DICTIONARY)) return; diff --git a/atom/browser/api/atom_api_desktop_capturer.cc b/atom/browser/api/atom_api_desktop_capturer.cc index 9200a89224c2..3cb29a9124d3 100644 --- a/atom/browser/api/atom_api_desktop_capturer.cc +++ b/atom/browser/api/atom_api_desktop_capturer.cc @@ -61,9 +61,9 @@ void DesktopCapturer::StartHandling(bool capture_window, options.set_disable_effects(false); #endif - scoped_ptr screen_capturer( + std::unique_ptr screen_capturer( capture_screen ? webrtc::ScreenCapturer::Create(options) : nullptr); - scoped_ptr window_capturer( + std::unique_ptr window_capturer( capture_window ? webrtc::WindowCapturer::Create(options) : nullptr); media_list_.reset(new NativeDesktopMediaList( std::move(screen_capturer), std::move(window_capturer))); diff --git a/atom/browser/api/atom_api_desktop_capturer.h b/atom/browser/api/atom_api_desktop_capturer.h index e71141fa5218..4d1755e06827 100644 --- a/atom/browser/api/atom_api_desktop_capturer.h +++ b/atom/browser/api/atom_api_desktop_capturer.h @@ -39,7 +39,7 @@ class DesktopCapturer: public mate::EventEmitter, bool OnRefreshFinished() override; private: - scoped_ptr media_list_; + std::unique_ptr media_list_; DISALLOW_COPY_AND_ASSIGN(DesktopCapturer); }; diff --git a/atom/browser/api/atom_api_menu.h b/atom/browser/api/atom_api_menu.h index 5701985ab101..9ba4d7a754c4 100644 --- a/atom/browser/api/atom_api_menu.h +++ b/atom/browser/api/atom_api_menu.h @@ -55,7 +55,7 @@ class Menu : public mate::TrackableObject, int x = -1, int y = -1, int positioning_item = 0) = 0; - scoped_ptr model_; + std::unique_ptr model_; Menu* parent_; private: diff --git a/atom/browser/api/atom_api_power_save_blocker.cc b/atom/browser/api/atom_api_power_save_blocker.cc index b8adcb776e56..67c9b6dd83c2 100644 --- a/atom/browser/api/atom_api_power_save_blocker.cc +++ b/atom/browser/api/atom_api_power_save_blocker.cc @@ -70,7 +70,7 @@ void PowerSaveBlocker::UpdatePowerSaveBlocker() { } if (!power_save_blocker_ || new_blocker_type != current_blocker_type_) { - scoped_ptr new_blocker = + std::unique_ptr new_blocker = content::PowerSaveBlocker::Create( new_blocker_type, content::PowerSaveBlocker::kReasonOther, diff --git a/atom/browser/api/atom_api_power_save_blocker.h b/atom/browser/api/atom_api_power_save_blocker.h index c24ae0aa4b66..a20b493e75bf 100644 --- a/atom/browser/api/atom_api_power_save_blocker.h +++ b/atom/browser/api/atom_api_power_save_blocker.h @@ -37,7 +37,7 @@ class PowerSaveBlocker : public mate::TrackableObject { bool Stop(int id); bool IsStarted(int id); - scoped_ptr power_save_blocker_; + std::unique_ptr power_save_blocker_; // Currnet blocker type used by |power_save_blocker_| content::PowerSaveBlocker::PowerSaveBlockerType current_blocker_type_; diff --git a/atom/browser/api/atom_api_protocol.h b/atom/browser/api/atom_api_protocol.h index 19fca9ac81bd..d33e63fa9cff 100644 --- a/atom/browser/api/atom_api_protocol.h +++ b/atom/browser/api/atom_api_protocol.h @@ -110,7 +110,7 @@ class Protocol : public mate::Wrappable { const Handler& handler) { if (job_factory_->IsHandledProtocol(scheme)) return PROTOCOL_REGISTERED; - scoped_ptr> protocol_handler( + std::unique_ptr> protocol_handler( new CustomProtocolHandler( isolate(), request_context_getter_, handler)); if (job_factory_->SetProtocolHandler(scheme, std::move(protocol_handler))) @@ -152,7 +152,7 @@ class Protocol : public mate::Wrappable { return PROTOCOL_FAIL; if (ContainsKey(original_protocols_, scheme)) return PROTOCOL_INTERCEPTED; - scoped_ptr> protocol_handler( + std::unique_ptr> protocol_handler( new CustomProtocolHandler( isolate(), request_context_getter_, handler)); original_protocols_.set( @@ -176,7 +176,7 @@ class Protocol : public mate::Wrappable { // Map that stores the original protocols of schemes. using OriginalProtocolsMap = base::ScopedPtrHashMap< std::string, - scoped_ptr>; + std::unique_ptr>; OriginalProtocolsMap original_protocols_; AtomURLRequestJobFactory* job_factory_; // weak ref diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index 58fd358ca971..2e6ff448ce9b 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -369,7 +369,7 @@ void Session::SetDownloadPath(const base::FilePath& path) { } void Session::EnableNetworkEmulation(const mate::Dictionary& options) { - scoped_ptr conditions; + std::unique_ptr conditions; bool offline = false; double latency, download_throughput, upload_throughput; if (options.Get("offline", &offline) && offline) { @@ -392,7 +392,7 @@ void Session::EnableNetworkEmulation(const mate::Dictionary& options) { } void Session::DisableNetworkEmulation() { - scoped_ptr conditions; + std::unique_ptr conditions; browser_context_->network_controller_handle()->SetNetworkState( devtools_network_emulation_client_id_, std::move(conditions)); browser_context_->network_delegate()->SetDevToolsNetworkEmulationClientId( diff --git a/atom/browser/api/atom_api_system_preferences_mac.mm b/atom/browser/api/atom_api_system_preferences_mac.mm index 1bc65a14f94b..f0b48adf2564 100644 --- a/atom/browser/api/atom_api_system_preferences_mac.mm +++ b/atom/browser/api/atom_api_system_preferences_mac.mm @@ -36,7 +36,7 @@ int SystemPreferences::SubscribeNotification( object:nil queue:nil usingBlock:^(NSNotification* notification) { - scoped_ptr user_info = + std::unique_ptr user_info = NSDictionaryToDictionaryValue(notification.userInfo); if (user_info) { copied_callback.Run( diff --git a/atom/browser/api/atom_api_tray.h b/atom/browser/api/atom_api_tray.h index 3c3d02e9ca40..a6c329567ca3 100644 --- a/atom/browser/api/atom_api_tray.h +++ b/atom/browser/api/atom_api_tray.h @@ -70,7 +70,7 @@ class Tray : public mate::TrackableObject, v8::Local ModifiersToObject(v8::Isolate* isolate, int modifiers); v8::Global menu_; - scoped_ptr tray_icon_; + std::unique_ptr tray_icon_; DISALLOW_COPY_AND_ASSIGN(Tray); }; diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index eac378b2a77f..2298a7b5ec18 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -155,7 +155,7 @@ struct Converter { if (response_headers.GetList(key, &values)) values->AppendString(value); } else { - scoped_ptr values(new base::ListValue()); + std::unique_ptr values(new base::ListValue()); values->AppendString(value); response_headers.Set(key, std::move(values)); } @@ -1125,7 +1125,7 @@ void WebContents::BeginFrameSubscription( const FrameSubscriber::FrameCaptureCallback& callback) { const auto view = web_contents()->GetRenderWidgetHostView(); if (view) { - scoped_ptr frame_subscriber(new FrameSubscriber( + std::unique_ptr frame_subscriber(new FrameSubscriber( isolate(), view, callback)); view->BeginFrameSubscription(std::move(frame_subscriber)); } diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 81d97dfdde6c..f3661bedd253 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -289,7 +289,7 @@ class WebContents : public mate::TrackableObject, v8::Global devtools_web_contents_; v8::Global debugger_; - scoped_ptr guest_delegate_; + std::unique_ptr guest_delegate_; // The host webcontents that may contain this webcontents. WebContents* embedder_; diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index f174cdba88c6..e698eaaf78cc 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -193,7 +193,7 @@ class Window : public mate::TrackableObject, api::WebContents* api_web_contents_; - scoped_ptr window_; + std::unique_ptr window_; DISALLOW_COPY_AND_ASSIGN(Window); }; diff --git a/atom/browser/api/trackable_object.h b/atom/browser/api/trackable_object.h index 2786261d8860..a5ed593a6ba6 100644 --- a/atom/browser/api/trackable_object.h +++ b/atom/browser/api/trackable_object.h @@ -123,7 +123,7 @@ class TrackableObject : public TrackableObjectBase, private: static int32_t next_id_; - static scoped_ptr> weak_map_; + static std::unique_ptr> weak_map_; DISALLOW_COPY_AND_ASSIGN(TrackableObject); }; @@ -132,7 +132,7 @@ template int32_t TrackableObject::next_id_ = 0; template -scoped_ptr> TrackableObject::weak_map_; +std::unique_ptr> TrackableObject::weak_map_; } // namespace mate diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 8ecd37a6bca4..5fab9c60d1e9 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -208,7 +208,7 @@ void AtomBrowserClient::AllowCertificateError( void AtomBrowserClient::SelectClientCertificate( content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, - scoped_ptr delegate) { + std::unique_ptr delegate) { if (!cert_request_info->client_certs.empty() && delegate_) { delegate_->SelectClientCertificate( web_contents, cert_request_info, std::move(delegate)); diff --git a/atom/browser/atom_browser_client.h b/atom/browser/atom_browser_client.h index ef5fd5a43300..5588f0435afa 100644 --- a/atom/browser/atom_browser_client.h +++ b/atom/browser/atom_browser_client.h @@ -73,7 +73,7 @@ class AtomBrowserClient : public brightray::BrowserClient, void SelectClientCertificate( content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, - scoped_ptr delegate) override; + std::unique_ptr delegate) override; void ResourceDispatcherHostCreated() override; bool CanCreateWindow(const GURL& opener_url, const GURL& opener_top_level_frame_url, @@ -106,7 +106,7 @@ class AtomBrowserClient : public brightray::BrowserClient, // pending_render_process => current_render_process. std::map pending_processes_; - scoped_ptr + std::unique_ptr resource_dispatcher_host_delegate_; Delegate* delegate_; diff --git a/atom/browser/atom_browser_context.cc b/atom/browser/atom_browser_context.cc index 04d5134a49e9..63da86f441f1 100644 --- a/atom/browser/atom_browser_context.cc +++ b/atom/browser/atom_browser_context.cc @@ -46,7 +46,7 @@ namespace { class NoCacheBackend : public net::HttpCache::BackendFactory { int CreateBackend(net::NetLog* net_log, - scoped_ptr* backend, + std::unique_ptr* backend, const net::CompletionCallback& callback) override { return net::ERR_FAILED; } @@ -95,11 +95,11 @@ std::string AtomBrowserContext::GetUserAgent() { return content::BuildUserAgentFromProduct(user_agent); } -scoped_ptr +std::unique_ptr AtomBrowserContext::CreateURLRequestJobFactory( content::ProtocolHandlerMap* handlers, content::URLRequestInterceptorScopedVector* interceptors) { - scoped_ptr job_factory(job_factory_); + std::unique_ptr job_factory(job_factory_); for (auto& it : *handlers) { job_factory->SetProtocolHandler(it.first, @@ -134,7 +134,7 @@ AtomBrowserContext::CreateURLRequestJobFactory( new net::FtpNetworkLayer(host_resolver)))); // Set up interceptors in the reverse order. - scoped_ptr top_job_factory = + std::unique_ptr top_job_factory = std::move(job_factory); content::URLRequestInterceptorScopedVector::reverse_iterator it; for (it = interceptors->rbegin(); it != interceptors->rend(); ++it) @@ -177,7 +177,7 @@ content::PermissionManager* AtomBrowserContext::GetPermissionManager() { return permission_manager_.get(); } -scoped_ptr AtomBrowserContext::CreateCertVerifier() { +std::unique_ptr AtomBrowserContext::CreateCertVerifier() { return make_scoped_ptr(cert_verifier_); } diff --git a/atom/browser/atom_browser_context.h b/atom/browser/atom_browser_context.h index d959adbc753a..b208ca97cc1b 100644 --- a/atom/browser/atom_browser_context.h +++ b/atom/browser/atom_browser_context.h @@ -26,12 +26,12 @@ class AtomBrowserContext : public brightray::BrowserContext { // brightray::URLRequestContextGetter::Delegate: net::NetworkDelegate* CreateNetworkDelegate() override; std::string GetUserAgent() override; - scoped_ptr CreateURLRequestJobFactory( + std::unique_ptr CreateURLRequestJobFactory( content::ProtocolHandlerMap* handlers, content::URLRequestInterceptorScopedVector* interceptors) override; net::HttpCache::BackendFactory* CreateHttpCacheBackendFactory( const base::FilePath& base_path) override; - scoped_ptr CreateCertVerifier() override; + std::unique_ptr CreateCertVerifier() override; net::SSLConfigService* CreateSSLConfigService() override; bool AllowNTLMCredentialsForDomain(const GURL& auth_origin) override; @@ -52,9 +52,9 @@ class AtomBrowserContext : public brightray::BrowserContext { AtomNetworkDelegate* network_delegate() const { return network_delegate_; } private: - scoped_ptr download_manager_delegate_; - scoped_ptr guest_manager_; - scoped_ptr permission_manager_; + std::unique_ptr download_manager_delegate_; + std::unique_ptr guest_manager_; + std::unique_ptr permission_manager_; // Managed by brightray::BrowserContext. AtomCertVerifier* cert_verifier_; diff --git a/atom/browser/atom_browser_main_parts.h b/atom/browser/atom_browser_main_parts.h index e1053a257b91..0d8619f6865a 100644 --- a/atom/browser/atom_browser_main_parts.h +++ b/atom/browser/atom_browser_main_parts.h @@ -68,7 +68,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts { #endif // A fake BrowserProcess object that used to feed the source code from chrome. - scoped_ptr fake_browser_process_; + std::unique_ptr fake_browser_process_; // The gin::PerIsolateData requires a task runner to create, so we feed it // with a task runner that will post all work to main loop. @@ -77,11 +77,11 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts { // Pointer to exit code. int* exit_code_; - scoped_ptr browser_; - scoped_ptr js_env_; - scoped_ptr node_bindings_; - scoped_ptr atom_bindings_; - scoped_ptr node_debugger_; + std::unique_ptr browser_; + std::unique_ptr js_env_; + std::unique_ptr node_bindings_; + std::unique_ptr atom_bindings_; + std::unique_ptr node_debugger_; base::Timer gc_timer_; diff --git a/atom/browser/atom_javascript_dialog_manager.cc b/atom/browser/atom_javascript_dialog_manager.cc index c21d1fb11816..e1299821f5e4 100644 --- a/atom/browser/atom_javascript_dialog_manager.cc +++ b/atom/browser/atom_javascript_dialog_manager.cc @@ -13,7 +13,6 @@ namespace atom { void AtomJavaScriptDialogManager::RunJavaScriptDialog( content::WebContents* web_contents, const GURL& origin_url, - const std::string& accept_lang, content::JavaScriptMessageType javascript_message_type, const base::string16& message_text, const base::string16& default_prompt_text, @@ -24,12 +23,10 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog( void AtomJavaScriptDialogManager::RunBeforeUnloadDialog( content::WebContents* web_contents, - const base::string16& message_text, bool is_reload, const DialogClosedCallback& callback) { - bool prevent_reload = message_text.empty() || - message_text == base::ASCIIToUTF16("false"); - callback.Run(!prevent_reload, message_text); + // FIXME(zcbenz): the |message_text| is removed, figure out what should we do. + callback.Run(true); } } // namespace atom diff --git a/atom/browser/atom_javascript_dialog_manager.h b/atom/browser/atom_javascript_dialog_manager.h index c0a0dccf0fa9..3844e41f9d2f 100644 --- a/atom/browser/atom_javascript_dialog_manager.h +++ b/atom/browser/atom_javascript_dialog_manager.h @@ -17,7 +17,6 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager { void RunJavaScriptDialog( content::WebContents* web_contents, const GURL& origin_url, - const std::string& accept_lang, content::JavaScriptMessageType javascript_message_type, const base::string16& message_text, const base::string16& default_prompt_text, @@ -25,7 +24,6 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager { bool* did_suppress_message) override; void RunBeforeUnloadDialog( content::WebContents* web_contents, - const base::string16& message_text, bool is_reload, const DialogClosedCallback& callback) override; void CancelActiveAndPendingDialogs( diff --git a/atom/browser/atom_permission_manager.cc b/atom/browser/atom_permission_manager.cc index a102a1cb5c9a..7fc5fa0d0378 100644 --- a/atom/browser/atom_permission_manager.cc +++ b/atom/browser/atom_permission_manager.cc @@ -40,7 +40,7 @@ void AtomPermissionManager::SetPermissionRequestHandler( if (handler.is_null() && !pending_requests_.empty()) { for (const auto& request : pending_requests_) { if (!WebContentsDestroyed(request.second.render_process_id)) - request.second.callback.Run(content::PermissionStatus::DENIED); + request.second.callback.Run(blink::mojom::PermissionStatus::DENIED); } pending_requests_.clear(); } @@ -73,7 +73,7 @@ int AtomPermissionManager::RequestPermission( return request_id_; } - response_callback.Run(content::PermissionStatus::GRANTED); + response_callback.Run(blink::mojom::PermissionStatus::GRANTED); return kNoPendingOperation; } @@ -82,15 +82,15 @@ int AtomPermissionManager::RequestPermissions( content::RenderFrameHost* render_frame_host, const GURL& requesting_origin, const base::Callback&)>& callback) { + const std::vector&)>& callback) { // FIXME(zcbenz): Just ignore multiple permissions request for now. - std::vector permissionStatuses; + std::vector permissionStatuses; for (auto permission : permissions) { if (permission == content::PermissionType::MIDI_SYSEX) { content::ChildProcessSecurityPolicy::GetInstance()-> GrantSendMidiSysExMessage(render_frame_host->GetProcess()->GetID()); } - permissionStatuses.push_back(content::PermissionStatus::GRANTED); + permissionStatuses.push_back(blink::mojom::PermissionStatus::GRANTED); } callback.Run(permissionStatuses); return kNoPendingOperation; @@ -100,7 +100,7 @@ void AtomPermissionManager::OnPermissionResponse( int request_id, const GURL& origin, const ResponseCallback& callback, - content::PermissionStatus status) { + blink::mojom::PermissionStatus status) { auto request = pending_requests_.find(request_id); if (request != pending_requests_.end()) { if (!WebContentsDestroyed(request->second.render_process_id)) @@ -113,7 +113,7 @@ void AtomPermissionManager::CancelPermissionRequest(int request_id) { auto request = pending_requests_.find(request_id); if (request != pending_requests_.end()) { if (!WebContentsDestroyed(request->second.render_process_id)) - request->second.callback.Run(content::PermissionStatus::DENIED); + request->second.callback.Run(blink::mojom::PermissionStatus::DENIED); pending_requests_.erase(request); } } @@ -124,11 +124,11 @@ void AtomPermissionManager::ResetPermission( const GURL& embedding_origin) { } -content::PermissionStatus AtomPermissionManager::GetPermissionStatus( +blink::mojom::PermissionStatus AtomPermissionManager::GetPermissionStatus( content::PermissionType permission, const GURL& requesting_origin, const GURL& embedding_origin) { - return content::PermissionStatus::GRANTED; + return blink::mojom::PermissionStatus::GRANTED; } void AtomPermissionManager::RegisterPermissionUsage( diff --git a/atom/browser/atom_permission_manager.h b/atom/browser/atom_permission_manager.h index 7361e6bc0541..d0fcdc60768f 100644 --- a/atom/browser/atom_permission_manager.h +++ b/atom/browser/atom_permission_manager.h @@ -23,7 +23,7 @@ class AtomPermissionManager : public content::PermissionManager { ~AtomPermissionManager() override; using ResponseCallback = - base::Callback; + base::Callback; using RequestHandler = base::Callback&)>& callback) override; + const std::vector&)>& callback) override; protected: void OnPermissionResponse(int request_id, const GURL& url, const ResponseCallback& callback, - content::PermissionStatus status); + blink::mojom::PermissionStatus status); // content::PermissionManager: void CancelPermissionRequest(int request_id) override; void ResetPermission(content::PermissionType permission, const GURL& requesting_origin, const GURL& embedding_origin) override; - content::PermissionStatus GetPermissionStatus( + blink::mojom::PermissionStatus GetPermissionStatus( content::PermissionType permission, const GURL& requesting_origin, const GURL& embedding_origin) override; @@ -67,7 +67,8 @@ class AtomPermissionManager : public content::PermissionManager { content::PermissionType permission, const GURL& requesting_origin, const GURL& embedding_origin, - const base::Callback& callback) override; + const base::Callback& callback) + override; void UnsubscribePermissionStatusChange(int subscription_id) override; private: diff --git a/atom/browser/atom_security_state_model_client.h b/atom/browser/atom_security_state_model_client.h index cc943eb7f949..0dd3aa66c125 100644 --- a/atom/browser/atom_security_state_model_client.h +++ b/atom/browser/atom_security_state_model_client.h @@ -32,7 +32,7 @@ class AtomSecurityStateModelClient friend class content::WebContentsUserData; content::WebContents* web_contents_; - scoped_ptr security_state_model_; + std::unique_ptr security_state_model_; DISALLOW_COPY_AND_ASSIGN(AtomSecurityStateModelClient); }; diff --git a/atom/browser/browser_win.cc b/atom/browser/browser_win.cc index 7b1402ba2d2c..345e2bcf67ce 100644 --- a/atom/browser/browser_win.cc +++ b/atom/browser/browser_win.cc @@ -281,7 +281,7 @@ PCWSTR Browser::GetAppUserModelID() { std::string Browser::GetExecutableFileVersion() const { base::FilePath path; if (PathService::Get(base::FILE_EXE, &path)) { - scoped_ptr version_info( + std::unique_ptr version_info( FileVersionInfo::CreateFileVersionInfo(path)); return base::UTF16ToUTF8(version_info->product_version()); } @@ -292,7 +292,7 @@ std::string Browser::GetExecutableFileVersion() const { std::string Browser::GetExecutableFileProductName() const { base::FilePath path; if (PathService::Get(base::FILE_EXE, &path)) { - scoped_ptr version_info( + std::unique_ptr version_info( FileVersionInfo::CreateFileVersionInfo(path)); return base::UTF16ToUTF8(version_info->product_name()); } diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc index ea2bf8677cba..c275d4aee74e 100644 --- a/atom/browser/common_web_contents_delegate.cc +++ b/atom/browser/common_web_contents_delegate.cc @@ -464,7 +464,7 @@ void CommonWebContentsDelegate::DevToolsAddFileSystem( FileSystem file_system = CreateFileSystemStruct(GetDevToolsWebContents(), file_system_id, path.AsUTF8Unsafe()); - scoped_ptr file_system_value( + std::unique_ptr file_system_value( CreateFileSystemValue(file_system)); auto pref_service = GetPrefService(GetDevToolsWebContents()); diff --git a/atom/browser/common_web_contents_delegate.h b/atom/browser/common_web_contents_delegate.h index 095dad3bcebe..1746d63b2082 100644 --- a/atom/browser/common_web_contents_delegate.h +++ b/atom/browser/common_web_contents_delegate.h @@ -146,8 +146,8 @@ class CommonWebContentsDelegate // Whether window is fullscreened by window api. bool native_fullscreen_; - scoped_ptr web_dialog_helper_; - scoped_ptr dialog_manager_; + std::unique_ptr web_dialog_helper_; + std::unique_ptr dialog_manager_; scoped_refptr devtools_file_system_indexer_; // Make sure BrowserContext is alwasys destroyed after WebContents. @@ -157,7 +157,7 @@ class CommonWebContentsDelegate // Notice that web_contents_ must be placed after dialog_manager_, so we can // make sure web_contents_ is destroyed before dialog_manager_, otherwise a // crash would happen. - scoped_ptr web_contents_; + std::unique_ptr web_contents_; // Maps url to file path, used by the file requests sent from devtools. typedef std::map PathsMap; diff --git a/atom/browser/mac/atom_application_delegate.mm b/atom/browser/mac/atom_application_delegate.mm index 7fa3b3027f6c..84caae9d5ee3 100644 --- a/atom/browser/mac/atom_application_delegate.mm +++ b/atom/browser/mac/atom_application_delegate.mm @@ -65,7 +65,7 @@ continueUserActivity:(NSUserActivity*)userActivity restorationHandler:(void (^)(NSArray*restorableObjects))restorationHandler { std::string activity_type(base::SysNSStringToUTF8(userActivity.activityType)); - scoped_ptr user_info = + std::unique_ptr user_info = atom::NSDictionaryToDictionaryValue(userActivity.userInfo); if (!user_info) return NO; diff --git a/atom/browser/mac/dict_util.h b/atom/browser/mac/dict_util.h index e5b293652d8a..404636d1901a 100644 --- a/atom/browser/mac/dict_util.h +++ b/atom/browser/mac/dict_util.h @@ -18,7 +18,7 @@ namespace atom { NSDictionary* DictionaryValueToNSDictionary(const base::DictionaryValue& value); -scoped_ptr NSDictionaryToDictionaryValue( +std::unique_ptr NSDictionaryToDictionaryValue( NSDictionary* dict); } // namespace atom diff --git a/atom/browser/mac/dict_util.mm b/atom/browser/mac/dict_util.mm index 1fb8401a2a23..43b629cc32be 100644 --- a/atom/browser/mac/dict_util.mm +++ b/atom/browser/mac/dict_util.mm @@ -12,11 +12,11 @@ namespace atom { namespace { -scoped_ptr NSArrayToListValue(NSArray* arr) { +std::unique_ptr NSArrayToListValue(NSArray* arr) { if (!arr) return nullptr; - scoped_ptr result(new base::ListValue); + std::unique_ptr result(new base::ListValue); for (id value in arr) { if ([value isKindOfClass:[NSString class]]) { result->AppendString(base::SysNSStringToUTF8(value)); @@ -31,13 +31,13 @@ scoped_ptr NSArrayToListValue(NSArray* arr) { else result->AppendInteger([value intValue]); } else if ([value isKindOfClass:[NSArray class]]) { - scoped_ptr sub_arr = NSArrayToListValue(value); + std::unique_ptr sub_arr = NSArrayToListValue(value); if (sub_arr) result->Append(std::move(sub_arr)); else result->Append(base::Value::CreateNullValue()); } else if ([value isKindOfClass:[NSDictionary class]]) { - scoped_ptr sub_dict = + std::unique_ptr sub_dict = NSDictionaryToDictionaryValue(value); if (sub_dict) result->Append(std::move(sub_dict)); @@ -66,12 +66,12 @@ NSDictionary* DictionaryValueToNSDictionary(const base::DictionaryValue& value) return obj; } -scoped_ptr NSDictionaryToDictionaryValue( +std::unique_ptr NSDictionaryToDictionaryValue( NSDictionary* dict) { if (!dict) return nullptr; - scoped_ptr result(new base::DictionaryValue); + std::unique_ptr result(new base::DictionaryValue); for (id key in dict) { std::string str_key = base::SysNSStringToUTF8( [key isKindOfClass:[NSString class]] ? key : [key description]); @@ -91,14 +91,14 @@ scoped_ptr NSDictionaryToDictionaryValue( else result->SetIntegerWithoutPathExpansion(str_key, [value intValue]); } else if ([value isKindOfClass:[NSArray class]]) { - scoped_ptr sub_arr = NSArrayToListValue(value); + std::unique_ptr sub_arr = NSArrayToListValue(value); if (sub_arr) result->SetWithoutPathExpansion(str_key, std::move(sub_arr)); else result->SetWithoutPathExpansion(str_key, base::Value::CreateNullValue()); } else if ([value isKindOfClass:[NSDictionary class]]) { - scoped_ptr sub_dict = + std::unique_ptr sub_dict = NSDictionaryToDictionaryValue(value); if (sub_dict) result->SetWithoutPathExpansion(str_key, std::move(sub_dict)); diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 31567c197508..651d9eb35f80 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -527,9 +527,9 @@ void NativeWindow::NotifyWindowMessage( } #endif -scoped_ptr NativeWindow::DraggableRegionsToSkRegion( +std::unique_ptr NativeWindow::DraggableRegionsToSkRegion( const std::vector& regions) { - scoped_ptr sk_region(new SkRegion); + std::unique_ptr sk_region(new SkRegion); for (const DraggableRegion& region : regions) { sk_region->op( region.bounds.x(), diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 7bc432d45deb..a9b5ffc3f783 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -263,7 +263,7 @@ class NativeWindow : public base::SupportsUserData, // Convert draggable regions in raw format to SkRegion format. Caller is // responsible for deleting the returned SkRegion instance. - scoped_ptr DraggableRegionsToSkRegion( + std::unique_ptr DraggableRegionsToSkRegion( const std::vector& regions); // Converts between content size to window size. @@ -299,7 +299,7 @@ class NativeWindow : public base::SupportsUserData, // For custom drag, the whole window is non-draggable and the draggable region // has to been explicitly provided. - scoped_ptr draggable_region_; // used in custom drag. + std::unique_ptr draggable_region_; // used in custom drag. // Minimum and maximum size, stored as content size. extensions::SizeConstraints size_constraints_; diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 333b282266f5..10dd17785c3d 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -942,8 +942,8 @@ std::vector NativeWindowMac::CalculateNonDraggableRegions( if (regions.empty()) { result.push_back(gfx::Rect(0, 0, width, height)); } else { - scoped_ptr draggable(DraggableRegionsToSkRegion(regions)); - scoped_ptr non_draggable(new SkRegion); + std::unique_ptr draggable(DraggableRegionsToSkRegion(regions)); + std::unique_ptr non_draggable(new SkRegion); non_draggable->op(0, 0, width, height, SkRegion::kUnion_Op); non_draggable->op(*draggable, SkRegion::kDifference_Op); for (SkRegion::Iterator it(*non_draggable); !it.done(); it.next()) { diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index 8a5d8ae0e082..85c7ddbeba7a 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -170,19 +170,19 @@ class NativeWindowViews : public NativeWindow, // Returns the restore state for the window. ui::WindowShowState GetRestoredState(); - scoped_ptr window_; + std::unique_ptr window_; views::View* web_view_; // Managed by inspectable_web_contents_. - scoped_ptr menu_bar_; + std::unique_ptr menu_bar_; bool menu_bar_autohide_; bool menu_bar_visible_; bool menu_bar_alt_pressed_; #if defined(USE_X11) - scoped_ptr global_menu_bar_; + std::unique_ptr global_menu_bar_; // Handles window state events. - scoped_ptr window_state_watcher_; + std::unique_ptr window_state_watcher_; // The "resizable" flag on Linux is implemented by setting size constraints, // we need to make sure size constraints are restored when window becomes @@ -208,7 +208,7 @@ class NativeWindowViews : public NativeWindow, #endif // Handles unhandled keyboard messages coming back from the renderer process. - scoped_ptr keyboard_event_handler_; + std::unique_ptr keyboard_event_handler_; // Map from accelerator to menu item's command id. accelerator_util::AcceleratorTable accelerator_table_; diff --git a/atom/browser/net/asar/url_request_asar_job.h b/atom/browser/net/asar/url_request_asar_job.h index 7103abc4139a..56c519823c0e 100644 --- a/atom/browser/net/asar/url_request_asar_job.h +++ b/atom/browser/net/asar/url_request_asar_job.h @@ -112,7 +112,7 @@ class URLRequestAsarJob : public net::URLRequestJob { base::FilePath file_path_; Archive::FileInfo file_info_; - scoped_ptr stream_; + std::unique_ptr stream_; FileMetaInfo meta_info_; scoped_refptr file_task_runner_; diff --git a/atom/browser/net/atom_cert_verifier.cc b/atom/browser/net/atom_cert_verifier.cc index 3633d805fb5b..adfba7060c90 100644 --- a/atom/browser/net/atom_cert_verifier.cc +++ b/atom/browser/net/atom_cert_verifier.cc @@ -48,7 +48,7 @@ int AtomCertVerifier::Verify( net::CRLSet* crl_set, net::CertVerifyResult* verify_result, const net::CompletionCallback& callback, - scoped_ptr* out_req, + std::unique_ptr* out_req, const net::BoundNetLog& net_log) { DCHECK_CURRENTLY_ON(BrowserThread::IO); diff --git a/atom/browser/net/atom_cert_verifier.h b/atom/browser/net/atom_cert_verifier.h index 796ae2849bda..e00ba260ec3f 100644 --- a/atom/browser/net/atom_cert_verifier.h +++ b/atom/browser/net/atom_cert_verifier.h @@ -34,14 +34,14 @@ class AtomCertVerifier : public net::CertVerifier { net::CRLSet* crl_set, net::CertVerifyResult* verify_result, const net::CompletionCallback& callback, - scoped_ptr* out_req, + std::unique_ptr* out_req, const net::BoundNetLog& net_log) override; bool SupportsOCSPStapling() override; private: base::Lock lock_; VerifyProc verify_proc_; - scoped_ptr default_cert_verifier_; + std::unique_ptr default_cert_verifier_; DISALLOW_COPY_AND_ASSIGN(AtomCertVerifier); }; diff --git a/atom/browser/net/atom_network_delegate.cc b/atom/browser/net/atom_network_delegate.cc index 39e0f732656b..fd0c52b3554f 100644 --- a/atom/browser/net/atom_network_delegate.cc +++ b/atom/browser/net/atom_network_delegate.cc @@ -45,13 +45,13 @@ using ResponseHeadersContainer = std::pair*, const std::string&>; void RunSimpleListener(const AtomNetworkDelegate::SimpleListener& listener, - scoped_ptr details) { + std::unique_ptr details) { return listener.Run(*(details.get())); } void RunResponseListener( const AtomNetworkDelegate::ResponseListener& listener, - scoped_ptr details, + std::unique_ptr details, const AtomNetworkDelegate::ResponseCallback& callback) { return listener.Run(*(details.get()), callback); } @@ -79,7 +79,7 @@ void ToDictionary(base::DictionaryValue* details, net::URLRequest* request) { details->SetString("resourceType", info ? ResourceTypeToString(info->GetResourceType()) : "other"); - scoped_ptr list(new base::ListValue); + std::unique_ptr list(new base::ListValue); GetUploadData(list.get(), request); if (!list->empty()) details->Set("uploadData", std::move(list)); @@ -87,7 +87,7 @@ void ToDictionary(base::DictionaryValue* details, net::URLRequest* request) { void ToDictionary(base::DictionaryValue* details, const net::HttpRequestHeaders& headers) { - scoped_ptr dict(new base::DictionaryValue); + std::unique_ptr dict(new base::DictionaryValue); net::HttpRequestHeaders::Iterator it(headers); while (it.GetNext()) dict->SetString(it.name(), it.value()); @@ -99,7 +99,7 @@ void ToDictionary(base::DictionaryValue* details, if (!headers) return; - scoped_ptr dict(new base::DictionaryValue); + std::unique_ptr dict(new base::DictionaryValue); size_t iter = 0; std::string key; std::string value; @@ -109,7 +109,7 @@ void ToDictionary(base::DictionaryValue* details, if (dict->GetList(key, &values)) values->AppendString(value); } else { - scoped_ptr values(new base::ListValue); + std::unique_ptr values(new base::ListValue); values->AppendString(value); dict->Set(key, std::move(values)); } @@ -369,7 +369,7 @@ int AtomNetworkDelegate::HandleResponseEvent( if (!MatchesFilterCondition(request, info.url_patterns)) return net::OK; - scoped_ptr details(new base::DictionaryValue); + std::unique_ptr details(new base::DictionaryValue); FillDetailsObject(details.get(), request, args...); // The |request| could be destroyed before the |callback| is called. @@ -392,7 +392,7 @@ void AtomNetworkDelegate::HandleSimpleEvent( if (!MatchesFilterCondition(request, info.url_patterns)) return; - scoped_ptr details(new base::DictionaryValue); + std::unique_ptr details(new base::DictionaryValue); FillDetailsObject(details.get(), request, args...); BrowserThread::PostTask( @@ -402,7 +402,7 @@ void AtomNetworkDelegate::HandleSimpleEvent( template void AtomNetworkDelegate::OnListenerResultInIO( - uint64_t id, T out, scoped_ptr response) { + uint64_t id, T out, std::unique_ptr response) { // The request has been destroyed. if (!ContainsKey(callbacks_, id)) return; @@ -417,7 +417,7 @@ void AtomNetworkDelegate::OnListenerResultInIO( template void AtomNetworkDelegate::OnListenerResultInUI( uint64_t id, T out, const base::DictionaryValue& response) { - scoped_ptr copy = response.CreateDeepCopy(); + std::unique_ptr copy = response.CreateDeepCopy(); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&AtomNetworkDelegate::OnListenerResultInIO, diff --git a/atom/browser/net/atom_network_delegate.h b/atom/browser/net/atom_network_delegate.h index 701a953c265e..62653df0baeb 100644 --- a/atom/browser/net/atom_network_delegate.h +++ b/atom/browser/net/atom_network_delegate.h @@ -111,7 +111,7 @@ class AtomNetworkDelegate : public brightray::NetworkDelegate { // Deal with the results of Listener. template void OnListenerResultInIO( - uint64_t id, T out, scoped_ptr response); + uint64_t id, T out, std::unique_ptr response); template void OnListenerResultInUI( uint64_t id, T out, const base::DictionaryValue& response); diff --git a/atom/browser/net/atom_url_request_job_factory.cc b/atom/browser/net/atom_url_request_job_factory.cc index dbd8b4160cfd..3bf332d0fb33 100644 --- a/atom/browser/net/atom_url_request_job_factory.cc +++ b/atom/browser/net/atom_url_request_job_factory.cc @@ -23,7 +23,7 @@ AtomURLRequestJobFactory::~AtomURLRequestJobFactory() { } bool AtomURLRequestJobFactory::SetProtocolHandler( - const std::string& scheme, scoped_ptr protocol_handler) { + const std::string& scheme, std::unique_ptr protocol_handler) { if (!protocol_handler) { ProtocolHandlerMap::iterator it = protocol_handler_map_.find(scheme); if (it == protocol_handler_map_.end()) @@ -40,8 +40,8 @@ bool AtomURLRequestJobFactory::SetProtocolHandler( return true; } -scoped_ptr AtomURLRequestJobFactory::ReplaceProtocol( - const std::string& scheme, scoped_ptr protocol_handler) { +std::unique_ptr AtomURLRequestJobFactory::ReplaceProtocol( + const std::string& scheme, std::unique_ptr protocol_handler) { if (!ContainsKey(protocol_handler_map_, scheme)) return nullptr; ProtocolHandler* original_protocol_handler = protocol_handler_map_[scheme]; diff --git a/atom/browser/net/atom_url_request_job_factory.h b/atom/browser/net/atom_url_request_job_factory.h index dde36225b7af..ba7a4796f9a5 100644 --- a/atom/browser/net/atom_url_request_job_factory.h +++ b/atom/browser/net/atom_url_request_job_factory.h @@ -25,12 +25,12 @@ class AtomURLRequestJobFactory : public net::URLRequestJobFactory { // failure (a ProtocolHandler already exists for |scheme|). On success, // URLRequestJobFactory takes ownership of |protocol_handler|. bool SetProtocolHandler( - const std::string& scheme, scoped_ptr protocol_handler); + const std::string& scheme, std::unique_ptr protocol_handler); // Intercepts the ProtocolHandler for a scheme. Returns the original protocol // handler on success, otherwise returns NULL. - scoped_ptr ReplaceProtocol( - const std::string& scheme, scoped_ptr protocol_handler); + std::unique_ptr ReplaceProtocol( + const std::string& scheme, std::unique_ptr protocol_handler); // Returns the protocol handler registered with scheme. ProtocolHandler* GetProtocolHandler(const std::string& scheme) const; diff --git a/atom/browser/net/js_asker.cc b/atom/browser/net/js_asker.cc index b11a69c9c13b..8362c1add1c6 100644 --- a/atom/browser/net/js_asker.cc +++ b/atom/browser/net/js_asker.cc @@ -34,7 +34,7 @@ void HandlerCallback(const BeforeStartCallback& before_start, // Pass whatever user passed to the actaul request job. V8ValueConverter converter; v8::Local context = args->isolate()->GetCurrentContext(); - scoped_ptr options(converter.FromV8Value(value, context)); + std::unique_ptr options(converter.FromV8Value(value, context)); content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, base::Bind(callback, true, base::Passed(&options))); diff --git a/atom/browser/net/js_asker.h b/atom/browser/net/js_asker.h index 8a70794fa946..6301f4de2c2a 100644 --- a/atom/browser/net/js_asker.h +++ b/atom/browser/net/js_asker.h @@ -26,7 +26,7 @@ namespace internal { using BeforeStartCallback = base::Callback)>; using ResponseCallback = - base::Callback options)>; + base::Callback options)>; // Ask handler for options in UI thread. void AskForOptions(v8::Isolate* isolate, @@ -58,7 +58,7 @@ class JsAsker : public RequestJob { // Subclass should do initailze work here. virtual void BeforeStartInUI(v8::Isolate*, v8::Local) {} - virtual void StartAsync(scoped_ptr options) = 0; + virtual void StartAsync(std::unique_ptr options) = 0; net::URLRequestContextGetter* request_context_getter() const { return request_context_getter_; @@ -84,7 +84,7 @@ class JsAsker : public RequestJob { // Called when the JS handler has sent the response, we need to decide whether // to start, or fail the job. - void OnResponse(bool success, scoped_ptr value) { + void OnResponse(bool success, std::unique_ptr value) { int error = net::ERR_NOT_IMPLEMENTED; if (success && value && !internal::IsErrorOptions(value.get(), &error)) { StartAsync(std::move(value)); diff --git a/atom/browser/net/url_request_async_asar_job.cc b/atom/browser/net/url_request_async_asar_job.cc index 3578f3b7971c..1234bccf4303 100644 --- a/atom/browser/net/url_request_async_asar_job.cc +++ b/atom/browser/net/url_request_async_asar_job.cc @@ -16,7 +16,7 @@ URLRequestAsyncAsarJob::URLRequestAsyncAsarJob( : JsAsker(request, network_delegate) { } -void URLRequestAsyncAsarJob::StartAsync(scoped_ptr options) { +void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr options) { base::FilePath::StringType file_path; if (options->IsType(base::Value::TYPE_DICTIONARY)) { static_cast(options.get())->GetString( diff --git a/atom/browser/net/url_request_async_asar_job.h b/atom/browser/net/url_request_async_asar_job.h index d65142f0bdbb..032f3d992413 100644 --- a/atom/browser/net/url_request_async_asar_job.h +++ b/atom/browser/net/url_request_async_asar_job.h @@ -16,7 +16,7 @@ class URLRequestAsyncAsarJob : public JsAsker { URLRequestAsyncAsarJob(net::URLRequest*, net::NetworkDelegate*); // JsAsker: - void StartAsync(scoped_ptr options) override; + void StartAsync(std::unique_ptr options) override; // URLRequestJob: void GetResponseInfo(net::HttpResponseInfo* info) override; diff --git a/atom/browser/net/url_request_buffer_job.cc b/atom/browser/net/url_request_buffer_job.cc index aa273bf81693..c0c8e1584e69 100644 --- a/atom/browser/net/url_request_buffer_job.cc +++ b/atom/browser/net/url_request_buffer_job.cc @@ -18,7 +18,7 @@ URLRequestBufferJob::URLRequestBufferJob( status_code_(net::HTTP_NOT_IMPLEMENTED) { } -void URLRequestBufferJob::StartAsync(scoped_ptr options) { +void URLRequestBufferJob::StartAsync(std::unique_ptr options) { const base::BinaryValue* binary = nullptr; if (options->IsType(base::Value::TYPE_DICTIONARY)) { base::DictionaryValue* dict = diff --git a/atom/browser/net/url_request_buffer_job.h b/atom/browser/net/url_request_buffer_job.h index ab8de7e8f030..356ca9347f6f 100644 --- a/atom/browser/net/url_request_buffer_job.h +++ b/atom/browser/net/url_request_buffer_job.h @@ -19,7 +19,7 @@ class URLRequestBufferJob : public JsAsker { URLRequestBufferJob(net::URLRequest*, net::NetworkDelegate*); // JsAsker: - void StartAsync(scoped_ptr options) override; + void StartAsync(std::unique_ptr options) override; // URLRequestJob: void GetResponseInfo(net::HttpResponseInfo* info) override; diff --git a/atom/browser/net/url_request_fetch_job.cc b/atom/browser/net/url_request_fetch_job.cc index 2f907314cad4..b6aadc89ec62 100644 --- a/atom/browser/net/url_request_fetch_job.cc +++ b/atom/browser/net/url_request_fetch_job.cc @@ -99,7 +99,7 @@ void URLRequestFetchJob::BeforeStartInUI( } } -void URLRequestFetchJob::StartAsync(scoped_ptr options) { +void URLRequestFetchJob::StartAsync(std::unique_ptr options) { if (!options->IsType(base::Value::TYPE_DICTIONARY)) { NotifyStartError(net::URLRequestStatus( net::URLRequestStatus::FAILED, net::ERR_NOT_IMPLEMENTED)); diff --git a/atom/browser/net/url_request_fetch_job.h b/atom/browser/net/url_request_fetch_job.h index 69067fdc7fd3..65d73f27ca94 100644 --- a/atom/browser/net/url_request_fetch_job.h +++ b/atom/browser/net/url_request_fetch_job.h @@ -30,7 +30,7 @@ class URLRequestFetchJob : public JsAsker, protected: // JsAsker: void BeforeStartInUI(v8::Isolate*, v8::Local) override; - void StartAsync(scoped_ptr options) override; + void StartAsync(std::unique_ptr options) override; // net::URLRequestJob: void Kill() override; @@ -44,10 +44,10 @@ class URLRequestFetchJob : public JsAsker, private: scoped_refptr url_request_context_getter_; - scoped_ptr fetcher_; + std::unique_ptr fetcher_; scoped_refptr pending_buffer_; int pending_buffer_size_; - scoped_ptr response_info_; + std::unique_ptr response_info_; DISALLOW_COPY_AND_ASSIGN(URLRequestFetchJob); }; diff --git a/atom/browser/net/url_request_string_job.cc b/atom/browser/net/url_request_string_job.cc index 606781142da0..59945e66db07 100644 --- a/atom/browser/net/url_request_string_job.cc +++ b/atom/browser/net/url_request_string_job.cc @@ -16,7 +16,7 @@ URLRequestStringJob::URLRequestStringJob( : JsAsker(request, network_delegate) { } -void URLRequestStringJob::StartAsync(scoped_ptr options) { +void URLRequestStringJob::StartAsync(std::unique_ptr options) { if (options->IsType(base::Value::TYPE_DICTIONARY)) { base::DictionaryValue* dict = static_cast(options.get()); diff --git a/atom/browser/net/url_request_string_job.h b/atom/browser/net/url_request_string_job.h index e40f0d93dab7..474473cca87d 100644 --- a/atom/browser/net/url_request_string_job.h +++ b/atom/browser/net/url_request_string_job.h @@ -17,7 +17,7 @@ class URLRequestStringJob : public JsAsker { URLRequestStringJob(net::URLRequest*, net::NetworkDelegate*); // JsAsker: - void StartAsync(scoped_ptr options) override; + void StartAsync(std::unique_ptr options) override; // URLRequestJob: void GetResponseInfo(net::HttpResponseInfo* info) override; diff --git a/atom/browser/node_debugger.cc b/atom/browser/node_debugger.cc index 50aa454fe757..55025dd69f72 100644 --- a/atom/browser/node_debugger.cc +++ b/atom/browser/node_debugger.cc @@ -145,7 +145,7 @@ void NodeDebugger::DebugMessageHandler(const v8::Debug::Message& message) { void NodeDebugger::DidAccept( net::test_server::StreamListenSocket* server, - scoped_ptr socket) { + std::unique_ptr socket) { // Only accept one session. if (accepted_socket_) { socket->Send(std::string("Remote debugging session already active"), true); diff --git a/atom/browser/node_debugger.h b/atom/browser/node_debugger.h index aedf7b2c0310..f708de6329f3 100644 --- a/atom/browser/node_debugger.h +++ b/atom/browser/node_debugger.h @@ -38,7 +38,7 @@ class NodeDebugger : public net::test_server::StreamListenSocket::Delegate { // net::test_server::StreamListenSocket::Delegate: void DidAccept( net::test_server::StreamListenSocket* server, - scoped_ptr socket) override; + std::unique_ptr socket) override; void DidRead(net::test_server::StreamListenSocket* socket, const char* data, int len) override; @@ -49,8 +49,8 @@ class NodeDebugger : public net::test_server::StreamListenSocket::Delegate { uv_async_t weak_up_ui_handle_; base::Thread thread_; - scoped_ptr server_; - scoped_ptr accepted_socket_; + std::unique_ptr server_; + std::unique_ptr accepted_socket_; std::string buffer_; int content_length_; diff --git a/atom/browser/ui/accelerator_util_mac.mm b/atom/browser/ui/accelerator_util_mac.mm index d3395884c97f..e2448833ab0d 100644 --- a/atom/browser/ui/accelerator_util_mac.mm +++ b/atom/browser/ui/accelerator_util_mac.mm @@ -32,7 +32,7 @@ void SetPlatformAccelerator(ui::Accelerator* accelerator) { NSString* characters = [[[NSString alloc] initWithCharacters:&character length:1] autorelease]; - scoped_ptr platform_accelerator( + std::unique_ptr platform_accelerator( new ui::PlatformAcceleratorCocoa(characters, modifiers)); accelerator->set_platform_accelerator(std::move(platform_accelerator)); } diff --git a/atom/browser/ui/file_dialog_gtk.cc b/atom/browser/ui/file_dialog_gtk.cc index 2c8b785544a2..1ad7ff5f2d41 100644 --- a/atom/browser/ui/file_dialog_gtk.cc +++ b/atom/browser/ui/file_dialog_gtk.cc @@ -177,7 +177,7 @@ void FileChooserDialog::AddFilters(const Filters& filters) { GtkFileFilter* gtk_filter = gtk_file_filter_new(); for (size_t j = 0; j < filter.second.size(); ++j) { - scoped_ptr file_extension( + std::unique_ptr file_extension( new std::string("." + filter.second[j])); gtk_file_filter_add_custom( gtk_filter, diff --git a/atom/browser/ui/file_dialog_win.cc b/atom/browser/ui/file_dialog_win.cc index af699a103937..5314b63a45a8 100644 --- a/atom/browser/ui/file_dialog_win.cc +++ b/atom/browser/ui/file_dialog_win.cc @@ -134,7 +134,7 @@ class FileDialog { GetPtr()->SetFolder(folder_item); } - scoped_ptr dialog_; + std::unique_ptr dialog_; DISALLOW_COPY_AND_ASSIGN(FileDialog); }; @@ -145,7 +145,7 @@ struct RunState { }; bool CreateDialogThread(RunState* run_state) { - scoped_ptr thread( + std::unique_ptr thread( new base::Thread(ATOM_PRODUCT_NAME "FileDialogThread")); thread->init_com_with_mta(false); if (!thread->Start()) diff --git a/atom/browser/ui/message_box_win.cc b/atom/browser/ui/message_box_win.cc index 2c4ce54856d4..b966ef92a8fd 100644 --- a/atom/browser/ui/message_box_win.cc +++ b/atom/browser/ui/message_box_win.cc @@ -222,7 +222,7 @@ void ShowMessageBox(NativeWindow* parent, const std::string& detail, const gfx::ImageSkia& icon, const MessageBoxCallback& callback) { - scoped_ptr thread( + std::unique_ptr thread( new base::Thread(ATOM_PRODUCT_NAME "MessageBoxThread")); thread->init_com_with_mta(false); if (!thread->Start()) { diff --git a/atom/browser/ui/tray_icon_gtk.h b/atom/browser/ui/tray_icon_gtk.h index 2be3259f218d..cfeb8ab3d0bf 100644 --- a/atom/browser/ui/tray_icon_gtk.h +++ b/atom/browser/ui/tray_icon_gtk.h @@ -32,7 +32,7 @@ class TrayIconGtk : public TrayIcon, void OnClick() override; bool HasClickAction() override; - scoped_ptr icon_; + std::unique_ptr icon_; DISALLOW_COPY_AND_ASSIGN(TrayIconGtk); }; diff --git a/atom/browser/ui/views/menu_delegate.h b/atom/browser/ui/views/menu_delegate.h index 211ddb57bc39..ad7093b48f72 100644 --- a/atom/browser/ui/views/menu_delegate.h +++ b/atom/browser/ui/views/menu_delegate.h @@ -52,8 +52,8 @@ class MenuDelegate : public views::MenuDelegate { private: MenuBar* menu_bar_; int id_; - scoped_ptr adapter_; - scoped_ptr menu_runner_; + std::unique_ptr adapter_; + std::unique_ptr menu_runner_; DISALLOW_COPY_AND_ASSIGN(MenuDelegate); }; diff --git a/atom/browser/ui/x/x_window_utils.cc b/atom/browser/ui/x/x_window_utils.cc index db83753bb376..48e8bc977322 100644 --- a/atom/browser/ui/x/x_window_utils.cc +++ b/atom/browser/ui/x/x_window_utils.cc @@ -51,7 +51,7 @@ void SetWindowType(::Window xwindow, const std::string& type) { } bool ShouldUseGlobalMenuBar() { - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); if (env->HasVar("ELECTRON_FORCE_WINDOW_MENU_BAR")) return false; @@ -61,7 +61,7 @@ bool ShouldUseGlobalMenuBar() { dbus::ObjectProxy* object_proxy = bus->GetObjectProxy(DBUS_SERVICE_DBUS, dbus::ObjectPath(DBUS_PATH_DBUS)); dbus::MethodCall method_call(DBUS_INTERFACE_DBUS, "ListNames"); - scoped_ptr response(object_proxy->CallMethodAndBlock( + std::unique_ptr response(object_proxy->CallMethodAndBlock( &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)); if (!response) { bus->ShutdownAndBlock(); diff --git a/atom/browser/web_view_guest_delegate.h b/atom/browser/web_view_guest_delegate.h index 3dae1a1749b5..d65eb1463586 100644 --- a/atom/browser/web_view_guest_delegate.h +++ b/atom/browser/web_view_guest_delegate.h @@ -24,10 +24,10 @@ struct SetSizeParams { SetSizeParams() {} ~SetSizeParams() {} - scoped_ptr enable_auto_size; - scoped_ptr min_size; - scoped_ptr max_size; - scoped_ptr normal_size; + std::unique_ptr enable_auto_size; + std::unique_ptr min_size; + std::unique_ptr max_size; + std::unique_ptr normal_size; }; class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate, diff --git a/atom/common/api/atom_api_asar.cc b/atom/common/api/atom_api_asar.cc index 1b0ea799e7d7..97c2e47fde0d 100644 --- a/atom/common/api/atom_api_asar.cc +++ b/atom/common/api/atom_api_asar.cc @@ -22,7 +22,7 @@ class Archive : public mate::Wrappable { public: static v8::Local Create(v8::Isolate* isolate, const base::FilePath& path) { - scoped_ptr archive(new asar::Archive(path)); + std::unique_ptr archive(new asar::Archive(path)); if (!archive->Init()) return v8::False(isolate); return (new Archive(isolate, std::move(archive)))->GetWrapper(); @@ -42,7 +42,7 @@ class Archive : public mate::Wrappable { } protected: - Archive(v8::Isolate* isolate, scoped_ptr archive) + Archive(v8::Isolate* isolate, std::unique_ptr archive) : archive_(std::move(archive)) { Init(isolate); } @@ -120,7 +120,7 @@ class Archive : public mate::Wrappable { } private: - scoped_ptr archive_; + std::unique_ptr archive_; DISALLOW_COPY_AND_ASSIGN(Archive); }; diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index d5a75e3f440b..c0b51ba2af28 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -76,7 +76,7 @@ bool AddImageSkiaRep(gfx::ImageSkia* image, const unsigned char* data, size_t size, double scale_factor) { - scoped_ptr decoded(new SkBitmap()); + std::unique_ptr decoded(new SkBitmap()); // Try PNG first. if (!gfx::PNGCodec::Decode(data, size, decoded.get())) @@ -162,7 +162,7 @@ base::win::ScopedHICON ReadICOFromPath(int size, const base::FilePath& path) { void ReadImageSkiaFromICO(gfx::ImageSkia* image, HICON icon) { // Convert the icon from the Windows specific HICON to gfx::ImageSkia. - scoped_ptr bitmap(IconUtil::CreateSkBitmapFromHICON(icon)); + std::unique_ptr bitmap(IconUtil::CreateSkBitmapFromHICON(icon)); image->AddRepresentation(gfx::ImageSkiaRep(*bitmap, 1.0f)); } #endif diff --git a/atom/common/api/event_emitter_caller.cc b/atom/common/api/event_emitter_caller.cc index 4b44553d3740..2b0de7a76161 100644 --- a/atom/common/api/event_emitter_caller.cc +++ b/atom/common/api/event_emitter_caller.cc @@ -17,7 +17,7 @@ v8::Local CallEmitWithArgs(v8::Isolate* isolate, v8::Local obj, ValueVector* args) { // Perform microtask checkpoint after running JavaScript. - scoped_ptr script_scope( + std::unique_ptr script_scope( Locker::IsBrowserProcess() ? nullptr : new blink::WebScopedRunV8Script); // Use node::MakeCallback to call the callback, and it will also run pending diff --git a/atom/common/api/locker.h b/atom/common/api/locker.h index 201217ff625a..e64ef1853ec5 100644 --- a/atom/common/api/locker.h +++ b/atom/common/api/locker.h @@ -5,7 +5,9 @@ #ifndef ATOM_COMMON_API_LOCKER_H_ #define ATOM_COMMON_API_LOCKER_H_ -#include "base/memory/scoped_ptr.h" +#include + +#include "base/macros.h" #include "v8/include/v8.h" namespace mate { @@ -24,7 +26,7 @@ class Locker { void* operator new(size_t size); void operator delete(void*, size_t); - scoped_ptr locker_; + std::unique_ptr locker_; DISALLOW_COPY_AND_ASSIGN(Locker); }; diff --git a/atom/common/asar/archive.cc b/atom/common/asar/archive.cc index 4f04812e07e7..c2306c3c8f38 100644 --- a/atom/common/asar/archive.cc +++ b/atom/common/asar/archive.cc @@ -180,7 +180,7 @@ bool Archive::Init() { std::string error; base::JSONReader reader; - scoped_ptr value(reader.ReadToValue(header)); + std::unique_ptr value(reader.ReadToValue(header)); if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) { LOG(ERROR) << "Failed to parse header: " << error; return false; @@ -283,7 +283,7 @@ bool Archive::CopyFileOut(const base::FilePath& path, base::FilePath* out) { return true; } - scoped_ptr temp_file(new ScopedTemporaryFile); + std::unique_ptr temp_file(new ScopedTemporaryFile); base::FilePath::StringType ext = path.Extension(); if (!temp_file->InitFromFile(&file_, ext, info.offset, info.size)) return false; diff --git a/atom/common/asar/archive.h b/atom/common/asar/archive.h index 79b848623c99..5438776885f3 100644 --- a/atom/common/asar/archive.h +++ b/atom/common/asar/archive.h @@ -72,10 +72,10 @@ class Archive { base::File file_; int fd_; uint32_t header_size_; - scoped_ptr header_; + std::unique_ptr header_; // Cached external temporary files. - base::ScopedPtrHashMap> + base::ScopedPtrHashMap> external_files_; DISALLOW_COPY_AND_ASSIGN(Archive); diff --git a/atom/common/crash_reporter/crash_reporter_linux.h b/atom/common/crash_reporter/crash_reporter_linux.h index 165c288ab2b1..b74103ccbf76 100644 --- a/atom/common/crash_reporter/crash_reporter_linux.h +++ b/atom/common/crash_reporter/crash_reporter_linux.h @@ -47,7 +47,7 @@ class CrashReporterLinux : public CrashReporter { void* context, const bool succeeded); - scoped_ptr breakpad_; + std::unique_ptr breakpad_; CrashKeyStorage crash_keys_; uint64_t process_start_time_; diff --git a/atom/common/crash_reporter/crash_reporter_mac.h b/atom/common/crash_reporter/crash_reporter_mac.h index f03154359155..5556263cd350 100644 --- a/atom/common/crash_reporter/crash_reporter_mac.h +++ b/atom/common/crash_reporter/crash_reporter_mac.h @@ -45,7 +45,7 @@ class CrashReporterMac : public CrashReporter { std::vector GetUploadedReports( const std::string& path) override; - scoped_ptr simple_string_dictionary_; + std::unique_ptr simple_string_dictionary_; DISALLOW_COPY_AND_ASSIGN(CrashReporterMac); }; diff --git a/atom/common/crash_reporter/crash_reporter_win.h b/atom/common/crash_reporter/crash_reporter_win.h index 181c9eabd23c..0ab8f4bcfb19 100644 --- a/atom/common/crash_reporter/crash_reporter_win.h +++ b/atom/common/crash_reporter/crash_reporter_win.h @@ -62,7 +62,7 @@ class CrashReporterWin : public CrashReporter { google_breakpad::CustomClientInfo custom_info_; bool skip_system_crash_handler_; - scoped_ptr breakpad_; + std::unique_ptr breakpad_; DISALLOW_COPY_AND_ASSIGN(CrashReporterWin); }; diff --git a/atom/common/native_mate_converters/callback.h b/atom/common/native_mate_converters/callback.h index 6ef8e74c735a..43a1baf25fa8 100644 --- a/atom/common/native_mate_converters/callback.h +++ b/atom/common/native_mate_converters/callback.h @@ -13,7 +13,6 @@ #include "base/memory/weak_ptr.h" #include "native_mate/function_template.h" #include "native_mate/scoped_persistent.h" -#include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" namespace mate { @@ -49,9 +48,11 @@ struct V8FunctionInvoker(ArgTypes...)> { v8::EscapableHandleScope handle_scope(isolate); if (!function.IsAlive()) return v8::Null(isolate); - scoped_ptr script_scope( + std::unique_ptr script_scope( Locker::IsBrowserProcess() ? - nullptr : new blink::WebScopedRunV8Script); + nullptr : + new v8::MicrotasksScope(isolate, + v8::MicrotasksScope::kRunMicrotasks)); v8::Local holder = function.NewHandle(isolate); v8::Local context = holder->CreationContext(); v8::Context::Scope context_scope(context); @@ -70,9 +71,11 @@ struct V8FunctionInvoker { v8::HandleScope handle_scope(isolate); if (!function.IsAlive()) return; - scoped_ptr script_scope( + std::unique_ptr script_scope( Locker::IsBrowserProcess() ? - nullptr : new blink::WebScopedRunV8Script); + nullptr : + new v8::MicrotasksScope(isolate, + v8::MicrotasksScope::kRunMicrotasks)); v8::Local holder = function.NewHandle(isolate); v8::Local context = holder->CreationContext(); v8::Context::Scope context_scope(context); @@ -91,9 +94,11 @@ struct V8FunctionInvoker { ReturnType ret = ReturnType(); if (!function.IsAlive()) return ret; - scoped_ptr script_scope( + std::unique_ptr script_scope( Locker::IsBrowserProcess() ? - nullptr : new blink::WebScopedRunV8Script); + nullptr : + new v8::MicrotasksScope(isolate, + v8::MicrotasksScope::kRunMicrotasks)); v8::Local holder = function.NewHandle(isolate); v8::Local context = holder->CreationContext(); v8::Context::Scope context_scope(context); diff --git a/atom/common/native_mate_converters/content_converter.cc b/atom/common/native_mate_converters/content_converter.cc index b672f946cb6c..824065882e82 100644 --- a/atom/common/native_mate_converters/content_converter.cc +++ b/atom/common/native_mate_converters/content_converter.cc @@ -121,18 +121,18 @@ v8::Local Converter::ToV8( } // static -bool Converter::FromV8( +bool Converter::FromV8( v8::Isolate* isolate, v8::Local val, - content::PermissionStatus* out) { + blink::mojom::PermissionStatus* out) { bool result; if (!ConvertFromV8(isolate, val, &result)) return false; if (result) - *out = content::PermissionStatus::GRANTED; + *out = blink::mojom::PermissionStatus::GRANTED; else - *out = content::PermissionStatus::DENIED; + *out = blink::mojom::PermissionStatus::DENIED; return true; } diff --git a/atom/common/native_mate_converters/content_converter.h b/atom/common/native_mate_converters/content_converter.h index f2e7211ce5d1..522961a7e96c 100644 --- a/atom/common/native_mate_converters/content_converter.h +++ b/atom/common/native_mate_converters/content_converter.h @@ -9,8 +9,8 @@ #include "content/public/browser/permission_type.h" #include "content/public/common/menu_item.h" -#include "content/public/common/permission_status.mojom.h" #include "content/public/common/stop_find_action.h" +#include "third_party/WebKit/public/platform/modules/permissions/permission_status.mojom.h" #include "native_mate/converter.h" namespace content { @@ -36,9 +36,9 @@ struct Converter { }; template<> -struct Converter { +struct Converter { static bool FromV8(v8::Isolate* isolate, v8::Local val, - content::PermissionStatus* out); + blink::mojom::PermissionStatus* out); }; template<> diff --git a/atom/common/native_mate_converters/net_converter.cc b/atom/common/native_mate_converters/net_converter.cc index 5223709ae585..772ae6e22087 100644 --- a/atom/common/native_mate_converters/net_converter.cc +++ b/atom/common/native_mate_converters/net_converter.cc @@ -25,13 +25,13 @@ namespace mate { // static v8::Local Converter::ToV8( v8::Isolate* isolate, const net::URLRequest* val) { - scoped_ptr dict(new base::DictionaryValue); + std::unique_ptr dict(new base::DictionaryValue); dict->SetString("method", val->method()); std::string url; if (!val->url_chain().empty()) url = val->url().spec(); dict->SetStringWithoutPathExpansion("url", url); dict->SetString("referrer", val->referrer()); - scoped_ptr list(new base::ListValue); + std::unique_ptr list(new base::ListValue); atom::GetUploadData(list.get(), val); if (!list->empty()) dict->Set("uploadData", std::move(list)); @@ -74,15 +74,15 @@ void GetUploadData(base::ListValue* upload_data_list, const net::UploadDataStream* upload_data = request->get_upload(); if (!upload_data) return; - const std::vector>* readers = + const std::vector>* readers = upload_data->GetElementReaders(); for (const auto& reader : *readers) { - scoped_ptr upload_data_dict( + std::unique_ptr upload_data_dict( new base::DictionaryValue); if (reader->AsBytesReader()) { const net::UploadBytesElementReader* bytes_reader = reader->AsBytesReader(); - scoped_ptr bytes( + std::unique_ptr bytes( base::BinaryValue::CreateWithCopiedBuffer(bytes_reader->bytes(), bytes_reader->length())); upload_data_dict->Set("bytes", std::move(bytes)); diff --git a/atom/common/native_mate_converters/v8_value_converter.cc b/atom/common/native_mate_converters/v8_value_converter.cc index 99873cd1c4f0..13df524c34e5 100644 --- a/atom/common/native_mate_converters/v8_value_converter.cc +++ b/atom/common/native_mate_converters/v8_value_converter.cc @@ -288,7 +288,7 @@ base::Value* V8ValueConverter::FromV8Array( if (!state->UpdateAndCheckUniqueness(val)) return base::Value::CreateNullValue().release(); - scoped_ptr scope; + std::unique_ptr scope; // If val was created in a different context than our current one, change to // that context, but change back after val is converted. if (!val->CreationContext().IsEmpty() && @@ -335,14 +335,14 @@ base::Value* V8ValueConverter::FromV8Object( if (!state->UpdateAndCheckUniqueness(val)) return base::Value::CreateNullValue().release(); - scoped_ptr scope; + std::unique_ptr scope; // If val was created in a different context than our current one, change to // that context, but change back after val is converted. if (!val->CreationContext().IsEmpty() && val->CreationContext() != isolate->GetCurrentContext()) scope.reset(new v8::Context::Scope(val->CreationContext())); - scoped_ptr result(new base::DictionaryValue()); + std::unique_ptr result(new base::DictionaryValue()); v8::Local property_names(val->GetOwnPropertyNames()); for (uint32_t i = 0; i < property_names->Length(); ++i) { @@ -371,7 +371,7 @@ base::Value* V8ValueConverter::FromV8Object( child_v8 = v8::Null(isolate); } - scoped_ptr child(FromV8ValueImpl(state, child_v8, isolate)); + std::unique_ptr child(FromV8ValueImpl(state, child_v8, isolate)); if (!child.get()) // JSON.stringify skips properties whose values don't serialize, for // example undefined and functions. Emulate that behavior. diff --git a/atom/common/native_mate_converters/value_converter.cc b/atom/common/native_mate_converters/value_converter.cc index c9c1a861ba26..c3c7ae0383c5 100644 --- a/atom/common/native_mate_converters/value_converter.cc +++ b/atom/common/native_mate_converters/value_converter.cc @@ -12,8 +12,8 @@ namespace mate { bool Converter::FromV8(v8::Isolate* isolate, v8::Local val, base::DictionaryValue* out) { - scoped_ptr converter(new atom::V8ValueConverter); - scoped_ptr value(converter->FromV8Value( + std::unique_ptr converter(new atom::V8ValueConverter); + std::unique_ptr value(converter->FromV8Value( val, isolate->GetCurrentContext())); if (value && value->IsType(base::Value::TYPE_DICTIONARY)) { out->Swap(static_cast(value.get())); @@ -26,15 +26,15 @@ bool Converter::FromV8(v8::Isolate* isolate, v8::Local Converter::ToV8( v8::Isolate* isolate, const base::DictionaryValue& val) { - scoped_ptr converter(new atom::V8ValueConverter); + std::unique_ptr converter(new atom::V8ValueConverter); return converter->ToV8Value(&val, isolate->GetCurrentContext()); } bool Converter::FromV8(v8::Isolate* isolate, v8::Local val, base::ListValue* out) { - scoped_ptr converter(new atom::V8ValueConverter); - scoped_ptr value(converter->FromV8Value( + std::unique_ptr converter(new atom::V8ValueConverter); + std::unique_ptr value(converter->FromV8Value( val, isolate->GetCurrentContext())); if (value->IsType(base::Value::TYPE_LIST)) { out->Swap(static_cast(value.get())); @@ -47,7 +47,7 @@ bool Converter::FromV8(v8::Isolate* isolate, v8::Local Converter::ToV8( v8::Isolate* isolate, const base::ListValue& val) { - scoped_ptr converter(new atom::V8ValueConverter); + std::unique_ptr converter(new atom::V8ValueConverter); return converter->ToV8Value(&val, isolate->GetCurrentContext()); } diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index b3c36fdd8e03..561f0085a186 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -79,9 +79,9 @@ void UvNoOp(uv_async_t* handle) { // Convert the given vector to an array of C-strings. The strings in the // returned vector are only guaranteed valid so long as the vector of strings // is not modified. -scoped_ptr StringVectorToArgArray( +std::unique_ptr StringVectorToArgArray( const std::vector& vector) { - scoped_ptr array(new const char*[vector.size()]); + std::unique_ptr array(new const char*[vector.size()]); for (size_t i = 0; i < vector.size(); ++i) { array[i] = vector[i].c_str(); } @@ -146,7 +146,7 @@ void NodeBindings::Initialize() { #if defined(OS_WIN) // uv_init overrides error mode to suppress the default crash dialog, bring // it back if user wants to show it. - scoped_ptr env(base::Environment::Create()); + std::unique_ptr env(base::Environment::Create()); if (env->HasVar("ELECTRON_DEFAULT_ERROR_MODE")) SetErrorMode(0); #endif @@ -167,7 +167,7 @@ node::Environment* NodeBindings::CreateEnvironment( std::string script_path_str = script_path.AsUTF8Unsafe(); args.insert(args.begin() + 1, script_path_str.c_str()); - scoped_ptr c_argv = StringVectorToArgArray(args); + std::unique_ptr c_argv = StringVectorToArgArray(args); node::Environment* env = node::CreateEnvironment( context->GetIsolate(), uv_default_loop(), context, args.size(), c_argv.get(), 0, nullptr); @@ -226,7 +226,7 @@ void NodeBindings::UvRunOnce() { v8::Context::Scope context_scope(env->context()); // Perform microtask checkpoint after running JavaScript. - scoped_ptr script_scope( + std::unique_ptr script_scope( is_browser_ ? nullptr : new blink::WebScopedRunV8Script); // Deal with uv events. diff --git a/atom/renderer/api/atom_api_web_frame.cc b/atom/renderer/api/atom_api_web_frame.cc index d32b5f1c8c46..0b291d3b552a 100644 --- a/atom/renderer/api/atom_api_web_frame.cc +++ b/atom/renderer/api/atom_api_web_frame.cc @@ -158,7 +158,7 @@ void WebFrame::ExecuteJavaScript(const base::string16& code, args->GetNext(&has_user_gesture); ScriptExecutionCallback::CompletionCallback completion_callback; args->GetNext(&completion_callback); - scoped_ptr callback( + std::unique_ptr callback( new ScriptExecutionCallback(completion_callback)); web_frame_->requestExecuteScriptAndReturnValue( blink::WebScriptSource(code), diff --git a/atom/renderer/api/atom_api_web_frame.h b/atom/renderer/api/atom_api_web_frame.h index 2e120ecb6ae3..df0392a933e0 100644 --- a/atom/renderer/api/atom_api_web_frame.h +++ b/atom/renderer/api/atom_api_web_frame.h @@ -74,7 +74,7 @@ class WebFrame : public mate::Wrappable { blink::WebCache::ResourceTypeStats GetResourceUsage(v8::Isolate* isolate); void ClearCache(v8::Isolate* isolate); - scoped_ptr spell_check_client_; + std::unique_ptr spell_check_client_; blink::WebLocalFrame* web_frame_; diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index aa93f63aa2bb..5613f20d2ecc 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -95,15 +95,11 @@ AtomRendererClient::AtomRendererClient() AtomRendererClient::~AtomRendererClient() { } -void AtomRendererClient::WebKitInitialized() { +void AtomRendererClient::RenderThreadStarted() { blink::WebCustomElement::addEmbedderCustomElementName("webview"); blink::WebCustomElement::addEmbedderCustomElementName("browserplugin"); OverrideNodeArrayBuffer(); -} - -void AtomRendererClient::RenderThreadStarted() { - content::RenderThread::Get()->AddObserver(this); #if defined(OS_WIN) // Set ApplicationUserModelID in renderer process. diff --git a/atom/renderer/atom_renderer_client.h b/atom/renderer/atom_renderer_client.h index 11d6028928a0..16b975fd41f7 100644 --- a/atom/renderer/atom_renderer_client.h +++ b/atom/renderer/atom_renderer_client.h @@ -9,15 +9,13 @@ #include #include "content/public/renderer/content_renderer_client.h" -#include "content/public/renderer/render_process_observer.h" namespace atom { class AtomBindings; class NodeBindings; -class AtomRendererClient : public content::ContentRendererClient, - public content::RenderProcessObserver { +class AtomRendererClient : public content::ContentRendererClient { public: AtomRendererClient(); virtual ~AtomRendererClient(); @@ -33,9 +31,6 @@ class AtomRendererClient : public content::ContentRendererClient, DISABLE, }; - // content::RenderProcessObserver: - void WebKitInitialized() override; - // content::ContentRendererClient: void RenderThreadStarted() override; void RenderFrameCreated(content::RenderFrame*) override; @@ -64,8 +59,8 @@ class AtomRendererClient : public content::ContentRendererClient, std::string* error_html, base::string16* error_description) override; - scoped_ptr node_bindings_; - scoped_ptr atom_bindings_; + std::unique_ptr node_bindings_; + std::unique_ptr atom_bindings_; DISALLOW_COPY_AND_ASSIGN(AtomRendererClient); }; diff --git a/vendor/brightray b/vendor/brightray index 477290bfa105..3f18ef50c26a 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 477290bfa105053719a2de5f42089eb8ba261713 +Subproject commit 3f18ef50c26a6cea42845292abe076fb627f5ef1