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

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

Issue 1318523011: [Password Manager] Copiable username and origin. Linkable origin elided from the left. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Icons appearance fixed Created 5 years, 2 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 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 #ifndef COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ 5 #ifndef COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
6 #define COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ 6 #define COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/task/cancelable_task_tracker.h" 10 #include "base/task/cancelable_task_tracker.h"
11 #include "components/favicon_base/favicon_callback.h" 11 #include "components/favicon_base/favicon_callback.h"
12 #include "components/keyed_service/core/keyed_service.h" 12 #include "components/keyed_service/core/keyed_service.h"
13 13
14 class GURL; 14 class GURL;
15 15
16 namespace base { 16 namespace base {
17 class TaskRunner; 17 class TaskRunner;
18 } 18 }
19 19
20 namespace favicon_base {
21 struct FallbackIconStyle;
22 }
23
20 namespace favicon { 24 namespace favicon {
21 25
22 class FaviconService; 26 class FaviconService;
23 27
24 // The large icon service provides methods to access large icons. It relies on 28 // The large icon service provides methods to access large icons. It relies on
25 // the favicon service. 29 // the favicon service.
26 class LargeIconService : public KeyedService { 30 class LargeIconService : public KeyedService {
27 public: 31 public:
28 LargeIconService( 32 LargeIconService(
29 FaviconService* favicon_service, 33 FaviconService* favicon_service,
30 const scoped_refptr<base::TaskRunner>& background_task_runner); 34 const scoped_refptr<base::TaskRunner>& background_task_runner);
31 ~LargeIconService() override; 35 ~LargeIconService() override;
32 36
33 // Requests the best large icon for the page at |page_url|. 37 // Requests the best large icon for the page at |page_url|.
34 // Case 1. An icon exists whose size is >= |min_source_size_in_pixel|: 38 // Case 1. An icon exists whose size is >= |min_source_size_in_pixel|:
35 // - If |desired_size_in_pixel| == 0: returns icon as is. 39 // - If |desired_size_in_pixel| == 0: returns icon as is.
36 // - Else: returns the icon resized to |desired_size_in_pixel|. 40 // - Else: returns the icon resized to |desired_size_in_pixel|.
37 // Case 2. An icon exists whose size is < |min_source_size_in_pixel|: 41 // Case 2. An icon exists whose size is < |min_source_size_in_pixel|:
38 // - Extracts dominant color of smaller image, returns a fallback icon style 42 // - Extracts dominant color of smaller image, returns a fallback icon style
39 // that has a matching background. 43 // that has a matching background.
40 // Case 3. No icon exists. 44 // Case 3. No icon exists.
41 // - Returns the default fallback icon style. 45 // - Returns the default fallback icon style.
42 // For cases 2 and 3, this function returns the style of the fallback icon 46 // For cases 2 and 3, this function returns the style of the fallback icon
43 // instead of rendering an icon so clients can render the icon themselves. 47 // instead of rendering an icon so clients can render the icon themselves.
44 base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle( 48 base::CancelableTaskTracker::TaskId GetLargeIconOrFallbackStyle(
45 const GURL& page_url, 49 const GURL& page_url,
46 int min_source_size_in_pixel, 50 int min_source_size_in_pixel,
47 int desired_size_in_pixel, 51 int desired_size_in_pixel,
48 const favicon_base::LargeIconCallback& callback, 52 const favicon_base::FallbackIconStyle& fallback_icon_style,
49 base::CancelableTaskTracker* tracker); 53 const favicon_base::LargeIconCallback& callback,
54 base::CancelableTaskTracker* tracker);
50 55
51 private: 56 private:
52 // For testing. 57 // For testing.
53 friend class TestLargeIconService; 58 friend class TestLargeIconService;
54 59
55 FaviconService* favicon_service_; 60 FaviconService* favicon_service_;
56 scoped_refptr<base::TaskRunner> background_task_runner_; 61 scoped_refptr<base::TaskRunner> background_task_runner_;
57 62
58 // A pre-populated list of icon types to consider when looking for large 63 // A pre-populated list of icon types to consider when looking for large
59 // icons. This is an optimization over populating an icon type vector on each 64 // icons. This is an optimization over populating an icon type vector on each
60 // request. 65 // request.
61 std::vector<int> large_icon_types_; 66 std::vector<int> large_icon_types_;
62 67
63 DISALLOW_COPY_AND_ASSIGN(LargeIconService); 68 DISALLOW_COPY_AND_ASSIGN(LargeIconService);
64 }; 69 };
65 70
66 } // namespace favicon 71 } // namespace favicon
67 72
68 #endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_ 73 #endif // COMPONENTS_FAVICON_CORE_LARGE_ICON_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698