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 #include <htiframe.h> | 5 #include <htiframe.h> |
6 #include <mshtml.h> | 6 #include <mshtml.h> |
7 #include <shlobj.h> | 7 #include <shlobj.h> |
8 #include <wininet.h> | 8 #include <wininet.h> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/file_version_info.h" | 11 #include "base/file_version_info.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/registry.h" | 15 #include "base/registry.h" |
| 16 #include "base/scoped_bstr_win.h" |
16 #include "base/scoped_comptr_win.h" | 17 #include "base/scoped_comptr_win.h" |
17 #include "base/scoped_variant_win.h" | 18 #include "base/scoped_variant_win.h" |
18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
19 #include "base/thread_local.h" | 20 #include "base/thread_local.h" |
20 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
21 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
22 #include "chrome/installer/util/chrome_frame_distribution.h" | 23 #include "chrome/installer/util/chrome_frame_distribution.h" |
23 #include "chrome_frame/extra_system_apis.h" | 24 #include "chrome_frame/extra_system_apis.h" |
24 #include "chrome_frame/html_utils.h" | 25 #include "chrome_frame/html_utils.h" |
25 #include "chrome_frame/simple_resource_loader.h" | 26 #include "chrome_frame/simple_resource_loader.h" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 405 } |
405 } else { | 406 } else { |
406 NOTREACHED() << "Can't get IE version"; | 407 NOTREACHED() << "Can't get IE version"; |
407 } | 408 } |
408 } | 409 } |
409 } | 410 } |
410 | 411 |
411 return ie_version; | 412 return ie_version; |
412 } | 413 } |
413 | 414 |
| 415 FilePath GetIETemporaryFilesFolder() { |
| 416 DCHECK_EQ(BROWSER_IE, GetBrowserType()); |
| 417 |
| 418 LPITEMIDLIST tif_pidl = NULL; |
| 419 HRESULT hr = SHGetFolderLocation(NULL, CSIDL_INTERNET_CACHE, NULL, |
| 420 SHGFP_TYPE_CURRENT, &tif_pidl); |
| 421 DCHECK(SUCCEEDED(hr) && tif_pidl); |
| 422 |
| 423 ScopedComPtr<IShellFolder> parent_folder; |
| 424 LPCITEMIDLIST relative_pidl = NULL; |
| 425 hr = SHBindToParent(tif_pidl, IID_IShellFolder, |
| 426 reinterpret_cast<void**>(parent_folder.Receive()), |
| 427 &relative_pidl); |
| 428 DCHECK(SUCCEEDED(hr) && relative_pidl); |
| 429 |
| 430 STRRET path = {0}; |
| 431 hr = parent_folder->GetDisplayNameOf(relative_pidl, |
| 432 SHGDN_NORMAL | SHGDN_FORPARSING, |
| 433 &path); |
| 434 DCHECK(SUCCEEDED(hr)); |
| 435 ScopedBstr tif_bstr; |
| 436 StrRetToBSTR(&path, relative_pidl, tif_bstr.Receive()); |
| 437 FilePath tif(static_cast<BSTR>(tif_bstr)); |
| 438 |
| 439 ILFree(tif_pidl); |
| 440 return tif; |
| 441 } |
| 442 |
414 bool IsIEInPrivate() { | 443 bool IsIEInPrivate() { |
415 typedef BOOL (WINAPI* IEIsInPrivateBrowsingPtr)(); | 444 typedef BOOL (WINAPI* IEIsInPrivateBrowsingPtr)(); |
416 bool incognito_mode = false; | 445 bool incognito_mode = false; |
417 HMODULE h = GetModuleHandle(L"ieframe.dll"); | 446 HMODULE h = GetModuleHandle(L"ieframe.dll"); |
418 if (h) { | 447 if (h) { |
419 IEIsInPrivateBrowsingPtr IsInPrivate = | 448 IEIsInPrivateBrowsingPtr IsInPrivate = |
420 reinterpret_cast<IEIsInPrivateBrowsingPtr>(GetProcAddress(h, | 449 reinterpret_cast<IEIsInPrivateBrowsingPtr>(GetProcAddress(h, |
421 "IEIsInPrivateBrowsing")); | 450 "IEIsInPrivateBrowsing")); |
422 if (IsInPrivate) { | 451 if (IsInPrivate) { |
423 incognito_mode = !!IsInPrivate(); | 452 incognito_mode = !!IsInPrivate(); |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 case COOKIE_STATE_REJECT: | 942 case COOKIE_STATE_REJECT: |
914 cookie_action = COOKIEACTION_REJECT; | 943 cookie_action = COOKIEACTION_REJECT; |
915 break; | 944 break; |
916 default: | 945 default: |
917 cookie_action = COOKIEACTION_REJECT; | 946 cookie_action = COOKIEACTION_REJECT; |
918 break; | 947 break; |
919 } | 948 } |
920 return cookie_action; | 949 return cookie_action; |
921 } | 950 } |
922 | 951 |
OLD | NEW |