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 | |
16 namespace { | 12 namespace { |
17 // English is the default locale for the Terms of Service. | 13 // English is the default locale for the Terms of Service. |
18 const char kEnglishLocale[] = "en"; | 14 const char kEnglishLocale[] = "en"; |
19 // The prefix of the Chrome Terms of Service file name. | 15 // The prefix of the Chrome Terms of Service file name. |
20 const char kChromeTosFilePrefix[] = "terms"; | 16 const char kChromeTosFilePrefix[] = "terms"; |
21 // The file name extension for HTML files. | 17 // The file name extension for HTML files. |
22 const char kHtmlFileExtension[] = "html"; | 18 const char kHtmlFileExtension[] = "html"; |
23 | 19 |
24 // Checks that the requested file exists in the application's resource | 20 // Checks that the requested file exists in the application's resource |
25 // bundle and returns the filename. Returns an empty string if resource does not | 21 // 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... |
82 resource_file = FindFileInResource(base_name, kEnglishLocale, ext); | 78 resource_file = FindFileInResource(base_name, kEnglishLocale, ext); |
83 } | 79 } |
84 DCHECK(!resource_file.empty()); | 80 DCHECK(!resource_file.empty()); |
85 return resource_file; | 81 return resource_file; |
86 } | 82 } |
87 | 83 |
88 std::string GetTermsOfServicePath() { | 84 std::string GetTermsOfServicePath() { |
89 const std::string& locale = GetApplicationContext()->GetApplicationLocale(); | 85 const std::string& locale = GetApplicationContext()->GetApplicationLocale(); |
90 return GetLocalizedFileName(kChromeTosFilePrefix, locale, kHtmlFileExtension); | 86 return GetLocalizedFileName(kChromeTosFilePrefix, locale, kHtmlFileExtension); |
91 } | 87 } |
OLD | NEW |