Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: ios/chrome/browser/web/mailto_url_rewriter.h

Issue 2859743002: Adds MailtoURLRewriterObserver to MailtoURLRewriter (Closed)
Patch Set: no changes to BUILD.gn any more Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_ 5 #ifndef IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_
6 #define IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_ 6 #define IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 @class MailtoHandler; 10 @class MailtoHandler;
11 @class MailtoURLRewriter;
11 class GURL; 12 class GURL;
12 13
14 // Protocol that must be implemented by observers of MailtoURLRewriter object.
15 @protocol MailtoURLRewriterObserver<NSObject>
16 // The default mailto: handler has been changed.
17 - (void)rewriterDidChange:(MailtoURLRewriter*)rewriter;
18 @end
19
13 // An object that manages the available Mail client apps. The currently selected 20 // An object that manages the available Mail client apps. The currently selected
14 // Mail client to handle mailto: URL is stored in a key in NSUserDefaults. 21 // Mail client to handle mailto: URL is stored in a key in NSUserDefaults.
15 // If the key in NSUserDefaults is not set, the system-provided Mail client app 22 // If the key in NSUserDefaults is not set, the system-provided Mail client app
16 // will be used. 23 // will be used.
17 @interface MailtoURLRewriter : NSObject 24 @interface MailtoURLRewriter : NSObject
18 25
19 // The unique ID of the Mail client app was set to handle mailto: URL scheme. 26 // The unique ID of the Mail client app was set to handle mailto: URL scheme.
20 @property(nonatomic, copy) NSString* defaultHandlerID; 27 @property(nonatomic, copy) NSString* defaultHandlerID;
21 28
29 // Observer object that will be called when |defaultHandlerID| is changed.
30 @property(nonatomic, assign) id<MailtoURLRewriterObserver> observer;
jif 2017/05/10 09:32:07 use weak instead of assign to avoid the risk of ha
pkl (ping after 24h if needed) 2017/05/10 16:28:06 Done.
31
22 // Returns the ID as a string for the system-provided Mail client app. 32 // Returns the ID as a string for the system-provided Mail client app.
23 + (NSString*)systemMailApp; 33 + (NSString*)systemMailApp;
24 34
25 // An initializer returning an instance that has the standard set of 35 // An initializer returning an instance that has the standard set of
26 // MailtoHandlers initialized. Unit tests can use -init and then set up the 36 // MailtoHandlers initialized. Unit tests can use -init and then set up the
27 // different handlers. 37 // different handlers.
28 - (instancetype)initWithStandardHandlers; 38 - (instancetype)initWithStandardHandlers;
29 39
30 // Returns an array of all the currently supported Mail client apps that claims 40 // Returns an array of all the currently supported Mail client apps that claims
31 // to handle mailto: URL scheme through their own custom defined URL schemes. 41 // to handle mailto: URL scheme through their own custom defined URL schemes.
32 - (NSArray<MailtoHandler*>*)defaultHandlers; 42 - (NSArray<MailtoHandler*>*)defaultHandlers;
33 43
44 // Returns the name of the application that handles mailto: URLs.
45 - (NSString*)defaultHandlerName;
46
34 // Rewrites |gURL| into a new URL that can be "opened" to launch the Mail 47 // Rewrites |gURL| into a new URL that can be "opened" to launch the Mail
35 // client app. May return nil if |gURL| is not a mailto: URL or there are no 48 // client app. May return nil if |gURL| is not a mailto: URL or there are no
36 // Mail client app available. 49 // Mail client app available.
37 - (NSString*)rewriteMailtoURL:(const GURL&)gURL; 50 - (NSString*)rewriteMailtoURL:(const GURL&)gURL;
38 51
39 @end 52 @end
40 53
41 #endif // IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_ 54 #endif // IOS_CHROME_BROWSER_WEB_MAILTO_URL_REWRITER_H_
OLDNEW
« no previous file with comments | « no previous file | ios/chrome/browser/web/mailto_url_rewriter.mm » ('j') | ios/chrome/browser/web/mailto_url_rewriter_unittest.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698