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_VIEW_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_READER_MODE_READER_MODE_VIEW_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 #include <memory> |
| 11 |
| 12 #include "base/ios/block_types.h" |
| 13 |
| 14 namespace dom_distiller { |
| 15 class DistillerViewer; |
| 16 } |
| 17 |
| 18 // Simple delegate to be notified on user action. |
| 19 @protocol ReaderModeViewDelegate |
| 20 // Called when the user decides to exit reader mode. |
| 21 - (void)exitReaderMode; |
| 22 @end |
| 23 |
| 24 // A waiting view to show to the user while the distillation is taking place. |
| 25 // This view also owns the dom_distiller::DistillerViewer for the content, this |
| 26 // allows for the distillation to stop if the view is deallocated before the |
| 27 // distillation finishes. |
| 28 @interface ReaderModeView : UIView |
| 29 |
| 30 - (instancetype)initWithFrame:(CGRect)frame |
| 31 delegate:(id<ReaderModeViewDelegate>)delegate |
| 32 NS_DESIGNATED_INITIALIZER; |
| 33 |
| 34 - (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE; |
| 35 - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; |
| 36 |
| 37 // The view's delegate. |
| 38 @property(nonatomic, readonly) id<ReaderModeViewDelegate> delegate; |
| 39 |
| 40 // Takes ownership of the viewer as it is the only handle to the distillation: |
| 41 // When freed it cancels the distillation, if it is not finished yet. The |
| 42 // ReaderModeView instance owns this object so that the distillation is |
| 43 // cancelled if the view is deallocated. |
| 44 - (void)assignDistillerViewer: |
| 45 (std::unique_ptr<dom_distiller::DistillerViewer>)viewer; |
| 46 |
| 47 // Starts the waiting animation. |
| 48 - (void)start; |
| 49 |
| 50 // Call this method when this view is removed from the visible view hierarchy. |
| 51 // |completion| will be called when this view is done animating out. |
| 52 - (void)stopWaitingWithCompletion:(ProceduralBlock)completion; |
| 53 |
| 54 @end |
| 55 |
| 56 #endif // IOS_CHROME_BROWSER_UI_READER_MODE_READER_MODE_VIEW_H_ |
OLD | NEW |