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

Side by Side Diff: components/favicon/ios/web_favicon_driver.mm

Issue 2694333002: Fix leaking page visits in incognito mode via bookmarked favicons (Closed)
Patch Set: Rebased Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « components/favicon/ios/web_favicon_driver.h ('k') | ios/chrome/browser/reading_list/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/favicon/ios/web_favicon_driver.h" 5 #include "components/favicon/ios/web_favicon_driver.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/threading/sequenced_worker_pool.h" 9 #include "base/threading/sequenced_worker_pool.h"
10 #include "components/favicon/core/favicon_url.h" 10 #include "components/favicon/core/favicon_url.h"
(...skipping 20 matching lines...) Expand all
31 const GURL& image_url, 31 const GURL& image_url,
32 const std::vector<SkBitmap>& bitmaps, 32 const std::vector<SkBitmap>& bitmaps,
33 const std::vector<gfx::Size>& sizes)>; 33 const std::vector<gfx::Size>& sizes)>;
34 34
35 namespace favicon { 35 namespace favicon {
36 36
37 // static 37 // static
38 void WebFaviconDriver::CreateForWebState( 38 void WebFaviconDriver::CreateForWebState(
39 web::WebState* web_state, 39 web::WebState* web_state,
40 FaviconService* favicon_service, 40 FaviconService* favicon_service,
41 history::HistoryService* history_service, 41 history::HistoryService* history_service) {
42 bookmarks::BookmarkModel* bookmark_model) {
43 if (FromWebState(web_state)) 42 if (FromWebState(web_state))
44 return; 43 return;
45 44
46 web_state->SetUserData(UserDataKey(), base::WrapUnique(new WebFaviconDriver( 45 web_state->SetUserData(UserDataKey(),
47 web_state, favicon_service, 46 base::WrapUnique(new WebFaviconDriver(
48 history_service, bookmark_model))); 47 web_state, favicon_service, history_service)));
49 } 48 }
50 49
51 void WebFaviconDriver::FetchFavicon(const GURL& page_url, 50 void WebFaviconDriver::FetchFavicon(const GURL& page_url,
52 bool is_same_document) { 51 bool is_same_document) {
53 fetch_favicon_url_ = page_url; 52 fetch_favicon_url_ = page_url;
54 FaviconDriverImpl::FetchFavicon(page_url, is_same_document); 53 FaviconDriverImpl::FetchFavicon(page_url, is_same_document);
55 } 54 }
56 55
57 gfx::Image WebFaviconDriver::GetFavicon() const { 56 gfx::Image WebFaviconDriver::GetFavicon() const {
58 web::NavigationItem* item = 57 web::NavigationItem* item =
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 web_state()->GetNavigationManager()->GetVisibleItem(); 125 web_state()->GetNavigationManager()->GetVisibleItem();
127 if (!item || item->GetURL() != page_url) 126 if (!item || item->GetURL() != page_url)
128 return; 127 return;
129 128
130 NotifyFaviconUpdatedObservers(notification_icon_type, icon_url, 129 NotifyFaviconUpdatedObservers(notification_icon_type, icon_url,
131 icon_url_changed, image); 130 icon_url_changed, image);
132 } 131 }
133 132
134 WebFaviconDriver::WebFaviconDriver(web::WebState* web_state, 133 WebFaviconDriver::WebFaviconDriver(web::WebState* web_state,
135 FaviconService* favicon_service, 134 FaviconService* favicon_service,
136 history::HistoryService* history_service, 135 history::HistoryService* history_service)
137 bookmarks::BookmarkModel* bookmark_model)
138 : web::WebStateObserver(web_state), 136 : web::WebStateObserver(web_state),
139 FaviconDriverImpl(favicon_service, history_service, bookmark_model), 137 FaviconDriverImpl(favicon_service, history_service),
140 image_fetcher_(web_state->GetBrowserState()->GetRequestContext()) {} 138 image_fetcher_(web_state->GetBrowserState()->GetRequestContext()) {}
141 139
142 WebFaviconDriver::~WebFaviconDriver() { 140 WebFaviconDriver::~WebFaviconDriver() {
143 } 141 }
144 142
145 void WebFaviconDriver::FaviconUrlUpdated( 143 void WebFaviconDriver::FaviconUrlUpdated(
146 const std::vector<web::FaviconURL>& candidates) { 144 const std::vector<web::FaviconURL>& candidates) {
147 DCHECK(!candidates.empty()); 145 DCHECK(!candidates.empty());
148 OnUpdateCandidates(GetActiveURL(), FaviconURLsFromWebFaviconURLs(candidates), 146 OnUpdateCandidates(GetActiveURL(), FaviconURLsFromWebFaviconURLs(candidates),
149 GURL()); 147 GURL());
150 } 148 }
151 149
152 } // namespace favicon 150 } // namespace favicon
OLDNEW
« no previous file with comments | « components/favicon/ios/web_favicon_driver.h ('k') | ios/chrome/browser/reading_list/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698