Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/common/app_group/app_group_constants.h" | 5 #include "ios/chrome/common/app_group/app_group_constants.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "build/config/ios/ios_app_bundle_id_prefix.h" | |
| 9 #include "components/version_info/version_info.h" | 10 #include "components/version_info/version_info.h" |
| 10 | 11 |
| 11 #if !defined(__has_feature) || !__has_feature(objc_arc) | 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 12 #error "This file requires ARC support." | 13 #error "This file requires ARC support." |
| 13 #endif | 14 #endif |
| 14 | 15 |
| 15 namespace { | |
| 16 NSString* const kChromeAppGroupIdentifier = | |
| 17 @"group." IOS_BUNDLE_ID_PREFIX ".chrome"; | |
| 18 } | |
| 19 | |
| 20 namespace app_group { | 16 namespace app_group { |
| 21 | 17 |
| 22 const char kChromeAppGroupXCallbackCommand[] = "app-group-command"; | 18 const char kChromeAppGroupXCallbackCommand[] = "app-group-command"; |
| 23 | 19 |
| 24 const char kChromeAppGroupCommandPreference[] = | 20 const char kChromeAppGroupCommandPreference[] = |
| 25 "GroupApp.ChromeAppGroupCommand"; | 21 "GroupApp.ChromeAppGroupCommand"; |
| 26 | 22 |
| 27 const char kChromeAppGroupCommandTimePreference[] = "CommandTime"; | 23 const char kChromeAppGroupCommandTimePreference[] = "CommandTime"; |
| 28 | 24 |
| 29 const char kChromeAppGroupCommandAppPreference[] = "SourceApp"; | 25 const char kChromeAppGroupCommandAppPreference[] = "SourceApp"; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 44 NSString* const kShareItemURL = @"URL"; | 40 NSString* const kShareItemURL = @"URL"; |
| 45 NSString* const kShareItemTitle = @"Title"; | 41 NSString* const kShareItemTitle = @"Title"; |
| 46 NSString* const kShareItemDate = @"Date"; | 42 NSString* const kShareItemDate = @"Date"; |
| 47 NSString* const kShareItemCancel = @"Cancel"; | 43 NSString* const kShareItemCancel = @"Cancel"; |
| 48 NSString* const kShareItemType = @"Type"; | 44 NSString* const kShareItemType = @"Type"; |
| 49 | 45 |
| 50 NSString* ApplicationGroup() { | 46 NSString* ApplicationGroup() { |
| 51 NSBundle* bundle = [NSBundle mainBundle]; | 47 NSBundle* bundle = [NSBundle mainBundle]; |
| 52 NSString* group = [bundle objectForInfoDictionaryKey:@"KSApplicationGroup"]; | 48 NSString* group = [bundle objectForInfoDictionaryKey:@"KSApplicationGroup"]; |
| 53 if (![group length]) { | 49 if (![group length]) { |
| 54 return kChromeAppGroupIdentifier; | 50 return [NSString stringWithFormat:@"group.%s.chrome", |
| 51 BUILDFLAG(IOS_APP_BUNDLE_ID_PREFIX), nil]; | |
|
rohitrao (ping after 24h)
2016/12/13 14:14:30
Is there a better way to concatenate these strings
sdefresne
2016/12/13 15:18:02
Ah, BUILDFLAG(IOS_APP_BUNDLE_ID_PREFIX) expands to
| |
| 55 } | 52 } |
| 56 return group; | 53 return group; |
| 57 } | 54 } |
| 58 | 55 |
| 59 NSString* ApplicationName(AppGroupApplications application) { | 56 NSString* ApplicationName(AppGroupApplications application) { |
| 60 switch (application) { | 57 switch (application) { |
| 61 case APP_GROUP_CHROME: | 58 case APP_GROUP_CHROME: |
| 62 return base::SysUTF8ToNSString(version_info::GetProductName()); | 59 return base::SysUTF8ToNSString(version_info::GetProductName()); |
| 63 case APP_GROUP_TODAY_EXTENSION: | 60 case APP_GROUP_TODAY_EXTENSION: |
| 64 return @"TodayExtension"; | 61 return @"TodayExtension"; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 83 NSURL* ShareExtensionItemsFolder() { | 80 NSURL* ShareExtensionItemsFolder() { |
| 84 NSURL* groupURL = [[NSFileManager defaultManager] | 81 NSURL* groupURL = [[NSFileManager defaultManager] |
| 85 containerURLForSecurityApplicationGroupIdentifier:ApplicationGroup()]; | 82 containerURLForSecurityApplicationGroupIdentifier:ApplicationGroup()]; |
| 86 NSURL* readingListURL = | 83 NSURL* readingListURL = |
| 87 [groupURL URLByAppendingPathComponent:@"ShareExtensionItems" | 84 [groupURL URLByAppendingPathComponent:@"ShareExtensionItems" |
| 88 isDirectory:YES]; | 85 isDirectory:YES]; |
| 89 return readingListURL; | 86 return readingListURL; |
| 90 } | 87 } |
| 91 | 88 |
| 92 } // namespace app_group | 89 } // namespace app_group |
| OLD | NEW |