OLD | NEW |
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" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "chrome/browser/android/shortcut_helper.h" | 15 #include "chrome/browser/android/shortcut_helper.h" |
16 #include "chrome/browser/banners/app_banner_settings_helper.h" | 16 #include "chrome/browser/banners/app_banner_settings_helper.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
19 #include "content/public/common/manifest.h" | 19 #include "content/public/common/manifest.h" |
20 #include "jni/AddToHomescreenDialogHelper_jni.h" | 20 #include "jni/AddToHomescreenDialogHelper_jni.h" |
21 #include "ui/gfx/android/java_bitmap.h" | 21 #include "ui/gfx/android/java_bitmap.h" |
22 #include "ui/gfx/color_analysis.h" | 22 #include "ui/gfx/color_analysis.h" |
23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
24 | 24 |
25 using content::Manifest; | 25 using content::Manifest; |
26 | 26 |
27 jlong Initialize(JNIEnv* env, jobject obj, jobject java_web_contents) { | 27 jlong Initialize(JNIEnv* env, |
| 28 const JavaParamRef<jobject>& obj, |
| 29 const JavaParamRef<jobject>& java_web_contents) { |
28 content::WebContents* web_contents = | 30 content::WebContents* web_contents = |
29 content::WebContents::FromJavaWebContents(java_web_contents); | 31 content::WebContents::FromJavaWebContents(java_web_contents); |
30 AddToHomescreenDialogHelper* add_to_homescreen_helper = | 32 AddToHomescreenDialogHelper* add_to_homescreen_helper = |
31 new AddToHomescreenDialogHelper(env, obj, web_contents); | 33 new AddToHomescreenDialogHelper(env, obj, web_contents); |
32 return reinterpret_cast<intptr_t>(add_to_homescreen_helper); | 34 return reinterpret_cast<intptr_t>(add_to_homescreen_helper); |
33 } | 35 } |
34 | 36 |
35 AddToHomescreenDialogHelper::AddToHomescreenDialogHelper(JNIEnv* env, | 37 AddToHomescreenDialogHelper::AddToHomescreenDialogHelper(JNIEnv* env, |
36 jobject obj, | 38 jobject obj, |
37 content::WebContents* web_contents) | 39 content::WebContents* web_contents) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 content::WebContents* web_contents = data_fetcher_->web_contents(); | 151 content::WebContents* web_contents = data_fetcher_->web_contents(); |
150 if (!web_contents) | 152 if (!web_contents) |
151 return; | 153 return; |
152 | 154 |
153 AppBannerSettingsHelper::RecordBannerEvent( | 155 AppBannerSettingsHelper::RecordBannerEvent( |
154 web_contents, web_contents->GetURL(), | 156 web_contents, web_contents->GetURL(), |
155 data_fetcher_->shortcut_info().url.spec(), | 157 data_fetcher_->shortcut_info().url.spec(), |
156 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, | 158 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, |
157 base::Time::Now()); | 159 base::Time::Now()); |
158 } | 160 } |
OLD | NEW |