| OLD | NEW |
| 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 CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/task/cancelable_task_tracker.h" | 13 #include "base/task/cancelable_task_tracker.h" |
| 14 #include "chrome/browser/favicon/favicon_service.h" | 14 #include "chrome/browser/favicon/favicon_service.h" |
| 15 #include "content/public/browser/url_data_source.h" | 15 #include "content/public/browser/url_data_source.h" |
| 16 #include "ui/gfx/favicon_size.h" | 16 #include "ui/gfx/favicon_size.h" |
| 17 | 17 |
| 18 class Profile; | 18 class Profile; |
| 19 | 19 |
| 20 // FaviconSource is the gateway between network-level chrome: | 20 // FaviconSource is the gateway between network-level chrome: |
| 21 // requests for favicons and the history backend that serves these. | 21 // requests for favicons and the history backend that serves these. |
| 22 // | 22 // |
| 23 // Format: | 23 // Format: |
| 24 // chrome://favicon/size&scalefactor/urlmodifier/url | 24 // chrome://favicon/size&scalefactor/fallback&specs/urlmodifier/url |
| 25 // Some parameters are optional as described below. However, the order of the | 25 // Some parameters are optional as described below. However, the order of the |
| 26 // parameters is not interchangeable. | 26 // parameters is not interchangeable. |
| 27 // | 27 // |
| 28 // Parameter: | 28 // Parameter: |
| 29 // 'url' Required | 29 // 'url' Required |
| 30 // Specifies the page URL of the requested favicon. If the 'urlmodifier' | 30 // Specifies the page URL of the requested favicon. If the 'urlmodifier' |
| 31 // parameter is 'iconurl', the URL refers to the URL of the favicon image | 31 // parameter is 'iconurl', the URL refers to the URL of the favicon image |
| 32 // instead. | 32 // instead. |
| 33 // 'size&scalefactor' Optional | 33 // 'size&scalefactor' Optional |
| 34 // Values: ['largest', size/aa@bx/] | 34 // Values: ['largest', size/aa@bx/] |
| 35 // 'largest': Specifies that the largest available favicon is requested. | 35 // 'largest': Specifies that the largest available favicon is requested. |
| 36 // Example: chrome://favicon/largest/http://www.google.com/ | 36 // Example: chrome://favicon/largest/http://www.google.com/ |
| 37 // 'size/aa@bx/': | 37 // 'size/aa@bx/': |
| 38 // Specifies the requested favicon's size in DIP (aa) and the requested | 38 // Specifies the requested favicon's size in DIP (aa) and the requested |
| 39 // favicon's scale factor. (b). | 39 // favicon's scale factor. (b). |
| 40 // The supported requested DIP sizes are: 16x16, 32x32 and 64x64. | 40 // The supported requested DIP sizes are: 16x16, 32x32 and 64x64. |
| 41 // If the parameter is unspecified, the requested favicon's size defaults | 41 // If the parameter is unspecified, the requested favicon's size defaults |
| 42 // to 16 and the requested scale factor defaults to 1x. | 42 // to 16 and the requested scale factor defaults to 1x. |
| 43 // Example: chrome://favicon/size/16@2x/http://www.google.com/ | 43 // Example: chrome://favicon/size/16@2x/http://www.google.com/ |
| 44 // 'urlmodifier' Optional | 44 // 'fallback&specs' Optional |
| 45 // Values: ['fallback/<specs>/'] |
| 46 // 'fallback/specs/': |
| 47 // Specifies explicit request of a fallback favicon. <specs> is a comma- |
| 48 // separated string of fallback specifications. For details, see |
| 49 // /components/favicon_base/fallback_icon_specs_builder.h. |
| 50 // Example: chrome://favicon/fallback/fff,000/http://www.google.com/ |
| 51 // This requests the fallback favicon for http://www.google.com, using |
| 52 // #fff as the background color and #000 as the text color. |
| 53 // 'urlmodifier' Optional |
| 45 // Values: ['iconurl', 'origin'] | 54 // Values: ['iconurl', 'origin'] |
| 46 // 'iconurl': Specifies that the url parameter refers to the URL of | 55 // 'iconurl': Specifies that the url parameter refers to the URL of |
| 47 // the favicon image as opposed to the URL of the page that the favicon is | 56 // the favicon image as opposed to the URL of the page that the favicon is |
| 48 // on. | 57 // on. |
| 49 // Example: chrome://favicon/iconurl/http://www.google.com/favicon.ico | 58 // Example: chrome://favicon/iconurl/http://www.google.com/favicon.ico |
| 50 // 'origin': Specifies that the URL should be converted to a form with | 59 // 'origin': Specifies that the URL should be converted to a form with |
| 51 // an empty path and a valid scheme. The converted URL will be used to | 60 // an empty path and a valid scheme. The converted URL will be used to |
| 52 // request the favicon from the favicon service. | 61 // request the favicon from the favicon service. |
| 53 // Examples: | 62 // Examples: |
| 54 // chrome://favicon/origin/http://example.com/a | 63 // chrome://favicon/origin/http://example.com/a |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // database doesn't have a favicon for a webpage. Indexed by IconSize values. | 143 // database doesn't have a favicon for a webpage. Indexed by IconSize values. |
| 135 scoped_refptr<base::RefCountedMemory> default_favicons_[NUM_SIZES]; | 144 scoped_refptr<base::RefCountedMemory> default_favicons_[NUM_SIZES]; |
| 136 | 145 |
| 137 // The favicon_base::IconTypes of icon that this FaviconSource handles. | 146 // The favicon_base::IconTypes of icon that this FaviconSource handles. |
| 138 int icon_types_; | 147 int icon_types_; |
| 139 | 148 |
| 140 DISALLOW_COPY_AND_ASSIGN(FaviconSource); | 149 DISALLOW_COPY_AND_ASSIGN(FaviconSource); |
| 141 }; | 150 }; |
| 142 | 151 |
| 143 #endif // CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ | 152 #endif // CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ |
| OLD | NEW |