| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/search/instant_service.h" | 5 #include "chrome/browser/search/instant_service.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
| 12 #include "chrome/browser/history/history_notifications.h" | 12 #include "chrome/browser/history/history_notifications.h" |
| 13 #include "chrome/browser/history/most_visited_tiles_experiment.h" |
| 13 #include "chrome/browser/history/top_sites.h" | 14 #include "chrome/browser/history/top_sites.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/search/instant_io_context.h" | 16 #include "chrome/browser/search/instant_io_context.h" |
| 16 #include "chrome/browser/search/instant_service_factory.h" | 17 #include "chrome/browser/search/instant_service_factory.h" |
| 17 #include "chrome/browser/search/instant_service_observer.h" | 18 #include "chrome/browser/search/instant_service_observer.h" |
| 18 #include "chrome/browser/search/local_ntp_source.h" | 19 #include "chrome/browser/search/local_ntp_source.h" |
| 19 #include "chrome/browser/search/most_visited_iframe_source.h" | 20 #include "chrome/browser/search/most_visited_iframe_source.h" |
| 20 #include "chrome/browser/search/search.h" | 21 #include "chrome/browser/search/search.h" |
| 21 #include "chrome/browser/themes/theme_properties.h" | 22 #include "chrome/browser/themes/theme_properties.h" |
| 22 #include "chrome/browser/themes/theme_service.h" | 23 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 243 } |
| 243 #endif // defined(ENABLE_THEMES) | 244 #endif // defined(ENABLE_THEMES) |
| 244 default: | 245 default: |
| 245 NOTREACHED() << "Unexpected notification type in InstantService."; | 246 NOTREACHED() << "Unexpected notification type in InstantService."; |
| 246 } | 247 } |
| 247 } | 248 } |
| 248 | 249 |
| 249 void InstantService::OnMostVisitedItemsReceived( | 250 void InstantService::OnMostVisitedItemsReceived( |
| 250 const history::MostVisitedURLList& data) { | 251 const history::MostVisitedURLList& data) { |
| 251 history::MostVisitedURLList reordered_data(data); | 252 history::MostVisitedURLList reordered_data(data); |
| 252 history::TopSites::MaybeShuffle(&reordered_data); | 253 history::MostVisitedTilesExperiment::MaybeShuffle(&reordered_data); |
| 253 | 254 |
| 254 std::vector<InstantMostVisitedItem> new_most_visited_items; | 255 std::vector<InstantMostVisitedItem> new_most_visited_items; |
| 255 for (size_t i = 0; i < reordered_data.size(); i++) { | 256 for (size_t i = 0; i < reordered_data.size(); i++) { |
| 256 const history::MostVisitedURL& url = reordered_data[i]; | 257 const history::MostVisitedURL& url = reordered_data[i]; |
| 257 InstantMostVisitedItem item; | 258 InstantMostVisitedItem item; |
| 258 item.url = url.url; | 259 item.url = url.url; |
| 259 item.title = url.title; | 260 item.title = url.title; |
| 260 new_most_visited_items.push_back(item); | 261 new_most_visited_items.push_back(item); |
| 261 } | 262 } |
| 262 | 263 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 theme_service->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION); | 379 theme_service->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION); |
| 379 } | 380 } |
| 380 | 381 |
| 381 FOR_EACH_OBSERVER(InstantServiceObserver, observers_, | 382 FOR_EACH_OBSERVER(InstantServiceObserver, observers_, |
| 382 ThemeInfoChanged(*theme_info_)); | 383 ThemeInfoChanged(*theme_info_)); |
| 383 } | 384 } |
| 384 | 385 |
| 385 InstantNTPPrerenderer* InstantService::ntp_prerenderer() { | 386 InstantNTPPrerenderer* InstantService::ntp_prerenderer() { |
| 386 return &ntp_prerenderer_; | 387 return &ntp_prerenderer_; |
| 387 } | 388 } |
| OLD | NEW |