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/bho.h" | 5 #include "chrome_frame/bho.h" |
6 | 6 |
7 #include <shlguid.h> | 7 #include <shlguid.h> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 bool PatchHelper::InitializeAndPatchProtocolsIfNeeded() { | 358 bool PatchHelper::InitializeAndPatchProtocolsIfNeeded() { |
359 bool ret = false; | 359 bool ret = false; |
360 | 360 |
361 _pAtlModule->m_csStaticDataInitAndTypeInfo.Lock(); | 361 _pAtlModule->m_csStaticDataInitAndTypeInfo.Lock(); |
362 | 362 |
363 if (state_ == UNKNOWN) { | 363 if (state_ == UNKNOWN) { |
364 g_trans_hooks.InstallHooks(); | 364 g_trans_hooks.InstallHooks(); |
365 // IE9 sends the short user agent by default. To enable websites to | 365 HttpNegotiatePatch::Initialize(); |
366 // identify and send content specific to chrome frame we need the | |
367 // negotiate patch which adds the user agent to outgoing requests. | |
368 if (GetIEVersion() == IE_9) { | |
369 HttpNegotiatePatch::Initialize(); | |
370 } | |
371 state_ = PATCH_PROTOCOL; | 366 state_ = PATCH_PROTOCOL; |
372 ret = true; | 367 ret = true; |
373 } | 368 } |
374 | 369 |
375 _pAtlModule->m_csStaticDataInitAndTypeInfo.Unlock(); | 370 _pAtlModule->m_csStaticDataInitAndTypeInfo.Unlock(); |
376 | 371 |
377 return ret; | 372 return ret; |
378 } | 373 } |
379 | 374 |
380 void PatchHelper::PatchBrowserService(IBrowserService* browser_service) { | 375 void PatchHelper::PatchBrowserService(IBrowserService* browser_service) { |
381 DCHECK(state_ == PATCH_IBROWSER); | 376 DCHECK(state_ == PATCH_IBROWSER); |
382 if (!IS_PATCHED(IBrowserService)) { | 377 if (!IS_PATCHED(IBrowserService)) { |
383 vtable_patch::PatchInterfaceMethods(browser_service, | 378 vtable_patch::PatchInterfaceMethods(browser_service, |
384 IBrowserService_PatchInfo); | 379 IBrowserService_PatchInfo); |
385 } | 380 } |
386 } | 381 } |
387 | 382 |
388 void PatchHelper::UnpatchIfNeeded() { | 383 void PatchHelper::UnpatchIfNeeded() { |
389 if (state_ == PATCH_PROTOCOL) { | 384 if (state_ == PATCH_PROTOCOL) { |
390 g_trans_hooks.RevertHooks(); | 385 g_trans_hooks.RevertHooks(); |
391 if (GetIEVersion() == IE_9) { | 386 if (GetIEVersion() == IE_9) { |
392 HttpNegotiatePatch::Uninitialize(); | 387 HttpNegotiatePatch::Uninitialize(); |
393 } | 388 } |
394 } | 389 } |
395 state_ = UNKNOWN; | 390 state_ = UNKNOWN; |
396 } | 391 } |
OLD | NEW |