OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file defines utility functions for working with html. | 5 // This file defines utility functions for working with html. |
6 | 6 |
7 #ifndef CHROME_FRAME_HTML_UTILS_H_ | 7 #ifndef CHROME_FRAME_HTML_UTILS_H_ |
8 #define CHROME_FRAME_HTML_UTILS_H_ | 8 #define CHROME_FRAME_HTML_UTILS_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "net/http/http_util.h" |
14 #include "testing/gtest/include/gtest/gtest_prod.h" | 15 #include "testing/gtest/include/gtest/gtest_prod.h" |
15 | 16 |
16 // Forward declarations | 17 // Forward declarations |
17 class HtmlUtilUnittest; | 18 class HtmlUtilUnittest; |
18 | 19 |
19 // | 20 // |
20 // Class designed to take a string of HTML and extract from it named | 21 // Class designed to take a string of HTML and extract from it named |
21 // attribute values from named tags. | 22 // attribute values from named tags. |
22 // | 23 // |
23 // Caveat: this class currently doesn't handle multi-word UTF-16 encoded | 24 // Caveat: this class currently doesn't handle multi-word UTF-16 encoded |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 111 |
111 // We store a (CollapsedWhitespace'd) copy of the html data. | 112 // We store a (CollapsedWhitespace'd) copy of the html data. |
112 const std::wstring html_string_; | 113 const std::wstring html_string_; |
113 | 114 |
114 // Store the string of quote characters to avoid repeated construction. | 115 // Store the string of quote characters to avoid repeated construction. |
115 const std::wstring quotes_; | 116 const std::wstring quotes_; |
116 | 117 |
117 DISALLOW_COPY_AND_ASSIGN(HTMLScanner); | 118 DISALLOW_COPY_AND_ASSIGN(HTMLScanner); |
118 }; | 119 }; |
119 | 120 |
| 121 namespace http_utils { |
| 122 |
| 123 // Adds "chromeframe/x.y" to the end of the User-Agent string (x.y is the |
| 124 // version). If the cf tag has already been added to the string, |
| 125 // the original string is returned. |
| 126 std::string AddChromeFrameToUserAgentValue(const std::string& value); |
| 127 |
| 128 // Fetches the user agent from urlmon and adds chrome frame to the |
| 129 // comment section. |
| 130 // NOTE: The returned string includes the "User-Agent: " header name. |
| 131 std::string GetDefaultUserAgentHeaderWithCFTag(); |
| 132 |
| 133 // Fetches the default user agent string from urlmon. |
| 134 // This value does not include the "User-Agent:" header name. |
| 135 std::string GetDefaultUserAgent(); |
| 136 |
| 137 // Returns the Chrome Frame user agent. E.g. "chromeframe/1.0". |
| 138 // Note that in unit tests this will be "chromeframe/0.0" due to the version |
| 139 // table not being present in the unit test executable. |
| 140 const char* GetChromeFrameUserAgent(); |
| 141 |
| 142 } // namespace http_utils |
| 143 |
120 #endif // CHROME_FRAME_HTML_UTILS_H_ | 144 #endif // CHROME_FRAME_HTML_UTILS_H_ |
OLD | NEW |