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

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

Issue 1833763002: Add new NTP layout with snippet cards and hide it behind a flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address more comments Created 4 years, 8 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
« no previous file with comments | « chrome/android/java_sources.gni ('k') | chrome/browser/android/ntp/ntp_snippets_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_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"
11 #include "base/scoped_observer.h" 11 #include "base/scoped_observer.h"
12 #include "components/ntp_snippets/ntp_snippets_service.h" 12 #include "components/ntp_snippets/ntp_snippets_service.h"
13 13
14 // The C++ counterpart to NTPSnippetsBridge.java. Enables Java code to access 14 // The C++ counterpart to SnippetsBridge.java. Enables Java code to access
15 // the list of snippets to show on the NTP 15 // the list of snippets to show on the NTP
16 class NTPSnippetsBridge : public ntp_snippets::NTPSnippetsServiceObserver { 16 class NTPSnippetsBridge : public ntp_snippets::NTPSnippetsServiceObserver {
17 public: 17 public:
18 NTPSnippetsBridge(JNIEnv* env, 18 NTPSnippetsBridge(JNIEnv* env,
19 const base::android::JavaParamRef<jobject>& j_profile); 19 const base::android::JavaParamRef<jobject>& j_profile);
20 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 20 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
21 21
22 void SetObserver(JNIEnv* env, 22 void SetObserver(JNIEnv* env,
23 const base::android::JavaParamRef<jobject>& obj, 23 const base::android::JavaParamRef<jobject>& obj,
24 const base::android::JavaParamRef<jobject>& j_observer); 24 const base::android::JavaParamRef<jobject>& j_observer);
25 25
26 static bool Register(JNIEnv* env); 26 static bool Register(JNIEnv* env);
27 27
28 private: 28 private:
29 ~NTPSnippetsBridge() override; 29 ~NTPSnippetsBridge() override;
30 30
31 // NTPSnippetsServiceObserver overrides 31 // NTPSnippetsServiceObserver overrides
32 void NTPSnippetsServiceLoaded( 32 void NTPSnippetsServiceLoaded(
33 ntp_snippets::NTPSnippetsService* service) override; 33 ntp_snippets::NTPSnippetsService* service) override;
34 void NTPSnippetsServiceShutdown( 34 void NTPSnippetsServiceShutdown(
35 ntp_snippets::NTPSnippetsService* service) override; 35 ntp_snippets::NTPSnippetsService* service) override;
36 36
37 ntp_snippets::NTPSnippetsService* ntp_snippets_service_; 37 ntp_snippets::NTPSnippetsService* ntp_snippets_service_;
38 38
39 // Used to notify the Java side when new snippets have been fetched.
39 base::android::ScopedJavaGlobalRef<jobject> observer_; 40 base::android::ScopedJavaGlobalRef<jobject> observer_;
40 ScopedObserver<ntp_snippets::NTPSnippetsService, 41 ScopedObserver<ntp_snippets::NTPSnippetsService,
41 ntp_snippets::NTPSnippetsServiceObserver> 42 ntp_snippets::NTPSnippetsServiceObserver>
42 snippet_service_observer_; 43 snippet_service_observer_;
43 44
44 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); 45 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge);
45 }; 46 };
46 47
47 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ 48 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_
OLDNEW
« no previous file with comments | « chrome/android/java_sources.gni ('k') | chrome/browser/android/ntp/ntp_snippets_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698