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
3 // found in the LICENSE file.
5 #import "ios/chrome/browser/ui/commands/show_mail_composer_command.h"
7 #include "base/files/file_path.h"
8 #include "base/logging.h"
9 #include "base/mac/scoped_nsobject.h"
10 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
12 @implementation ShowMailComposerCommand {
13 base::scoped_nsobject<NSArray> _toRecipients;
14 base::scoped_nsobject<NSString> _subject;
15 base::scoped_nsobject<NSString> _body;
16 base::FilePath _textFileToAttach;
19 @synthesize emailNotConfiguredAlertTitleId = _emailNotConfiguredAlertTitleId;
20 @synthesize emailNotConfiguredAlertMessageId =
21 _emailNotConfiguredAlertMessageId;
23 - (instancetype)initWithTag:(NSInteger)tag {
28 - (instancetype)initWithToRecipient:(NSString*)toRecipient
29 subject:(NSString*)subject
31 emailNotConfiguredAlertTitleId:(int)alertTitleId
32 emailNotConfiguredAlertMessageId:(int)alertMessageId {
34 DCHECK(alertMessageId);
35 self = [super initWithTag:IDC_SHOW_MAIL_COMPOSER];
37 _toRecipients.reset([@[ toRecipient ] retain]);
38 _subject.reset([subject copy]);
39 _body.reset([body copy]);
40 _emailNotConfiguredAlertTitleId = alertTitleId;
41 _emailNotConfiguredAlertMessageId = alertMessageId;
46 - (NSArray*)toRecipients {
47 return _toRecipients.get();
50 - (NSString*)subject {
51 return _subject.get();
58 - (const base::FilePath&)textFileToAttach {
59 return _textFileToAttach;
62 - (void)setTextFileToAttach:(const base::FilePath&)textFileToAttach {
63 _textFileToAttach = textFileToAttach;