Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(639)

Side by Side Diff: chrome/browser/android/ntp/most_visited_sites_bridge.h

Issue 2572533002: Add ChromeMostVisitedSitesFactory (Closed)
Patch Set: Use factory for webui Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/android/ntp/most_visited_sites_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_BRIDGE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_BRIDGE_H_
6 #define CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_BRIDGE_H_ 6 #define CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 #include <stddef.h>
10 9
11 #include <memory> 10 #include <memory>
12 #include <string>
13 #include <vector>
14 11
15 #include "base/android/scoped_java_ref.h" 12 #include "base/android/scoped_java_ref.h"
16 #include "base/macros.h" 13 #include "base/macros.h"
17 #include "chrome/browser/supervised_user/supervised_user_service.h"
18 #include "chrome/browser/supervised_user/supervised_user_service_observer.h"
19 #include "components/ntp_tiles/most_visited_sites.h"
20
21 using ntp_tiles::NTPTilesVector;
22 14
23 class Profile; 15 class Profile;
24 16
17 namespace ntp_tiles {
18 class MostVisitedSites;
19 } // namespace ntp_tiles
20
25 // Provides the list of most visited sites and their thumbnails to Java. 21 // Provides the list of most visited sites and their thumbnails to Java.
26 class MostVisitedSitesBridge { 22 class MostVisitedSitesBridge {
27 public: 23 public:
28 explicit MostVisitedSitesBridge(Profile* profile); 24 explicit MostVisitedSitesBridge(Profile* profile);
29 25
30 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 26 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
31 27
32 void SetMostVisitedURLsObserver( 28 void SetMostVisitedURLsObserver(
33 JNIEnv* env, 29 JNIEnv* env,
34 const base::android::JavaParamRef<jobject>& obj, 30 const base::android::JavaParamRef<jobject>& obj,
(...skipping 20 matching lines...) Expand all
55 51
56 // Registers JNI methods. 52 // Registers JNI methods.
57 static bool Register(JNIEnv* env); 53 static bool Register(JNIEnv* env);
58 54
59 private: 55 private:
60 ~MostVisitedSitesBridge(); 56 ~MostVisitedSitesBridge();
61 57
62 class JavaObserver; 58 class JavaObserver;
63 std::unique_ptr<JavaObserver> java_observer_; 59 std::unique_ptr<JavaObserver> java_observer_;
64 60
65 class SupervisorBridge : public ntp_tiles::MostVisitedSitesSupervisor, 61 std::unique_ptr<ntp_tiles::MostVisitedSites> most_visited_;
66 public SupervisedUserServiceObserver {
67 public:
68 explicit SupervisorBridge(Profile* profile);
69 ~SupervisorBridge() override;
70
71 void SetObserver(Observer* observer) override;
72 bool IsBlocked(const GURL& url) override;
73 std::vector<MostVisitedSitesSupervisor::Whitelist> whitelists() override;
74 bool IsChildProfile() override;
75
76 // SupervisedUserServiceObserver implementation.
77 void OnURLFilterChanged() override;
78
79 private:
80 Profile* const profile_;
81 Observer* supervisor_observer_;
82 ScopedObserver<SupervisedUserService, SupervisedUserServiceObserver>
83 register_observer_;
84 };
85 SupervisorBridge supervisor_;
86
87 ntp_tiles::MostVisitedSites most_visited_;
88 62
89 DISALLOW_COPY_AND_ASSIGN(MostVisitedSitesBridge); 63 DISALLOW_COPY_AND_ASSIGN(MostVisitedSitesBridge);
90 }; 64 };
91 65
92 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_BRIDGE_H_ 66 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_BRIDGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/android/ntp/most_visited_sites_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698