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/utils.h" | 5 #include "chrome_frame/utils.h" |
6 | 6 |
7 #include <atlsafe.h> | 7 #include <atlsafe.h> |
8 #include <atlsecurity.h> | 8 #include <atlsecurity.h> |
9 #include <htiframe.h> | 9 #include <htiframe.h> |
10 #include <mshtml.h> | 10 #include <mshtml.h> |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 void DisplayVersionMismatchWarning(HWND parent, | 297 void DisplayVersionMismatchWarning(HWND parent, |
298 const std::string& server_version) { | 298 const std::string& server_version) { |
299 // Obtain the current module version. | 299 // Obtain the current module version. |
300 scoped_ptr<FileVersionInfo> module_version_info( | 300 scoped_ptr<FileVersionInfo> module_version_info( |
301 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); | 301 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); |
302 base::string16 version_string(module_version_info->file_version()); | 302 base::string16 version_string(module_version_info->file_version()); |
303 std::wstring wide_server_version; | 303 std::wstring wide_server_version; |
304 if (server_version.empty()) { | 304 if (server_version.empty()) { |
305 wide_server_version = SimpleResourceLoader::Get(IDS_VERSIONUNKNOWN); | 305 wide_server_version = SimpleResourceLoader::Get(IDS_VERSIONUNKNOWN); |
306 } else { | 306 } else { |
307 wide_server_version = ASCIIToWide(server_version); | 307 wide_server_version = base::ASCIIToWide(server_version); |
308 } | 308 } |
309 std::wstring title = SimpleResourceLoader::Get(IDS_VERSIONMISMATCH_HEADER); | 309 std::wstring title = SimpleResourceLoader::Get(IDS_VERSIONMISMATCH_HEADER); |
310 std::wstring message; | 310 std::wstring message; |
311 base::SStringPrintf(&message, | 311 base::SStringPrintf(&message, |
312 SimpleResourceLoader::Get(IDS_VERSIONMISMATCH).c_str(), | 312 SimpleResourceLoader::Get(IDS_VERSIONMISMATCH).c_str(), |
313 wide_server_version.c_str(), | 313 wide_server_version.c_str(), |
314 version_string.c_str()); | 314 version_string.c_str()); |
315 | 315 |
316 ::MessageBox(parent, message.c_str(), title.c_str(), MB_OK); | 316 ::MessageBox(parent, message.c_str(), title.c_str(), MB_OK); |
317 } | 317 } |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 // manager and use it. | 893 // manager and use it. |
894 if (target_url.has_ref()) { | 894 if (target_url.has_ref()) { |
895 url_parse::Component comp; | 895 url_parse::Component comp; |
896 GURL::Replacements replacements; | 896 GURL::Replacements replacements; |
897 replacements.SetRef("", comp); | 897 replacements.SetRef("", comp); |
898 | 898 |
899 target_url = target_url.ReplaceComponents(replacements); | 899 target_url = target_url.ReplaceComponents(replacements); |
900 fragment = NULL; | 900 fragment = NULL; |
901 } | 901 } |
902 | 902 |
903 base::win::ScopedVariant var_url(UTF8ToWide(target_url.spec()).c_str()); | 903 base::win::ScopedVariant var_url( |
| 904 base::UTF8ToWide(target_url.spec()).c_str()); |
904 hr = browser_priv->NavigateWithBindCtx(var_url.AsInput(), flags, NULL, | 905 hr = browser_priv->NavigateWithBindCtx(var_url.AsInput(), flags, NULL, |
905 post_data_variant.AsInput(), | 906 post_data_variant.AsInput(), |
906 headers_var.AsInput(), bind_ctx, | 907 headers_var.AsInput(), bind_ctx, |
907 const_cast<wchar_t*>(fragment)); | 908 const_cast<wchar_t*>(fragment)); |
908 DLOG_IF(WARNING, FAILED(hr)) | 909 DLOG_IF(WARNING, FAILED(hr)) |
909 << base::StringPrintf(L"NavigateWithBindCtx 0x%08X", hr); | 910 << base::StringPrintf(L"NavigateWithBindCtx 0x%08X", hr); |
910 } else { | 911 } else { |
911 NOTREACHED(); | 912 NOTREACHED(); |
912 } | 913 } |
913 ::CoTaskMemFree(url); | 914 ::CoTaskMemFree(url); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 return unpinned; | 1035 return unpinned; |
1035 } | 1036 } |
1036 | 1037 |
1037 std::wstring GetActualUrlFromMoniker(IMoniker* moniker, | 1038 std::wstring GetActualUrlFromMoniker(IMoniker* moniker, |
1038 IBindCtx* bind_context, | 1039 IBindCtx* bind_context, |
1039 const std::wstring& bho_url) { | 1040 const std::wstring& bho_url) { |
1040 CComHeapPtr<WCHAR> display_name; | 1041 CComHeapPtr<WCHAR> display_name; |
1041 moniker->GetDisplayName(bind_context, NULL, &display_name); | 1042 moniker->GetDisplayName(bind_context, NULL, &display_name); |
1042 std::wstring moniker_url = display_name; | 1043 std::wstring moniker_url = display_name; |
1043 | 1044 |
1044 GURL parsed_url(WideToUTF8(bho_url)); | 1045 GURL parsed_url(base::WideToUTF8(bho_url)); |
1045 if (!parsed_url.has_ref()) | 1046 if (!parsed_url.has_ref()) |
1046 return moniker_url; | 1047 return moniker_url; |
1047 | 1048 |
1048 if (StartsWith(bho_url, moniker_url, false) && | 1049 if (StartsWith(bho_url, moniker_url, false) && |
1049 bho_url[moniker_url.length()] == L'#') | 1050 bho_url[moniker_url.length()] == L'#') |
1050 return bho_url; | 1051 return bho_url; |
1051 | 1052 |
1052 return moniker_url; | 1053 return moniker_url; |
1053 } | 1054 } |
1054 | 1055 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 } | 1125 } |
1125 | 1126 |
1126 std::string FindReferrerFromHeaders(const wchar_t* headers, | 1127 std::string FindReferrerFromHeaders(const wchar_t* headers, |
1127 const wchar_t* additional_headers) { | 1128 const wchar_t* additional_headers) { |
1128 std::string referrer; | 1129 std::string referrer; |
1129 | 1130 |
1130 const wchar_t* both_headers[] = { headers, additional_headers }; | 1131 const wchar_t* both_headers[] = { headers, additional_headers }; |
1131 for (int i = 0; referrer.empty() && i < arraysize(both_headers); ++i) { | 1132 for (int i = 0; referrer.empty() && i < arraysize(both_headers); ++i) { |
1132 if (!both_headers[i]) | 1133 if (!both_headers[i]) |
1133 continue; | 1134 continue; |
1134 std::string raw_headers_utf8 = WideToUTF8(both_headers[i]); | 1135 std::string raw_headers_utf8 = base::WideToUTF8(both_headers[i]); |
1135 net::HttpUtil::HeadersIterator it(raw_headers_utf8.begin(), | 1136 net::HttpUtil::HeadersIterator it(raw_headers_utf8.begin(), |
1136 raw_headers_utf8.end(), "\r\n"); | 1137 raw_headers_utf8.end(), "\r\n"); |
1137 while (it.GetNext()) { | 1138 while (it.GetNext()) { |
1138 if (LowerCaseEqualsASCII(it.name(), "referer")) { | 1139 if (LowerCaseEqualsASCII(it.name(), "referer")) { |
1139 referrer = it.values(); | 1140 referrer = it.values(); |
1140 break; | 1141 break; |
1141 } | 1142 } |
1142 } | 1143 } |
1143 } | 1144 } |
1144 | 1145 |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 wininet_connection_count_updated = true; | 1632 wininet_connection_count_updated = true; |
1632 return true; | 1633 return true; |
1633 } | 1634 } |
1634 | 1635 |
1635 void GetChromeFrameProfilePath(const base::string16& profile_name, | 1636 void GetChromeFrameProfilePath(const base::string16& profile_name, |
1636 base::FilePath* profile_path) { | 1637 base::FilePath* profile_path) { |
1637 chrome::GetChromeFrameUserDataDirectory(profile_path); | 1638 chrome::GetChromeFrameUserDataDirectory(profile_path); |
1638 *profile_path = profile_path->Append(profile_name); | 1639 *profile_path = profile_path->Append(profile_name); |
1639 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); | 1640 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); |
1640 } | 1641 } |
OLD | NEW |