OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/options/general_page_view.h" | 5 #include "chrome/browser/views/options/general_page_view.h" |
6 | 6 |
7 #include "app/combobox_model.h" | 7 #include "app/combobox_model.h" |
| 8 #include "app/gfx/codec/png_codec.h" |
8 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
10 #include "base/gfx/png_decoder.h" | |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/browser/browser.h" | 13 #include "chrome/browser/browser.h" |
14 #include "chrome/browser/browser_list.h" | 14 #include "chrome/browser/browser_list.h" |
15 #include "chrome/browser/dom_ui/new_tab_ui.h" | 15 #include "chrome/browser/dom_ui/new_tab_ui.h" |
16 #include "chrome/browser/favicon_service.h" | 16 #include "chrome/browser/favicon_service.h" |
17 #include "chrome/browser/history/history.h" | 17 #include "chrome/browser/history/history.h" |
18 #include "chrome/browser/net/url_fixer_upper.h" | 18 #include "chrome/browser/net/url_fixer_upper.h" |
19 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
20 #include "chrome/browser/session_startup_pref.h" | 20 #include "chrome/browser/session_startup_pref.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 scoped_refptr<RefCountedBytes> image_data, | 232 scoped_refptr<RefCountedBytes> image_data, |
233 bool is_expired, | 233 bool is_expired, |
234 GURL icon_url) { | 234 GURL icon_url) { |
235 int entry_index; | 235 int entry_index; |
236 Entry* entry = GetEntryByLoadHandle(handle, &entry_index); | 236 Entry* entry = GetEntryByLoadHandle(handle, &entry_index); |
237 DCHECK(entry); | 237 DCHECK(entry); |
238 entry->fav_icon_handle = 0; | 238 entry->fav_icon_handle = 0; |
239 if (know_fav_icon && image_data.get() && !image_data->data.empty()) { | 239 if (know_fav_icon && image_data.get() && !image_data->data.empty()) { |
240 int width, height; | 240 int width, height; |
241 std::vector<unsigned char> decoded_data; | 241 std::vector<unsigned char> decoded_data; |
242 if (PNGDecoder::Decode(&image_data->data.front(), image_data->data.size(), | 242 if (gfx::PNGCodec::Decode(&image_data->data.front(), |
243 PNGDecoder::FORMAT_BGRA, &decoded_data, &width, | 243 image_data->data.size(), |
244 &height)) { | 244 gfx::PNGCodec::FORMAT_BGRA, &decoded_data, |
| 245 &width, &height)) { |
245 entry->icon.setConfig(SkBitmap::kARGB_8888_Config, width, height); | 246 entry->icon.setConfig(SkBitmap::kARGB_8888_Config, width, height); |
246 entry->icon.allocPixels(); | 247 entry->icon.allocPixels(); |
247 memcpy(entry->icon.getPixels(), &decoded_data.front(), | 248 memcpy(entry->icon.getPixels(), &decoded_data.front(), |
248 width * height * 4); | 249 width * height * 4); |
249 if (observer_) | 250 if (observer_) |
250 observer_->OnItemsChanged(static_cast<int>(entry_index), 1); | 251 observer_->OnItemsChanged(static_cast<int>(entry_index), 1); |
251 } | 252 } |
252 } | 253 } |
253 } | 254 } |
254 | 255 |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 homepage_use_url_textfield_->SetEnabled(false); | 979 homepage_use_url_textfield_->SetEnabled(false); |
979 homepage_use_url_textfield_->SetReadOnly(true); | 980 homepage_use_url_textfield_->SetReadOnly(true); |
980 } | 981 } |
981 } | 982 } |
982 | 983 |
983 void GeneralPageView::SetDefaultSearchProvider() { | 984 void GeneralPageView::SetDefaultSearchProvider() { |
984 const int index = default_search_engine_combobox_->selected_item(); | 985 const int index = default_search_engine_combobox_->selected_item(); |
985 default_search_engines_model_->model()->SetDefaultSearchProvider( | 986 default_search_engines_model_->model()->SetDefaultSearchProvider( |
986 default_search_engines_model_->GetTemplateURLAt(index)); | 987 default_search_engines_model_->GetTemplateURLAt(index)); |
987 } | 988 } |
OLD | NEW |