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

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

Issue 2382973002: Convert WebSecurityOrigin -> GURL without re-parsing the url (Closed)
Patch Set: rebase Created 4 years, 2 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 191 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
192 #include "third_party/WebKit/public/web/WebScriptSource.h" 192 #include "third_party/WebKit/public/web/WebScriptSource.h"
193 #include "third_party/WebKit/public/web/WebSearchableFormData.h" 193 #include "third_party/WebKit/public/web/WebSearchableFormData.h"
194 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 194 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
195 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" 195 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h"
196 #include "third_party/WebKit/public/web/WebSettings.h" 196 #include "third_party/WebKit/public/web/WebSettings.h"
197 #include "third_party/WebKit/public/web/WebSurroundingText.h" 197 #include "third_party/WebKit/public/web/WebSurroundingText.h"
198 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 198 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
199 #include "third_party/WebKit/public/web/WebView.h" 199 #include "third_party/WebKit/public/web/WebView.h"
200 #include "third_party/WebKit/public/web/WebWidget.h" 200 #include "third_party/WebKit/public/web/WebWidget.h"
201 #include "url/origin.h"
201 #include "url/url_constants.h" 202 #include "url/url_constants.h"
202 #include "url/url_util.h" 203 #include "url/url_util.h"
203 204
204 #if defined(ENABLE_PLUGINS) 205 #if defined(ENABLE_PLUGINS)
205 #include "content/renderer/pepper/pepper_browser_connection.h" 206 #include "content/renderer/pepper/pepper_browser_connection.h"
206 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 207 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
207 #include "content/renderer/pepper/pepper_plugin_registry.h" 208 #include "content/renderer/pepper/pepper_plugin_registry.h"
208 #include "content/renderer/pepper/pepper_webplugin_impl.h" 209 #include "content/renderer/pepper/pepper_webplugin_impl.h"
209 #include "content/renderer/pepper/plugin_module.h" 210 #include "content/renderer/pepper/plugin_module.h"
210 #endif 211 #endif
(...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2595 ->renderer() 2596 ->renderer()
2596 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, 2597 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType,
2597 GURL(params.url)) 2598 GURL(params.url))
2598 ->GetWeakPtr()); 2599 ->GetWeakPtr());
2599 } 2600 }
2600 2601
2601 #if defined(ENABLE_PLUGINS) 2602 #if defined(ENABLE_PLUGINS)
2602 WebPluginInfo info; 2603 WebPluginInfo info;
2603 std::string mime_type; 2604 std::string mime_type;
2604 bool found = false; 2605 bool found = false;
2605 WebString top_origin = frame->top()->getSecurityOrigin().toString(); 2606 Send(new FrameHostMsg_GetPluginInfo(
2606 Send(new FrameHostMsg_GetPluginInfo(routing_id_, params.url, 2607 routing_id_, params.url,
2607 blink::WebStringToGURL(top_origin), 2608 url::Origin(frame->top()->getSecurityOrigin()).GetURL(),
2608 params.mimeType.utf8(), &found, &info, 2609 params.mimeType.utf8(), &found, &info, &mime_type));
2609 &mime_type));
2610 if (!found) 2610 if (!found)
2611 return NULL; 2611 return NULL;
2612 2612
2613 WebPluginParams params_to_use = params; 2613 WebPluginParams params_to_use = params;
2614 params_to_use.mimeType = WebString::fromUTF8(mime_type); 2614 params_to_use.mimeType = WebString::fromUTF8(mime_type);
2615 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); 2615 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */);
2616 #else 2616 #else
2617 return NULL; 2617 return NULL;
2618 #endif // defined(ENABLE_PLUGINS) 2618 #endif // defined(ENABLE_PLUGINS)
2619 } 2619 }
(...skipping 23 matching lines...) Expand all
2643 sink_id.utf8(), frame_->getSecurityOrigin()); 2643 sink_id.utf8(), frame_->getSecurityOrigin());
2644 // We need to keep a reference to the context provider (see crbug.com/610527) 2644 // We need to keep a reference to the context provider (see crbug.com/610527)
2645 // but media/ can't depend on cc/, so for now, just keep a reference in the 2645 // but media/ can't depend on cc/, so for now, just keep a reference in the
2646 // callback. 2646 // callback.
2647 // TODO(piman): replace media::Context3D to scoped_refptr<ContextProvider> in 2647 // TODO(piman): replace media::Context3D to scoped_refptr<ContextProvider> in
2648 // media/ once ContextProvider is in gpu/. 2648 // media/ once ContextProvider is in gpu/.
2649 media::WebMediaPlayerParams::Context3DCB context_3d_cb = base::Bind( 2649 media::WebMediaPlayerParams::Context3DCB context_3d_cb = base::Bind(
2650 &GetSharedMainThreadContext3D, 2650 &GetSharedMainThreadContext3D,
2651 RenderThreadImpl::current()->SharedMainThreadContextProvider()); 2651 RenderThreadImpl::current()->SharedMainThreadContextProvider());
2652 2652
2653 scoped_refptr<media::MediaLog> media_log(new RenderMediaLog( 2653 scoped_refptr<media::MediaLog> media_log(
2654 blink::WebStringToGURL(frame_->getSecurityOrigin().toString()))); 2654 new RenderMediaLog(url::Origin(frame_->getSecurityOrigin()).GetURL()));
2655 2655
2656 #if defined(OS_ANDROID) 2656 #if defined(OS_ANDROID)
2657 if (UseWebMediaPlayerImpl(url) && !media_surface_manager_) 2657 if (UseWebMediaPlayerImpl(url) && !media_surface_manager_)
2658 media_surface_manager_ = new RendererSurfaceViewManager(this); 2658 media_surface_manager_ = new RendererSurfaceViewManager(this);
2659 #endif 2659 #endif
2660 media::WebMediaPlayerParams params( 2660 media::WebMediaPlayerParams params(
2661 base::Bind(&ContentRendererClient::DeferMediaLoad, 2661 base::Bind(&ContentRendererClient::DeferMediaLoad,
2662 base::Unretained(GetContentClient()->renderer()), 2662 base::Unretained(GetContentClient()->renderer()),
2663 static_cast<RenderFrame*>(this), 2663 static_cast<RenderFrame*>(this),
2664 GetWebMediaPlayerDelegate()->has_played_media()), 2664 GetWebMediaPlayerDelegate()->has_played_media()),
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 blink::WebStorageQuotaType type, 4307 blink::WebStorageQuotaType type,
4308 unsigned long long requested_size, 4308 unsigned long long requested_size,
4309 blink::WebStorageQuotaCallbacks callbacks) { 4309 blink::WebStorageQuotaCallbacks callbacks) {
4310 WebSecurityOrigin origin = frame_->document().getSecurityOrigin(); 4310 WebSecurityOrigin origin = frame_->document().getSecurityOrigin();
4311 if (origin.isUnique()) { 4311 if (origin.isUnique()) {
4312 // Unique origins cannot store persistent state. 4312 // Unique origins cannot store persistent state.
4313 callbacks.didFail(blink::WebStorageQuotaErrorAbort); 4313 callbacks.didFail(blink::WebStorageQuotaErrorAbort);
4314 return; 4314 return;
4315 } 4315 }
4316 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota( 4316 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota(
4317 render_view_->GetRoutingID(), 4317 render_view_->GetRoutingID(), url::Origin(origin).GetURL(),
4318 blink::WebStringToGURL(origin.toString()), 4318 static_cast<storage::StorageType>(type), requested_size,
4319 static_cast<storage::StorageType>(type),
4320 requested_size,
4321 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); 4319 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks));
4322 } 4320 }
4323 4321
4324 blink::WebPresentationClient* RenderFrameImpl::presentationClient() { 4322 blink::WebPresentationClient* RenderFrameImpl::presentationClient() {
4325 if (!presentation_dispatcher_) 4323 if (!presentation_dispatcher_)
4326 presentation_dispatcher_ = new PresentationDispatcher(this); 4324 presentation_dispatcher_ = new PresentationDispatcher(this);
4327 return presentation_dispatcher_; 4325 return presentation_dispatcher_;
4328 } 4326 }
4329 4327
4330 blink::WebPushClient* RenderFrameImpl::pushClient() { 4328 blink::WebPushClient* RenderFrameImpl::pushClient() {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
4393 return WebString::fromUTF8("1"); 4391 return WebString::fromUTF8("1");
4394 return WebString(); 4392 return WebString();
4395 } 4393 }
4396 4394
4397 bool RenderFrameImpl::allowWebGL(bool default_value) { 4395 bool RenderFrameImpl::allowWebGL(bool default_value) {
4398 if (!default_value) 4396 if (!default_value)
4399 return false; 4397 return false;
4400 4398
4401 bool blocked = true; 4399 bool blocked = true;
4402 Send(new FrameHostMsg_Are3DAPIsBlocked( 4400 Send(new FrameHostMsg_Are3DAPIsBlocked(
4403 routing_id_, 4401 routing_id_, url::Origin(frame_->top()->getSecurityOrigin()).GetURL(),
4404 blink::WebStringToGURL(frame_->top()->getSecurityOrigin().toString()),
4405 THREE_D_API_TYPE_WEBGL, &blocked)); 4402 THREE_D_API_TYPE_WEBGL, &blocked));
4406 return !blocked; 4403 return !blocked;
4407 } 4404 }
4408 4405
4409 blink::WebScreenOrientationClient* 4406 blink::WebScreenOrientationClient*
4410 RenderFrameImpl::webScreenOrientationClient() { 4407 RenderFrameImpl::webScreenOrientationClient() {
4411 if (!screen_orientation_dispatcher_) 4408 if (!screen_orientation_dispatcher_)
4412 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this); 4409 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this);
4413 return screen_orientation_dispatcher_; 4410 return screen_orientation_dispatcher_;
4414 } 4411 }
(...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after
5834 #if defined(ENABLE_WEBRTC) 5831 #if defined(ENABLE_WEBRTC)
5835 RenderThreadImpl* const render_thread = RenderThreadImpl::current(); 5832 RenderThreadImpl* const render_thread = RenderThreadImpl::current();
5836 5833
5837 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = 5834 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner =
5838 render_thread->compositor_task_runner(); 5835 render_thread->compositor_task_runner();
5839 if (!compositor_task_runner.get()) 5836 if (!compositor_task_runner.get())
5840 compositor_task_runner = base::ThreadTaskRunnerHandle::Get(); 5837 compositor_task_runner = base::ThreadTaskRunnerHandle::Get();
5841 5838
5842 return new WebMediaPlayerMS( 5839 return new WebMediaPlayerMS(
5843 frame_, client, GetWebMediaPlayerDelegate()->AsWeakPtr(), 5840 frame_, client, GetWebMediaPlayerDelegate()->AsWeakPtr(),
5844 new RenderMediaLog(blink::WebStringToGURL(security_origin.toString())), 5841 new RenderMediaLog(url::Origin(security_origin).GetURL()),
5845 CreateRendererFactory(), compositor_task_runner, 5842 CreateRendererFactory(), compositor_task_runner,
5846 render_thread->GetMediaThreadTaskRunner(), 5843 render_thread->GetMediaThreadTaskRunner(),
5847 render_thread->GetWorkerTaskRunner(), render_thread->GetGpuFactories(), 5844 render_thread->GetWorkerTaskRunner(), render_thread->GetGpuFactories(),
5848 sink_id, security_origin); 5845 sink_id, security_origin);
5849 #else 5846 #else
5850 return NULL; 5847 return NULL;
5851 #endif // defined(ENABLE_WEBRTC) 5848 #endif // defined(ENABLE_WEBRTC)
5852 } 5849 }
5853 5850
5854 std::unique_ptr<MediaStreamRendererFactory> 5851 std::unique_ptr<MediaStreamRendererFactory>
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
6430 // event target. Potentially a Pepper plugin will receive the event. 6427 // event target. Potentially a Pepper plugin will receive the event.
6431 // In order to tell whether a plugin gets the last mouse event and which it 6428 // In order to tell whether a plugin gets the last mouse event and which it
6432 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6429 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6433 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6430 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6434 // |pepper_last_mouse_event_target_|. 6431 // |pepper_last_mouse_event_target_|.
6435 pepper_last_mouse_event_target_ = nullptr; 6432 pepper_last_mouse_event_target_ = nullptr;
6436 #endif 6433 #endif
6437 } 6434 }
6438 6435
6439 } // namespace content 6436 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698