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

Side by Side Diff: chrome/browser/favicon/favicon_handler.cc

Issue 10834099: Removing instances of profile_->GetBookmarkModel() as part of converting BookmarkModel to a PKS. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « chrome/browser/browser_commands_unittest.cc ('k') | no next file » | 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/favicon/favicon_handler.h" 5 #include "chrome/browser/favicon/favicon_handler.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/memory/ref_counted_memory.h" 13 #include "base/memory/ref_counted_memory.h"
14 #include "chrome/browser/bookmarks/bookmark_model.h" 14 #include "chrome/browser/bookmarks/bookmark_model.h"
15 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/common/icon_messages.h" 17 #include "chrome/common/icon_messages.h"
17 #include "content/public/browser/favicon_status.h" 18 #include "content/public/browser/favicon_status.h"
18 #include "content/public/browser/navigation_entry.h" 19 #include "content/public/browser/navigation_entry.h"
19 #include "skia/ext/image_operations.h" 20 #include "skia/ext/image_operations.h"
20 #include "ui/gfx/codec/png_codec.h" 21 #include "ui/gfx/codec/png_codec.h"
21 #include "ui/gfx/image/image.h" 22 #include "ui/gfx/image/image.h"
22 #include "ui/gfx/image/image_util.h" 23 #include "ui/gfx/image/image_util.h"
23 24
24 using content::NavigationEntry; 25 using content::NavigationEntry;
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 const std::vector<unsigned char>& image_data, 384 const std::vector<unsigned char>& image_data,
384 history::IconType icon_type) { 385 history::IconType icon_type) {
385 GetFaviconService()->SetFavicon(page_url, icon_url, image_data, icon_type); 386 GetFaviconService()->SetFavicon(page_url, icon_url, image_data, icon_type);
386 } 387 }
387 388
388 bool FaviconHandler::ShouldSaveFavicon(const GURL& url) { 389 bool FaviconHandler::ShouldSaveFavicon(const GURL& url) {
389 if (!profile_->IsOffTheRecord()) 390 if (!profile_->IsOffTheRecord())
390 return true; 391 return true;
391 392
392 // Otherwise store the favicon if the page is bookmarked. 393 // Otherwise store the favicon if the page is bookmarked.
393 BookmarkModel* bookmark_model = profile_->GetBookmarkModel(); 394 BookmarkModel* bookmark_model =
395 BookmarkModelFactory::GetForProfile(profile_);
394 return bookmark_model && bookmark_model->IsBookmarked(url); 396 return bookmark_model && bookmark_model->IsBookmarked(url);
395 } 397 }
396 398
397 void FaviconHandler::OnFaviconDataForInitialURL( 399 void FaviconHandler::OnFaviconDataForInitialURL(
398 FaviconService::Handle handle, 400 FaviconService::Handle handle,
399 history::FaviconData favicon) { 401 history::FaviconData favicon) {
400 NavigationEntry* entry = GetEntry(); 402 NavigationEntry* entry = GetEntry();
401 if (!entry) 403 if (!entry)
402 return; 404 return;
403 405
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 int height = bitmap.height(); 534 int height = bitmap.height();
533 if (width > 0 && height > 0) { 535 if (width > 0 && height > 0) {
534 gfx::CalculateFaviconTargetSize(&width, &height); 536 gfx::CalculateFaviconTargetSize(&width, &height);
535 return gfx::Image(skia::ImageOperations::Resize( 537 return gfx::Image(skia::ImageOperations::Resize(
536 bitmap, skia::ImageOperations::RESIZE_LANCZOS3, 538 bitmap, skia::ImageOperations::RESIZE_LANCZOS3,
537 width, height)); 539 width, height));
538 } 540 }
539 541
540 return image; 542 return image;
541 } 543 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_commands_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698