| 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 #ifndef CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ |
| 6 #define CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ | 6 #define CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 struct Suggestion; | 49 struct Suggestion; |
| 50 using SuggestionsVector = std::vector<Suggestion>; | 50 using SuggestionsVector = std::vector<Suggestion>; |
| 51 using PopularSitesVector = std::vector<PopularSites::Site>; | 51 using PopularSitesVector = std::vector<PopularSites::Site>; |
| 52 | 52 |
| 53 // The source of the Most Visited sites. | 53 // The source of the Most Visited sites. |
| 54 enum MostVisitedSource { TOP_SITES, SUGGESTIONS_SERVICE, POPULAR, WHITELIST }; | 54 enum MostVisitedSource { TOP_SITES, SUGGESTIONS_SERVICE, POPULAR, WHITELIST }; |
| 55 | 55 |
| 56 // The observer to be notified when the list of most visited sites changes. | 56 // The observer to be notified when the list of most visited sites changes. |
| 57 class Observer { | 57 class Observer { |
| 58 public: | 58 public: |
| 59 virtual ~Observer() {} | |
| 60 | |
| 61 virtual void OnMostVisitedURLsAvailable( | 59 virtual void OnMostVisitedURLsAvailable( |
| 62 const SuggestionsVector& suggestions) = 0; | 60 const SuggestionsVector& suggestions) = 0; |
| 63 virtual void OnPopularURLsAvailable(const PopularSitesVector& sites) = 0; | 61 virtual void OnPopularURLsAvailable(const PopularSitesVector& sites) = 0; |
| 62 |
| 63 protected: |
| 64 virtual ~Observer() {} |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 struct Suggestion { | 67 struct Suggestion { |
| 67 base::string16 title; | 68 base::string16 title; |
| 68 GURL url; | 69 GURL url; |
| 69 MostVisitedSource source; | 70 MostVisitedSource source; |
| 70 | 71 |
| 71 // Only valid for source == WHITELIST (empty otherwise). | 72 // Only valid for source == WHITELIST (empty otherwise). |
| 72 base::FilePath whitelist_icon_path; | 73 base::FilePath whitelist_icon_path; |
| 73 | 74 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 241 |
| 241 SuggestionsVector current_suggestions_; | 242 SuggestionsVector current_suggestions_; |
| 242 | 243 |
| 243 // For callbacks may be run after destruction. | 244 // For callbacks may be run after destruction. |
| 244 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 245 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
| 245 | 246 |
| 246 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 247 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
| 247 }; | 248 }; |
| 248 | 249 |
| 249 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ | 250 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ |
| OLD | NEW |