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

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

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 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
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"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 CHECK(args->GetString(0, &path)); 84 CHECK(args->GetString(0, &path));
85 std::string prefix = "chrome://favicon/size/"; 85 std::string prefix = "chrome://favicon/size/";
86 DCHECK(StartsWithASCII(path, prefix, false)) << "path is " << path; 86 DCHECK(StartsWithASCII(path, prefix, false)) << "path is " << path;
87 size_t slash = path.find("/", prefix.length()); 87 size_t slash = path.find("/", prefix.length());
88 path = path.substr(slash + 1); 88 path = path.substr(slash + 1);
89 89
90 std::string dom_id; 90 std::string dom_id;
91 CHECK(args->GetString(1, &dom_id)); 91 CHECK(args->GetString(1, &dom_id));
92 92
93 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( 93 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
94 Profile::FromWebUI(web_ui()), Profile::EXPLICIT_ACCESS); 94 Profile::FromWebUI(web_ui()), ServiceAccessType::EXPLICIT_ACCESS);
95 if (!favicon_service || path.empty()) 95 if (!favicon_service || path.empty())
96 return; 96 return;
97 97
98 GURL url(path); 98 GURL url(path);
99 // Intercept requests for prepopulated pages. 99 // Intercept requests for prepopulated pages.
100 for (size_t i = 0; i < history::kPrepopulatedPagesCount; i++) { 100 for (size_t i = 0; i < history::kPrepopulatedPagesCount; i++) {
101 if (url.spec() == 101 if (url.spec() ==
102 l10n_util::GetStringUTF8(history::kPrepopulatedPages[i].url_id)) { 102 l10n_util::GetStringUTF8(history::kPrepopulatedPages[i].url_id)) {
103 base::StringValue dom_id_value(dom_id); 103 base::StringValue dom_id_value(dom_id);
104 scoped_ptr<base::StringValue> color( 104 scoped_ptr<base::StringValue> color(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &bits)) 158 if (!gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &bits))
159 return; 159 return;
160 scoped_refptr<base::RefCountedStaticMemory> bits_mem( 160 scoped_refptr<base::RefCountedStaticMemory> bits_mem(
161 new base::RefCountedStaticMemory(&bits.front(), bits.size())); 161 new base::RefCountedStaticMemory(&bits.front(), bits.size()));
162 scoped_ptr<base::StringValue> color_value( 162 scoped_ptr<base::StringValue> color_value(
163 GetDominantColorCssString(bits_mem)); 163 GetDominantColorCssString(bits_mem));
164 base::StringValue id(extension_id); 164 base::StringValue id(extension_id);
165 web_ui()->CallJavascriptFunction( 165 web_ui()->CallJavascriptFunction(
166 "ntp.setFaviconDominantColor", id, *color_value); 166 "ntp.setFaviconDominantColor", id, *color_value);
167 } 167 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.cc ('k') | chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698