OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_moniker.h" | 5 #include "chrome_frame/urlmon_moniker.h" |
6 | 6 |
7 #include <exdisp.h> | 7 #include <exdisp.h> |
8 #include <shlguid.h> | 8 #include <shlguid.h> |
9 | 9 |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 base::win::ScopedComPtr<IMoniker> moniker; | 46 base::win::ScopedComPtr<IMoniker> moniker; |
47 DCHECK(bind_context); | 47 DCHECK(bind_context); |
48 if (SUCCEEDED(hr) && | 48 if (SUCCEEDED(hr) && |
49 SUCCEEDED(hr = ::CreateURLMonikerEx(NULL, url_.c_str(), moniker.Receive(), | 49 SUCCEEDED(hr = ::CreateURLMonikerEx(NULL, url_.c_str(), moniker.Receive(), |
50 URL_MK_UNIFORM))) { | 50 URL_MK_UNIFORM))) { |
51 if (SUCCEEDED(hr)) { | 51 if (SUCCEEDED(hr)) { |
52 // If there's a referrer, preserve it. | 52 // If there's a referrer, preserve it. |
53 std::wstring headers; | 53 std::wstring headers; |
54 if (!referrer_.empty()) { | 54 if (!referrer_.empty()) { |
55 headers = base::StringPrintf(L"Referer: %ls\r\n\r\n", | 55 headers = base::StringPrintf(L"Referer: %ls\r\n\r\n", |
56 ASCIIToWide(referrer_).c_str()); | 56 base::ASCIIToWide(referrer_).c_str()); |
57 } | 57 } |
58 | 58 |
59 // Pass in URL fragments if applicable. | 59 // Pass in URL fragments if applicable. |
60 std::wstring fragment; | 60 std::wstring fragment; |
61 GURL parsed_moniker_url(url_); | 61 GURL parsed_moniker_url(url_); |
62 if (parsed_moniker_url.has_ref()) { | 62 if (parsed_moniker_url.has_ref()) { |
63 fragment = UTF8ToWide(parsed_moniker_url.ref()); | 63 fragment = base::UTF8ToWide(parsed_moniker_url.ref()); |
64 } | 64 } |
65 | 65 |
66 VARIANT flags = { VT_I4 }; | 66 VARIANT flags = { VT_I4 }; |
67 V_VT(&flags) = navNoHistory | navOpenInNewWindow; | 67 V_VT(&flags) = navNoHistory | navOpenInNewWindow; |
68 | 68 |
69 hr = NavigateBrowserToMoniker(browser, moniker, headers.c_str(), | 69 hr = NavigateBrowserToMoniker(browser, moniker, headers.c_str(), |
70 bind_context, fragment.c_str(), NULL, &flags); | 70 bind_context, fragment.c_str(), NULL, &flags); |
71 DVLOG(1) << base::StringPrintf("NavigateBrowserToMoniker: 0x%08X", hr); | 71 DVLOG(1) << base::StringPrintf("NavigateBrowserToMoniker: 0x%08X", hr); |
72 } | 72 } |
73 } | 73 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 // If the binding terminates before the data could be played back | 255 // If the binding terminates before the data could be played back |
256 // now is the chance. Sometimes OnStopBinding happens after this returns | 256 // now is the chance. Sometimes OnStopBinding happens after this returns |
257 // and then it's too late. | 257 // and then it's too late. |
258 if ((S_OK == hr) && callback) | 258 if ((S_OK == hr) && callback) |
259 callback->MayPlayBack(BSCF_LASTDATANOTIFICATION); | 259 callback->MayPlayBack(BSCF_LASTDATANOTIFICATION); |
260 | 260 |
261 return hr; | 261 return hr; |
262 } | 262 } |
263 | 263 |
OLD | NEW |