OLD | NEW |
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 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 render_view_id); | 99 render_view_id); |
100 if (!rvh) | 100 if (!rvh) |
101 return; | 101 return; |
102 | 102 |
103 content::NotificationService::current()->Notify( | 103 content::NotificationService::current()->Notify( |
104 chrome::NOTIFICATION_DOWNLOAD_INITIATED, | 104 chrome::NOTIFICATION_DOWNLOAD_INITIATED, |
105 content::Source<RenderViewHost>(rvh), | 105 content::Source<RenderViewHost>(rvh), |
106 content::NotificationService::NoDetails()); | 106 content::NotificationService::NoDetails()); |
107 } | 107 } |
108 | 108 |
| 109 #if !defined(OS_ANDROID) |
109 // Goes through the extension's file browser handlers and checks if there is one | 110 // Goes through the extension's file browser handlers and checks if there is one |
110 // that can handle the |mime_type|. | 111 // that can handle the |mime_type|. |
111 // |extension| must not be NULL. | 112 // |extension| must not be NULL. |
112 bool ExtensionCanHandleMimeType(const Extension* extension, | 113 bool ExtensionCanHandleMimeType(const Extension* extension, |
113 const std::string& mime_type) { | 114 const std::string& mime_type) { |
114 MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension); | 115 MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension); |
115 if (!handler) | 116 if (!handler) |
116 return false; | 117 return false; |
117 | 118 |
118 return handler->CanHandleMIMEType(mime_type); | 119 return handler->CanHandleMIMEType(mime_type); |
(...skipping 23 matching lines...) Expand all Loading... |
142 Profile* profile = Profile::FromBrowserContext(browser_context); | 143 Profile* profile = Profile::FromBrowserContext(browser_context); |
143 if (!profile) | 144 if (!profile) |
144 return; | 145 return; |
145 | 146 |
146 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile); | 147 StreamsPrivateAPI* streams_private = StreamsPrivateAPI::Get(profile); |
147 if (!streams_private) | 148 if (!streams_private) |
148 return; | 149 return; |
149 streams_private->ExecuteMimeTypeHandler( | 150 streams_private->ExecuteMimeTypeHandler( |
150 extension_id, web_contents, stream.Pass(), expected_content_size); | 151 extension_id, web_contents, stream.Pass(), expected_content_size); |
151 } | 152 } |
| 153 #endif // !defined(OS_ANDROID) |
152 | 154 |
153 enum PrerenderSchemeCancelReason { | 155 enum PrerenderSchemeCancelReason { |
154 PRERENDER_SCHEME_CANCEL_REASON_EXTERNAL_PROTOCOL, | 156 PRERENDER_SCHEME_CANCEL_REASON_EXTERNAL_PROTOCOL, |
155 PRERENDER_SCHEME_CANCEL_REASON_DATA, | 157 PRERENDER_SCHEME_CANCEL_REASON_DATA, |
156 PRERENDER_SCHEME_CANCEL_REASON_BLOB, | 158 PRERENDER_SCHEME_CANCEL_REASON_BLOB, |
157 PRERENDER_SCHEME_CANCEL_REASON_FILE, | 159 PRERENDER_SCHEME_CANCEL_REASON_FILE, |
158 PRERENDER_SCHEME_CANCEL_REASON_FILESYSTEM, | 160 PRERENDER_SCHEME_CANCEL_REASON_FILESYSTEM, |
159 PRERENDER_SCHEME_CANCEL_REASON_WEBSOCKET, | 161 PRERENDER_SCHEME_CANCEL_REASON_WEBSOCKET, |
160 PRERENDER_SCHEME_CANCEL_REASON_FTP, | 162 PRERENDER_SCHEME_CANCEL_REASON_FTP, |
161 PRERENDER_SCHEME_CANCEL_REASON_CHROME, | 163 PRERENDER_SCHEME_CANCEL_REASON_CHROME, |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && | 733 if (!prerender::PrerenderManager::DoesURLHaveValidScheme(redirect_url) && |
732 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( | 734 ResourceRequestInfo::ForRequest(request)->GetAssociatedRenderView( |
733 &child_id, &route_id) && | 735 &child_id, &route_id) && |
734 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id) && | 736 prerender_tracker_->IsPrerenderingOnIOThread(child_id, route_id) && |
735 prerender_tracker_->TryCancel( | 737 prerender_tracker_->TryCancel( |
736 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME)) { | 738 child_id, route_id, prerender::FINAL_STATUS_UNSUPPORTED_SCHEME)) { |
737 ReportUnsupportedPrerenderScheme(redirect_url); | 739 ReportUnsupportedPrerenderScheme(redirect_url); |
738 request->Cancel(); | 740 request->Cancel(); |
739 } | 741 } |
740 } | 742 } |
OLD | NEW |