OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_READER_MODE_READER_MODE_CONTROLLER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_READER_MODE_READER_MODE_CONTROLLER_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 class GURL; |
| 11 class ReaderModeChecker; |
| 12 |
| 13 namespace web { |
| 14 class WebState; |
| 15 } |
| 16 |
| 17 @protocol ReaderModeControllerDelegate |
| 18 // Called by the controller to retrieve the superview that the reader mode |
| 19 // panel should be a subview of. The panel's position is based on the size of |
| 20 // the superview, which is presumed to fill the device's screen. |
| 21 - (UIView*)superviewForReaderModePanel; |
| 22 |
| 23 // Called when the distillation finishes. |
| 24 - (void)loadReaderModeHTML:(NSString*)html forURL:(const GURL&)url; |
| 25 @end |
| 26 |
| 27 // A reader mode controller can trigger distillations on the current visible |
| 28 // page on a web state. |
| 29 @interface ReaderModeController : NSObject |
| 30 |
| 31 - (instancetype)initWithWebState:(web::WebState*)state |
| 32 delegate:(id<ReaderModeControllerDelegate>)delegate |
| 33 NS_DESIGNATED_INITIALIZER; |
| 34 |
| 35 - (instancetype)init NS_UNAVAILABLE; |
| 36 |
| 37 // The object that checks if a URL is suitable for reader mode. |
| 38 @property(nonatomic, readonly, assign) ReaderModeChecker* checker; |
| 39 |
| 40 // Starts a distillation, animates a view on screen to show a waiting UI to the |
| 41 // user while the distillation is ongoing, and calls the delegate once finished. |
| 42 - (void)switchToReaderMode; |
| 43 // Removes the waiting view from the superview returned by the delegate. |
| 44 - (void)exitReaderMode; |
| 45 // Instructs the controller to detach itself from the web state. |
| 46 - (void)detachFromWebState; |
| 47 @end |
| 48 |
| 49 #endif // IOS_CHROME_BROWSER_UI_READER_MODE_READER_MODE_CONTROLLER_H_ |
OLD | NEW |