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

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: Add missing (optional) semi-colon in the javascript 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..e141ece2a4ecad0d6c0b869b3bfb9a0807f56ec6
--- /dev/null
+++ b/components/dom_distiller/ios/distiller_page_ios.h
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
noyau (Ping after 24h) 2015/02/19 09:15:43 2015 :)
sdefresne 2015/02/19 10:50:12 We generally don't change the copyright line when
+// 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/mac/scoped_nsobject.h"
droger 2015/02/19 09:38:49 Remove.
sdefresne 2015/02/19 10:50:12 Done.
+#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"
+
+class GURL;
droger 2015/02/19 09:38:49 You need to actually include gurl.h
sdefresne 2015/02/19 10:50:12 Done.
+
+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
droger 2015/02/19 09:38:49 s/urls/URLs/
sdefresne 2015/02/19 10:50:12 Done.
+// 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;
+ // Called by |web_state_observer_| once the page has finished loading.
+ void OnLoadURLDone(web::PageLoadCompletionStatus load_completion_status);
+ // 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