| 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/guid.h" | 11 #include "base/guid.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 base::android::JavaParamRef; |
| 26 using base::android::ScopedJavaLocalRef; |
| 25 using content::Manifest; | 27 using content::Manifest; |
| 26 | 28 |
| 27 jlong Initialize(JNIEnv* env, | 29 jlong Initialize(JNIEnv* env, |
| 28 const JavaParamRef<jobject>& obj, | 30 const JavaParamRef<jobject>& obj, |
| 29 const JavaParamRef<jobject>& java_web_contents) { | 31 const JavaParamRef<jobject>& java_web_contents) { |
| 30 content::WebContents* web_contents = | 32 content::WebContents* web_contents = |
| 31 content::WebContents::FromJavaWebContents(java_web_contents); | 33 content::WebContents::FromJavaWebContents(java_web_contents); |
| 32 AddToHomescreenDialogHelper* add_to_homescreen_helper = | 34 AddToHomescreenDialogHelper* add_to_homescreen_helper = |
| 33 new AddToHomescreenDialogHelper(env, obj, web_contents); | 35 new AddToHomescreenDialogHelper(env, obj, web_contents); |
| 34 return reinterpret_cast<intptr_t>(add_to_homescreen_helper); | 36 return reinterpret_cast<intptr_t>(add_to_homescreen_helper); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 content::WebContents* web_contents = data_fetcher_->web_contents(); | 140 content::WebContents* web_contents = data_fetcher_->web_contents(); |
| 139 if (!web_contents) | 141 if (!web_contents) |
| 140 return; | 142 return; |
| 141 | 143 |
| 142 AppBannerSettingsHelper::RecordBannerEvent( | 144 AppBannerSettingsHelper::RecordBannerEvent( |
| 143 web_contents, web_contents->GetURL(), | 145 web_contents, web_contents->GetURL(), |
| 144 data_fetcher_->shortcut_info().url.spec(), | 146 data_fetcher_->shortcut_info().url.spec(), |
| 145 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, | 147 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, |
| 146 base::Time::Now()); | 148 base::Time::Now()); |
| 147 } | 149 } |
| OLD | NEW |