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

Side by Side Diff: chrome_frame/utils.cc

Issue 12211108: Rename FilePath -> base::FilePath in various toplevel directories (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/test_utils.cc ('k') | gpu/tools/compositor_model_bench/compositor_model_bench.cc » ('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) 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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 DCHECK_LE(renderer_type, RENDERER_TYPE_OTHER); 346 DCHECK_LE(renderer_type, RENDERER_TYPE_OTHER);
347 return renderer_type >= RENDERER_TYPE_CHROME_MIN && 347 return renderer_type >= RENDERER_TYPE_CHROME_MIN &&
348 renderer_type <= RENDERER_TYPE_CHROME_MAX; 348 renderer_type <= RENDERER_TYPE_CHROME_MAX;
349 } 349 }
350 350
351 namespace { 351 namespace {
352 const char kIEImageName[] = "iexplore.exe"; 352 const char kIEImageName[] = "iexplore.exe";
353 } // namespace 353 } // namespace
354 354
355 std::wstring GetHostProcessName(bool include_extension) { 355 std::wstring GetHostProcessName(bool include_extension) {
356 FilePath exe; 356 base::FilePath exe;
357 if (PathService::Get(base::FILE_EXE, &exe)) 357 if (PathService::Get(base::FILE_EXE, &exe))
358 exe = exe.BaseName(); 358 exe = exe.BaseName();
359 if (!include_extension) { 359 if (!include_extension) {
360 exe = exe.RemoveExtension(); 360 exe = exe.RemoveExtension();
361 } 361 }
362 return exe.value(); 362 return exe.value();
363 } 363 }
364 364
365 BrowserType GetBrowserType() { 365 BrowserType GetBrowserType() {
366 static BrowserType browser_type = BROWSER_INVALID; 366 static BrowserType browser_type = BROWSER_INVALID;
(...skipping 16 matching lines...) Expand all
383 return browser_type; 383 return browser_type;
384 } 384 }
385 385
386 uint32 GetIEMajorVersion() { 386 uint32 GetIEMajorVersion() {
387 static uint32 ie_major_version = UINT_MAX; 387 static uint32 ie_major_version = UINT_MAX;
388 388
389 if (ie_major_version == UINT_MAX) { 389 if (ie_major_version == UINT_MAX) {
390 wchar_t exe_path[MAX_PATH]; 390 wchar_t exe_path[MAX_PATH];
391 HMODULE mod = GetModuleHandle(NULL); 391 HMODULE mod = GetModuleHandle(NULL);
392 GetModuleFileName(mod, exe_path, arraysize(exe_path) - 1); 392 GetModuleFileName(mod, exe_path, arraysize(exe_path) - 1);
393 std::wstring exe_name = FilePath(exe_path).BaseName().value(); 393 std::wstring exe_name = base::FilePath(exe_path).BaseName().value();
394 if (!LowerCaseEqualsASCII(exe_name, kIEImageName)) { 394 if (!LowerCaseEqualsASCII(exe_name, kIEImageName)) {
395 ie_major_version = 0; 395 ie_major_version = 0;
396 } else { 396 } else {
397 uint32 high = 0; 397 uint32 high = 0;
398 uint32 low = 0; 398 uint32 low = 0;
399 if (GetModuleVersion(mod, &high, &low)) { 399 if (GetModuleVersion(mod, &high, &low)) {
400 ie_major_version = HIWORD(high); 400 ie_major_version = HIWORD(high);
401 } else { 401 } else {
402 ie_major_version = 0; 402 ie_major_version = 0;
403 } 403 }
(...skipping 26 matching lines...) Expand all
430 break; 430 break;
431 default: 431 default:
432 ie_version = (major_version >= 10) ? IE_10 : IE_UNSUPPORTED; 432 ie_version = (major_version >= 10) ? IE_10 : IE_UNSUPPORTED;
433 break; 433 break;
434 } 434 }
435 } 435 }
436 436
437 return ie_version; 437 return ie_version;
438 } 438 }
439 439
440 FilePath GetIETemporaryFilesFolder() { 440 base::FilePath GetIETemporaryFilesFolder() {
441 LPITEMIDLIST tif_pidl = NULL; 441 LPITEMIDLIST tif_pidl = NULL;
442 HRESULT hr = SHGetFolderLocation(NULL, CSIDL_INTERNET_CACHE, NULL, 442 HRESULT hr = SHGetFolderLocation(NULL, CSIDL_INTERNET_CACHE, NULL,
443 SHGFP_TYPE_CURRENT, &tif_pidl); 443 SHGFP_TYPE_CURRENT, &tif_pidl);
444 if (SUCCEEDED(hr) && tif_pidl) { 444 if (SUCCEEDED(hr) && tif_pidl) {
445 base::win::ScopedComPtr<IShellFolder> parent_folder; 445 base::win::ScopedComPtr<IShellFolder> parent_folder;
446 LPITEMIDLIST relative_pidl = NULL; 446 LPITEMIDLIST relative_pidl = NULL;
447 hr = SHBindToParent(tif_pidl, IID_IShellFolder, 447 hr = SHBindToParent(tif_pidl, IID_IShellFolder,
448 reinterpret_cast<void**>(parent_folder.Receive()), 448 reinterpret_cast<void**>(parent_folder.Receive()),
449 const_cast<LPCITEMIDLIST*>(&relative_pidl)); 449 const_cast<LPCITEMIDLIST*>(&relative_pidl));
450 if (SUCCEEDED(hr) && relative_pidl) { 450 if (SUCCEEDED(hr) && relative_pidl) {
451 STRRET path = {0}; 451 STRRET path = {0};
452 hr = parent_folder->GetDisplayNameOf(relative_pidl, 452 hr = parent_folder->GetDisplayNameOf(relative_pidl,
453 SHGDN_NORMAL | SHGDN_FORPARSING, 453 SHGDN_NORMAL | SHGDN_FORPARSING,
454 &path); 454 &path);
455 DCHECK(SUCCEEDED(hr)); 455 DCHECK(SUCCEEDED(hr));
456 base::win::ScopedBstr temp_internet_files_bstr; 456 base::win::ScopedBstr temp_internet_files_bstr;
457 StrRetToBSTR(&path, relative_pidl, temp_internet_files_bstr.Receive()); 457 StrRetToBSTR(&path, relative_pidl, temp_internet_files_bstr.Receive());
458 FilePath temp_internet_files(static_cast<BSTR>(temp_internet_files_bstr)); 458 base::FilePath temp_internet_files(
459 static_cast<BSTR>(temp_internet_files_bstr));
459 ILFree(tif_pidl); 460 ILFree(tif_pidl);
460 return temp_internet_files; 461 return temp_internet_files;
461 } else { 462 } else {
462 NOTREACHED() << "SHBindToParent failed with Error:" << hr; 463 NOTREACHED() << "SHBindToParent failed with Error:" << hr;
463 ILFree(tif_pidl); 464 ILFree(tif_pidl);
464 } 465 }
465 } else { 466 } else {
466 NOTREACHED() << "SHGetFolderLocation for internet cache failed. Error:" 467 NOTREACHED() << "SHGetFolderLocation for internet cache failed. Error:"
467 << hr; 468 << hr;
468 } 469 }
469 // As a last ditch effort we use the SHGetFolderPath function to retrieve the 470 // As a last ditch effort we use the SHGetFolderPath function to retrieve the
470 // path. This function has a limitation of MAX_PATH. 471 // path. This function has a limitation of MAX_PATH.
471 wchar_t path[MAX_PATH + 1] = {0}; 472 wchar_t path[MAX_PATH + 1] = {0};
472 hr = SHGetFolderPath(NULL, CSIDL_INTERNET_CACHE, NULL, SHGFP_TYPE_CURRENT, 473 hr = SHGetFolderPath(NULL, CSIDL_INTERNET_CACHE, NULL, SHGFP_TYPE_CURRENT,
473 path); 474 path);
474 if (SUCCEEDED(hr)) { 475 if (SUCCEEDED(hr)) {
475 return FilePath(path); 476 return base::FilePath(path);
476 } else { 477 } else {
477 NOTREACHED() << "SHGetFolderPath for internet cache failed. Error:" 478 NOTREACHED() << "SHGetFolderPath for internet cache failed. Error:"
478 << hr; 479 << hr;
479 } 480 }
480 return FilePath(); 481 return base::FilePath();
481 } 482 }
482 483
483 bool IsIEInPrivate() { 484 bool IsIEInPrivate() {
484 typedef BOOL (WINAPI* IEIsInPrivateBrowsingPtr)(); 485 typedef BOOL (WINAPI* IEIsInPrivateBrowsingPtr)();
485 bool incognito_mode = false; 486 bool incognito_mode = false;
486 HMODULE h = GetModuleHandle(L"ieframe.dll"); 487 HMODULE h = GetModuleHandle(L"ieframe.dll");
487 if (h) { 488 if (h) {
488 IEIsInPrivateBrowsingPtr IsInPrivate = 489 IEIsInPrivateBrowsingPtr IsInPrivate =
489 reinterpret_cast<IEIsInPrivateBrowsingPtr>(GetProcAddress(h, 490 reinterpret_cast<IEIsInPrivateBrowsingPtr>(GetProcAddress(h,
490 "IEIsInPrivateBrowsing")); 491 "IEIsInPrivateBrowsing"));
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 &connections, connection_value_size); 1667 &connections, connection_value_size);
1667 if (!ret) { 1668 if (!ret) {
1668 return false; 1669 return false;
1669 } 1670 }
1670 } 1671 }
1671 wininet_connection_count_updated = true; 1672 wininet_connection_count_updated = true;
1672 return true; 1673 return true;
1673 } 1674 }
1674 1675
1675 void GetChromeFrameProfilePath(const string16& profile_name, 1676 void GetChromeFrameProfilePath(const string16& profile_name,
1676 FilePath* profile_path) { 1677 base::FilePath* profile_path) {
1677 chrome::GetChromeFrameUserDataDirectory(profile_path); 1678 chrome::GetChromeFrameUserDataDirectory(profile_path);
1678 *profile_path = profile_path->Append(profile_name); 1679 *profile_path = profile_path->Append(profile_name);
1679 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); 1680 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value();
1680 } 1681 }
OLDNEW
« no previous file with comments | « chrome_frame/test_utils.cc ('k') | gpu/tools/compositor_model_bench/compositor_model_bench.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698