Index: ios/chrome/browser/ui/activity_services/print_activity.mm |
diff --git a/ios/chrome/browser/ui/activity_services/print_activity.mm b/ios/chrome/browser/ui/activity_services/print_activity.mm |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3e47c9d1d5df123c6906d0b65e8085971f6496ab |
--- /dev/null |
+++ b/ios/chrome/browser/ui/activity_services/print_activity.mm |
@@ -0,0 +1,73 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#import "ios/chrome/browser/ui/activity_services/print_activity.h" |
+ |
+#include "base/logging.h" |
+#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" |
+#import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
+#include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
+#include "ios/chrome/grit/ios_strings.h" |
+#include "ui/base/l10n/l10n_util_mac.h" |
+ |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
+namespace { |
+ |
+NSString* const kPrintActivityType = @"com.google.chrome.printActivity"; |
+ |
+} // namespace |
+ |
+@interface PrintActivity () { |
+ UIResponder* responder_; |
+} |
+@end |
+ |
+@implementation PrintActivity |
+@dynamic responder; |
+ |
++ (NSString*)activityIdentifier { |
+ return kPrintActivityType; |
+} |
+ |
+#pragma mark - UIActivity |
+ |
+- (void)setResponder:(UIResponder*)responder { |
+ responder_ = responder; |
+} |
+ |
+- (NSString*)activityType { |
+ return [PrintActivity activityIdentifier]; |
+} |
+ |
+- (NSString*)activityTitle { |
+ return l10n_util::GetNSString(IDS_IOS_SHARE_MENU_PRINT_ACTION); |
+} |
+ |
+- (UIImage*)activityImage { |
+ return [UIImage imageNamed:@"activity_services_print"]; |
+} |
+ |
+- (BOOL)canPerformWithActivityItems:(NSArray*)activityItems { |
+ return YES; |
+} |
+ |
+- (void)prepareWithActivityItems:(NSArray*)activityItems { |
+} |
+ |
++ (UIActivityCategory)activityCategory { |
+ return UIActivityCategoryAction; |
+} |
+ |
+- (void)performActivity { |
+ GenericChromeCommand* command = |
+ [[GenericChromeCommand alloc] initWithTag:IDC_PRINT]; |
+ DCHECK(responder_); |
+ [responder_ chromeExecuteCommand:command]; |
+ [self activityDidFinish:YES]; |
+} |
+ |
+@end |