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

Side by Side Diff: chrome/common/chrome_paths.cc

Issue 11418005: Get a minimal unit_tests target building and running for iOS (Closed) Base URL: http://git.chromium.org/chromium/src.git@chrome-gyp-ios-support
Patch Set: Better ifdefing in chrome_paths Created 8 years, 1 month 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
« no previous file with comments | « chrome/common/chrome_paths.h ('k') | chrome/common/chrome_paths_internal.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) 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/common/chrome_paths.h" 5 #include "chrome/common/chrome_paths.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/sys_info.h" 12 #include "base/sys_info.h"
13 #include "base/version.h" 13 #include "base/version.h"
14 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/chrome_paths_internal.h" 15 #include "chrome/common/chrome_paths_internal.h"
16 #include "ui/base/ui_base_paths.h" 16 #include "ui/base/ui_base_paths.h"
17 17
18 #if defined(OS_ANDROID) 18 #if defined(OS_ANDROID)
19 #include "base/android/path_utils.h" 19 #include "base/android/path_utils.h"
20 #endif 20 #endif
21 21
22 #if defined(OS_MACOSX) 22 #if defined(OS_MACOSX)
23 #include "base/mac/mac_util.h" 23 #include "base/mac/foundation_util.h"
24 #endif 24 #endif
25 25
26 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 26 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
27 27
28 namespace { 28 namespace {
29 29
30 // File name of the internal Flash plugin on different platforms. 30 // File name of the internal Flash plugin on different platforms.
31 const FilePath::CharType kInternalFlashPluginFileName[] = 31 const FilePath::CharType kInternalFlashPluginFileName[] =
32 #if defined(OS_MACOSX) 32 #if defined(OS_MACOSX)
33 FILE_PATH_LITERAL("Flash Player Plugin for Chrome.plugin"); 33 FILE_PATH_LITERAL("Flash Player Plugin for Chrome.plugin");
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 FILE_PATH_LITERAL("/usr/share/chromium/default_app_order.json"); 100 FILE_PATH_LITERAL("/usr/share/chromium/default_app_order.json");
101 #endif // defined(GOOGLE_CHROME_BUILD) 101 #endif // defined(GOOGLE_CHROME_BUILD)
102 #endif // defined(OS_CHROMEOS) 102 #endif // defined(OS_CHROMEOS)
103 103
104 } // namespace 104 } // namespace
105 105
106 namespace chrome { 106 namespace chrome {
107 107
108 // Gets the path for internal plugins. 108 // Gets the path for internal plugins.
109 bool GetInternalPluginsDirectory(FilePath* result) { 109 bool GetInternalPluginsDirectory(FilePath* result) {
110 #if defined(OS_MACOSX) 110 #if defined(OS_MACOSX) && !defined(OS_IOS)
111 // If called from Chrome, get internal plugins from a subdirectory of the 111 // If called from Chrome, get internal plugins from a subdirectory of the
112 // framework. 112 // framework.
113 if (base::mac::AmIBundled()) { 113 if (base::mac::AmIBundled()) {
114 *result = chrome::GetFrameworkBundlePath(); 114 *result = chrome::GetFrameworkBundlePath();
115 DCHECK(!result->empty()); 115 DCHECK(!result->empty());
116 *result = result->Append("Internet Plug-Ins"); 116 *result = result->Append("Internet Plug-Ins");
117 return true; 117 return true;
118 } 118 }
119 // In tests, just look in the module directory (below). 119 // In tests, just look in the module directory (below).
120 #endif 120 #endif
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 break; 339 break;
340 #endif 340 #endif
341 #if defined(WIDEVINE_CDM_AVAILABLE) 341 #if defined(WIDEVINE_CDM_AVAILABLE)
342 case chrome::FILE_WIDEVINE_CDM_PLUGIN: 342 case chrome::FILE_WIDEVINE_CDM_PLUGIN:
343 if (!PathService::Get(base::DIR_MODULE, &cur)) 343 if (!PathService::Get(base::DIR_MODULE, &cur))
344 return false; 344 return false;
345 cur = cur.Append(kWidevineCdmPluginFileName); 345 cur = cur.Append(kWidevineCdmPluginFileName);
346 break; 346 break;
347 #endif 347 #endif
348 case chrome::FILE_RESOURCES_PACK: 348 case chrome::FILE_RESOURCES_PACK:
349 #if defined(OS_MACOSX) 349 #if defined(OS_MACOSX) && !defined(OS_IOS)
350 if (base::mac::AmIBundled()) { 350 if (base::mac::AmIBundled()) {
351 cur = base::mac::FrameworkBundlePath(); 351 cur = base::mac::FrameworkBundlePath();
352 cur = cur.Append(FILE_PATH_LITERAL("Resources")) 352 cur = cur.Append(FILE_PATH_LITERAL("Resources"))
353 .Append(FILE_PATH_LITERAL("resources.pak")); 353 .Append(FILE_PATH_LITERAL("resources.pak"));
354 break; 354 break;
355 } 355 }
356 #elif defined(OS_ANDROID) 356 #elif defined(OS_ANDROID)
357 if (!PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &cur)) 357 if (!PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &cur))
358 return false; 358 return false;
359 #else 359 #else
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) 411 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
412 case chrome::DIR_POLICY_FILES: { 412 case chrome::DIR_POLICY_FILES: {
413 #if defined(GOOGLE_CHROME_BUILD) 413 #if defined(GOOGLE_CHROME_BUILD)
414 cur = FilePath(FILE_PATH_LITERAL("/etc/opt/chrome/policies")); 414 cur = FilePath(FILE_PATH_LITERAL("/etc/opt/chrome/policies"));
415 #else 415 #else
416 cur = FilePath(FILE_PATH_LITERAL("/etc/chromium/policies")); 416 cur = FilePath(FILE_PATH_LITERAL("/etc/chromium/policies"));
417 #endif 417 #endif
418 break; 418 break;
419 } 419 }
420 #endif 420 #endif
421 #if defined(OS_MACOSX) 421 #if defined(OS_MACOSX) && !defined(OS_IOS)
422 case chrome::DIR_MANAGED_PREFS: { 422 case chrome::DIR_MANAGED_PREFS: {
423 if (!GetLocalLibraryDirectory(&cur)) 423 if (!GetLocalLibraryDirectory(&cur))
424 return false; 424 return false;
425 cur = cur.Append(FILE_PATH_LITERAL("Managed Preferences")); 425 cur = cur.Append(FILE_PATH_LITERAL("Managed Preferences"));
426 char* login = getlogin(); 426 char* login = getlogin();
427 if (!login) 427 if (!login)
428 return false; 428 return false;
429 cur = cur.AppendASCII(login); 429 cur = cur.AppendASCII(login);
430 if (!file_util::PathExists(cur)) // We don't want to create this. 430 if (!file_util::PathExists(cur)) // We don't want to create this.
431 return false; 431 return false;
432 break; 432 break;
433 } 433 }
434 #endif 434 #endif
435 #if defined(OS_CHROMEOS) || defined(OS_MACOSX) 435 #if defined(OS_CHROMEOS) || (defined(OS_MACOSX) && !defined(OS_IOS))
436 case chrome::DIR_USER_EXTERNAL_EXTENSIONS: { 436 case chrome::DIR_USER_EXTERNAL_EXTENSIONS: {
437 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 437 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
438 return false; 438 return false;
439 cur = cur.Append(FILE_PATH_LITERAL("External Extensions")); 439 cur = cur.Append(FILE_PATH_LITERAL("External Extensions"));
440 break; 440 break;
441 } 441 }
442 #endif 442 #endif
443 #if defined(OS_LINUX) 443 #if defined(OS_LINUX)
444 case chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS: { 444 case chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS: {
445 cur = FilePath(FILE_PATH_LITERAL(kFilepathSinglePrefExtensions)); 445 cur = FilePath(FILE_PATH_LITERAL(kFilepathSinglePrefExtensions));
446 break; 446 break;
447 } 447 }
448 #endif 448 #endif
449 case chrome::DIR_EXTERNAL_EXTENSIONS: 449 case chrome::DIR_EXTERNAL_EXTENSIONS:
450 #if defined(OS_MACOSX) 450 #if defined(OS_MACOSX) && !defined(OS_IOS)
451 if (!chrome::GetGlobalApplicationSupportDirectory(&cur)) 451 if (!chrome::GetGlobalApplicationSupportDirectory(&cur))
452 return false; 452 return false;
453 453
454 cur = cur.Append(FILE_PATH_LITERAL("Google")) 454 cur = cur.Append(FILE_PATH_LITERAL("Google"))
455 .Append(FILE_PATH_LITERAL("Chrome")) 455 .Append(FILE_PATH_LITERAL("Chrome"))
456 .Append(FILE_PATH_LITERAL("External Extensions")); 456 .Append(FILE_PATH_LITERAL("External Extensions"));
457 create_dir = false; 457 create_dir = false;
458 #else 458 #else
459 if (!PathService::Get(base::DIR_MODULE, &cur)) 459 if (!PathService::Get(base::DIR_MODULE, &cur))
460 return false; 460 return false;
(...skipping 26 matching lines...) Expand all
487 return true; 487 return true;
488 } 488 }
489 489
490 // This cannot be done as a static initializer sadly since Visual Studio will 490 // This cannot be done as a static initializer sadly since Visual Studio will
491 // eliminate this object file if there is no direct entry point into it. 491 // eliminate this object file if there is no direct entry point into it.
492 void RegisterPathProvider() { 492 void RegisterPathProvider() {
493 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); 493 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
494 } 494 }
495 495
496 } // namespace chrome 496 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/chrome_paths.h ('k') | chrome/common/chrome_paths_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698