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

Side by Side Diff: components/favicon/core/favicon_handler.h

Issue 1064823002: Componentize FaviconTabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@favicon-notification
Patch Set: Fix BUILD.gn Created 5 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
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 COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ 5 #ifndef COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_
6 #define COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ 6 #define COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/task/cancelable_task_tracker.h" 15 #include "base/task/cancelable_task_tracker.h"
16 #include "components/favicon/core/favicon_url.h" 16 #include "components/favicon/core/favicon_url.h"
17 #include "components/favicon_base/favicon_callback.h" 17 #include "components/favicon_base/favicon_callback.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 FaviconTabHelperTest;
23 class SkBitmap; 22 class SkBitmap;
24 class TestFaviconHandler; 23 class TestFaviconHandler;
25 24
26 namespace base { 25 namespace base {
27 class RefCountedMemory; 26 class RefCountedMemory;
28 } 27 }
29 28
30 namespace favicon { 29 namespace favicon {
31 30
32 class FaviconDriver; 31 class FaviconDriver;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 int id, 110 int id,
112 const GURL& image_url, 111 const GURL& image_url,
113 const std::vector<SkBitmap>& bitmaps, 112 const std::vector<SkBitmap>& bitmaps,
114 const std::vector<gfx::Size>& original_bitmap_sizes); 113 const std::vector<gfx::Size>& original_bitmap_sizes);
115 114
116 // For testing. 115 // For testing.
117 const std::vector<favicon::FaviconURL>& image_urls() const { 116 const std::vector<favicon::FaviconURL>& image_urls() const {
118 return image_urls_; 117 return image_urls_;
119 } 118 }
120 119
120 // Returns whether the handler is waiting for a download to complete or for
121 // data from the FaviconService. Reserved for testing.
122 bool HasPendingTasksForTest();
123
121 protected: 124 protected:
122 // These virtual methods make FaviconHandler testable and are overridden by 125 // These virtual methods make FaviconHandler testable and are overridden by
123 // TestFaviconHandler. 126 // TestFaviconHandler.
124 127
125 // Asks the render to download favicon, returns the request id. 128 // Asks the render to download favicon, returns the request id.
126 virtual int DownloadFavicon(const GURL& image_url, int max_bitmap_size); 129 virtual int DownloadFavicon(const GURL& image_url, int max_bitmap_size);
127 130
128 // Ask the favicon from history 131 // Ask the favicon from history
129 virtual void UpdateFaviconMappingAndFetch( 132 virtual void UpdateFaviconMappingAndFetch(
130 const GURL& page_url, 133 const GURL& page_url,
(...skipping 17 matching lines...) Expand all
148 virtual void SetHistoryFavicons(const GURL& page_url, 151 virtual void SetHistoryFavicons(const GURL& page_url,
149 const GURL& icon_url, 152 const GURL& icon_url,
150 favicon_base::IconType icon_type, 153 favicon_base::IconType icon_type,
151 const gfx::Image& image); 154 const gfx::Image& image);
152 155
153 // Returns true if the favicon should be saved. 156 // Returns true if the favicon should be saved.
154 virtual bool ShouldSaveFavicon(const GURL& url); 157 virtual bool ShouldSaveFavicon(const GURL& url);
155 158
156 private: 159 private:
157 // For testing: 160 // For testing:
158 friend class ::FaviconTabHelperTest;
159 friend class ::TestFaviconHandler; 161 friend class ::TestFaviconHandler;
160 162
161 // Represents an in progress download of an image from the renderer. 163 // Represents an in progress download of an image from the renderer.
162 struct DownloadRequest { 164 struct DownloadRequest {
163 DownloadRequest(); 165 DownloadRequest();
164 ~DownloadRequest(); 166 ~DownloadRequest();
165 167
166 DownloadRequest(const GURL& url, 168 DownloadRequest(const GURL& url,
167 const GURL& image_url, 169 const GURL& image_url,
168 favicon_base::IconType icon_type); 170 favicon_base::IconType icon_type);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 // available the favicon service and the current page are updated (assuming 310 // available the favicon service and the current page are updated (assuming
309 // the image is for a favicon). 311 // the image is for a favicon).
310 FaviconCandidate best_favicon_candidate_; 312 FaviconCandidate best_favicon_candidate_;
311 313
312 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); 314 DISALLOW_COPY_AND_ASSIGN(FaviconHandler);
313 }; 315 };
314 316
315 } // namespace favicon 317 } // namespace favicon
316 318
317 #endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_ 319 #endif // COMPONENTS_FAVICON_CORE_FAVICON_HANDLER_H_
OLDNEW
« no previous file with comments | « components/favicon/core/favicon_driver_impl.cc ('k') | components/favicon/core/favicon_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698