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

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

Issue 2382973002: Convert WebSecurityOrigin -> GURL without re-parsing the url (Closed)
Patch Set: rebase on #427122 Created 4 years, 1 month 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 #include "third_party/WebKit/public/web/WebScopedUserGesture.h" 195 #include "third_party/WebKit/public/web/WebScopedUserGesture.h"
196 #include "third_party/WebKit/public/web/WebScriptSource.h" 196 #include "third_party/WebKit/public/web/WebScriptSource.h"
197 #include "third_party/WebKit/public/web/WebSearchableFormData.h" 197 #include "third_party/WebKit/public/web/WebSearchableFormData.h"
198 #include "third_party/WebKit/public/web/WebSecurityPolicy.h" 198 #include "third_party/WebKit/public/web/WebSecurityPolicy.h"
199 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h" 199 #include "third_party/WebKit/public/web/WebSerializedScriptValue.h"
200 #include "third_party/WebKit/public/web/WebSettings.h" 200 #include "third_party/WebKit/public/web/WebSettings.h"
201 #include "third_party/WebKit/public/web/WebSurroundingText.h" 201 #include "third_party/WebKit/public/web/WebSurroundingText.h"
202 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" 202 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
203 #include "third_party/WebKit/public/web/WebView.h" 203 #include "third_party/WebKit/public/web/WebView.h"
204 #include "third_party/WebKit/public/web/WebWidget.h" 204 #include "third_party/WebKit/public/web/WebWidget.h"
205 #include "url/origin.h"
205 #include "url/url_constants.h" 206 #include "url/url_constants.h"
206 #include "url/url_util.h" 207 #include "url/url_util.h"
207 208
208 #if defined(ENABLE_PLUGINS) 209 #if defined(ENABLE_PLUGINS)
209 #include "content/renderer/pepper/pepper_browser_connection.h" 210 #include "content/renderer/pepper/pepper_browser_connection.h"
210 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 211 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
211 #include "content/renderer/pepper/pepper_plugin_registry.h" 212 #include "content/renderer/pepper/pepper_plugin_registry.h"
212 #include "content/renderer/pepper/pepper_webplugin_impl.h" 213 #include "content/renderer/pepper/pepper_webplugin_impl.h"
213 #include "content/renderer/pepper/plugin_module.h" 214 #include "content/renderer/pepper/plugin_module.h"
214 #endif 215 #endif
(...skipping 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 sink_id.utf8(), frame_->getSecurityOrigin()); 2713 sink_id.utf8(), frame_->getSecurityOrigin());
2713 // We need to keep a reference to the context provider (see crbug.com/610527) 2714 // We need to keep a reference to the context provider (see crbug.com/610527)
2714 // but media/ can't depend on cc/, so for now, just keep a reference in the 2715 // but media/ can't depend on cc/, so for now, just keep a reference in the
2715 // callback. 2716 // callback.
2716 // TODO(piman): replace media::Context3D to scoped_refptr<ContextProvider> in 2717 // TODO(piman): replace media::Context3D to scoped_refptr<ContextProvider> in
2717 // media/ once ContextProvider is in gpu/. 2718 // media/ once ContextProvider is in gpu/.
2718 media::WebMediaPlayerParams::Context3DCB context_3d_cb = base::Bind( 2719 media::WebMediaPlayerParams::Context3DCB context_3d_cb = base::Bind(
2719 &GetSharedMainThreadContext3D, 2720 &GetSharedMainThreadContext3D,
2720 RenderThreadImpl::current()->SharedMainThreadContextProvider()); 2721 RenderThreadImpl::current()->SharedMainThreadContextProvider());
2721 2722
2722 scoped_refptr<media::MediaLog> media_log(new RenderMediaLog( 2723 scoped_refptr<media::MediaLog> media_log(
2723 blink::WebStringToGURL(frame_->getSecurityOrigin().toString()))); 2724 new RenderMediaLog(url::Origin(frame_->getSecurityOrigin()).GetURL()));
2724 2725
2725 #if defined(OS_ANDROID) 2726 #if defined(OS_ANDROID)
2726 if (UseWebMediaPlayerImpl(url) && !media_surface_manager_) 2727 if (UseWebMediaPlayerImpl(url) && !media_surface_manager_)
2727 media_surface_manager_ = new RendererSurfaceViewManager(this); 2728 media_surface_manager_ = new RendererSurfaceViewManager(this);
2728 #endif // defined(OS_ANDROID) 2729 #endif // defined(OS_ANDROID)
2729 2730
2730 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) 2731 #if BUILDFLAG(ENABLE_MEDIA_REMOTING)
2731 std::unique_ptr<media::RemotingController> remoting_controller = 2732 std::unique_ptr<media::RemotingController> remoting_controller =
2732 CreateRemotingController(); 2733 CreateRemotingController();
2733 base::WeakPtr<media::MediaObserver> media_observer = 2734 base::WeakPtr<media::MediaObserver> media_observer =
(...skipping 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after
4437 blink::WebStorageQuotaType type, 4438 blink::WebStorageQuotaType type,
4438 unsigned long long requested_size, 4439 unsigned long long requested_size,
4439 blink::WebStorageQuotaCallbacks callbacks) { 4440 blink::WebStorageQuotaCallbacks callbacks) {
4440 WebSecurityOrigin origin = frame_->document().getSecurityOrigin(); 4441 WebSecurityOrigin origin = frame_->document().getSecurityOrigin();
4441 if (origin.isUnique()) { 4442 if (origin.isUnique()) {
4442 // Unique origins cannot store persistent state. 4443 // Unique origins cannot store persistent state.
4443 callbacks.didFail(blink::WebStorageQuotaErrorAbort); 4444 callbacks.didFail(blink::WebStorageQuotaErrorAbort);
4444 return; 4445 return;
4445 } 4446 }
4446 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota( 4447 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota(
4447 render_view_->GetRoutingID(), 4448 render_view_->GetRoutingID(), url::Origin(origin).GetURL(),
4448 blink::WebStringToGURL(origin.toString()), 4449 static_cast<storage::StorageType>(type), requested_size,
4449 static_cast<storage::StorageType>(type),
4450 requested_size,
4451 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); 4450 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks));
4452 } 4451 }
4453 4452
4454 blink::WebPresentationClient* RenderFrameImpl::presentationClient() { 4453 blink::WebPresentationClient* RenderFrameImpl::presentationClient() {
4455 if (!presentation_dispatcher_) 4454 if (!presentation_dispatcher_)
4456 presentation_dispatcher_ = new PresentationDispatcher(this); 4455 presentation_dispatcher_ = new PresentationDispatcher(this);
4457 return presentation_dispatcher_; 4456 return presentation_dispatcher_;
4458 } 4457 }
4459 4458
4460 blink::WebPushClient* RenderFrameImpl::pushClient() { 4459 blink::WebPushClient* RenderFrameImpl::pushClient() {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
4523 return WebString::fromUTF8("1"); 4522 return WebString::fromUTF8("1");
4524 return WebString(); 4523 return WebString();
4525 } 4524 }
4526 4525
4527 bool RenderFrameImpl::allowWebGL(bool default_value) { 4526 bool RenderFrameImpl::allowWebGL(bool default_value) {
4528 if (!default_value) 4527 if (!default_value)
4529 return false; 4528 return false;
4530 4529
4531 bool blocked = true; 4530 bool blocked = true;
4532 Send(new FrameHostMsg_Are3DAPIsBlocked( 4531 Send(new FrameHostMsg_Are3DAPIsBlocked(
4533 routing_id_, 4532 routing_id_, url::Origin(frame_->top()->getSecurityOrigin()).GetURL(),
4534 blink::WebStringToGURL(frame_->top()->getSecurityOrigin().toString()),
4535 THREE_D_API_TYPE_WEBGL, &blocked)); 4533 THREE_D_API_TYPE_WEBGL, &blocked));
4536 return !blocked; 4534 return !blocked;
4537 } 4535 }
4538 4536
4539 blink::WebScreenOrientationClient* 4537 blink::WebScreenOrientationClient*
4540 RenderFrameImpl::webScreenOrientationClient() { 4538 RenderFrameImpl::webScreenOrientationClient() {
4541 if (!screen_orientation_dispatcher_) 4539 if (!screen_orientation_dispatcher_)
4542 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this); 4540 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this);
4543 return screen_orientation_dispatcher_; 4541 return screen_orientation_dispatcher_;
4544 } 4542 }
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
5974 #if defined(ENABLE_WEBRTC) 5972 #if defined(ENABLE_WEBRTC)
5975 RenderThreadImpl* const render_thread = RenderThreadImpl::current(); 5973 RenderThreadImpl* const render_thread = RenderThreadImpl::current();
5976 5974
5977 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = 5975 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner =
5978 render_thread->compositor_task_runner(); 5976 render_thread->compositor_task_runner();
5979 if (!compositor_task_runner.get()) 5977 if (!compositor_task_runner.get())
5980 compositor_task_runner = base::ThreadTaskRunnerHandle::Get(); 5978 compositor_task_runner = base::ThreadTaskRunnerHandle::Get();
5981 5979
5982 return new WebMediaPlayerMS( 5980 return new WebMediaPlayerMS(
5983 frame_, client, GetWebMediaPlayerDelegate()->AsWeakPtr(), 5981 frame_, client, GetWebMediaPlayerDelegate()->AsWeakPtr(),
5984 new RenderMediaLog(blink::WebStringToGURL(security_origin.toString())), 5982 new RenderMediaLog(url::Origin(security_origin).GetURL()),
5985 CreateRendererFactory(), compositor_task_runner, 5983 CreateRendererFactory(), compositor_task_runner,
5986 render_thread->GetMediaThreadTaskRunner(), 5984 render_thread->GetMediaThreadTaskRunner(),
5987 render_thread->GetWorkerTaskRunner(), render_thread->GetGpuFactories(), 5985 render_thread->GetWorkerTaskRunner(), render_thread->GetGpuFactories(),
5988 sink_id, security_origin); 5986 sink_id, security_origin);
5989 #else 5987 #else
5990 return NULL; 5988 return NULL;
5991 #endif // defined(ENABLE_WEBRTC) 5989 #endif // defined(ENABLE_WEBRTC)
5992 } 5990 }
5993 5991
5994 std::unique_ptr<MediaStreamRendererFactory> 5992 std::unique_ptr<MediaStreamRendererFactory>
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
6569 // event target. Potentially a Pepper plugin will receive the event. 6567 // event target. Potentially a Pepper plugin will receive the event.
6570 // In order to tell whether a plugin gets the last mouse event and which it 6568 // In order to tell whether a plugin gets the last mouse event and which it
6571 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6569 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6572 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6570 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6573 // |pepper_last_mouse_event_target_|. 6571 // |pepper_last_mouse_event_target_|.
6574 pepper_last_mouse_event_target_ = nullptr; 6572 pepper_last_mouse_event_target_ = nullptr;
6575 #endif 6573 #endif
6576 } 6574 }
6577 6575
6578 } // namespace content 6576 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/cdm/pepper_cdm_wrapper_impl.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698