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

Unified Diff: components/dom_distiller/ios/distiller_page_ios.h

Issue 936843002: Upstream iOS implementation of dom_distiller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web_controller_provider
Patch Set: Address comments Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/ios/distiller_page_ios.h
diff --git a/components/dom_distiller/ios/distiller_page_ios.h b/components/dom_distiller/ios/distiller_page_ios.h
new file mode 100644
index 0000000000000000000000000000000000000000..0727e9e52ff99a25a15181503b45378ed92ac98a
--- /dev/null
+++ b/components/dom_distiller/ios/distiller_page_ios.h
@@ -0,0 +1,56 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
nyquist 2015/02/20 18:55:48 Not: 2015
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_
+#define COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "components/dom_distiller/core/distiller_page.h"
+#include "ios/web/public/web_state/web_state_observer.h"
+#include "url/gurl.h"
+
+namespace ios {
+class WebControllerProvider;
+}
+
+namespace web {
+class BrowserState;
+class WebState;
+}
+
+namespace dom_distiller {
+
+class DistillerWebStateObserver;
+
+// Loads URLs and injects JavaScript into a page, extracting the distilled page
+// content.
+class DistillerPageIOS : public DistillerPage {
+ public:
+ explicit DistillerPageIOS(web::BrowserState* browser_state);
+ ~DistillerPageIOS() override;
+
+ protected:
+ void DistillPageImpl(const GURL& url, const std::string& script) override;
+
+ private:
+ friend class DistillerWebStateObserver;
bengr 2015/02/20 20:11:38 Add blank line below.
sdefresne 2015/02/23 14:48:13 Done.
+ // Called by |web_state_observer_| once the page has finished loading.
+ void OnLoadURLDone(web::PageLoadCompletionStatus load_completion_status);
bengr 2015/02/20 20:11:38 Add blank line below.
sdefresne 2015/02/23 14:48:13 Done.
+ // Called once the |script_| has been evaluated on the page.
+ void HandleJavaScriptResultString(NSString* result);
+
+ web::BrowserState* browser_state_;
+ GURL url_;
+ std::string script_;
+ scoped_ptr<ios::WebControllerProvider> provider_;
+ scoped_ptr<DistillerWebStateObserver> web_state_observer_;
+ base::WeakPtrFactory<DistillerPageIOS> weak_ptr_factory_;
+};
+
+} // namespace dom_distiller
+
+#endif // COMPONENTS_DOM_DISTILLER_IOS_DISTILLER_PAGE_IOS_H_

Powered by Google App Engine
This is Rietveld 408576698