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

Side by Side Diff: chrome/browser/instant/instant_controller.cc

Issue 10828263: Moving FaviconService to a ProfileKeyedService. (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
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/instant/instant_controller.h" 5 #include "chrome/browser/instant/instant_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/i18n/case_conversion.h" 8 #include "base/i18n/case_conversion.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "chrome/browser/autocomplete/autocomplete_match.h" 10 #include "chrome/browser/autocomplete/autocomplete_match.h"
11 #include "chrome/browser/favicon/favicon_service_factory.h"
11 #include "chrome/browser/history/history.h" 12 #include "chrome/browser/history/history.h"
12 #include "chrome/browser/history/history_service_factory.h" 13 #include "chrome/browser/history/history_service_factory.h"
13 #include "chrome/browser/history/history_tab_helper.h" 14 #include "chrome/browser/history/history_tab_helper.h"
14 #include "chrome/browser/instant/instant_controller_delegate.h" 15 #include "chrome/browser/instant/instant_controller_delegate.h"
15 #include "chrome/browser/instant/instant_loader.h" 16 #include "chrome/browser/instant/instant_loader.h"
16 #include "chrome/browser/platform_util.h" 17 #include "chrome/browser/platform_util.h"
17 #include "chrome/browser/prefs/pref_service.h" 18 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/search_engines/template_url_service.h" 19 #include "chrome/browser/search_engines/template_url_service.h"
19 #include "chrome/browser/search_engines/template_url_service_factory.h" 20 #include "chrome/browser/search_engines/template_url_service_factory.h"
20 #include "chrome/browser/ui/tab_contents/tab_contents.h" 21 #include "chrome/browser/ui/tab_contents/tab_contents.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 preview->web_contents()->GetController().GetActiveEntry(); 264 preview->web_contents()->GetController().GetActiveEntry();
264 DCHECK_EQ(last_navigation->url, entry->GetURL()); 265 DCHECK_EQ(last_navigation->url, entry->GetURL());
265 266
266 // Add the page to history. 267 // Add the page to history.
267 preview->history_tab_helper()->UpdateHistoryForNavigation(last_navigation); 268 preview->history_tab_helper()->UpdateHistoryForNavigation(last_navigation);
268 269
269 // Update the page title. 270 // Update the page title.
270 preview->history_tab_helper()->UpdateHistoryPageTitle(*entry); 271 preview->history_tab_helper()->UpdateHistoryPageTitle(*entry);
271 272
272 // Update the favicon. 273 // Update the favicon.
273 FaviconService* favicon_service = 274 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
274 preview->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); 275 preview->profile(), Profile::EXPLICIT_ACCESS);
275 if (favicon_service && entry->GetFavicon().valid && 276 if (favicon_service && entry->GetFavicon().valid &&
276 entry->GetFavicon().image.IsEmpty()) { 277 entry->GetFavicon().image.IsEmpty()) {
277 std::vector<unsigned char> image_data; 278 std::vector<unsigned char> image_data;
278 // TODO: Add all variants once the history service supports it. 279 // TODO: Add all variants once the history service supports it.
279 gfx::PNGCodec::EncodeBGRASkBitmap( 280 gfx::PNGCodec::EncodeBGRASkBitmap(
280 entry->GetFavicon().image.AsBitmap(), false, &image_data); 281 entry->GetFavicon().image.AsBitmap(), false, &image_data);
281 favicon_service->SetFavicon(entry->GetURL(), 282 favicon_service->SetFavicon(entry->GetURL(),
282 entry->GetFavicon().url, 283 entry->GetFavicon().url,
283 image_data, 284 image_data,
284 history::FAVICON); 285 history::FAVICON);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 return false; 581 return false;
581 } 582 }
582 583
583 return true; 584 return true;
584 } 585 }
585 586
586 bool InstantController::IsOutOfDate() const { 587 bool InstantController::IsOutOfDate() const {
587 return !last_active_tab_ || 588 return !last_active_tab_ ||
588 last_active_tab_ != delegate_->GetActiveTabContents(); 589 last_active_tab_ != delegate_->GetActiveTabContents();
589 } 590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698