OLD | NEW |
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" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // Add the page to history. | 283 // Add the page to history. |
284 preview->history_tab_helper()->UpdateHistoryForNavigation(last_navigation); | 284 preview->history_tab_helper()->UpdateHistoryForNavigation(last_navigation); |
285 | 285 |
286 // Update the page title. | 286 // Update the page title. |
287 preview->history_tab_helper()->UpdateHistoryPageTitle(*entry); | 287 preview->history_tab_helper()->UpdateHistoryPageTitle(*entry); |
288 | 288 |
289 // Update the favicon. | 289 // Update the favicon. |
290 FaviconService* favicon_service = | 290 FaviconService* favicon_service = |
291 preview->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); | 291 preview->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS); |
292 if (favicon_service && entry->GetFavicon().valid && | 292 if (favicon_service && entry->GetFavicon().valid && |
293 entry->GetFavicon().image.IsEmpty()) { | 293 !entry->GetFavicon().image.IsEmpty()) { |
294 std::vector<unsigned char> image_data; | 294 std::vector<unsigned char> image_data; |
295 // TODO: Add all variants once the history service supports it. | 295 // TODO: Add all variants once the history service supports it. |
296 gfx::PNGCodec::EncodeBGRASkBitmap( | 296 gfx::PNGCodec::EncodeBGRASkBitmap( |
297 entry->GetFavicon().image.AsBitmap(), false, &image_data); | 297 *entry->GetFavicon().image.ToSkBitmap(), false, &image_data); |
298 favicon_service->SetFavicon(entry->GetURL(), | 298 favicon_service->SetFavicon(entry->GetURL(), |
299 entry->GetFavicon().url, | 299 entry->GetFavicon().url, |
300 image_data, | 300 image_data, |
301 history::FAVICON); | 301 history::FAVICON); |
302 } | 302 } |
303 } | 303 } |
304 | 304 |
305 // Add a fake history entry with a non-Instant search URL, so that search | 305 // Add a fake history entry with a non-Instant search URL, so that search |
306 // terms extraction (for autocomplete history matches) works. | 306 // terms extraction (for autocomplete history matches) works. |
307 HistoryService* history = HistoryServiceFactory::GetForProfile( | 307 HistoryService* history = HistoryServiceFactory::GetForProfile( |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 return false; | 594 return false; |
595 } | 595 } |
596 | 596 |
597 return true; | 597 return true; |
598 } | 598 } |
599 | 599 |
600 bool InstantController::IsOutOfDate() const { | 600 bool InstantController::IsOutOfDate() const { |
601 return !last_active_tab_ || | 601 return !last_active_tab_ || |
602 last_active_tab_ != delegate_->GetActiveTabContents(); | 602 last_active_tab_ != delegate_->GetActiveTabContents(); |
603 } | 603 } |
OLD | NEW |