Chromium Code Reviews
[email protected] (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2134)

Side by Side Diff: chrome/browser/android/download/ui/thumbnail_provider.h

Issue 2294983002: [Download Home] Add image thumbnail support (Closed)
Patch Set: Changed how the image is resized Created 4 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ANDROID_DOWNLOAD_UI_THUMBNAIL_PROVIDER_H_
6 #define CHROME_BROWSER_ANDROID_DOWNLOAD_UI_THUMBNAIL_PROVIDER_H_
7
8 #include <string>
9
10 #include "base/android/jni_android.h"
11 #include "chrome/browser/image_decoder.h"
12
13 // Kicks off asynchronous pipelines for creating thumbnails for local files.
14 // The native-side ThumbnailProvider is owned by the Java-side and can be
Ian Wen 2016/08/31 00:08:10 nit: simplify the comments to be "This class is ow
gone 2016/08/31 01:35:04 Wanted to be explicitly clear about how the ImageR
15 // safely destroyed while a request is being processed.
16 class ThumbnailProvider {
17 public:
18 ThumbnailProvider(const base::android::JavaParamRef<jobject>& jobj,
19 int icon_size);
20
21 // Destroys the ThumbnailProvider. Any currently running ImageRequest will
22 // delete itself when it has completed.
23 void Destroy(JNIEnv* env,
24 const base::android::JavaParamRef<jobject>& jobj);
25
26 // Kicks off an asynchronous process to retrieve the thumbnail for the file
27 // located at |file_path| with a max size of |icon_size| in each dimension.
28 void RetrieveThumbnail(JNIEnv* env,
29 const base::android::JavaParamRef<jobject>& jobj,
30 jstring file_path,
31 jint icon_size);
32
33 // Called when the thumbnail is ready. |thumbnail| will be empty on failure.
34 void OnThumbnailRetrieved(const std::string& file_path,
35 const SkBitmap& thumbnail);
36
37 // Registers the JNI bindings.
38 static bool RegisterJNI(JNIEnv* env);
39
40 private:
41 ~ThumbnailProvider();
42
43 base::android::ScopedJavaGlobalRef<jobject> java_delegate_;
44 base::WeakPtrFactory<ThumbnailProvider> weak_factory_;
45
46 DISALLOW_COPY_AND_ASSIGN(ThumbnailProvider);
47 };
48
49 #endif // CHROME_BROWSER_ANDROID_DOWNLOAD_UI_THUMBNAIL_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698