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

Unified Diff: ios/chrome/browser/dom_distiller/distiller_favicon.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
Index: ios/chrome/browser/dom_distiller/distiller_favicon.mm
diff --git a/ios/chrome/browser/dom_distiller/distiller_favicon.mm b/ios/chrome/browser/dom_distiller/distiller_favicon.mm
new file mode 100644
index 0000000000000000000000000000000000000000..a3ccab360927145175ea2e5c12be1bd8f92b7f2f
--- /dev/null
+++ b/ios/chrome/browser/dom_distiller/distiller_favicon.mm
@@ -0,0 +1,51 @@
+// Copyright 2016 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.
+
+#include "ios/chrome/browser/dom_distiller/distiller_favicon.h"
+
+#include "components/favicon/ios/web_favicon_driver.h"
+#include "components/keyed_service/core/service_access_type.h"
+#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h"
+#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/chrome/browser/favicon/favicon_service_factory.h"
+#include "ios/chrome/browser/history/history_service_factory.h"
+#include "ios/public/provider/web/web_controller_provider.h"
+#include "ios/web/public/favicon_url.h"
+#include "url/gurl.h"
+#include "ios/chrome/browser/dom_distiller/distiller_favicon_driver.h"
+
+namespace dom_distiller {
+
+DistillerFavicon::DistillerFavicon(web::BrowserState* browser_state)
+ : browser_state_(browser_state) {}
+
+DistillerFavicon::~DistillerFavicon() {}
+std::unique_ptr<ios::WebControllerProvider> DistillerFavicon::CreateProvider(
+ const GURL& page_url) {
+ ios::ChromeBrowserState* original_browser_state =
+ ios::ChromeBrowserState::FromBrowserState(browser_state_);
+
+ std::unique_ptr<ios::WebControllerProvider> provider =
+ ios::GetWebControllerProviderFactory()->CreateWebControllerProvider(
+ browser_state_);
+
+ web::WebState* web_state = provider->GetWebState();
+
+ ::DistillerFaviconDriver::CreateForWebState(
+ web_state,
+ ios::FaviconServiceFactory::GetForBrowserState(
+ original_browser_state, ServiceAccessType::EXPLICIT_ACCESS),
+ ios::HistoryServiceFactory::GetForBrowserState(
+ original_browser_state, ServiceAccessType::EXPLICIT_ACCESS),
+ ios::BookmarkModelFactory::GetForBrowserState(original_browser_state),
+ page_url);
+
+ favicon::WebFaviconDriver* favicon_driver =
+ favicon::WebFaviconDriver::FromWebState(web_state);
+
+ favicon_driver->FetchFavicon(page_url);
+
+ return provider;
+}
+}
« no previous file with comments | « ios/chrome/browser/dom_distiller/distiller_favicon.h ('k') | ios/chrome/browser/dom_distiller/distiller_favicon_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698