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 // Only valid for source == WHITELIST (empty otherwise). | |
Bernhard Bauer
2016/03/15 12:03:35
Please add empty lines before comments, to make it
atanasova
2016/03/16 10:55:24
Done.
| |
94 base::FilePath large_icon_path; | |
92 // Only valid for source == SUGGESTIONS_SERVICE (-1 otherwise). | 95 // Only valid for source == SUGGESTIONS_SERVICE (-1 otherwise). |
93 int provider_index; | 96 int provider_index; |
94 | 97 |
95 Suggestion(const base::string16& title, | 98 Suggestion(const base::string16& title, |
96 const std::string& url, | 99 const std::string& url, |
97 MostVisitedSource source); | 100 MostVisitedSource source); |
98 Suggestion(const base::string16& title, | 101 Suggestion(const base::string16& title, |
99 const GURL& url, | 102 const GURL& url, |
103 MostVisitedSource source, | |
104 const base::FilePath& large_icon_path); | |
105 Suggestion(const base::string16& title, | |
Bernhard Bauer
2016/03/15 12:03:35
Do we really need all of these constructors? Could
atanasova
2016/03/16 10:55:24
Created a builder class
| |
106 const GURL& url, | |
100 MostVisitedSource source); | 107 MostVisitedSource source); |
101 Suggestion(const base::string16& title, | 108 Suggestion(const base::string16& title, |
102 const std::string& url, | 109 const std::string& url, |
103 MostVisitedSource source, | 110 MostVisitedSource source, |
104 int provider_index); | 111 int provider_index); |
105 ~Suggestion(); | 112 ~Suggestion(); |
106 | 113 |
107 // Get the Histogram name associated with the source. | 114 // Get the Histogram name associated with the source. |
108 std::string GetSourceHistogramName() const; | 115 std::string GetSourceHistogramName() const; |
109 | 116 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 | 244 |
238 SuggestionsVector current_suggestions_; | 245 SuggestionsVector current_suggestions_; |
239 | 246 |
240 // For callbacks may be run after destruction. | 247 // For callbacks may be run after destruction. |
241 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 248 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
242 | 249 |
243 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 250 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
244 }; | 251 }; |
245 | 252 |
246 #endif // CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ | 253 #endif // CHROME_BROWSER_ANDROID_MOST_VISITED_SITES_H_ |
OLD | NEW |