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

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

Issue 2883053003: Delete unused chrome://fallback-icon/ handling (Closed)
Patch Set: Merge branch 'master' into searchbox3 Created 3 years, 7 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 | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/webui/fallback_icon_source.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_FALLBACK_ICON_SOURCE_H_
6 #define CHROME_BROWSER_UI_WEBUI_FALLBACK_ICON_SOURCE_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/macros.h"
12 #include "content/public/browser/url_data_source.h"
13
14 class GURL;
15
16 namespace favicon_base {
17 struct FallbackIconStyle;
18 }
19
20 namespace favicon {
21 class FallbackIconService;
22 }
23
24 // FallbackIconSource services explicit chrome:// requests for fallback icons.
25 //
26 // Format:
27 // chrome://fallback-icon/size,bc,tc,fsr,r/url
28 // All of the parameters except for the url are optional. However, the order of
29 // the parameters is not interchangeable, and all "," must be in place.
30 //
31 // Parameter:
32 // 'size'
33 // Positive integer to specify the fallback icon's size in pixels.
34 // 'bc'
35 // Fallback icon's background color, as named CSS color, or RGB / ARGB /
36 // RRGGBB / AARRGGBB hex formats (no leading "#").
37 // 'tc'
38 // Fallback icon text color, as named CSS color, or RGB / ARGB / RRGGBB /
39 // AARRGGBB hex formats (no leading "#").
40 // 'fsr'
41 // Number in [0.0, 1.0] to specify the fallback icon's font size (pixels)
42 // as a ratio to the icon's size.
43 // 'r'
44 // Number in [0.0, 1.0] to specify the fallback icon's roundness.
45 // 0.0 specifies a square icon; 1.0 specifies a circle icon; intermediate
46 // values specify a rounded square icon.
47 // 'url'
48 // String to specify the page URL of the fallback icon.
49 //
50 // Example: chrome://fallback-icon/32,red,#000,0.5,1.0/http://www.google.com/
51 // This requests a 32x32 fallback icon for http://www.google.com, using
52 // red as the background color, #000 as the text color, with font size of
53 // 32 * 0.5 = 16, and the icon's background shape is a circle.
54 class FallbackIconSource : public content::URLDataSource {
55 public:
56 // |fallback_icon_service| is owned by caller, and may be null.
57 explicit FallbackIconSource(
58 favicon::FallbackIconService* fallback_icon_service);
59
60 ~FallbackIconSource() override;
61
62 // content::URLDataSource implementation.
63 std::string GetSource() const override;
64 void StartDataRequest(
65 const std::string& path,
66 const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
67 const content::URLDataSource::GotDataCallback& callback) override;
68 std::string GetMimeType(const std::string&) const override;
69 bool AllowCaching() const override;
70 bool ShouldReplaceExistingSource() const override;
71 bool ShouldServiceRequest(const GURL& url,
72 content::ResourceContext* resource_context,
73 int render_process_id) const override;
74
75 private:
76 void SendFallbackIconHelper(
77 const GURL& url,
78 int size_in_pixels,
79 const favicon_base::FallbackIconStyle& style,
80 const content::URLDataSource::GotDataCallback& callback);
81
82 // Sends the default fallback icon.
83 void SendDefaultResponse(
84 const content::URLDataSource::GotDataCallback& callback);
85
86 favicon::FallbackIconService* fallback_icon_service_;
87
88 DISALLOW_COPY_AND_ASSIGN(FallbackIconSource);
89 };
90
91 #endif // CHROME_BROWSER_UI_WEBUI_FALLBACK_ICON_SOURCE_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/webui/fallback_icon_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698