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

Side by Side Diff: chrome/browser/android/webapps/add_to_homescreen_dialog_helper.cc

Issue 2228273002: Run ShortcutHelper::AddToLauncherInBackgroundWithSkBitmap() on Worker thread instead of IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_builder_impl2_thread Created 4 years, 4 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/webapps/add_to_homescreen_dialog_helper.h" 5 #include "chrome/browser/android/webapps/add_to_homescreen_dialog_helper.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/guid.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return; 114 return;
115 add_shortcut_pending_ = false; 115 add_shortcut_pending_ = false;
116 116
117 content::WebContents* web_contents = data_fetcher_->web_contents(); 117 content::WebContents* web_contents = data_fetcher_->web_contents();
118 if (!web_contents) 118 if (!web_contents)
119 return; 119 return;
120 120
121 RecordAddToHomescreen(); 121 RecordAddToHomescreen();
122 122
123 const std::string& uid = base::GenerateGUID(); 123 const std::string& uid = base::GenerateGUID();
124 content::BrowserThread::PostTask( 124 ShortcutHelper::AddToLauncherWithSkBitmap(
125 content::BrowserThread::IO, FROM_HERE, 125 web_contents->GetBrowserContext(), info, uid, icon,
126 base::Bind(&ShortcutHelper::AddToLauncherInBackgroundWithSkBitmap, 126 data_fetcher_->FetchSplashScreenImageCallback(uid));
127 web_contents->GetBrowserContext(), info, uid, icon,
128 data_fetcher_->FetchSplashScreenImageCallback(uid)));
129 } 127 }
130 128
131 bool AddToHomescreenDialogHelper::RegisterAddToHomescreenDialogHelper( 129 bool AddToHomescreenDialogHelper::RegisterAddToHomescreenDialogHelper(
132 JNIEnv* env) { 130 JNIEnv* env) {
133 return RegisterNativesImpl(env); 131 return RegisterNativesImpl(env);
134 } 132 }
135 133
136 void AddToHomescreenDialogHelper::RecordAddToHomescreen() { 134 void AddToHomescreenDialogHelper::RecordAddToHomescreen() {
137 // Record that the shortcut has been added, so no banners will be shown 135 // Record that the shortcut has been added, so no banners will be shown
138 // for this app. 136 // for this app.
139 content::WebContents* web_contents = data_fetcher_->web_contents(); 137 content::WebContents* web_contents = data_fetcher_->web_contents();
140 if (!web_contents) 138 if (!web_contents)
141 return; 139 return;
142 140
143 AppBannerSettingsHelper::RecordBannerEvent( 141 AppBannerSettingsHelper::RecordBannerEvent(
144 web_contents, web_contents->GetURL(), 142 web_contents, web_contents->GetURL(),
145 data_fetcher_->shortcut_info().url.spec(), 143 data_fetcher_->shortcut_info().url.spec(),
146 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, 144 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN,
147 base::Time::Now()); 145 base::Time::Now());
148 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698