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

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

Issue 11747016: Add support for high DPI favicons on the "other devices" menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ordering in header file. Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/shared/js/util.js ('k') | chrome/browser/ui/webui/favicon_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
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
(...skipping 30 matching lines...) Expand all
41 // the path we registered. 41 // the path we registered.
42 virtual void StartDataRequest(const std::string& path, 42 virtual void StartDataRequest(const std::string& path,
43 bool is_incognito, 43 bool is_incognito,
44 int request_id) OVERRIDE; 44 int request_id) OVERRIDE;
45 45
46 virtual std::string GetMimeType(const std::string&) const OVERRIDE; 46 virtual std::string GetMimeType(const std::string&) const OVERRIDE;
47 47
48 virtual bool ShouldReplaceExistingSource() const OVERRIDE; 48 virtual bool ShouldReplaceExistingSource() const OVERRIDE;
49 49
50 protected: 50 protected:
51 struct IconRequest {
52 IconRequest()
53 : request_id(0),
54 request_path(""),
55 size_in_dip(gfx::kFaviconSize),
56 scale_factor(ui::SCALE_FACTOR_NONE) {
57 }
58 IconRequest(int id,
59 const std::string& path,
60 int size,
61 ui::ScaleFactor scale)
62 : request_id(id),
63 request_path(path),
64 size_in_dip(size),
65 scale_factor(scale) {
66 }
67 int request_id;
68 std::string request_path;
69 int size_in_dip;
70 ui::ScaleFactor scale_factor;
71 };
72
51 virtual ~FaviconSource(); 73 virtual ~FaviconSource();
52 74
75 // Called when the favicon data is missing to perform additional checks to
76 // locate the resource.
77 // |request| contains information for the failed request.
78 // Returns true if the missing resource is found.
79 virtual bool HandleMissingResource(const IconRequest& request);
80
53 Profile* profile_; 81 Profile* profile_;
54 82
55 private: 83 private:
56 // Defines the allowed pixel sizes for requested favicons. 84 // Defines the allowed pixel sizes for requested favicons.
57 enum IconSize { 85 enum IconSize {
58 SIZE_16, 86 SIZE_16,
59 SIZE_32, 87 SIZE_32,
60 SIZE_64, 88 SIZE_64,
61 NUM_SIZES 89 NUM_SIZES
62 }; 90 };
63 91
64 struct IconRequest {
65 IconRequest()
66 : request_id(0),
67 size_in_dip(gfx::kFaviconSize),
68 scale_factor(ui::SCALE_FACTOR_NONE) {
69 }
70 IconRequest(int id, int size, ui::ScaleFactor scale)
71 : request_id(id),
72 size_in_dip(size),
73 scale_factor(scale) {
74 }
75 int request_id;
76 int size_in_dip;
77 ui::ScaleFactor scale_factor;
78 };
79
80 void Init(Profile* profile, IconType type); 92 void Init(Profile* profile, IconType type);
81 93
82 // Called when favicon data is available from the history backend. 94 // Called when favicon data is available from the history backend.
83 void OnFaviconDataAvailable( 95 void OnFaviconDataAvailable(
84 const IconRequest& request, 96 const IconRequest& request,
85 const history::FaviconBitmapResult& bitmap_result); 97 const history::FaviconBitmapResult& bitmap_result);
86 98
87 // Sends the default favicon. 99 // Sends the default favicon.
88 void SendDefaultResponse(const IconRequest& request); 100 void SendDefaultResponse(const IconRequest& request);
89 101
90 CancelableTaskTracker cancelable_task_tracker_; 102 CancelableTaskTracker cancelable_task_tracker_;
91 103
92 // Raw PNG representations of favicons of each size to show when the favicon 104 // Raw PNG representations of favicons of each size to show when the favicon
93 // database doesn't have a favicon for a webpage. Indexed by IconSize values. 105 // database doesn't have a favicon for a webpage. Indexed by IconSize values.
94 scoped_refptr<base::RefCountedMemory> default_favicons_[NUM_SIZES]; 106 scoped_refptr<base::RefCountedMemory> default_favicons_[NUM_SIZES];
95 107
96 // The history::IconTypes of icon that this FaviconSource handles. 108 // The history::IconTypes of icon that this FaviconSource handles.
97 int icon_types_; 109 int icon_types_;
98 110
99 DISALLOW_COPY_AND_ASSIGN(FaviconSource); 111 DISALLOW_COPY_AND_ASSIGN(FaviconSource);
100 }; 112 };
101 113
102 #endif // CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ 114 #endif // CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/shared/js/util.js ('k') | chrome/browser/ui/webui/favicon_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698