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

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

Issue 896243004: Start piping Android app promos through AppBannerInfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing nits Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_H_ 5 #ifndef CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_
6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ 6 #define CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_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/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 void Destroy(JNIEnv* env, jobject obj); 78 void Destroy(JNIEnv* env, jobject obj);
79 79
80 // Blocks a banner for |package_name| from appearing on the domain for |url|. 80 // Blocks a banner for |package_name| from appearing on the domain for |url|.
81 void BlockBanner(JNIEnv* env, jobject obj, jstring jurl, jstring jpackage); 81 void BlockBanner(JNIEnv* env, jobject obj, jstring jurl, jstring jpackage);
82 82
83 // Observes a new WebContents, if necessary. 83 // Observes a new WebContents, if necessary.
84 void ReplaceWebContents(JNIEnv* env, 84 void ReplaceWebContents(JNIEnv* env,
85 jobject obj, 85 jobject obj,
86 jobject jweb_contents); 86 jobject jweb_contents);
87 87
88 // Fetches the icon at the given URL asynchronously. 88 // Called when the Java-side has retrieved information for the app.
89 // Returns |false| if this couldn't be kicked off. 89 // Returns |false| if an icon fetch couldn't be kicked off.
90 bool FetchIcon(JNIEnv* env, 90 bool OnAppDetailsRetrieved(JNIEnv* env,
91 jobject obj, 91 jobject obj,
92 jstring jimage_url); 92 jobject japp_data,
93 jstring japp_title,
94 jstring japp_package,
95 jstring jicon_url);
93 96
94 // Fetches the icon at the given URL asynchronously. 97 // Fetches the icon at the given URL asynchronously.
95 // Returns |false| if this couldn't be kicked off. 98 // Returns |false| if this couldn't be kicked off.
96 bool FetchIcon(const GURL& image_url); 99 bool FetchIcon(const GURL& image_url);
97 100
98 // Installs the app defined by the manifest. 101 // Installs the app defined by the manifest.
99 // TODO(dfalcantara): Fold into Install() when more CLs land. 102 // TODO(dfalcantara): Fold into Install() when more CLs land.
100 static void InstallManifestApp(const content::Manifest& manifest, 103 static void InstallManifestApp(const content::Manifest& manifest,
101 const SkBitmap& icon); 104 const SkBitmap& icon);
102 105
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // Fetches the icon for an app. 151 // Fetches the icon for an app.
149 scoped_ptr<chrome::BitmapFetcher> fetcher_; 152 scoped_ptr<chrome::BitmapFetcher> fetcher_;
150 GURL validated_url_; 153 GURL validated_url_;
151 GURL app_icon_url_; 154 GURL app_icon_url_;
152 155
153 base::string16 app_title_; 156 base::string16 app_title_;
154 scoped_ptr<SkBitmap> app_icon_; 157 scoped_ptr<SkBitmap> app_icon_;
155 158
156 content::Manifest web_app_data_; 159 content::Manifest web_app_data_;
157 160
161 base::android::ScopedJavaGlobalRef<jobject> native_app_data_;
162 std::string native_app_package_;
163
158 // Weak pointer to the InfoBar that is being managed. 164 // Weak pointer to the InfoBar that is being managed.
159 AppBannerInfoBar* weak_infobar_ptr_; 165 AppBannerInfoBar* weak_infobar_ptr_;
160 166
161 // AppBannerManager on the Java side. 167 // AppBannerManager on the Java side.
162 JavaObjectWeakGlobalRef weak_java_banner_view_manager_; 168 JavaObjectWeakGlobalRef weak_java_banner_view_manager_;
163 169
164 // A weak pointer is used as the lifetime of the ServiceWorkerContext is 170 // A weak pointer is used as the lifetime of the ServiceWorkerContext is
165 // longer than the lifetime of this banner manager. The banner manager 171 // longer than the lifetime of this banner manager. The banner manager
166 // might be gone when calls sent to the ServiceWorkerContext are completed. 172 // might be gone when calls sent to the ServiceWorkerContext are completed.
167 base::WeakPtrFactory<AppBannerManager> weak_factory_; 173 base::WeakPtrFactory<AppBannerManager> weak_factory_;
168 174
169 DISALLOW_COPY_AND_ASSIGN(AppBannerManager); 175 DISALLOW_COPY_AND_ASSIGN(AppBannerManager);
170 }; // class AppBannerManager 176 }; // class AppBannerManager
171 177
172 // Register native methods 178 // Register native methods
173 bool RegisterAppBannerManager(JNIEnv* env); 179 bool RegisterAppBannerManager(JNIEnv* env);
174 180
175 } // namespace banners 181 } // namespace banners
176 182
177 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_ 183 #endif // CHROME_BROWSER_ANDROID_BANNERS_APP_BANNER_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/banners/app_banner_infobar_delegate.cc ('k') | chrome/browser/android/banners/app_banner_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698