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

Side by Side Diff: chrome/browser/ui/webui/large_icon_source.h

Issue 996253002: [Fallback Icons] Refactor FallbackIconService to be a BrowserContext-level singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fixes; remove useless code. Created 5 years, 9 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 CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_
6 #define CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_ 6 #define CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_
7 7
8 #include <string>
9
8 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
9 #include "base/task/cancelable_task_tracker.h" 11 #include "base/task/cancelable_task_tracker.h"
10 #include "components/favicon/core/fallback_icon_service.h" 12 #include "components/favicon/core/fallback_icon_service.h"
11 #include "components/favicon_base/favicon_types.h" 13 #include "components/favicon_base/favicon_types.h"
12 #include "content/public/browser/url_data_source.h" 14 #include "content/public/browser/url_data_source.h"
13 15
14 class Profile; 16 class FallbackIconService;
17 class FaviconService;
15 18
16 // LargeIconSource services explicit chrome:// requests for large icons. 19 // LargeIconSource services explicit chrome:// requests for large icons.
17 // 20 //
18 // Format: 21 // Format:
19 // chrome://large-icon/size/url 22 // chrome://large-icon/size/url
20 // 23 //
21 // Parameter: 24 // Parameter:
22 // 'size' Required (including trailing '/') 25 // 'size' Required (including trailing '/')
23 // Positive integer to specify the large icon's size in pixels. 26 // Positive integer to specify the large icon's size in pixels.
24 // 'url' Optional 27 // 'url' Optional
25 // String to specify the page URL of the large icon. 28 // String to specify the page URL of the large icon.
26 // 29 //
27 // Example: chrome://large-icon/48/http://www.google.com/ 30 // Example: chrome://large-icon/48/http://www.google.com/
28 // This requests a 48x48 large icon for http://www.google.com. 31 // This requests a 48x48 large icon for http://www.google.com.
29 class LargeIconSource : public content::URLDataSource { 32 class LargeIconSource : public content::URLDataSource {
30 public: 33 public:
31 explicit LargeIconSource(Profile* profile); 34 // |favicon_service| and |fallback_icon_service| are owned by caller and may
35 // be null.
36 LargeIconSource(FaviconService* favicon_service,
37 FallbackIconService* fallback_icon_service);
32 38
33 ~LargeIconSource() override; 39 ~LargeIconSource() override;
34 40
35 // content::URLDataSource implementation. 41 // content::URLDataSource implementation.
36 std::string GetSource() const override; 42 std::string GetSource() const override;
37 void StartDataRequest( 43 void StartDataRequest(
38 const std::string& path, 44 const std::string& path,
39 int render_process_id, 45 int render_process_id,
40 int render_frame_id, 46 int render_frame_id,
41 const content::URLDataSource::GotDataCallback& callback) override; 47 const content::URLDataSource::GotDataCallback& callback) override;
(...skipping 20 matching lines...) Expand all
62 const IconRequest& request, 68 const IconRequest& request,
63 const favicon_base::FaviconRawBitmapResult& bitmap_result); 69 const favicon_base::FaviconRawBitmapResult& bitmap_result);
64 70
65 // Renders and sends a fallback icon. 71 // Renders and sends a fallback icon.
66 void SendFallbackIcon(const IconRequest& request); 72 void SendFallbackIcon(const IconRequest& request);
67 73
68 // Returns null to trigger "Not Found" response. 74 // Returns null to trigger "Not Found" response.
69 void SendNotFoundResponse( 75 void SendNotFoundResponse(
70 const content::URLDataSource::GotDataCallback& callback); 76 const content::URLDataSource::GotDataCallback& callback);
71 77
72 Profile* profile_;
73
74 base::CancelableTaskTracker cancelable_task_tracker_; 78 base::CancelableTaskTracker cancelable_task_tracker_;
75 79
76 scoped_ptr<FallbackIconService> fallback_icon_service_; 80 FaviconService* favicon_service_;
81
82 FallbackIconService* fallback_icon_service_;
77 83
78 DISALLOW_COPY_AND_ASSIGN(LargeIconSource); 84 DISALLOW_COPY_AND_ASSIGN(LargeIconSource);
79 }; 85 };
80 86
81 #endif // CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_ 87 #endif // CHROME_BROWSER_UI_WEBUI_LARGE_ICON_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698