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

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

Issue 10918065: Introduce structures to reduce the number of arguments in the FaviconService methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove the auxiliary structure for non-URL cases. Created 8 years, 3 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 | Annotate | Revision Log
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/android/bookmarks_handler.h" 5 #include "chrome/browser/ui/webui/ntp/android/bookmarks_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (args && !args->empty() && ParseNtpBookmarkId(args, &id, &is_partner)) { 348 if (args && !args->empty() && ParseNtpBookmarkId(args, &id, &is_partner)) {
349 DCHECK(partner_bookmarks_shim_ != NULL); 349 DCHECK(partner_bookmarks_shim_ != NULL);
350 const BookmarkNode* node = 350 const BookmarkNode* node =
351 partner_bookmarks_shim_->GetNodeByID(id, is_partner); 351 partner_bookmarks_shim_->GetNodeByID(id, is_partner);
352 if (!node) 352 if (!node)
353 return; 353 return;
354 354
355 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( 355 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
356 profile, Profile::EXPLICIT_ACCESS); 356 profile, Profile::EXPLICIT_ACCESS);
357 FaviconService::Handle handle = favicon_service->GetRawFaviconForURL( 357 FaviconService::Handle handle = favicon_service->GetRawFaviconForURL(
358 profile, 358 FaviconService::FaviconForURLParams(
359 node->url(), 359 profile,
360 history::FAVICON | history::TOUCH_ICON, 360 node->url(),
361 gfx::kFaviconSize, 361 history::FAVICON | history::TOUCH_ICON,
362 gfx::kFaviconSize,
363 &cancelable_consumer_),
362 ui::SCALE_FACTOR_100P, 364 ui::SCALE_FACTOR_100P,
363 &cancelable_consumer_,
364 base::Bind(&BookmarksHandler::OnShortcutFaviconDataAvailable, 365 base::Bind(&BookmarksHandler::OnShortcutFaviconDataAvailable,
365 base::Unretained(this))); 366 base::Unretained(this)));
366 cancelable_consumer_.SetClientData(favicon_service, handle, node); 367 cancelable_consumer_.SetClientData(favicon_service, handle, node);
367 } 368 }
368 } 369 }
369 370
370 void BookmarksHandler::OnShortcutFaviconDataAvailable( 371 void BookmarksHandler::OnShortcutFaviconDataAvailable(
371 FaviconService::Handle handle, 372 FaviconService::Handle handle,
372 const history::FaviconBitmapResult& bitmap_result) { 373 const history::FaviconBitmapResult& bitmap_result) {
373 SkColor color = SK_ColorWHITE; 374 SkColor color = SK_ColorWHITE;
(...skipping 12 matching lines...) Expand all
386 handle); 387 handle);
387 388
388 TabAndroid* tab = TabAndroid::FromWebContents( 389 TabAndroid* tab = TabAndroid::FromWebContents(
389 web_ui()->GetWebContents()); 390 web_ui()->GetWebContents());
390 if (tab) { 391 if (tab) {
391 tab->AddShortcutToBookmark(node->url(), node->GetTitle(), 392 tab->AddShortcutToBookmark(node->url(), node->GetTitle(),
392 favicon_bitmap, SkColorGetR(color), 393 favicon_bitmap, SkColorGetR(color),
393 SkColorGetG(color), SkColorGetB(color)); 394 SkColorGetG(color), SkColorGetB(color));
394 } 395 }
395 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698