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 #include "chrome/browser/ui/webui/favicon_source.h" | 5 #include "chrome/browser/ui/webui/favicon_source.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "chrome/browser/history/top_sites.h" | 9 #include "chrome/browser/history/top_sites.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 if (favicon.is_valid()) { | 126 if (favicon.is_valid()) { |
127 // Forward the data along to the networking system. | 127 // Forward the data along to the networking system. |
128 SendResponse(request_id, favicon.image_data); | 128 SendResponse(request_id, favicon.image_data); |
129 } else { | 129 } else { |
130 SendDefaultResponse(request_id); | 130 SendDefaultResponse(request_id); |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 void FaviconSource::SendDefaultResponse(int request_id) { | 134 void FaviconSource::SendDefaultResponse(int request_id) { |
135 RefCountedMemory* bytes = NULL; | 135 base::RefCountedMemory* bytes = NULL; |
136 if (request_size_map_[request_id] == 32) { | 136 if (request_size_map_[request_id] == 32) { |
137 if (!default_favicon_large_.get()) { | 137 if (!default_favicon_large_.get()) { |
138 default_favicon_large_ = | 138 default_favicon_large_ = |
139 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 139 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
140 IDR_DEFAULT_LARGE_FAVICON); | 140 IDR_DEFAULT_LARGE_FAVICON); |
141 } | 141 } |
142 bytes = default_favicon_large_; | 142 bytes = default_favicon_large_; |
143 } else { | 143 } else { |
144 if (!default_favicon_.get()) { | 144 if (!default_favicon_.get()) { |
145 default_favicon_ = | 145 default_favicon_ = |
146 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 146 ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
147 IDR_DEFAULT_FAVICON); | 147 IDR_DEFAULT_FAVICON); |
148 } | 148 } |
149 bytes = default_favicon_; | 149 bytes = default_favicon_; |
150 } | 150 } |
151 request_size_map_.erase(request_id); | 151 request_size_map_.erase(request_id); |
152 | 152 |
153 SendResponse(request_id, bytes); | 153 SendResponse(request_id, bytes); |
154 } | 154 } |
OLD | NEW |