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/webapps/add_to_homescreen_dialog_helper.cc

Issue 2129043002: Split ShortcutHelper#addShortcut() into separate functions for each type of shortcut (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' into webapk_builder_impl0 Created 4 years, 5 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
« no previous file with comments | « chrome/browser/android/shortcut_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <jni.h> 7 #include <jni.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 DCHECK(add_shortcut_pending_); 115 DCHECK(add_shortcut_pending_);
116 if (!add_shortcut_pending_) 116 if (!add_shortcut_pending_)
117 return; 117 return;
118 add_shortcut_pending_ = false; 118 add_shortcut_pending_ = false;
119 119
120 RecordAddToHomescreen(); 120 RecordAddToHomescreen();
121 121
122 const std::string& uid = base::GenerateGUID(); 122 const std::string& uid = base::GenerateGUID();
123 content::BrowserThread::PostTask( 123 content::BrowserThread::PostTask(
124 content::BrowserThread::IO, FROM_HERE, 124 content::BrowserThread::IO, FROM_HERE,
125 base::Bind(&ShortcutHelper::AddShortcutInBackgroundWithSkBitmap, info, 125 base::Bind(&ShortcutHelper::AddToLauncherInBackgroundWithSkBitmap, info,
126 uid, icon, 126 uid, icon,
127 data_fetcher_->FetchSplashScreenImageCallback(uid))); 127 data_fetcher_->FetchSplashScreenImageCallback(uid)));
128 } 128 }
129 129
130 bool AddToHomescreenDialogHelper::RegisterAddToHomescreenDialogHelper( 130 bool AddToHomescreenDialogHelper::RegisterAddToHomescreenDialogHelper(
131 JNIEnv* env) { 131 JNIEnv* env) {
132 return RegisterNativesImpl(env); 132 return RegisterNativesImpl(env);
133 } 133 }
134 134
135 void AddToHomescreenDialogHelper::RecordAddToHomescreen() { 135 void AddToHomescreenDialogHelper::RecordAddToHomescreen() {
136 // Record that the shortcut has been added, so no banners will be shown 136 // Record that the shortcut has been added, so no banners will be shown
137 // for this app. 137 // for this app.
138 content::WebContents* web_contents = data_fetcher_->web_contents(); 138 content::WebContents* web_contents = data_fetcher_->web_contents();
139 if (!web_contents) 139 if (!web_contents)
140 return; 140 return;
141 141
142 AppBannerSettingsHelper::RecordBannerEvent( 142 AppBannerSettingsHelper::RecordBannerEvent(
143 web_contents, web_contents->GetURL(), 143 web_contents, web_contents->GetURL(),
144 data_fetcher_->shortcut_info().url.spec(), 144 data_fetcher_->shortcut_info().url.spec(),
145 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, 145 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN,
146 base::Time::Now()); 146 base::Time::Now());
147 } 147 }
OLDNEW
« no previous file with comments | « chrome/browser/android/shortcut_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698