OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 cache_.Release(); | 164 cache_.Release(); |
165 return hr; | 165 return hr; |
166 } | 166 } |
167 | 167 |
168 // Scan the buffer or OptIn URL list and decide if the renderer is | 168 // Scan the buffer or OptIn URL list and decide if the renderer is |
169 // to be switched. Last chance means there's no more data. | 169 // to be switched. Last chance means there's no more data. |
170 void SniffData::DetermineRendererType(bool last_chance) { | 170 void SniffData::DetermineRendererType(bool last_chance) { |
171 if (is_undetermined()) { | 171 if (is_undetermined()) { |
172 if (last_chance) | 172 if (last_chance) |
173 renderer_type_ = OTHER; | 173 renderer_type_ = OTHER; |
174 if (IsOptInUrl(url_.c_str())) { | 174 if (IsChrome(RendererTypeForUrl(url_.c_str()))) { |
175 renderer_type_ = CHROME; | 175 renderer_type_ = CHROME; |
176 } else { | 176 } else { |
177 if (is_cache_valid() && cache_) { | 177 if (is_cache_valid() && cache_) { |
178 HGLOBAL memory = NULL; | 178 HGLOBAL memory = NULL; |
179 GetHGlobalFromStream(cache_, &memory); | 179 GetHGlobalFromStream(cache_, &memory); |
180 const char* buffer = reinterpret_cast<const char*>(GlobalLock(memory)); | 180 const char* buffer = reinterpret_cast<const char*>(GlobalLock(memory)); |
181 | 181 |
182 std::wstring html_contents; | 182 std::wstring html_contents; |
183 // TODO(joshia): detect and handle different content encodings | 183 // TODO(joshia): detect and handle different content encodings |
184 if (buffer && size_) { | 184 if (buffer && size_) { |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 case BINDSTATUS_SERVER_MIMETYPEAVAILABLE: | 422 case BINDSTATUS_SERVER_MIMETYPEAVAILABLE: |
423 return true; | 423 return true; |
424 default: | 424 default: |
425 break; | 425 break; |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
429 return false; | 429 return false; |
430 } | 430 } |
431 | 431 |
OLD | NEW |