| 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_MOST_VISITED_SITES_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ |
| 6 #define CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ | 6 #define CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/files/file_path.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 19 #include "base/scoped_observer.h" | 20 #include "base/scoped_observer.h" |
| 20 #include "chrome/browser/supervised_user/supervised_user_service.h" | 21 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 21 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" | 22 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" |
| 22 #include "components/history/core/browser/history_types.h" | 23 #include "components/history/core/browser/history_types.h" |
| 23 #include "components/history/core/browser/top_sites_observer.h" | 24 #include "components/history/core/browser/top_sites_observer.h" |
| 24 #include "components/suggestions/proto/suggestions.pb.h" | 25 #include "components/suggestions/proto/suggestions.pb.h" |
| 25 #include "components/sync_driver/sync_service_observer.h" | 26 #include "components/sync_driver/sync_service_observer.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 private: | 83 private: |
| 83 friend class MostVisitedSitesTest; | 84 friend class MostVisitedSitesTest; |
| 84 | 85 |
| 85 // The source of the Most Visited sites. | 86 // The source of the Most Visited sites. |
| 86 enum MostVisitedSource { TOP_SITES, SUGGESTIONS_SERVICE, POPULAR, WHITELIST }; | 87 enum MostVisitedSource { TOP_SITES, SUGGESTIONS_SERVICE, POPULAR, WHITELIST }; |
| 87 | 88 |
| 88 struct Suggestion { | 89 struct Suggestion { |
| 89 base::string16 title; | 90 base::string16 title; |
| 90 GURL url; | 91 GURL url; |
| 91 MostVisitedSource source; | 92 MostVisitedSource source; |
| 93 |
| 94 // Only valid for source == WHITELIST (empty otherwise). |
| 95 base::FilePath whitelist_icon_path; |
| 96 |
| 92 // Only valid for source == SUGGESTIONS_SERVICE (-1 otherwise). | 97 // Only valid for source == SUGGESTIONS_SERVICE (-1 otherwise). |
| 93 int provider_index; | 98 int provider_index; |
| 94 | 99 |
| 95 Suggestion(const base::string16& title, | 100 Suggestion(); |
| 96 const std::string& url, | |
| 97 MostVisitedSource source); | |
| 98 Suggestion(const base::string16& title, | |
| 99 const GURL& url, | |
| 100 MostVisitedSource source); | |
| 101 Suggestion(const base::string16& title, | |
| 102 const std::string& url, | |
| 103 MostVisitedSource source, | |
| 104 int provider_index); | |
| 105 ~Suggestion(); | 101 ~Suggestion(); |
| 106 | 102 |
| 107 // Get the Histogram name associated with the source. | 103 // Get the Histogram name associated with the source. |
| 108 std::string GetSourceHistogramName() const; | 104 std::string GetSourceHistogramName() const; |
| 109 | 105 |
| 110 private: | 106 private: |
| 111 DISALLOW_COPY_AND_ASSIGN(Suggestion); | 107 DISALLOW_COPY_AND_ASSIGN(Suggestion); |
| 112 }; | 108 }; |
| 113 | 109 |
| 114 using SuggestionsVector = std::vector<scoped_ptr<Suggestion>>; | 110 using SuggestionsVector = std::vector<scoped_ptr<Suggestion>>; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 233 |
| 238 SuggestionsVector current_suggestions_; | 234 SuggestionsVector current_suggestions_; |
| 239 | 235 |
| 240 // For callbacks may be run after destruction. | 236 // For callbacks may be run after destruction. |
| 241 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 237 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
| 242 | 238 |
| 243 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 239 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
| 244 }; | 240 }; |
| 245 | 241 |
| 246 #endif // CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ | 242 #endif // CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ |
| OLD | NEW |