OLD | NEW |
---|---|
(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 "components/favicon_base/fallback_icon_service.h" | |
9 #include "content/public/browser/url_data_source.h" | |
10 | |
11 // FaviconSource is the gateway between network-level chrome: | |
12 // requests for fallback icons and the backend that renders these. | |
13 // | |
14 // Format: | |
15 // chrome://fallback-icon/size&scalefactor/rendering specs/url | |
16 // Some parameters are optional as described below. However, the order of the | |
17 // parameters is not interchangeable. | |
18 // | |
19 // Parameter: | |
20 // 'size&scalefactor' Optional | |
pkotwicz
2015/01/21 19:44:15
For simplicity, make all of the parameters mandato
huangs
2015/01/22 01:13:27
I really think size should be separate from styles
pkotwicz
2015/01/22 16:14:20
I don't think that making chrome://fallback-icon s
huangs
2015/01/22 22:51:39
Done, removed scale factor, and always have dummy
| |
21 // Values: ['size/aa@bx/'] | |
22 // 'size/aa@bx/': | |
23 // Specifies the requested fallback icon's size in DIP (aa) and the | |
24 // scale factor (b). | |
25 // If the parameter is unspecified, the requested icon's size defaults | |
26 // to 16 and the requested scale factor defaults to 1x. | |
27 // Example: chrome://fallback-icon/size/16@2x/http://www.google.com/ | |
28 // 'style&specs' Optional | |
29 // Values: ['style/<specs>/'] | |
30 // '<specs>': | |
31 // Specifies styling parameters of a fallback con. <specs> is a | |
32 // comma-separated string of fallback specifications. For details, see | |
33 // /components/favicon_base/fallback_icon_specs_builder.h. | |
34 // Example: chrome://fallback-icon/style/fff,000/http://www.google.com/ | |
35 // This requests the fallback icon for http://www.google.com, using | |
36 // #fff as the background color and #000 as the text color. | |
37 // 'url' Required | |
38 // Specifies the page URL of the requested fallback icon. | |
39 class FallbackIconSource : public content::URLDataSource { | |
40 public: | |
41 FallbackIconSource(); | |
42 | |
43 ~FallbackIconSource() override; | |
44 | |
45 // content::URLDataSource implementation. | |
46 std::string GetSource() const override; | |
47 void StartDataRequest( | |
48 const std::string& path, | |
49 int render_process_id, | |
50 int render_frame_id, | |
51 const content::URLDataSource::GotDataCallback& callback) override; | |
52 std::string GetMimeType(const std::string&) const override; | |
53 bool ShouldReplaceExistingSource() const override; | |
54 bool ShouldServiceRequest(const net::URLRequest* request) const override; | |
55 | |
56 private: | |
57 // Sends the 16x16 DIP 1x default favicon. | |
58 void SendDefaultResponse( | |
59 const content::URLDataSource::GotDataCallback& callback); | |
60 | |
61 favicon_base::FallbackIconService fallback_icon_service_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(FallbackIconSource); | |
64 }; | |
65 | |
66 #endif // CHROME_BROWSER_UI_WEBUI_FALLBACK_ICON_SOURCE_H_ | |
OLD | NEW |