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

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

Issue 2541093002: DO NOT COMMIT (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
« no previous file with comments | « components/dom_distiller/ios/distiller_page_ios.h ('k') | components/favicon/ios/web_favicon_driver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/dom_distiller/ios/distiller_page_ios.mm
diff --git a/components/dom_distiller/ios/distiller_page_ios.mm b/components/dom_distiller/ios/distiller_page_ios.mm
index a59548ae016bd82f1a14ebf921b252233d3ddbd1..3ceca0aa952595275efb7fc5405ffecacbb18821 100644
--- a/components/dom_distiller/ios/distiller_page_ios.mm
+++ b/components/dom_distiller/ios/distiller_page_ios.mm
@@ -14,9 +14,11 @@
#include "base/memory/ptr_util.h"
#include "base/strings/sys_string_conversions.h"
#include "base/values.h"
+#include "components/dom_distiller/ios/distiller_favicon_ios.h"
#include "ios/public/provider/web/web_controller_provider.h"
#include "ios/public/provider/web/web_controller_provider_factory.h"
#include "ios/web/public/browser_state.h"
+#include "ios/web/public/favicon_url.h"
namespace {
@@ -125,9 +127,9 @@ void DistillerWebStateObserver::PageLoaded(
#pragma mark -
-DistillerPageIOS::DistillerPageIOS(web::BrowserState* browser_state)
- : browser_state_(browser_state), weak_ptr_factory_(this) {
-}
+DistillerPageIOS::DistillerPageIOS(web::BrowserState* browser_state,
+ DistillerFaviconIOS* distiller_favicon)
+ : distiller_favicon_(distiller_favicon), weak_ptr_factory_(this) {}
DistillerPageIOS::~DistillerPageIOS() {
}
@@ -143,16 +145,18 @@ void DistillerPageIOS::DistillPageImpl(const GURL& url,
url_ = url;
script_ = script;
- // Lazily create provider.
- if (!provider_) {
- if (ios::GetWebControllerProviderFactory()) {
- provider_ =
- ios::GetWebControllerProviderFactory()->CreateWebControllerProvider(
- browser_state_);
- web_state_observer_.reset(
- new DistillerWebStateObserver(provider_->GetWebState(), this));
- }
- }
+ provider_ = distiller_favicon_->CreateProvider(url);
+
+ // Lazily create provider.
+ // if (!provider_) {
+ // if (ios::GetWebControllerProviderFactory()) {
+ // provider_ =
+ // ios::GetWebControllerProviderFactory()->CreateWebControllerProvider(
+ // browser_state_);
+ // web_state_observer_.reset(
+ // new DistillerWebStateObserver(provider_->GetWebState(), this));
+ // }
+ // }
// Load page using provider.
if (provider_)
@@ -175,8 +179,18 @@ void DistillerPageIOS::OnLoadURLDone(
base::WeakPtr<DistillerPageIOS> weak_this = weak_ptr_factory_.GetWeakPtr();
provider_->InjectScript(script_, ^(id result, NSError* error) {
DistillerPageIOS* distiller_page = weak_this.get();
- if (distiller_page)
+
+ if (distiller_page) {
distiller_page->HandleJavaScriptResult(result);
+
+ // Get the favicons.
+ // provider_->InjectScript(favicon_script_, ^(id result, NSError*
+ // error) {
+ // DistillerPageIOS* distiller_page_favicon = weak_this.get();
+ // if (distiller_page_favicon)
+ // distiller_page_favicon->HandleFaviconResult(result);
+ // });
+ }
});
}
« no previous file with comments | « components/dom_distiller/ios/distiller_page_ios.h ('k') | components/favicon/ios/web_favicon_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698