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

Side by Side Diff: chrome_frame/http_negotiate.cc

Issue 6825055: Include base/win/scoped_comptr.h instead of base/scoped_comptr_win.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert bad indentation, rebase Created 9 years, 8 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/http_negotiate.h ('k') | chrome_frame/in_place_menu.h » ('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) 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/http_negotiate.h" 5 #include "chrome_frame/http_negotiate.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlcom.h> 8 #include <atlcom.h>
9 #include <htiframe.h> 9 #include <htiframe.h>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome_frame/bho.h" 16 #include "chrome_frame/bho.h"
17 #include "chrome_frame/exception_barrier.h" 17 #include "chrome_frame/exception_barrier.h"
18 #include "chrome_frame/html_utils.h" 18 #include "chrome_frame/html_utils.h"
19 #include "chrome_frame/urlmon_moniker.h"
19 #include "chrome_frame/urlmon_url_request.h" 20 #include "chrome_frame/urlmon_url_request.h"
20 #include "chrome_frame/urlmon_moniker.h"
21 #include "chrome_frame/utils.h" 21 #include "chrome_frame/utils.h"
22 #include "chrome_frame/vtable_patch_manager.h" 22 #include "chrome_frame/vtable_patch_manager.h"
23 #include "net/http/http_response_headers.h" 23 #include "net/http/http_response_headers.h"
24 #include "net/http/http_util.h" 24 #include "net/http/http_util.h"
25 25
26 bool HttpNegotiatePatch::modify_user_agent_ = true; 26 bool HttpNegotiatePatch::modify_user_agent_ = true;
27 const char kUACompatibleHttpHeader[] = "x-ua-compatible"; 27 const char kUACompatibleHttpHeader[] = "x-ua-compatible";
28 const char kLowerCaseUserAgent[] = "user-agent"; 28 const char kLowerCaseUserAgent[] = "user-agent";
29 29
30 // From the latest urlmon.h. Symbol name prepended with LOCAL_ to 30 // From the latest urlmon.h. Symbol name prepended with LOCAL_ to
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 // static 166 // static
167 bool HttpNegotiatePatch::Initialize() { 167 bool HttpNegotiatePatch::Initialize() {
168 if (IS_PATCHED(IHttpNegotiate)) { 168 if (IS_PATCHED(IHttpNegotiate)) {
169 DLOG(WARNING) << __FUNCTION__ << " called more than once."; 169 DLOG(WARNING) << __FUNCTION__ << " called more than once.";
170 return true; 170 return true;
171 } 171 }
172 // Use our SimpleBindStatusCallback class as we need a temporary object that 172 // Use our SimpleBindStatusCallback class as we need a temporary object that
173 // implements IBindStatusCallback. 173 // implements IBindStatusCallback.
174 CComObjectStackEx<SimpleBindStatusCallback> request; 174 CComObjectStackEx<SimpleBindStatusCallback> request;
175 ScopedComPtr<IBindCtx> bind_ctx; 175 base::win::ScopedComPtr<IBindCtx> bind_ctx;
176 HRESULT hr = CreateAsyncBindCtx(0, &request, NULL, bind_ctx.Receive()); 176 HRESULT hr = CreateAsyncBindCtx(0, &request, NULL, bind_ctx.Receive());
177 DCHECK(SUCCEEDED(hr)) << "CreateAsyncBindCtx"; 177 DCHECK(SUCCEEDED(hr)) << "CreateAsyncBindCtx";
178 if (bind_ctx) { 178 if (bind_ctx) {
179 ScopedComPtr<IUnknown> bscb_holder; 179 base::win::ScopedComPtr<IUnknown> bscb_holder;
180 bind_ctx->GetObjectParam(L"_BSCB_Holder_", bscb_holder.Receive()); 180 bind_ctx->GetObjectParam(L"_BSCB_Holder_", bscb_holder.Receive());
181 if (bscb_holder) { 181 if (bscb_holder) {
182 hr = PatchHttpNegotiate(bscb_holder); 182 hr = PatchHttpNegotiate(bscb_holder);
183 } else { 183 } else {
184 NOTREACHED() << "Failed to get _BSCB_Holder_"; 184 NOTREACHED() << "Failed to get _BSCB_Holder_";
185 hr = E_UNEXPECTED; 185 hr = E_UNEXPECTED;
186 } 186 }
187 bind_ctx.Release(); 187 bind_ctx.Release();
188 } 188 }
189 189
190 return SUCCEEDED(hr); 190 return SUCCEEDED(hr);
191 } 191 }
192 192
193 // static 193 // static
194 void HttpNegotiatePatch::Uninitialize() { 194 void HttpNegotiatePatch::Uninitialize() {
195 vtable_patch::UnpatchInterfaceMethods(IHttpNegotiate_PatchInfo); 195 vtable_patch::UnpatchInterfaceMethods(IHttpNegotiate_PatchInfo);
196 } 196 }
197 197
198 // static 198 // static
199 HRESULT HttpNegotiatePatch::PatchHttpNegotiate(IUnknown* to_patch) { 199 HRESULT HttpNegotiatePatch::PatchHttpNegotiate(IUnknown* to_patch) {
200 DCHECK(to_patch); 200 DCHECK(to_patch);
201 DCHECK_IS_NOT_PATCHED(IHttpNegotiate); 201 DCHECK_IS_NOT_PATCHED(IHttpNegotiate);
202 202
203 ScopedComPtr<IHttpNegotiate> http; 203 base::win::ScopedComPtr<IHttpNegotiate> http;
204 HRESULT hr = http.QueryFrom(to_patch); 204 HRESULT hr = http.QueryFrom(to_patch);
205 if (FAILED(hr)) { 205 if (FAILED(hr)) {
206 hr = DoQueryService(IID_IHttpNegotiate, to_patch, http.Receive()); 206 hr = DoQueryService(IID_IHttpNegotiate, to_patch, http.Receive());
207 } 207 }
208 208
209 if (http) { 209 if (http) {
210 hr = vtable_patch::PatchInterfaceMethods(http, IHttpNegotiate_PatchInfo); 210 hr = vtable_patch::PatchInterfaceMethods(http, IHttpNegotiate_PatchInfo);
211 DLOG_IF(ERROR, FAILED(hr)) 211 DLOG_IF(ERROR, FAILED(hr))
212 << base::StringPrintf("HttpNegotiate patch failed 0x%08X", hr); 212 << base::StringPrintf("HttpNegotiate patch failed 0x%08X", hr);
213 } else { 213 } else {
(...skipping 28 matching lines...) Expand all
242 *additional_headers = reinterpret_cast<wchar_t*>(::CoTaskMemRealloc( 242 *additional_headers = reinterpret_cast<wchar_t*>(::CoTaskMemRealloc(
243 *additional_headers, 243 *additional_headers,
244 (updated_headers.length() + 1) * sizeof(wchar_t))); 244 (updated_headers.length() + 1) * sizeof(wchar_t)));
245 lstrcpyW(*additional_headers, ASCIIToWide(updated_headers).c_str()); 245 lstrcpyW(*additional_headers, ASCIIToWide(updated_headers).c_str());
246 } else { 246 } else {
247 // TODO(erikwright): Remove the user agent if it is present (i.e., because 247 // TODO(erikwright): Remove the user agent if it is present (i.e., because
248 // of PostPlatform setting in the registry). 248 // of PostPlatform setting in the registry).
249 } 249 }
250 return S_OK; 250 return S_OK;
251 } 251 }
OLDNEW
« no previous file with comments | « chrome_frame/http_negotiate.h ('k') | chrome_frame/in_place_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698