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

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

Issue 10909236: Add support for favicon scale factor in WebUI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use high-DPI icons for search engine dialog. Created 8 years, 3 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
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 virtual std::string GetMimeType(const std::string&) const OVERRIDE; 44 virtual std::string GetMimeType(const std::string&) const OVERRIDE;
45 45
46 virtual bool ShouldReplaceExistingSource() const OVERRIDE; 46 virtual bool ShouldReplaceExistingSource() const OVERRIDE;
47 47
48 protected: 48 protected:
49 virtual ~FaviconSource(); 49 virtual ~FaviconSource();
50 50
51 Profile* profile_; 51 Profile* profile_;
52 52
53 private: 53 private:
54
55 struct IconSize {
56 IconSize()
57 : pixel_size(16), scale_factor(ui::SCALE_FACTOR_NONE) {
pkotwicz 2012/09/17 19:32:06 I don't think you need this constructor.
kevers 2012/09/17 21:13:02 An empty constructor is required even if using ins
58 }
59 IconSize(const IconSize& ref)
60 : pixel_size(ref.pixel_size), scale_factor(ref.scale_factor) {
61 }
62 IconSize(int size, ui::ScaleFactor scale)
63 : pixel_size(size), scale_factor(scale) {
pkotwicz 2012/09/17 19:32:06 As you are using multiple lines for the initialize
kevers 2012/09/17 21:13:02 Explicit copy constructor removed since not needed
64 }
65 int pixel_size;
66 ui::ScaleFactor scale_factor;
67 };
68
54 void Init(Profile* profile, IconType type); 69 void Init(Profile* profile, IconType type);
55 70
56 // Called when favicon data is available from the history backend. 71 // Called when favicon data is available from the history backend.
57 void OnFaviconDataAvailable( 72 void OnFaviconDataAvailable(
58 FaviconService::Handle request_handle, 73 FaviconService::Handle request_handle,
59 const history::FaviconBitmapResult& bitmap_result); 74 const history::FaviconBitmapResult& bitmap_result);
60 75
61 // Sends the default favicon. 76 // Sends the default favicon.
62 void SendDefaultResponse(int request_id); 77 void SendDefaultResponse(int request_id);
63 78
64 CancelableRequestConsumerT<int, 0> cancelable_consumer_; 79 CancelableRequestConsumerT<int, 0> cancelable_consumer_;
65 80
66 // Map from request ID to size requested (in pixels). TODO(estade): Get rid of 81 // Map from request ID to size requested (in pixels). TODO(estade): Get rid of
67 // this map when we properly support multiple favicon sizes. 82 // this map when we properly support multiple favicon sizes.
68 std::map<int, int> request_size_map_; 83 std::map<int, IconSize> request_size_map_;
69 84
70 // Raw PNG representation of the favicon to show when the favicon 85 // Raw PNG representation of the favicon to show when the favicon
71 // database doesn't have a favicon for a webpage. 86 // database doesn't have a favicon for a webpage.
72 // 16x16 87 // 16x16
73 scoped_refptr<base::RefCountedMemory> default_favicon_; 88 scoped_refptr<base::RefCountedMemory> default_favicon_;
74 // 32x32 89 // 32x32
75 scoped_refptr<base::RefCountedMemory> default_favicon_large_; 90 scoped_refptr<base::RefCountedMemory> default_favicon_large_;
76 91
77 // The history::IconTypes of icon that this FaviconSource handles. 92 // The history::IconTypes of icon that this FaviconSource handles.
78 int icon_types_; 93 int icon_types_;
79 94
80 DISALLOW_COPY_AND_ASSIGN(FaviconSource); 95 DISALLOW_COPY_AND_ASSIGN(FaviconSource);
81 }; 96 };
82 97
83 #endif // CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_ 98 #endif // CHROME_BROWSER_UI_WEBUI_FAVICON_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698