OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "net/base/escape.h" | 11 #include "net/base/escape.h" |
12 #include "net/base/load_flags.h" | 12 #include "net/base/load_flags.h" |
13 #include "net/url_request/url_request.h" | 13 #include "net/url_request/url_request.h" |
14 #include "net/url_request/url_request_redirect_job.h" | 14 #include "net/url_request/url_request_redirect_job.h" |
15 #include "webkit/glue/plugins/plugin_list.h" | 15 #include "webkit/plugins/npapi/plugin_list.h" |
16 | 16 |
17 namespace chromeos { | 17 namespace chromeos { |
18 | 18 |
19 // The PDF mime type is treated special if the browser has a built-in | 19 // The PDF mime type is treated special if the browser has a built-in |
20 // PDF viewer plug-in installed - we want to intercept only if we're | 20 // PDF viewer plug-in installed - we want to intercept only if we're |
21 // told to. | 21 // told to. |
22 static const char kPdfMimeType[] = "application/pdf"; | 22 static const char kPdfMimeType[] = "application/pdf"; |
23 | 23 |
24 // This is the list of mime types currently supported by the Google | 24 // This is the list of mime types currently supported by the Google |
25 // Document Viewer. | 25 // Document Viewer. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // will redirect the browser to this new URL. | 77 // will redirect the browser to this new URL. |
78 if (supported_mime_types_.count(mime_type) > 0) { | 78 if (supported_mime_types_.count(mime_type) > 0) { |
79 std::string url(kGViewUrlPrefix); | 79 std::string url(kGViewUrlPrefix); |
80 url += EscapePath(request->url().spec()); | 80 url += EscapePath(request->url().spec()); |
81 return new net::URLRequestRedirectJob(request, GURL(url)); | 81 return new net::URLRequestRedirectJob(request, GURL(url)); |
82 } | 82 } |
83 return NULL; | 83 return NULL; |
84 } | 84 } |
85 | 85 |
86 } // namespace chromeos | 86 } // namespace chromeos |
OLD | NEW |