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

Side by Side Diff: chrome/browser/ui/webui/ntp/favicon_webui_handler.cc

Issue 983043003: Componentize FaviconService and FaviconHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@favicon_service
Patch Set: Fix android_aosp (reverted the change by mistake by switching computer) Created 5 years, 9 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
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/extensions/extension_icon_manager.h" 13 #include "chrome/browser/extensions/extension_icon_manager.h"
14 #include "chrome/browser/favicon/favicon_service.h"
15 #include "chrome/browser/favicon/favicon_service_factory.h" 14 #include "chrome/browser/favicon/favicon_service_factory.h"
16 #include "chrome/browser/history/top_sites_factory.h" 15 #include "chrome/browser/history/top_sites_factory.h"
17 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/url_constants.h" 17 #include "chrome/common/url_constants.h"
18 #include "components/favicon/core/browser/favicon_service.h"
19 #include "components/history/core/browser/top_sites.h" 19 #include "components/history/core/browser/top_sites.h"
20 #include "content/public/browser/web_ui.h" 20 #include "content/public/browser/web_ui.h"
21 #include "extensions/browser/extension_registry.h" 21 #include "extensions/browser/extension_registry.h"
22 #include "third_party/skia/include/core/SkBitmap.h" 22 #include "third_party/skia/include/core/SkBitmap.h"
23 #include "ui/base/l10n/l10n_util.h" 23 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/gfx/codec/png_codec.h" 24 #include "ui/gfx/codec/png_codec.h"
25 #include "ui/gfx/color_analysis.h" 25 #include "ui/gfx/color_analysis.h"
26 #include "ui/gfx/favicon_size.h" 26 #include "ui/gfx/favicon_size.h"
27 27
28 namespace { 28 namespace {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &bits)) 162 if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &bits))
163 return; 163 return;
164 scoped_refptr<base::RefCountedStaticMemory> bits_mem( 164 scoped_refptr<base::RefCountedStaticMemory> bits_mem(
165 new base::RefCountedStaticMemory(&bits.front(), bits.size())); 165 new base::RefCountedStaticMemory(&bits.front(), bits.size()));
166 scoped_ptr<base::StringValue> color_value( 166 scoped_ptr<base::StringValue> color_value(
167 GetDominantColorCssString(bits_mem)); 167 GetDominantColorCssString(bits_mem));
168 base::StringValue id(extension_id); 168 base::StringValue id(extension_id);
169 web_ui()->CallJavascriptFunction( 169 web_ui()->CallJavascriptFunction(
170 "ntp.setFaviconDominantColor", id, *color_value); 170 "ntp.setFaviconDominantColor", id, *color_value);
171 } 171 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698