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

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

Issue 2061803002: 📰 The Status card reports disabled sync states (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simplifyBridge
Patch Set: yolo: another big bag of changes Created 4 years, 5 months 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
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_NTP_SNIPPETS_BRIDGE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_
6 #define CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ 6 #define CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 28 matching lines...) Expand all
39 void DiscardSnippet(JNIEnv* env, 39 void DiscardSnippet(JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& obj, 40 const base::android::JavaParamRef<jobject>& obj,
41 const base::android::JavaParamRef<jstring>& snippet_id); 41 const base::android::JavaParamRef<jstring>& snippet_id);
42 42
43 // Checks if the URL has been visited. 43 // Checks if the URL has been visited.
44 void SnippetVisited(JNIEnv* env, 44 void SnippetVisited(JNIEnv* env,
45 const base::android::JavaParamRef<jobject>& obj, 45 const base::android::JavaParamRef<jobject>& obj,
46 const base::android::JavaParamRef<jobject>& callback, 46 const base::android::JavaParamRef<jobject>& callback,
47 const base::android::JavaParamRef<jstring>& jurl); 47 const base::android::JavaParamRef<jstring>& jurl);
48 48
49 // Returns a reason why the snippet service is disabled, or 0 if it isn't.
50 // See NTPSnippetsService::DisabledReason for more info.
51 int GetDisabledReason(JNIEnv* env,
52 const base::android::JavaParamRef<jobject>& obj);
53
49 static bool Register(JNIEnv* env); 54 static bool Register(JNIEnv* env);
50 55
51 private: 56 private:
52 ~NTPSnippetsBridge() override; 57 ~NTPSnippetsBridge() override;
53 58
54 // NTPSnippetsServiceObserver overrides 59 // NTPSnippetsServiceObserver overrides
55 void NTPSnippetsServiceLoaded() override; 60 void NTPSnippetsServiceLoaded() override;
56 void NTPSnippetsServiceShutdown() override; 61 void NTPSnippetsServiceShutdown() override;
57 void NTPSnippetsServiceDisabled() override; 62 void NTPSnippetsServiceDisabledReasonChanged(
63 ntp_snippets::DisabledReason disabled_reason) override;
58 64
59 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback, 65 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback,
60 const std::string& snippet_id, 66 const std::string& snippet_id,
61 const gfx::Image& image); 67 const gfx::Image& image);
62 68
63 ntp_snippets::NTPSnippetsService* ntp_snippets_service_; 69 ntp_snippets::NTPSnippetsService* ntp_snippets_service_;
64 history::HistoryService* history_service_; 70 history::HistoryService* history_service_;
65 base::CancelableTaskTracker tracker_; 71 base::CancelableTaskTracker tracker_;
66 72
67 // Used to notify the Java side when new snippets have been fetched. 73 // Used to notify the Java side when new snippets have been fetched.
68 base::android::ScopedJavaGlobalRef<jobject> observer_; 74 base::android::ScopedJavaGlobalRef<jobject> observer_;
69 ScopedObserver<ntp_snippets::NTPSnippetsService, 75 ScopedObserver<ntp_snippets::NTPSnippetsService,
70 ntp_snippets::NTPSnippetsServiceObserver> 76 ntp_snippets::NTPSnippetsServiceObserver>
71 snippet_service_observer_; 77 snippet_service_observer_;
72 78
73 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; 79 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_;
74 80
75 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); 81 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge);
76 }; 82 };
77 83
78 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ 84 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698