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_frame/urlmon_bind_status_callback.h" | 5 #include "chrome_frame/urlmon_bind_status_callback.h" |
6 | 6 |
7 #include <mshtml.h> | 7 #include <mshtml.h> |
8 #include <shlguid.h> | 8 #include <shlguid.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 renderer_type_ = CHROME; | 176 renderer_type_ = CHROME; |
177 } else { | 177 } else { |
178 if (is_cache_valid() && cache_) { | 178 if (is_cache_valid() && cache_) { |
179 HGLOBAL memory = NULL; | 179 HGLOBAL memory = NULL; |
180 GetHGlobalFromStream(cache_, &memory); | 180 GetHGlobalFromStream(cache_, &memory); |
181 const char* buffer = reinterpret_cast<const char*>(GlobalLock(memory)); | 181 const char* buffer = reinterpret_cast<const char*>(GlobalLock(memory)); |
182 | 182 |
183 std::wstring html_contents; | 183 std::wstring html_contents; |
184 // TODO(joshia): detect and handle different content encodings | 184 // TODO(joshia): detect and handle different content encodings |
185 if (buffer && size_) { | 185 if (buffer && size_) { |
186 UTF8ToWide(buffer, std::min(size_, kMaxSniffSize), &html_contents); | 186 base::UTF8ToWide(buffer, std::min(size_, kMaxSniffSize), |
| 187 &html_contents); |
187 GlobalUnlock(memory); | 188 GlobalUnlock(memory); |
188 } | 189 } |
189 | 190 |
190 // Note that document_contents_ may have NULL characters in it. While | 191 // Note that document_contents_ may have NULL characters in it. While |
191 // browsers may handle this properly, we don't and will stop scanning | 192 // browsers may handle this properly, we don't and will stop scanning |
192 // for the XUACompat content value if we encounter one. | 193 // for the XUACompat content value if we encounter one. |
193 std::wstring xua_compat_content; | 194 std::wstring xua_compat_content; |
194 UtilGetXUACompatContentValue(html_contents, &xua_compat_content); | 195 UtilGetXUACompatContentValue(html_contents, &xua_compat_content); |
195 if (StrStrI(xua_compat_content.c_str(), kChromeContentPrefix)) { | 196 if (StrStrI(xua_compat_content.c_str(), kChromeContentPrefix)) { |
196 renderer_type_ = CHROME; | 197 renderer_type_ = CHROME; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 case BINDSTATUS_CACHEFILENAMEAVAILABLE: | 421 case BINDSTATUS_CACHEFILENAMEAVAILABLE: |
421 case BINDSTATUS_SERVER_MIMETYPEAVAILABLE: | 422 case BINDSTATUS_SERVER_MIMETYPEAVAILABLE: |
422 return true; | 423 return true; |
423 default: | 424 default: |
424 break; | 425 break; |
425 } | 426 } |
426 } | 427 } |
427 | 428 |
428 return false; | 429 return false; |
429 } | 430 } |
OLD | NEW |