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

Side by Side Diff: extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc

Issue 694773003: Allow URL requests for object/embed tags to be intercepted as streams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-guest-view-container-3
Patch Set: Created 6 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
« no previous file with comments | « extensions/browser/api/declarative_webrequest/webrequest_condition_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_con tainer.h" 5 #include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_con tainer.h"
6 6
7 #include "content/public/renderer/render_frame.h" 7 #include "content/public/renderer/render_frame.h"
8 #include "extensions/common/extension_messages.h" 8 #include "extensions/common/extension_messages.h"
9 #include "extensions/common/guest_view/guest_view_constants.h" 9 #include "extensions/common/guest_view/guest_view_constants.h"
10 #include "third_party/WebKit/public/web/WebDocument.h" 10 #include "third_party/WebKit/public/web/WebDocument.h"
(...skipping 27 matching lines...) Expand all
38 html_string_ += std::string(data, data_length); 38 html_string_ += std::string(data, data_length);
39 } 39 }
40 40
41 void MimeHandlerViewContainer::Ready() { 41 void MimeHandlerViewContainer::Ready() {
42 blink::WebFrame* frame = render_frame()->GetWebFrame(); 42 blink::WebFrame* frame = render_frame()->GetWebFrame();
43 blink::WebURLLoaderOptions options; 43 blink::WebURLLoaderOptions options;
44 // The embedded plugin is allowed to be cross-origin. 44 // The embedded plugin is allowed to be cross-origin.
45 options.crossOriginRequestPolicy = 45 options.crossOriginRequestPolicy =
46 blink::WebURLLoaderOptions::CrossOriginRequestPolicyAllow; 46 blink::WebURLLoaderOptions::CrossOriginRequestPolicyAllow;
47 DCHECK(!loader_); 47 DCHECK(!loader_);
48 loader_.reset(frame->createAssociatedURLLoader()); 48 loader_.reset(frame->createAssociatedURLLoader(options));
49 49
50 // TODO(raymes): Currently this URL request won't be correctly intercepted as 50 blink::WebURLRequest request(original_url_);
51 // a stream. 51 request.setRequestContext(blink::WebURLRequest::RequestContextObject);
52 loader_->loadAsynchronously(blink::WebURLRequest(original_url_), this); 52 loader_->loadAsynchronously(request, this);
53 } 53 }
54 54
55 bool MimeHandlerViewContainer::HandlesMessage(const IPC::Message& message) { 55 bool MimeHandlerViewContainer::HandlesMessage(const IPC::Message& message) {
56 return message.type() == ExtensionMsg_CreateMimeHandlerViewGuestACK::ID; 56 return message.type() == ExtensionMsg_CreateMimeHandlerViewGuestACK::ID;
57 } 57 }
58 58
59 bool MimeHandlerViewContainer::OnMessage(const IPC::Message& message) { 59 bool MimeHandlerViewContainer::OnMessage(const IPC::Message& message) {
60 bool handled = true; 60 bool handled = true;
61 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewContainer, message) 61 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewContainer, message)
62 IPC_MESSAGE_HANDLER(ExtensionMsg_CreateMimeHandlerViewGuestACK, 62 IPC_MESSAGE_HANDLER(ExtensionMsg_CreateMimeHandlerViewGuestACK,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // Parse the stream URL to ensure it's valid. 95 // Parse the stream URL to ensure it's valid.
96 GURL stream_url(html_string_); 96 GURL stream_url(html_string_);
97 97
98 DCHECK_NE(element_instance_id(), guestview::kInstanceIDNone); 98 DCHECK_NE(element_instance_id(), guestview::kInstanceIDNone);
99 render_frame()->Send(new ExtensionHostMsg_CreateMimeHandlerViewGuest( 99 render_frame()->Send(new ExtensionHostMsg_CreateMimeHandlerViewGuest(
100 routing_id(), stream_url.spec(), original_url_.spec(), mime_type_, 100 routing_id(), stream_url.spec(), original_url_.spec(), mime_type_,
101 element_instance_id())); 101 element_instance_id()));
102 } 102 }
103 103
104 } // namespace extensions 104 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/declarative_webrequest/webrequest_condition_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698