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/banners/app_banner_manager_android.h" | 5 #include "chrome/browser/android/banners/app_banner_manager_android.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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 AppBannerManagerAndroid::~AppBannerManagerAndroid() { | 36 AppBannerManagerAndroid::~AppBannerManagerAndroid() { |
37 } | 37 } |
38 | 38 |
39 void AppBannerManagerAndroid::Destroy(JNIEnv* env, jobject obj) { | 39 void AppBannerManagerAndroid::Destroy(JNIEnv* env, jobject obj) { |
40 delete this; | 40 delete this; |
41 } | 41 } |
42 | 42 |
43 void AppBannerManagerAndroid::ReplaceWebContents(JNIEnv* env, | 43 void AppBannerManagerAndroid::ReplaceWebContents(JNIEnv* env, |
44 jobject obj, | 44 jobject obj, |
45 jobject jweb_contents) { | 45 jobject jweb_contents) { |
| 46 #if !defined(USE_AURA) |
46 content::WebContents* web_contents = | 47 content::WebContents* web_contents = |
47 content::WebContents::FromJavaWebContents(jweb_contents); | 48 content::WebContents::FromJavaWebContents(jweb_contents); |
48 AppBannerManager::ReplaceWebContents(web_contents); | 49 AppBannerManager::ReplaceWebContents(web_contents); |
| 50 #endif |
49 } | 51 } |
50 | 52 |
51 bool AppBannerManagerAndroid::HandleNonWebApp(const std::string& platform, | 53 bool AppBannerManagerAndroid::HandleNonWebApp(const std::string& platform, |
52 const GURL& url, | 54 const GURL& url, |
53 const std::string& id) { | 55 const std::string& id) { |
54 if (!CheckPlatformAndId(platform, id)) | 56 if (!CheckPlatformAndId(platform, id)) |
55 return false; | 57 return false; |
56 | 58 |
57 banners::TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_REQUESTED); | 59 banners::TrackDisplayEvent(DISPLAY_EVENT_NATIVE_APP_BANNER_REQUESTED); |
58 | 60 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 jdouble indirect_engagement) { | 157 jdouble indirect_engagement) { |
156 AppBannerManager::ForceEngagementWeightsForTesting(direct_engagement, | 158 AppBannerManager::ForceEngagementWeightsForTesting(direct_engagement, |
157 indirect_engagement); | 159 indirect_engagement); |
158 } | 160 } |
159 | 161 |
160 jboolean IsEnabled(JNIEnv* env, jclass clazz) { | 162 jboolean IsEnabled(JNIEnv* env, jclass clazz) { |
161 return base::FieldTrialList::FindFullName("AppBanners") == "Enabled"; | 163 return base::FieldTrialList::FindFullName("AppBanners") == "Enabled"; |
162 } | 164 } |
163 | 165 |
164 } // namespace banners | 166 } // namespace banners |
OLD | NEW |