| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ios/chrome/browser/ui/file_locations.h" | 5 #include "ios/chrome/browser/ui/file_locations.h" |
| 6 | 6 |
| 7 #include "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "ios/chrome/browser/application_context.h" | 10 #include "ios/chrome/browser/application_context.h" |
| 11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
| 12 namespace { | 16 namespace { |
| 13 // English is the default locale for the Terms of Service. | 17 // English is the default locale for the Terms of Service. |
| 14 const char kEnglishLocale[] = "en"; | 18 const char kEnglishLocale[] = "en"; |
| 15 // The prefix of the Chrome Terms of Service file name. | 19 // The prefix of the Chrome Terms of Service file name. |
| 16 const char kChromeTosFilePrefix[] = "terms"; | 20 const char kChromeTosFilePrefix[] = "terms"; |
| 17 // The file name extension for HTML files. | 21 // The file name extension for HTML files. |
| 18 const char kHtmlFileExtension[] = "html"; | 22 const char kHtmlFileExtension[] = "html"; |
| 19 | 23 |
| 20 // Checks that the requested file exists in the application's resource | 24 // Checks that the requested file exists in the application's resource |
| 21 // bundle and returns the filename. Returns an empty string if resource does not | 25 // bundle and returns the filename. Returns an empty string if resource does not |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 resource_file = FindFileInResource(base_name, kEnglishLocale, ext); | 82 resource_file = FindFileInResource(base_name, kEnglishLocale, ext); |
| 79 } | 83 } |
| 80 DCHECK(!resource_file.empty()); | 84 DCHECK(!resource_file.empty()); |
| 81 return resource_file; | 85 return resource_file; |
| 82 } | 86 } |
| 83 | 87 |
| 84 std::string GetTermsOfServicePath() { | 88 std::string GetTermsOfServicePath() { |
| 85 const std::string& locale = GetApplicationContext()->GetApplicationLocale(); | 89 const std::string& locale = GetApplicationContext()->GetApplicationLocale(); |
| 86 return GetLocalizedFileName(kChromeTosFilePrefix, locale, kHtmlFileExtension); | 90 return GetLocalizedFileName(kChromeTosFilePrefix, locale, kHtmlFileExtension); |
| 87 } | 91 } |
| OLD | NEW |