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

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

Issue 1974013002: Replace SkBitmap with gfx::Image in the ImageFetcher API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync again Created 4 years, 7 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 | « no previous file | 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/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/scoped_observer.h" 12 #include "base/scoped_observer.h"
13 #include "base/task/cancelable_task_tracker.h" 13 #include "base/task/cancelable_task_tracker.h"
14 #include "components/history/core/browser/history_service.h" 14 #include "components/history/core/browser/history_service.h"
15 #include "components/ntp_snippets/ntp_snippets_service.h" 15 #include "components/ntp_snippets/ntp_snippets_service.h"
16 16
17 class SkBitmap; 17 namespace gfx {
18 class Image;
19 }
18 20
19 // The C++ counterpart to SnippetsBridge.java. Enables Java code to access 21 // The C++ counterpart to SnippetsBridge.java. Enables Java code to access
20 // the list of snippets to show on the NTP 22 // the list of snippets to show on the NTP
21 class NTPSnippetsBridge : public ntp_snippets::NTPSnippetsServiceObserver { 23 class NTPSnippetsBridge : public ntp_snippets::NTPSnippetsServiceObserver {
22 public: 24 public:
23 NTPSnippetsBridge(JNIEnv* env, 25 NTPSnippetsBridge(JNIEnv* env,
24 const base::android::JavaParamRef<jobject>& j_profile); 26 const base::android::JavaParamRef<jobject>& j_profile);
25 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 27 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
26 28
27 void SetObserver(JNIEnv* env, 29 void SetObserver(JNIEnv* env,
(...skipping 21 matching lines...) Expand all
49 private: 51 private:
50 ~NTPSnippetsBridge() override; 52 ~NTPSnippetsBridge() override;
51 53
52 // NTPSnippetsServiceObserver overrides 54 // NTPSnippetsServiceObserver overrides
53 void NTPSnippetsServiceLoaded() override; 55 void NTPSnippetsServiceLoaded() override;
54 void NTPSnippetsServiceShutdown() override; 56 void NTPSnippetsServiceShutdown() override;
55 void NTPSnippetsServiceCleared() override; 57 void NTPSnippetsServiceCleared() override;
56 58
57 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback, 59 void OnImageFetched(base::android::ScopedJavaGlobalRef<jobject> callback,
58 const std::string& snippet_id, 60 const std::string& snippet_id,
59 const SkBitmap* bitmap); 61 const gfx::Image& image);
60 62
61 ntp_snippets::NTPSnippetsService* ntp_snippets_service_; 63 ntp_snippets::NTPSnippetsService* ntp_snippets_service_;
62 history::HistoryService* history_service_; 64 history::HistoryService* history_service_;
63 base::CancelableTaskTracker tracker_; 65 base::CancelableTaskTracker tracker_;
64 66
65 // Used to notify the Java side when new snippets have been fetched. 67 // Used to notify the Java side when new snippets have been fetched.
66 base::android::ScopedJavaGlobalRef<jobject> observer_; 68 base::android::ScopedJavaGlobalRef<jobject> observer_;
67 ScopedObserver<ntp_snippets::NTPSnippetsService, 69 ScopedObserver<ntp_snippets::NTPSnippetsService,
68 ntp_snippets::NTPSnippetsServiceObserver> 70 ntp_snippets::NTPSnippetsServiceObserver>
69 snippet_service_observer_; 71 snippet_service_observer_;
70 72
71 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_; 73 base::WeakPtrFactory<NTPSnippetsBridge> weak_ptr_factory_;
72 74
73 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge); 75 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsBridge);
74 }; 76 };
75 77
76 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_ 78 #endif // CHROME_BROWSER_ANDROID_NTP_NTP_SNIPPETS_BRIDGE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/ntp/ntp_snippets_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698