OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/singleton.h" | 9 #include "base/singleton.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 net::URLRequest::RegisterRequestInterceptor(this); | 36 net::URLRequest::RegisterRequestInterceptor(this); |
37 for (size_t i = 0; i < arraysize(supported_mime_type_list); ++i) { | 37 for (size_t i = 0; i < arraysize(supported_mime_type_list); ++i) { |
38 supported_mime_types_.insert(supported_mime_type_list[i]); | 38 supported_mime_types_.insert(supported_mime_type_list[i]); |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 GViewRequestInterceptor::~GViewRequestInterceptor() { | 42 GViewRequestInterceptor::~GViewRequestInterceptor() { |
43 net::URLRequest::UnregisterRequestInterceptor(this); | 43 net::URLRequest::UnregisterRequestInterceptor(this); |
44 } | 44 } |
45 | 45 |
46 URLRequestJob* GViewRequestInterceptor::MaybeIntercept( | 46 net::URLRequestJob* GViewRequestInterceptor::MaybeIntercept( |
47 net::URLRequest* request) { | 47 net::URLRequest* request) { |
48 // Don't attempt to intercept here as we want to wait until the mime | 48 // Don't attempt to intercept here as we want to wait until the mime |
49 // type is fully determined. | 49 // type is fully determined. |
50 return NULL; | 50 return NULL; |
51 } | 51 } |
52 | 52 |
53 URLRequestJob* GViewRequestInterceptor::MaybeInterceptResponse( | 53 net::URLRequestJob* GViewRequestInterceptor::MaybeInterceptResponse( |
54 net::URLRequest* request) { | 54 net::URLRequest* request) { |
55 // Do not intercept this request if it is a download. | 55 // Do not intercept this request if it is a download. |
56 if (request->load_flags() & net::LOAD_IS_DOWNLOAD) { | 56 if (request->load_flags() & net::LOAD_IS_DOWNLOAD) { |
57 return NULL; | 57 return NULL; |
58 } | 58 } |
59 | 59 |
60 std::string mime_type; | 60 std::string mime_type; |
61 request->GetMimeType(&mime_type); | 61 request->GetMimeType(&mime_type); |
62 // If the local PDF viewing plug-in is installed and enabled, don't | 62 // If the local PDF viewing plug-in is installed and enabled, don't |
63 // redirect PDF files to Google Document Viewer. | 63 // redirect PDF files to Google Document Viewer. |
(...skipping 15 matching lines...) Expand all Loading... |
79 } | 79 } |
80 return NULL; | 80 return NULL; |
81 } | 81 } |
82 | 82 |
83 net::URLRequest::Interceptor* | 83 net::URLRequest::Interceptor* |
84 GViewRequestInterceptor::GetGViewRequestInterceptor() { | 84 GViewRequestInterceptor::GetGViewRequestInterceptor() { |
85 return Singleton<GViewRequestInterceptor>::get(); | 85 return Singleton<GViewRequestInterceptor>::get(); |
86 } | 86 } |
87 | 87 |
88 } // namespace chromeos | 88 } // namespace chromeos |
OLD | NEW |