OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/url_request_util.h" | 5 #include "chrome/browser/extensions/url_request_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void OnMimeTypeRead(std::string* out_mime_type, | 100 void OnMimeTypeRead(std::string* out_mime_type, |
101 std::string* charset, | 101 std::string* charset, |
102 std::string* data, | 102 std::string* data, |
103 std::string* read_mime_type, | 103 std::string* read_mime_type, |
104 const net::CompletionCallback& callback, | 104 const net::CompletionCallback& callback, |
105 bool read_result) { | 105 bool read_result) { |
106 *out_mime_type = *read_mime_type; | 106 *out_mime_type = *read_mime_type; |
107 if (StartsWithASCII(*read_mime_type, "text/", false)) { | 107 if (StartsWithASCII(*read_mime_type, "text/", false)) { |
108 // All of our HTML files should be UTF-8 and for other resource types | 108 // All of our HTML files should be UTF-8 and for other resource types |
109 // (like images), charset doesn't matter. | 109 // (like images), charset doesn't matter. |
110 DCHECK(IsStringUTF8(*data)); | 110 DCHECK(base::IsStringUTF8(*data)); |
111 *charset = "utf-8"; | 111 *charset = "utf-8"; |
112 } | 112 } |
113 int result = read_result ? net::OK : net::ERR_INVALID_URL; | 113 int result = read_result ? net::OK : net::ERR_INVALID_URL; |
114 callback.Run(result); | 114 callback.Run(result); |
115 } | 115 } |
116 | 116 |
117 // We need the filename of the resource to determine the mime type. | 117 // We need the filename of the resource to determine the mime type. |
118 base::FilePath filename_; | 118 base::FilePath filename_; |
119 | 119 |
120 // The resource bundle id to load. | 120 // The resource bundle id to load. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 content::ResourceRequestInfo::ForRequest(request); | 244 content::ResourceRequestInfo::ForRequest(request); |
245 ExtensionRendererState* renderer_state = | 245 ExtensionRendererState* renderer_state = |
246 ExtensionRendererState::GetInstance(); | 246 ExtensionRendererState::GetInstance(); |
247 ExtensionRendererState::WebViewInfo webview_info; | 247 ExtensionRendererState::WebViewInfo webview_info; |
248 return renderer_state->GetWebViewInfo( | 248 return renderer_state->GetWebViewInfo( |
249 info->GetChildID(), info->GetRouteID(), &webview_info); | 249 info->GetChildID(), info->GetRouteID(), &webview_info); |
250 } | 250 } |
251 | 251 |
252 } // namespace url_request_util | 252 } // namespace url_request_util |
253 } // namespace extensions | 253 } // namespace extensions |
OLD | NEW |