| 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 "ui/base/ui_base_paths.h" | 5 #include "ui/base/ui_base_paths.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 | 12 |
| 13 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
| 14 #include "base/android/path_utils.h" | 14 #include "base/android/path_utils.h" |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 bool PathProvider(int key, FilePath* result) { | 19 bool PathProvider(int key, base::FilePath* result) { |
| 20 // Assume that we will not need to create the directory if it does not exist. | 20 // Assume that we will not need to create the directory if it does not exist. |
| 21 // This flag can be set to true for the cases where we want to create it. | 21 // This flag can be set to true for the cases where we want to create it. |
| 22 bool create_dir = false; | 22 bool create_dir = false; |
| 23 | 23 |
| 24 FilePath cur; | 24 base::FilePath cur; |
| 25 switch (key) { | 25 switch (key) { |
| 26 case ui::DIR_LOCALES: | 26 case ui::DIR_LOCALES: |
| 27 if (!PathService::Get(base::DIR_MODULE, &cur)) | 27 if (!PathService::Get(base::DIR_MODULE, &cur)) |
| 28 return false; | 28 return false; |
| 29 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
| 30 // On Mac, locale files are in Contents/Resources, a sibling of the | 30 // On Mac, locale files are in Contents/Resources, a sibling of the |
| 31 // App dir. | 31 // App dir. |
| 32 cur = cur.DirName(); | 32 cur = cur.DirName(); |
| 33 cur = cur.Append(FILE_PATH_LITERAL("Resources")); | 33 cur = cur.Append(FILE_PATH_LITERAL("Resources")); |
| 34 #elif defined(OS_ANDROID) | 34 #elif defined(OS_ANDROID) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return true; | 70 return true; |
| 71 } | 71 } |
| 72 | 72 |
| 73 // This cannot be done as a static initializer sadly since Visual Studio will | 73 // This cannot be done as a static initializer sadly since Visual Studio will |
| 74 // eliminate this object file if there is no direct entry point into it. | 74 // eliminate this object file if there is no direct entry point into it. |
| 75 void RegisterPathProvider() { | 75 void RegisterPathProvider() { |
| 76 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 76 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace ui | 79 } // namespace ui |
| OLD | NEW |