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

Unified Diff: ios/chrome/browser/ui/reader_mode/reader_mode_view.h

Issue 2589583003: Upstream Chrome on iOS source code [7/11]. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/reader_mode/reader_mode_view.h
diff --git a/ios/chrome/browser/ui/reader_mode/reader_mode_view.h b/ios/chrome/browser/ui/reader_mode/reader_mode_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..51ebe9743496f907d6f08b4604b35b1bb12d3b35
--- /dev/null
+++ b/ios/chrome/browser/ui/reader_mode/reader_mode_view.h
@@ -0,0 +1,56 @@
+// Copyright 2015 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.
+
+#ifndef IOS_CHROME_BROWSER_UI_READER_MODE_READER_MODE_VIEW_H_
+#define IOS_CHROME_BROWSER_UI_READER_MODE_READER_MODE_VIEW_H_
+
+#import <UIKit/UIKit.h>
+
+#include <memory>
+
+#include "base/ios/block_types.h"
+
+namespace dom_distiller {
+class DistillerViewer;
+}
+
+// Simple delegate to be notified on user action.
+@protocol ReaderModeViewDelegate
+// Called when the user decides to exit reader mode.
+- (void)exitReaderMode;
+@end
+
+// A waiting view to show to the user while the distillation is taking place.
+// This view also owns the dom_distiller::DistillerViewer for the content, this
+// allows for the distillation to stop if the view is deallocated before the
+// distillation finishes.
+@interface ReaderModeView : UIView
+
+- (instancetype)initWithFrame:(CGRect)frame
+ delegate:(id<ReaderModeViewDelegate>)delegate
+ NS_DESIGNATED_INITIALIZER;
+
+- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
+- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
+
+// The view's delegate.
+@property(nonatomic, readonly) id<ReaderModeViewDelegate> delegate;
+
+// Takes ownership of the viewer as it is the only handle to the distillation:
+// When freed it cancels the distillation, if it is not finished yet. The
+// ReaderModeView instance owns this object so that the distillation is
+// cancelled if the view is deallocated.
+- (void)assignDistillerViewer:
+ (std::unique_ptr<dom_distiller::DistillerViewer>)viewer;
+
+// Starts the waiting animation.
+- (void)start;
+
+// Call this method when this view is removed from the visible view hierarchy.
+// |completion| will be called when this view is done animating out.
+- (void)stopWaitingWithCompletion:(ProceduralBlock)completion;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_UI_READER_MODE_READER_MODE_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698