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

Side by Side Diff: chrome/browser/favicon/favicon_handler.h

Issue 228783002: Moves knowledge of Profile out of FaviconHandler, into FaviconTabHelper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FAVICON_3
Patch Set: Rebase. Created 6 years, 8 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 | « no previous file | chrome/browser/favicon/favicon_handler.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_
6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ 6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/task/cancelable_task_tracker.h" 13 #include "base/task/cancelable_task_tracker.h"
14 #include "chrome/browser/favicon/favicon_service.h" 14 #include "chrome/browser/favicon/favicon_service.h"
15 #include "chrome/browser/favicon/favicon_tab_helper.h" 15 #include "chrome/browser/favicon/favicon_tab_helper.h"
16 #include "chrome/common/ref_counted_util.h" 16 #include "chrome/common/ref_counted_util.h"
17 #include "content/public/common/favicon_url.h" 17 #include "content/public/common/favicon_url.h"
18 #include "ui/gfx/favicon_size.h" 18 #include "ui/gfx/favicon_size.h"
19 #include "ui/gfx/image/image.h" 19 #include "ui/gfx/image/image.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
22 class FaviconClient;
22 class FaviconHandlerDelegate; 23 class FaviconHandlerDelegate;
23 class Profile; 24 class Profile;
24 class SkBitmap; 25 class SkBitmap;
25 26
26 namespace base { 27 namespace base {
27 class RefCountedMemory; 28 class RefCountedMemory;
28 } 29 }
29 30
30 namespace content { 31 namespace content {
31 class NavigationEntry; 32 class NavigationEntry;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // NavigationEntry and notifies the database to save the favicon. 78 // NavigationEntry and notifies the database to save the favicon.
78 79
79 class FaviconHandler { 80 class FaviconHandler {
80 public: 81 public:
81 enum Type { 82 enum Type {
82 FAVICON, 83 FAVICON,
83 TOUCH, 84 TOUCH,
84 }; 85 };
85 86
86 FaviconHandler(Profile* profile, 87 FaviconHandler(Profile* profile,
88 FaviconClient* client,
87 FaviconHandlerDelegate* delegate, 89 FaviconHandlerDelegate* delegate,
88 Type icon_type); 90 Type icon_type);
89 virtual ~FaviconHandler(); 91 virtual ~FaviconHandler();
90 92
91 // Initiates loading the favicon for the specified url. 93 // Initiates loading the favicon for the specified url.
92 void FetchFavicon(const GURL& url); 94 void FetchFavicon(const GURL& url);
93 95
94 // Message Handler. Must be public, because also called from 96 // Message Handler. Must be public, because also called from
95 // PrerenderContents. Collects the |image_urls| list. 97 // PrerenderContents. Collects the |image_urls| list.
96 void OnUpdateFaviconURL(int32 page_id, 98 void OnUpdateFaviconURL(int32 page_id,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 const GURL& page_url, 147 const GURL& page_url,
146 int icon_types, 148 int icon_types,
147 const FaviconService::FaviconResultsCallback& callback, 149 const FaviconService::FaviconResultsCallback& callback,
148 base::CancelableTaskTracker* tracker); 150 base::CancelableTaskTracker* tracker);
149 151
150 virtual void SetHistoryFavicons(const GURL& page_url, 152 virtual void SetHistoryFavicons(const GURL& page_url,
151 const GURL& icon_url, 153 const GURL& icon_url,
152 chrome::IconType icon_type, 154 chrome::IconType icon_type,
153 const gfx::Image& image); 155 const gfx::Image& image);
154 156
155 virtual FaviconService* GetFaviconService();
156
157 // Returns true if the favicon should be saved. 157 // Returns true if the favicon should be saved.
158 virtual bool ShouldSaveFavicon(const GURL& url); 158 virtual bool ShouldSaveFavicon(const GURL& url);
159 159
160 // Notifies the delegate that the favicon for the active entry was updated. 160 // Notifies the delegate that the favicon for the active entry was updated.
161 // |icon_url_changed| is true if a favicon with a different icon URL has been 161 // |icon_url_changed| is true if a favicon with a different icon URL has been
162 // selected since the previous call to NotifyFaviconUpdated(). 162 // selected since the previous call to NotifyFaviconUpdated().
163 virtual void NotifyFaviconUpdated(bool icon_url_changed); 163 virtual void NotifyFaviconUpdated(bool icon_url_changed);
164 164
165 private: 165 private:
166 friend class TestFaviconHandler; // For testing 166 friend class TestFaviconHandler; // For testing
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 // The prioritized favicon candidates from the page back from the renderer. 280 // The prioritized favicon candidates from the page back from the renderer.
281 std::deque<content::FaviconURL> image_urls_; 281 std::deque<content::FaviconURL> image_urls_;
282 282
283 // The FaviconBitmapResults from history. 283 // The FaviconBitmapResults from history.
284 std::vector<chrome::FaviconBitmapResult> history_results_; 284 std::vector<chrome::FaviconBitmapResult> history_results_;
285 285
286 // The Profile associated with this handler. 286 // The Profile associated with this handler.
287 Profile* profile_; 287 Profile* profile_;
288 288
289 // The client which implements embedder-specific Favicon operations.
290 FaviconClient* client_; // weak
291
289 // This handler's delegate. 292 // This handler's delegate.
290 FaviconHandlerDelegate* delegate_; // weak 293 FaviconHandlerDelegate* delegate_; // weak
291 294
292 // Best image we've seen so far. As images are downloaded from the page they 295 // Best image we've seen so far. As images are downloaded from the page they
293 // are stored here. When there is an exact match, or no more images are 296 // are stored here. When there is an exact match, or no more images are
294 // available the favicon service and the NavigationEntry are updated (assuming 297 // available the favicon service and the NavigationEntry are updated (assuming
295 // the image is for a favicon). 298 // the image is for a favicon).
296 FaviconCandidate best_favicon_candidate_; 299 FaviconCandidate best_favicon_candidate_;
297 300
298 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); 301 DISALLOW_COPY_AND_ASSIGN(FaviconHandler);
299 }; 302 };
300 303
301 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ 304 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/favicon/favicon_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698