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

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: resyncing with library after revert 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 preview->web_contents()->GetController().GetActiveEntry(); 281 preview->web_contents()->GetController().GetActiveEntry();
281 DCHECK_EQ(last_navigation->url, entry->GetURL()); 282 DCHECK_EQ(last_navigation->url, entry->GetURL());
282 283
283 // Add the page to history. 284 // Add the page to history.
284 preview->history_tab_helper()->UpdateHistoryForNavigation(last_navigation); 285 preview->history_tab_helper()->UpdateHistoryForNavigation(last_navigation);
285 286
286 // Update the page title. 287 // Update the page title.
287 preview->history_tab_helper()->UpdateHistoryPageTitle(*entry); 288 preview->history_tab_helper()->UpdateHistoryPageTitle(*entry);
288 289
289 // Update the favicon. 290 // Update the favicon.
290 FaviconService* favicon_service = 291 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
291 preview->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); 292 preview->profile(), Profile::EXPLICIT_ACCESS);
292 if (favicon_service && entry->GetFavicon().valid && 293 if (favicon_service && entry->GetFavicon().valid &&
293 entry->GetFavicon().image.IsEmpty()) { 294 entry->GetFavicon().image.IsEmpty()) {
294 std::vector<unsigned char> image_data; 295 std::vector<unsigned char> image_data;
295 // TODO: Add all variants once the history service supports it. 296 // TODO: Add all variants once the history service supports it.
296 gfx::PNGCodec::EncodeBGRASkBitmap( 297 gfx::PNGCodec::EncodeBGRASkBitmap(
297 entry->GetFavicon().image.AsBitmap(), false, &image_data); 298 entry->GetFavicon().image.AsBitmap(), false, &image_data);
298 favicon_service->SetFavicon(entry->GetURL(), 299 favicon_service->SetFavicon(entry->GetURL(),
299 entry->GetFavicon().url, 300 entry->GetFavicon().url,
300 image_data, 301 image_data,
301 history::FAVICON); 302 history::FAVICON);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 return false; 595 return false;
595 } 596 }
596 597
597 return true; 598 return true;
598 } 599 }
599 600
600 bool InstantController::IsOutOfDate() const { 601 bool InstantController::IsOutOfDate() const {
601 return !last_active_tab_ || 602 return !last_active_tab_ ||
602 last_active_tab_ != delegate_->GetActiveTabContents(); 603 last_active_tab_ != delegate_->GetActiveTabContents();
603 } 604 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/profile_writer.cc ('k') | chrome/browser/intents/register_intent_handler_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698