Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2847983002: Use unique_ptr for Create{ServiceWorkerNetworkProvider,ApplicationCacheHost} (Closed)
Patch Set: addressed comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 2983 matching lines...) Expand 10 before | Expand all | Expand 10 after
2994 std::move(factory_selector), url_index_, std::move(params)); 2994 std::move(factory_selector), url_index_, std::move(params));
2995 2995
2996 #if defined(OS_ANDROID) // WMPI_CAST 2996 #if defined(OS_ANDROID) // WMPI_CAST
2997 media_player->SetMediaPlayerManager(GetMediaPlayerManager()); 2997 media_player->SetMediaPlayerManager(GetMediaPlayerManager());
2998 media_player->SetDeviceScaleFactor(render_view_->GetDeviceScaleFactor()); 2998 media_player->SetDeviceScaleFactor(render_view_->GetDeviceScaleFactor());
2999 #endif // defined(OS_ANDROID) 2999 #endif // defined(OS_ANDROID)
3000 3000
3001 return media_player; 3001 return media_player;
3002 } 3002 }
3003 3003
3004 blink::WebApplicationCacheHost* RenderFrameImpl::CreateApplicationCacheHost( 3004 std::unique_ptr<blink::WebApplicationCacheHost>
3005 RenderFrameImpl::CreateApplicationCacheHost(
3005 blink::WebApplicationCacheHostClient* client) { 3006 blink::WebApplicationCacheHostClient* client) {
3006 if (!frame_ || !frame_->View()) 3007 if (!frame_ || !frame_->View())
3007 return NULL; 3008 return nullptr;
3008 3009
3009 DocumentState* document_state = 3010 DocumentState* document_state =
3010 frame_->ProvisionalDataSource() 3011 frame_->ProvisionalDataSource()
3011 ? DocumentState::FromDataSource(frame_->ProvisionalDataSource()) 3012 ? DocumentState::FromDataSource(frame_->ProvisionalDataSource())
3012 : DocumentState::FromDataSource(frame_->DataSource()); 3013 : DocumentState::FromDataSource(frame_->DataSource());
3013 3014
3014 NavigationStateImpl* navigation_state = 3015 NavigationStateImpl* navigation_state =
3015 static_cast<NavigationStateImpl*>(document_state->navigation_state()); 3016 static_cast<NavigationStateImpl*>(document_state->navigation_state());
3016 3017
3017 return new RendererWebApplicationCacheHostImpl( 3018 return base::MakeUnique<RendererWebApplicationCacheHostImpl>(
3018 RenderViewImpl::FromWebView(frame_->View()), client, 3019 RenderViewImpl::FromWebView(frame_->View()), client,
3019 RenderThreadImpl::current()->appcache_dispatcher()->backend_proxy(), 3020 RenderThreadImpl::current()->appcache_dispatcher()->backend_proxy(),
3020 navigation_state->request_params().appcache_host_id); 3021 navigation_state->request_params().appcache_host_id);
3021 } 3022 }
3022 3023
3023 blink::WebWorkerContentSettingsClientProxy* 3024 blink::WebWorkerContentSettingsClientProxy*
3024 RenderFrameImpl::CreateWorkerContentSettingsClientProxy() { 3025 RenderFrameImpl::CreateWorkerContentSettingsClientProxy() {
3025 if (!frame_ || !frame_->View()) 3026 if (!frame_ || !frame_->View())
3026 return NULL; 3027 return NULL;
3027 return GetContentClient()->renderer()->CreateWorkerContentSettingsClientProxy( 3028 return GetContentClient()->renderer()->CreateWorkerContentSettingsClientProxy(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3080 3081
3081 blink::WebCookieJar* RenderFrameImpl::CookieJar() { 3082 blink::WebCookieJar* RenderFrameImpl::CookieJar() {
3082 return &cookie_jar_; 3083 return &cookie_jar_;
3083 } 3084 }
3084 3085
3085 blink::BlameContext* RenderFrameImpl::GetFrameBlameContext() { 3086 blink::BlameContext* RenderFrameImpl::GetFrameBlameContext() {
3086 DCHECK(blame_context_); 3087 DCHECK(blame_context_);
3087 return blame_context_.get(); 3088 return blame_context_.get();
3088 } 3089 }
3089 3090
3090 blink::WebServiceWorkerProvider* 3091 std::unique_ptr<blink::WebServiceWorkerProvider>
3091 RenderFrameImpl::CreateServiceWorkerProvider() { 3092 RenderFrameImpl::CreateServiceWorkerProvider() {
3092 // At this point we should have non-null data source. 3093 // At this point we should have non-null data source.
3093 DCHECK(frame_->DataSource()); 3094 DCHECK(frame_->DataSource());
3094 if (!ChildThreadImpl::current()) 3095 if (!ChildThreadImpl::current())
3095 return nullptr; // May be null in some tests. 3096 return nullptr; // May be null in some tests.
3096 ServiceWorkerNetworkProvider* provider = 3097 ServiceWorkerNetworkProvider* provider =
3097 ServiceWorkerNetworkProvider::FromWebServiceWorkerNetworkProvider( 3098 ServiceWorkerNetworkProvider::FromWebServiceWorkerNetworkProvider(
3098 frame_->DataSource()->GetServiceWorkerNetworkProvider()); 3099 frame_->DataSource()->GetServiceWorkerNetworkProvider());
3099 if (!provider->context()) { 3100 if (!provider->context()) {
3100 // The context can be null when the frame is sandboxed. 3101 // The context can be null when the frame is sandboxed.
3101 return nullptr; 3102 return nullptr;
3102 } 3103 }
3103 return new WebServiceWorkerProviderImpl( 3104 return base::MakeUnique<WebServiceWorkerProviderImpl>(
3104 ChildThreadImpl::current()->thread_safe_sender(), provider->context()); 3105 ChildThreadImpl::current()->thread_safe_sender(), provider->context());
3105 } 3106 }
3106 3107
3107 void RenderFrameImpl::DidAccessInitialDocument() { 3108 void RenderFrameImpl::DidAccessInitialDocument() {
3108 DCHECK(!frame_->Parent()); 3109 DCHECK(!frame_->Parent());
3109 // NOTE: Do not call back into JavaScript here, since this call is made from a 3110 // NOTE: Do not call back into JavaScript here, since this call is made from a
3110 // V8 security check. 3111 // V8 security check.
3111 3112
3112 // If the request hasn't yet committed, notify the browser process that it is 3113 // If the request hasn't yet committed, notify the browser process that it is
3113 // no longer safe to show the pending URL of the main frame, since a URL spoof 3114 // no longer safe to show the pending URL of the main frame, since a URL spoof
(...skipping 3925 matching lines...) Expand 10 before | Expand all | Expand 10 after
7039 policy(info.default_policy), 7040 policy(info.default_policy),
7040 replaces_current_history_item(info.replaces_current_history_item), 7041 replaces_current_history_item(info.replaces_current_history_item),
7041 history_navigation_in_new_child_frame( 7042 history_navigation_in_new_child_frame(
7042 info.is_history_navigation_in_new_child_frame), 7043 info.is_history_navigation_in_new_child_frame),
7043 client_redirect(info.is_client_redirect), 7044 client_redirect(info.is_client_redirect),
7044 cache_disabled(info.is_cache_disabled), 7045 cache_disabled(info.is_cache_disabled),
7045 form(info.form), 7046 form(info.form),
7046 source_location(info.source_location) {} 7047 source_location(info.source_location) {}
7047 7048
7048 } // namespace content 7049 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/service_worker/service_worker_context_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698