OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" | |
12 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "base/strings/string_tokenizer.h" |
13 #include "chrome/common/chrome_version_info.h" | 13 #include "chrome/common/chrome_version_info.h" |
14 #include "chrome_frame/utils.h" | 14 #include "chrome_frame/utils.h" |
15 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
16 #include "webkit/user_agent/user_agent_util.h" | 16 #include "webkit/user_agent/user_agent_util.h" |
17 | 17 |
18 const wchar_t kQuotes[] = L"\"'"; | 18 const wchar_t kQuotes[] = L"\"'"; |
19 const char kXFrameOptionsHeader[] = "X-Frame-Options"; | 19 const char kXFrameOptionsHeader[] = "X-Frame-Options"; |
20 const char kXFrameOptionsValueAllowAll[] = "allowall"; | 20 const char kXFrameOptionsValueAllowAll[] = "allowall"; |
21 | 21 |
22 HTMLScanner::StringRange::StringRange() { | 22 HTMLScanner::StringRange::StringRange() { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 StringRange* attribute_value) const { | 75 StringRange* attribute_value) const { |
76 if (NULL == attribute_name || NULL == attribute_value) { | 76 if (NULL == attribute_name || NULL == attribute_value) { |
77 NOTREACHED(); | 77 NOTREACHED(); |
78 return false; | 78 return false; |
79 } | 79 } |
80 | 80 |
81 // Use this so we can use the convenience method LowerCaseEqualsASCII() | 81 // Use this so we can use the convenience method LowerCaseEqualsASCII() |
82 // from string_util.h. | 82 // from string_util.h. |
83 std::string search_name_ascii(WideToASCII(attribute_name)); | 83 std::string search_name_ascii(WideToASCII(attribute_name)); |
84 | 84 |
85 WStringTokenizer tokenizer(start_, end_, L" =/"); | 85 base::WStringTokenizer tokenizer(start_, end_, L" =/"); |
86 tokenizer.set_options(WStringTokenizer::RETURN_DELIMS); | 86 tokenizer.set_options(base::WStringTokenizer::RETURN_DELIMS); |
87 | 87 |
88 // Set up the quote chars so that we get quoted attribute values as single | 88 // Set up the quote chars so that we get quoted attribute values as single |
89 // tokens. | 89 // tokens. |
90 tokenizer.set_quote_chars(L"\"'"); | 90 tokenizer.set_quote_chars(L"\"'"); |
91 | 91 |
92 const bool PARSE_STATE_NAME = true; | 92 const bool PARSE_STATE_NAME = true; |
93 const bool PARSE_STATE_VALUE = false; | 93 const bool PARSE_STATE_VALUE = false; |
94 bool parse_state = PARSE_STATE_NAME; | 94 bool parse_state = PARSE_STATE_NAME; |
95 | 95 |
96 // Used to skip the first token, which is the tag name. | 96 // Used to skip the first token, which is the tag name. |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 const std::string& headers) { | 466 const std::string& headers) { |
467 net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(), "\r\n"); | 467 net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(), "\r\n"); |
468 while (it.GetNext()) { | 468 while (it.GetNext()) { |
469 if (!lstrcmpiA(it.name().c_str(), header.c_str())) | 469 if (!lstrcmpiA(it.name().c_str(), header.c_str())) |
470 return std::string(it.values_begin(), it.values_end()); | 470 return std::string(it.values_begin(), it.values_end()); |
471 } | 471 } |
472 return std::string(); | 472 return std::string(); |
473 } | 473 } |
474 | 474 |
475 } // namespace http_utils | 475 } // namespace http_utils |
OLD | NEW |