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

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

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 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/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 10 matching lines...) Expand all
21 #include "jni/AddToHomescreenDialogHelper_jni.h" 21 #include "jni/AddToHomescreenDialogHelper_jni.h"
22 #include "ui/gfx/android/java_bitmap.h" 22 #include "ui/gfx/android/java_bitmap.h"
23 #include "ui/gfx/color_analysis.h" 23 #include "ui/gfx/color_analysis.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 25
26 using content::Manifest; 26 using content::Manifest;
27 27
28 jlong Initialize(JNIEnv* env, 28 jlong Initialize(JNIEnv* env,
29 const JavaParamRef<jobject>& obj, 29 const JavaParamRef<jobject>& obj,
30 const JavaParamRef<jobject>& java_web_contents, 30 const JavaParamRef<jobject>& java_web_contents,
31 jint ideal_splash_image_size_in_dp, 31 int ideal_icon_size_in_dp,
32 jint ideal_icon_size_in_dp) { 32 int minimum_icon_size_in_dp,
33 int ideal_splash_image_size_in_dp,
34 int minimum_splash_image_size_in_dp) {
33 content::WebContents* web_contents = 35 content::WebContents* web_contents =
34 content::WebContents::FromJavaWebContents(java_web_contents); 36 content::WebContents::FromJavaWebContents(java_web_contents);
35 AddToHomescreenDialogHelper* add_to_homescreen_helper = 37 AddToHomescreenDialogHelper* add_to_homescreen_helper =
36 new AddToHomescreenDialogHelper(env, obj, web_contents, 38 new AddToHomescreenDialogHelper(
37 ideal_splash_image_size_in_dp, ideal_icon_size_in_dp); 39 env, obj, web_contents,
40 ideal_icon_size_in_dp, minimum_icon_size_in_dp,
41 ideal_splash_image_size_in_dp, minimum_splash_image_size_in_dp);
38 return reinterpret_cast<intptr_t>(add_to_homescreen_helper); 42 return reinterpret_cast<intptr_t>(add_to_homescreen_helper);
39 } 43 }
40 44
41 AddToHomescreenDialogHelper::AddToHomescreenDialogHelper( 45 AddToHomescreenDialogHelper::AddToHomescreenDialogHelper(
42 JNIEnv* env, 46 JNIEnv* env,
43 jobject obj, 47 jobject obj,
44 content::WebContents* web_contents, 48 content::WebContents* web_contents,
49 int ideal_icon_size_in_dp,
50 int minimum_icon_size_in_dp,
45 int ideal_splash_image_size_in_dp, 51 int ideal_splash_image_size_in_dp,
46 int ideal_icon_size_in_dp) 52 int minimum_splash_image_size_in_dp)
47 : add_shortcut_pending_(false), 53 : add_shortcut_pending_(false),
48 data_fetcher_(new AddToHomescreenDataFetcher(web_contents, 54 data_fetcher_(new AddToHomescreenDataFetcher(web_contents,
55 ideal_icon_size_in_dp,
56 minimum_icon_size_in_dp,
49 ideal_splash_image_size_in_dp, 57 ideal_splash_image_size_in_dp,
50 ideal_icon_size_in_dp, 58 minimum_splash_image_size_in_dp,
51 this)) { 59 this)) {
52 java_ref_.Reset(env, obj); 60 java_ref_.Reset(env, obj);
53 } 61 }
54 62
55 AddToHomescreenDialogHelper::~AddToHomescreenDialogHelper() { 63 AddToHomescreenDialogHelper::~AddToHomescreenDialogHelper() {
56 data_fetcher_->set_weak_observer(nullptr); 64 data_fetcher_->set_weak_observer(nullptr);
57 data_fetcher_ = nullptr; 65 data_fetcher_ = nullptr;
58 } 66 }
59 67
60 void AddToHomescreenDialogHelper::OnUserTitleAvailable( 68 void AddToHomescreenDialogHelper::OnUserTitleAvailable(
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 content::WebContents* web_contents = data_fetcher_->web_contents(); 173 content::WebContents* web_contents = data_fetcher_->web_contents();
166 if (!web_contents) 174 if (!web_contents)
167 return; 175 return;
168 176
169 AppBannerSettingsHelper::RecordBannerEvent( 177 AppBannerSettingsHelper::RecordBannerEvent(
170 web_contents, web_contents->GetURL(), 178 web_contents, web_contents->GetURL(),
171 data_fetcher_->shortcut_info().url.spec(), 179 data_fetcher_->shortcut_info().url.spec(),
172 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, 180 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN,
173 base::Time::Now()); 181 base::Time::Now());
174 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698