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

Side by Side Diff: chrome/browser/android/banners/app_banner_infobar_delegate_android.cc

Issue 1310223002: webapps: initial addition of splash screen icon downloading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webapps-database-exp
Patch Set: Fix compile 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 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h" 5 #include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/guid.h"
9 #include "base/location.h" 10 #include "base/location.h"
10 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/android/shortcut_helper.h" 13 #include "chrome/browser/android/shortcut_helper.h"
13 #include "chrome/browser/android/shortcut_info.h" 14 #include "chrome/browser/android/shortcut_info.h"
14 #include "chrome/browser/android/tab_android.h" 15 #include "chrome/browser/android/tab_android.h"
15 #include "chrome/browser/banners/app_banner_data_fetcher.h" 16 #include "chrome/browser/banners/app_banner_data_fetcher.h"
16 #include "chrome/browser/banners/app_banner_metrics.h" 17 #include "chrome/browser/banners/app_banner_metrics.h"
17 #include "chrome/browser/banners/app_banner_settings_helper.h" 18 #include "chrome/browser/banners/app_banner_settings_helper.h"
18 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
(...skipping 12 matching lines...) Expand all
31 32
32 using base::android::ConvertJavaStringToUTF8; 33 using base::android::ConvertJavaStringToUTF8;
33 using base::android::ConvertJavaStringToUTF16; 34 using base::android::ConvertJavaStringToUTF16;
34 using base::android::ConvertUTF8ToJavaString; 35 using base::android::ConvertUTF8ToJavaString;
35 using base::android::ConvertUTF16ToJavaString; 36 using base::android::ConvertUTF16ToJavaString;
36 37
37 namespace banners { 38 namespace banners {
38 39
39 AppBannerInfoBarDelegateAndroid::AppBannerInfoBarDelegateAndroid( 40 AppBannerInfoBarDelegateAndroid::AppBannerInfoBarDelegateAndroid(
40 int event_request_id, 41 int event_request_id,
42 scoped_refptr<AppBannerDataFetcherAndroid> data_fetcher,
41 const base::string16& app_title, 43 const base::string16& app_title,
42 SkBitmap* app_icon, 44 SkBitmap* app_icon,
43 const content::Manifest& web_app_data) 45 const content::Manifest& web_app_data)
44 : app_title_(app_title), 46 : data_fetcher_(data_fetcher),
47 app_title_(app_title),
45 app_icon_(app_icon), 48 app_icon_(app_icon),
46 event_request_id_(event_request_id), 49 event_request_id_(event_request_id),
47 web_app_data_(web_app_data), 50 web_app_data_(web_app_data),
48 has_user_interaction_(false) { 51 has_user_interaction_(false) {
49 DCHECK(!web_app_data.IsEmpty()); 52 DCHECK(!web_app_data.IsEmpty());
50 CreateJavaDelegate(); 53 CreateJavaDelegate();
51 } 54 }
52 55
53 AppBannerInfoBarDelegateAndroid::AppBannerInfoBarDelegateAndroid( 56 AppBannerInfoBarDelegateAndroid::AppBannerInfoBarDelegateAndroid(
54 int event_request_id, 57 int event_request_id,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } else if (!web_app_data_.IsEmpty()) { 236 } else if (!web_app_data_.IsEmpty()) {
234 TrackUserResponse(USER_RESPONSE_WEB_APP_ACCEPTED); 237 TrackUserResponse(USER_RESPONSE_WEB_APP_ACCEPTED);
235 238
236 AppBannerSettingsHelper::RecordBannerInstallEvent( 239 AppBannerSettingsHelper::RecordBannerInstallEvent(
237 web_contents, web_app_data_.start_url.spec(), 240 web_contents, web_app_data_.start_url.spec(),
238 AppBannerSettingsHelper::WEB); 241 AppBannerSettingsHelper::WEB);
239 242
240 ShortcutInfo info(GURL::EmptyGURL()); 243 ShortcutInfo info(GURL::EmptyGURL());
241 info.UpdateFromManifest(web_app_data_); 244 info.UpdateFromManifest(web_app_data_);
242 info.UpdateSource(ShortcutInfo::SOURCE_APP_BANNER); 245 info.UpdateSource(ShortcutInfo::SOURCE_APP_BANNER);
246
247 const std::string& uid = base::GenerateGUID();
243 content::BrowserThread::PostTask( 248 content::BrowserThread::PostTask(
244 content::BrowserThread::IO, 249 content::BrowserThread::IO,
245 FROM_HERE, 250 FROM_HERE,
246 base::Bind(&ShortcutHelper::AddShortcutInBackgroundWithSkBitmap, 251 base::Bind(&ShortcutHelper::AddShortcutInBackgroundWithSkBitmap,
247 info, 252 info,
253 uid,
248 *app_icon_.get())); 254 *app_icon_.get()));
255 data_fetcher_->FetchWebappSplashScreenImage(uid);
249 256
250 SendBannerAccepted(web_contents, "web"); 257 SendBannerAccepted(web_contents, "web");
251 return true; 258 return true;
252 } 259 }
253 260
254 return true; 261 return true;
255 } 262 }
256 263
257 bool AppBannerInfoBarDelegateAndroid::LinkClicked( 264 bool AppBannerInfoBarDelegateAndroid::LinkClicked(
258 WindowOpenDisposition disposition) { 265 WindowOpenDisposition disposition) {
(...skipping 19 matching lines...) Expand all
278 285
279 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK); 286 TrackDismissEvent(DISMISS_EVENT_BANNER_CLICK);
280 return true; 287 return true;
281 } 288 }
282 289
283 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) { 290 bool RegisterAppBannerInfoBarDelegateAndroid(JNIEnv* env) {
284 return RegisterNativesImpl(env); 291 return RegisterNativesImpl(env);
285 } 292 }
286 293
287 } // namespace banners 294 } // namespace banners
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698