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

Side by Side Diff: chrome/browser/android/banners/app_banner_manager_android.h

Issue 1308533006: webapps: allow callers of icon downloader/selector to specify a minimum size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webapps-splashscreen-icon
Patch Set: Fix test failure Created 5 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_
6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_
7 7
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_weak_ref.h" 9 #include "base/android/jni_weak_ref.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/android/banners/app_banner_data_fetcher_android.h" 11 #include "chrome/browser/android/banners/app_banner_data_fetcher_android.h"
12 #include "chrome/browser/banners/app_banner_debug_log.h" 12 #include "chrome/browser/banners/app_banner_debug_log.h"
13 #include "chrome/browser/banners/app_banner_manager.h" 13 #include "chrome/browser/banners/app_banner_manager.h"
14 14
15 namespace banners { 15 namespace banners {
16 class AppBannerDataFetcherAndroid; 16 class AppBannerDataFetcherAndroid;
17 17
18 // Extends the AppBannerManager to support native Android apps. 18 // Extends the AppBannerManager to support native Android apps.
19 // TODO(dfalcantara): Flip it so the C++ AppBannerManagerAndroid owns the 19 // TODO(dfalcantara): Flip it so the C++ AppBannerManagerAndroid owns the
20 // Java AppBannerManager, move ownership of the AppBannerManagerAndroid to 20 // Java AppBannerManager, move ownership of the AppBannerManagerAndroid to
21 // the TabAndroid class, then move functions for retriving info from Java to 21 // the TabAndroid class, then move functions for retriving info from Java to
22 // the AppBannerDataFetcherAndroid. 22 // the AppBannerDataFetcherAndroid.
23 class AppBannerManagerAndroid : public AppBannerManager { 23 class AppBannerManagerAndroid : public AppBannerManager {
24 public: 24 public:
25 // Registers native methods. 25 // Registers native methods.
26 static bool Register(JNIEnv* env); 26 static bool Register(JNIEnv* env);
27 27
28 AppBannerManagerAndroid(JNIEnv* env, 28 AppBannerManagerAndroid(JNIEnv* env, jobject obj);
29 jobject obj,
30 int ideal_splash_image_size_in_dp,
31 int ideal_icon_size_in_dp);
32 ~AppBannerManagerAndroid() override; 29 ~AppBannerManagerAndroid() override;
33 30
34 // Destroys the AppBannerManagerAndroid. 31 // Destroys the AppBannerManagerAndroid.
35 void Destroy(JNIEnv* env, jobject obj); 32 void Destroy(JNIEnv* env, jobject obj);
36 33
37 // Observes a new WebContents, if necessary. 34 // Observes a new WebContents, if necessary.
38 void ReplaceWebContents(JNIEnv* env, 35 void ReplaceWebContents(JNIEnv* env,
39 jobject obj, 36 jobject obj,
40 jobject jweb_contents); 37 jobject jweb_contents);
41 38
42 // Return whether a BitmapFetcher is active. 39 // Return whether a BitmapFetcher is active.
43 bool IsFetcherActive(JNIEnv* env, jobject jobj); 40 bool IsFetcherActive(JNIEnv* env, jobject jobj);
44 41
45 // Called when the Java-side has retrieved information for the app. 42 // Called when the Java-side has retrieved information for the app.
46 // Returns |false| if an icon fetch couldn't be kicked off. 43 // Returns |false| if an icon fetch couldn't be kicked off.
47 bool OnAppDetailsRetrieved(JNIEnv* env, 44 bool OnAppDetailsRetrieved(JNIEnv* env,
48 jobject obj, 45 jobject obj,
49 jobject japp_data, 46 jobject japp_data,
50 jstring japp_title, 47 jstring japp_title,
51 jstring japp_package, 48 jstring japp_package,
52 jstring jicon_url); 49 jstring jicon_url);
53 50
54 protected: 51 protected:
55 AppBannerDataFetcher* CreateAppBannerDataFetcher( 52 AppBannerDataFetcher* CreateAppBannerDataFetcher(
56 base::WeakPtr<AppBannerDataFetcher::Delegate> weak_delegate, 53 base::WeakPtr<AppBannerDataFetcher::Delegate> weak_delegate) override;
57 const int ideal_icon_size_in_dp) override;
58 54
59 private: 55 private:
60 // AppBannerDataFetcher::Delegate overrides. 56 // AppBannerDataFetcher::Delegate overrides.
61 bool HandleNonWebApp(const std::string& platform, 57 bool HandleNonWebApp(const std::string& platform,
62 const GURL& url, 58 const GURL& url,
63 const std::string& id) override; 59 const std::string& id) override;
64 60
65 bool CheckPlatformAndId(const std::string& platform, const std::string& id); 61 bool CheckPlatformAndId(const std::string& platform, const std::string& id);
66 62
67 bool CheckFetcherMatchesContents(); 63 bool CheckFetcherMatchesContents();
68 64
69 std::string ExtractQueryValueForName(const GURL& url, 65 std::string ExtractQueryValueForName(const GURL& url,
70 const std::string& name); 66 const std::string& name);
71 67
72 // Ideal splash screen image size to use.
73 const int ideal_splash_image_size_in_dp_;
74
75 // AppBannerManager on the Java side. 68 // AppBannerManager on the Java side.
76 JavaObjectWeakGlobalRef weak_java_banner_view_manager_; 69 JavaObjectWeakGlobalRef weak_java_banner_view_manager_;
77 70
78 DISALLOW_COPY_AND_ASSIGN(AppBannerManagerAndroid); 71 DISALLOW_COPY_AND_ASSIGN(AppBannerManagerAndroid);
79 }; // class AppBannerManagerAndroid 72 }; // class AppBannerManagerAndroid
80 73
81 } // namespace banners 74 } // namespace banners
82 75
83 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_ 76 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698