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/chromeos/gview_request_interceptor.h" | 5 #include "chrome/browser/chromeos/gview_request_interceptor.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "chrome/browser/chrome_plugin_service_filter.h" | 9 #include "chrome/browser/chrome_plugin_service_filter.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // redirect PDF files to Google Document Viewer. | 106 // redirect PDF files to Google Document Viewer. |
107 if (mime_type == kPdfMimeType && ShouldUsePdfPlugin(request)) | 107 if (mime_type == kPdfMimeType && ShouldUsePdfPlugin(request)) |
108 return NULL; | 108 return NULL; |
109 | 109 |
110 // If supported, build the URL to the Google Document Viewer | 110 // If supported, build the URL to the Google Document Viewer |
111 // including the origial document's URL, then create a new job that | 111 // including the origial document's URL, then create a new job that |
112 // will redirect the browser to this new URL. | 112 // will redirect the browser to this new URL. |
113 if (supported_mime_types_.count(mime_type) > 0) { | 113 if (supported_mime_types_.count(mime_type) > 0) { |
114 std::string url(kGViewUrlPrefix); | 114 std::string url(kGViewUrlPrefix); |
115 url += net::EscapePath(request->url().spec()); | 115 url += net::EscapePath(request->url().spec()); |
116 return new net::URLRequestRedirectJob(request, network_delegate, GURL(url)); | 116 return new net::URLRequestRedirectJob( |
| 117 request, network_delegate, GURL(url), |
| 118 net::URLRequestRedirectJob::REDIRECT_302_FOUND); |
117 } | 119 } |
118 return NULL; | 120 return NULL; |
119 } | 121 } |
120 | 122 |
121 } // namespace chromeos | 123 } // namespace chromeos |
OLD | NEW |