| OLD | NEW | 
|---|
| 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/files/file_util.h" | 7 #include "base/files/file_util.h" | 
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" | 
| 9 #include "base/logging.h" | 9 #include "base/logging.h" | 
| 10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 53 | 53 | 
| 54 #if defined(OS_LINUX) | 54 #if defined(OS_LINUX) | 
| 55 // The path to the external extension <id>.json files. | 55 // The path to the external extension <id>.json files. | 
| 56 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ | 56 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ | 
| 57 const base::FilePath::CharType kFilepathSinglePrefExtensions[] = | 57 const base::FilePath::CharType kFilepathSinglePrefExtensions[] = | 
| 58 #if defined(GOOGLE_CHROME_BUILD) | 58 #if defined(GOOGLE_CHROME_BUILD) | 
| 59     FILE_PATH_LITERAL("/usr/share/google-chrome/extensions"); | 59     FILE_PATH_LITERAL("/usr/share/google-chrome/extensions"); | 
| 60 #else | 60 #else | 
| 61     FILE_PATH_LITERAL("/usr/share/chromium/extensions"); | 61     FILE_PATH_LITERAL("/usr/share/chromium/extensions"); | 
| 62 #endif  // defined(GOOGLE_CHROME_BUILD) | 62 #endif  // defined(GOOGLE_CHROME_BUILD) | 
|  | 63 | 
|  | 64 // The path to the hint file that tells the pepper plugin loader | 
|  | 65 // where it can find the latest component updated flash. | 
|  | 66 const base::FilePath::CharType kComponentUpdatedFlashHint[] = | 
|  | 67     FILE_PATH_LITERAL("latest-component-updated-flash"); | 
| 63 #endif  // defined(OS_LINUX) | 68 #endif  // defined(OS_LINUX) | 
| 64 | 69 | 
| 65 static base::LazyInstance<base::FilePath> | 70 static base::LazyInstance<base::FilePath> | 
| 66     g_invalid_specified_user_data_dir = LAZY_INSTANCE_INITIALIZER; | 71     g_invalid_specified_user_data_dir = LAZY_INSTANCE_INITIALIZER; | 
| 67 | 72 | 
| 68 // Gets the path for internal plugins. | 73 // Gets the path for internal plugins. | 
| 69 bool GetInternalPluginsDirectory(base::FilePath* result) { | 74 bool GetInternalPluginsDirectory(base::FilePath* result) { | 
| 70 #if defined(OS_MACOSX) && !defined(OS_IOS) | 75 #if defined(OS_MACOSX) && !defined(OS_IOS) | 
| 71   // If called from Chrome, get internal plugins from a subdirectory of the | 76   // If called from Chrome, get internal plugins from a subdirectory of the | 
| 72   // framework. | 77   // framework. | 
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 559       cur = cur.Append(kGCMStoreDirname); | 564       cur = cur.Append(kGCMStoreDirname); | 
| 560       break; | 565       break; | 
| 561 #endif  // !defined(OS_ANDROID) | 566 #endif  // !defined(OS_ANDROID) | 
| 562 #if defined(OS_ANDROID) | 567 #if defined(OS_ANDROID) | 
| 563     case chrome::DIR_OFFLINE_PAGE_METADATA: | 568     case chrome::DIR_OFFLINE_PAGE_METADATA: | 
| 564       if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) | 569       if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) | 
| 565         return false; | 570         return false; | 
| 566       cur = cur.Append(kOfflinePageMetadataDirname); | 571       cur = cur.Append(kOfflinePageMetadataDirname); | 
| 567       break; | 572       break; | 
| 568 #endif  // defined(OS_ANDROID) | 573 #endif  // defined(OS_ANDROID) | 
|  | 574 #if defined(OS_LINUX) | 
|  | 575     case chrome::FILE_COMPONENT_FLASH_HINT: | 
|  | 576       if (!PathService::Get(chrome::DIR_COMPONENT_UPDATED_PEPPER_FLASH_PLUGIN, | 
|  | 577                             &cur)) | 
|  | 578         return false; | 
|  | 579       cur = cur.Append(kComponentUpdatedFlashHint); | 
|  | 580       break; | 
|  | 581 #endif  // defined(OS_LINUX) | 
| 569 | 582 | 
| 570     default: | 583     default: | 
| 571       return false; | 584       return false; | 
| 572   } | 585   } | 
| 573 | 586 | 
| 574   // TODO(bauerb): http://crbug.com/259796 | 587   // TODO(bauerb): http://crbug.com/259796 | 
| 575   base::ThreadRestrictions::ScopedAllowIO allow_io; | 588   base::ThreadRestrictions::ScopedAllowIO allow_io; | 
| 576   if (create_dir && !base::PathExists(cur) && | 589   if (create_dir && !base::PathExists(cur) && | 
| 577       !base::CreateDirectory(cur)) | 590       !base::CreateDirectory(cur)) | 
| 578     return false; | 591     return false; | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 589 | 602 | 
| 590 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { | 603 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { | 
| 591   g_invalid_specified_user_data_dir.Get() = user_data_dir; | 604   g_invalid_specified_user_data_dir.Get() = user_data_dir; | 
| 592 } | 605 } | 
| 593 | 606 | 
| 594 const base::FilePath& GetInvalidSpecifiedUserDataDir() { | 607 const base::FilePath& GetInvalidSpecifiedUserDataDir() { | 
| 595   return g_invalid_specified_user_data_dir.Get(); | 608   return g_invalid_specified_user_data_dir.Get(); | 
| 596 } | 609 } | 
| 597 | 610 | 
| 598 }  // namespace chrome | 611 }  // namespace chrome | 
| OLD | NEW | 
|---|