| 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/ntp/favicon_webui_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.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 "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 SkColorToCss(history::kPrepopulatedPages[i].color)); | 105 SkColorToCss(history::kPrepopulatedPages[i].color)); |
| 106 web_ui()->CallJavascriptFunction("ntp.setFaviconDominantColor", | 106 web_ui()->CallJavascriptFunction("ntp.setFaviconDominantColor", |
| 107 dom_id_value, *color); | 107 dom_id_value, *color); |
| 108 return; | 108 return; |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 dom_id_map_[id_] = dom_id; | 112 dom_id_map_[id_] = dom_id; |
| 113 favicon_service->GetRawFaviconForURL( | 113 favicon_service->GetRawFaviconForURL( |
| 114 FaviconService::FaviconForURLParams( | 114 FaviconService::FaviconForURLParams( |
| 115 Profile::FromWebUI(web_ui()), | |
| 116 url, | 115 url, |
| 117 chrome::FAVICON, | 116 chrome::FAVICON, |
| 118 gfx::kFaviconSize), | 117 gfx::kFaviconSize), |
| 119 ui::SCALE_FACTOR_100P, | 118 ui::SCALE_FACTOR_100P, |
| 120 base::Bind(&FaviconWebUIHandler::OnFaviconDataAvailable, | 119 base::Bind(&FaviconWebUIHandler::OnFaviconDataAvailable, |
| 121 base::Unretained(this), | 120 base::Unretained(this), |
| 122 id_++), | 121 id_++), |
| 123 &cancelable_task_tracker_); | 122 &cancelable_task_tracker_); |
| 124 } | 123 } |
| 125 | 124 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 std::vector<unsigned char> bits; | 158 std::vector<unsigned char> bits; |
| 160 if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &bits)) | 159 if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &bits)) |
| 161 return; | 160 return; |
| 162 scoped_refptr<base::RefCountedStaticMemory> bits_mem( | 161 scoped_refptr<base::RefCountedStaticMemory> bits_mem( |
| 163 new base::RefCountedStaticMemory(&bits.front(), bits.size())); | 162 new base::RefCountedStaticMemory(&bits.front(), bits.size())); |
| 164 scoped_ptr<StringValue> color_value(GetDominantColorCssString(bits_mem)); | 163 scoped_ptr<StringValue> color_value(GetDominantColorCssString(bits_mem)); |
| 165 StringValue id(extension_id); | 164 StringValue id(extension_id); |
| 166 web_ui()->CallJavascriptFunction( | 165 web_ui()->CallJavascriptFunction( |
| 167 "ntp.setFaviconDominantColor", id, *color_value); | 166 "ntp.setFaviconDominantColor", id, *color_value); |
| 168 } | 167 } |
| OLD | NEW |