Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome_frame/html_utils.cc

Issue 2081007: Enable warning 4389 as an error on windows builds. This will make... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/function_stub_unittest.cc ('k') | chrome_frame/test/chrome_frame_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 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/html_utils.h" 5 #include "chrome_frame/html_utils.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <urlmon.h> 8 #include <urlmon.h>
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/string_tokenizer.h" 11 #include "base/string_tokenizer.h"
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 std::string ret; 335 std::string ret;
336 DWORD size = MAX_PATH; // NOLINT 336 DWORD size = MAX_PATH; // NOLINT
337 HRESULT hr = E_OUTOFMEMORY; 337 HRESULT hr = E_OUTOFMEMORY;
338 for (int retries = 1; hr == E_OUTOFMEMORY && retries <= 10; ++retries) { 338 for (int retries = 1; hr == E_OUTOFMEMORY && retries <= 10; ++retries) {
339 hr = ::ObtainUserAgentString(0, WriteInto(&ret, size + 1), &size); 339 hr = ::ObtainUserAgentString(0, WriteInto(&ret, size + 1), &size);
340 if (hr == E_OUTOFMEMORY) { 340 if (hr == E_OUTOFMEMORY) {
341 size = MAX_PATH * retries; 341 size = MAX_PATH * retries;
342 } else if (SUCCEEDED(hr)) { 342 } else if (SUCCEEDED(hr)) {
343 // Truncate the extra allocation. 343 // Truncate the extra allocation.
344 DCHECK(size > 0); // NOLINT 344 DCHECK(size > 0); // NOLINT
345 ret.resize(size - sizeof(char)); // NOLINT 345 ret.resize(size - 1); // NOLINT
346 } 346 }
347 } 347 }
348 348
349 if (FAILED(hr)) { 349 if (FAILED(hr)) {
350 NOTREACHED() << StringPrintf("ObtainUserAgentString==0x%08X", hr); 350 NOTREACHED() << StringPrintf("ObtainUserAgentString==0x%08X", hr);
351 return ""; 351 return std::string();
352 } else {
353 DCHECK(ret.length() == lstrlenA(ret.c_str()));
354 } 352 }
355 353
356 return ret; 354 return ret;
357 } 355 }
358 356
359 bool HasFrameBustingHeader(const std::string& http_headers) { 357 bool HasFrameBustingHeader(const std::string& http_headers) {
360 net::HttpUtil::HeadersIterator it( 358 net::HttpUtil::HeadersIterator it(
361 http_headers.begin(), http_headers.end(), "\r\n"); 359 http_headers.begin(), http_headers.end(), "\r\n");
362 while (it.GetNext()) { 360 while (it.GetNext()) {
363 if (lstrcmpiA(it.name().c_str(), kXFrameOptionsHeader) == 0) { 361 if (lstrcmpiA(it.name().c_str(), kXFrameOptionsHeader) == 0) {
364 std::string allow_all(kXFrameOptionsValueAllowAll); 362 std::string allow_all(kXFrameOptionsValueAllowAll);
365 if (it.values_end() - it.values_begin() != allow_all.length() || 363 if (it.values_end() - it.values_begin() !=
364 static_cast<int>(allow_all.length()) ||
366 !std::equal(it.values_begin(), it.values_end(), 365 !std::equal(it.values_begin(), it.values_end(),
367 allow_all.begin(), 366 allow_all.begin(),
368 CaseInsensitiveCompareASCII<const char>())) { 367 CaseInsensitiveCompareASCII<const char>())) {
369 return true; 368 return true;
370 } 369 }
371 } 370 }
372 } 371 }
373 372
374 return false; 373 return false;
375 } 374 }
376 375
377 } // namespace http_utils 376 } // namespace http_utils
OLDNEW
« no previous file with comments | « chrome_frame/function_stub_unittest.cc ('k') | chrome_frame/test/chrome_frame_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698