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 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 virtual ~FaviconSource(); | 51 virtual ~FaviconSource(); |
52 | 52 |
53 Profile* profile_; | 53 Profile* profile_; |
Evan Stade
2013/01/04 01:42:11
please put data members, type definitions and func
kevers
2013/01/04 16:24:13
Done.
| |
54 | 54 |
55 private: | |
56 // Defines the allowed pixel sizes for requested favicons. | 55 // Defines the allowed pixel sizes for requested favicons. |
57 enum IconSize { | 56 enum IconSize { |
58 SIZE_16, | 57 SIZE_16, |
59 SIZE_32, | 58 SIZE_32, |
60 SIZE_64, | 59 SIZE_64, |
61 NUM_SIZES | 60 NUM_SIZES |
62 }; | 61 }; |
63 | 62 |
64 struct IconRequest { | 63 struct IconRequest { |
65 IconRequest() | 64 IconRequest() |
66 : request_id(0), | 65 : request_id(0), |
66 request_path(""), | |
67 size_in_dip(gfx::kFaviconSize), | 67 size_in_dip(gfx::kFaviconSize), |
68 scale_factor(ui::SCALE_FACTOR_NONE) { | 68 scale_factor(ui::SCALE_FACTOR_NONE) { |
69 } | 69 } |
70 IconRequest(int id, int size, ui::ScaleFactor scale) | 70 IconRequest(int id, |
71 const std::string& path, | |
72 int size, | |
73 ui::ScaleFactor scale) | |
71 : request_id(id), | 74 : request_id(id), |
75 request_path(path), | |
72 size_in_dip(size), | 76 size_in_dip(size), |
73 scale_factor(scale) { | 77 scale_factor(scale) { |
74 } | 78 } |
75 int request_id; | 79 int request_id; |
80 std::string request_path; | |
76 int size_in_dip; | 81 int size_in_dip; |
77 ui::ScaleFactor scale_factor; | 82 ui::ScaleFactor scale_factor; |
78 }; | 83 }; |
79 | 84 |
85 // Called when the favicon data is missing to perform additional checks to | |
86 // locate the resource. | |
87 // |request| contains information for the failed request. | |
88 // Returns true if the missing resource is found. | |
89 virtual bool HandleMissingResource(const IconRequest& request); | |
90 | |
91 private: | |
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_ |
OLD | NEW |