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

Side by Side Diff: chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc

Issue 726343002: OOP PDF: Add whether a resource is embedded to StreamInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@embedded-pdfs
Patch Set: !streamDetails.embedded => 'full-frame' 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 if (prerender_manager) 169 if (prerender_manager)
170 prerender_manager->AddProfileNetworkBytesIfEnabled(bytes); 170 prerender_manager->AddProfileNetworkBytesIfEnabled(bytes);
171 } 171 }
172 172
173 #if defined(ENABLE_EXTENSIONS) 173 #if defined(ENABLE_EXTENSIONS)
174 void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamInfo> stream, 174 void SendExecuteMimeTypeHandlerEvent(scoped_ptr<content::StreamInfo> stream,
175 int64 expected_content_size, 175 int64 expected_content_size,
176 int render_process_id, 176 int render_process_id,
177 int render_view_id, 177 int render_view_id,
178 const std::string& extension_id, 178 const std::string& extension_id,
179 const std::string& view_id) { 179 const std::string& view_id,
180 bool embedded) {
180 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 181 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
181 182
182 content::WebContents* web_contents = 183 content::WebContents* web_contents =
183 tab_util::GetWebContentsByID(render_process_id, render_view_id); 184 tab_util::GetWebContentsByID(render_process_id, render_view_id);
184 if (!web_contents) 185 if (!web_contents)
185 return; 186 return;
186 187
187 // If the request was for a prerender, abort the prerender and do not 188 // If the request was for a prerender, abort the prerender and do not
188 // continue. 189 // continue.
189 prerender::PrerenderContents* prerender_contents = 190 prerender::PrerenderContents* prerender_contents =
190 prerender::PrerenderContents::FromWebContents(web_contents); 191 prerender::PrerenderContents::FromWebContents(web_contents);
191 if (prerender_contents) { 192 if (prerender_contents) {
192 prerender_contents->Destroy(prerender::FINAL_STATUS_DOWNLOAD); 193 prerender_contents->Destroy(prerender::FINAL_STATUS_DOWNLOAD);
193 return; 194 return;
194 } 195 }
195 196
196 Profile* profile = 197 Profile* profile =
197 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 198 Profile::FromBrowserContext(web_contents->GetBrowserContext());
198 199
199 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile); 200 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile);
200 if (!streams_private) 201 if (!streams_private)
201 return; 202 return;
202 streams_private->ExecuteMimeTypeHandler( 203 streams_private->ExecuteMimeTypeHandler(extension_id, web_contents,
203 extension_id, web_contents, stream.Pass(), view_id, 204 stream.Pass(), view_id,
204 expected_content_size); 205 expected_content_size, embedded);
205 } 206 }
206 #endif // !defined(ENABLE_EXTENSIONS) 207 #endif // !defined(ENABLE_EXTENSIONS)
207 208
208 #if !defined(OS_ANDROID) 209 #if !defined(OS_ANDROID)
209 void LaunchURL(const GURL& url, int render_process_id, int render_view_id) { 210 void LaunchURL(const GURL& url, int render_process_id, int render_view_id) {
210 // If there is no longer a WebContents, the request may have raced with tab 211 // If there is no longer a WebContents, the request may have raced with tab
211 // closing. Don't fire the external request. (It may have been a prerender.) 212 // closing. Don't fire the external request. (It may have been a prerender.)
212 content::WebContents* web_contents = 213 content::WebContents* web_contents =
213 tab_util::GetWebContentsByID(render_process_id, render_view_id); 214 tab_util::GetWebContentsByID(render_process_id, render_view_id);
214 if (!web_contents) 215 if (!web_contents)
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 net::URLRequest* request, 628 net::URLRequest* request,
628 scoped_ptr<content::StreamInfo> stream) { 629 scoped_ptr<content::StreamInfo> stream) {
629 #if defined(ENABLE_EXTENSIONS) 630 #if defined(ENABLE_EXTENSIONS)
630 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 631 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
631 std::map<net::URLRequest*, StreamTargetInfo>::iterator ix = 632 std::map<net::URLRequest*, StreamTargetInfo>::iterator ix =
632 stream_target_info_.find(request); 633 stream_target_info_.find(request);
633 CHECK(ix != stream_target_info_.end()); 634 CHECK(ix != stream_target_info_.end());
634 content::BrowserThread::PostTask( 635 content::BrowserThread::PostTask(
635 content::BrowserThread::UI, FROM_HERE, 636 content::BrowserThread::UI, FROM_HERE,
636 base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream), 637 base::Bind(&SendExecuteMimeTypeHandlerEvent, base::Passed(&stream),
637 request->GetExpectedContentSize(), 638 request->GetExpectedContentSize(), info->GetChildID(),
638 info->GetChildID(), info->GetRouteID(), 639 info->GetRouteID(), ix->second.extension_id,
639 ix->second.extension_id, ix->second.view_id)); 640 ix->second.view_id,
641 info->GetResourceType() != content::RESOURCE_TYPE_MAIN_FRAME));
raymes 2014/11/17 04:09:38 nit: maybe just split this out into a separate sta
Sam McNally 2014/11/17 04:31:29 Done.
640 stream_target_info_.erase(request); 642 stream_target_info_.erase(request);
641 #endif 643 #endif
642 } 644 }
643 645
644 void ChromeResourceDispatcherHostDelegate::OnResponseStarted( 646 void ChromeResourceDispatcherHostDelegate::OnResponseStarted(
645 net::URLRequest* request, 647 net::URLRequest* request,
646 content::ResourceContext* resource_context, 648 content::ResourceContext* resource_context,
647 content::ResourceResponse* response, 649 content::ResourceResponse* response,
648 IPC::Sender* sender) { 650 IPC::Sender* sender) {
649 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); 651 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 url_request->GetTotalReceivedBytes())); 763 url_request->GetTotalReceivedBytes()));
762 } 764 }
763 } 765 }
764 766
765 // static 767 // static
766 void ChromeResourceDispatcherHostDelegate:: 768 void ChromeResourceDispatcherHostDelegate::
767 SetExternalProtocolHandlerDelegateForTesting( 769 SetExternalProtocolHandlerDelegateForTesting(
768 ExternalProtocolHandler::Delegate* delegate) { 770 ExternalProtocolHandler::Delegate* delegate) {
769 g_external_protocol_handler_delegate = delegate; 771 g_external_protocol_handler_delegate = delegate;
770 } 772 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/streams_private/streams_private_api.cc ('k') | chrome/browser/resources/pdf/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698