| 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/android/ntp/most_visited_sites.h" | 5 #include "chrome/browser/android/ntp/most_visited_sites.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 MostVisitedSites::SuggestionsVector whitelist_suggestions = | 628 MostVisitedSites::SuggestionsVector whitelist_suggestions = |
| 629 CreateWhitelistEntryPointSuggestions(*personal_suggestions); | 629 CreateWhitelistEntryPointSuggestions(*personal_suggestions); |
| 630 MostVisitedSites::SuggestionsVector popular_sites_suggestions = | 630 MostVisitedSites::SuggestionsVector popular_sites_suggestions = |
| 631 CreatePopularSitesSuggestions(*personal_suggestions, | 631 CreatePopularSitesSuggestions(*personal_suggestions, |
| 632 whitelist_suggestions); | 632 whitelist_suggestions); |
| 633 size_t num_actual_tiles = personal_suggestions->size() + | 633 size_t num_actual_tiles = personal_suggestions->size() + |
| 634 whitelist_suggestions.size() + | 634 whitelist_suggestions.size() + |
| 635 popular_sites_suggestions.size(); | 635 popular_sites_suggestions.size(); |
| 636 std::vector<std::string> old_sites_url; | 636 std::vector<std::string> old_sites_url; |
| 637 std::vector<bool> old_sites_is_personal; | 637 std::vector<bool> old_sites_is_personal; |
| 638 GetPreviousNTPSites(num_actual_tiles, &old_sites_url, &old_sites_is_personal); | 638 // TODO(treib): We used to call |GetPreviousNTPSites| here to populate |
| 639 // |old_sites_url| and |old_sites_is_personal|, but that caused problems |
| 640 // (crbug.com/585391). Either figure out a way to fix them and re-enable, |
| 641 // or properly remove the order-persisting code. crbug.com/601734 |
| 639 MostVisitedSites::SuggestionsVector merged_suggestions = MergeSuggestions( | 642 MostVisitedSites::SuggestionsVector merged_suggestions = MergeSuggestions( |
| 640 personal_suggestions, &whitelist_suggestions, &popular_sites_suggestions, | 643 personal_suggestions, &whitelist_suggestions, &popular_sites_suggestions, |
| 641 old_sites_url, old_sites_is_personal); | 644 old_sites_url, old_sites_is_personal); |
| 642 DCHECK_EQ(num_actual_tiles, merged_suggestions.size()); | 645 DCHECK_EQ(num_actual_tiles, merged_suggestions.size()); |
| 643 current_suggestions_.swap(merged_suggestions); | 646 current_suggestions_.swap(merged_suggestions); |
| 644 if (received_popular_sites_) | 647 if (received_popular_sites_) |
| 645 SaveCurrentNTPSites(); | 648 SaveCurrentNTPSites(); |
| 646 } | 649 } |
| 647 | 650 |
| 648 // static | 651 // static |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 } | 871 } |
| 869 } | 872 } |
| 870 | 873 |
| 871 static jlong Init(JNIEnv* env, | 874 static jlong Init(JNIEnv* env, |
| 872 const JavaParamRef<jobject>& obj, | 875 const JavaParamRef<jobject>& obj, |
| 873 const JavaParamRef<jobject>& jprofile) { | 876 const JavaParamRef<jobject>& jprofile) { |
| 874 MostVisitedSites* most_visited_sites = | 877 MostVisitedSites* most_visited_sites = |
| 875 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile)); | 878 new MostVisitedSites(ProfileAndroid::FromProfileAndroid(jprofile)); |
| 876 return reinterpret_cast<intptr_t>(most_visited_sites); | 879 return reinterpret_cast<intptr_t>(most_visited_sites); |
| 877 } | 880 } |
| OLD | NEW |