Chromium Code Reviews| OLD | NEW |
|---|---|
| 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> | 9 #include <stddef.h> |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/android/scoped_java_ref.h" | 15 #include "base/android/scoped_java_ref.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "chrome/browser/android/ntp/most_visited_sites.h" | 17 #include "chrome/browser/android/ntp/most_visited_sites.h" |
| 18 #include "chrome/browser/supervised_user/supervised_user_service.h" | |
| 19 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" | |
| 18 | 20 |
| 19 class Profile; | 21 class Profile; |
| 20 | 22 |
| 21 // Provides the list of most visited sites and their thumbnails to Java. | 23 // Provides the list of most visited sites and their thumbnails to Java. |
| 22 class MostVisitedSitesBridge { | 24 class MostVisitedSitesBridge { |
| 23 public: | 25 public: |
| 24 explicit MostVisitedSitesBridge(Profile* profile); | 26 explicit MostVisitedSitesBridge(Profile* profile); |
| 25 | 27 |
| 26 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 28 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 27 | 29 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 51 jint index, | 53 jint index, |
| 52 jint tile_type); | 54 jint tile_type); |
| 53 | 55 |
| 54 // Registers JNI methods. | 56 // Registers JNI methods. |
| 55 static bool Register(JNIEnv* env); | 57 static bool Register(JNIEnv* env); |
| 56 | 58 |
| 57 private: | 59 private: |
| 58 ~MostVisitedSitesBridge(); | 60 ~MostVisitedSitesBridge(); |
| 59 | 61 |
| 60 class Observer; | 62 class Observer; |
| 61 std::unique_ptr<Observer> observer_; | 63 std::unique_ptr<Observer> observer_; |
|
Marc Treib
2016/05/09 08:22:48
Hm, can we rename this to something more explicit,
sfiera
2016/05/09 09:33:35
Done.
| |
| 62 | 64 |
| 65 class SupervisorBridge : public MostVisitedSitesSupervisor, | |
| 66 public SupervisedUserServiceObserver { | |
| 67 public: | |
| 68 explicit SupervisorBridge(Profile* profile); | |
| 69 | |
| 70 void SetObserver(Observer* observer) override; | |
| 71 bool IsBlocked(const GURL& url) override; | |
| 72 std::vector<MostVisitedSitesSupervisor::Whitelist> whitelists() override; | |
| 73 bool IsChildProfile() override; | |
| 74 | |
| 75 // SupervisedUserServiceObserver implementation. | |
| 76 void OnURLFilterChanged() override; | |
| 77 | |
| 78 private: | |
| 79 Profile* const profile_; | |
| 80 Observer* observer_; | |
| 81 ScopedObserver<SupervisedUserService, SupervisedUserServiceObserver> | |
| 82 register_observer_; | |
| 83 }; | |
| 84 SupervisorBridge supervisor_; | |
| 85 | |
| 63 MostVisitedSites most_visited_; | 86 MostVisitedSites most_visited_; |
| 64 | 87 |
| 65 DISALLOW_COPY_AND_ASSIGN(MostVisitedSitesBridge); | 88 DISALLOW_COPY_AND_ASSIGN(MostVisitedSitesBridge); |
| 66 }; | 89 }; |
| 67 | 90 |
| 68 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_BRIDGE_H_ | 91 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_BRIDGE_H_ |
| OLD | NEW |