OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shortcut_helper.h" | 5 #include "chrome/browser/android/shortcut_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/banners/app_banner_settings_helper.h" | 15 #include "chrome/browser/banners/app_banner_settings_helper.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
18 #include "content/public/common/manifest.h" | 18 #include "content/public/common/manifest.h" |
19 #include "jni/ShortcutHelper_jni.h" | 19 #include "jni/ShortcutHelper_jni.h" |
20 #include "ui/gfx/android/java_bitmap.h" | 20 #include "ui/gfx/android/java_bitmap.h" |
21 #include "ui/gfx/color_analysis.h" | 21 #include "ui/gfx/color_analysis.h" |
22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
23 | 23 |
24 using content::Manifest; | 24 using content::Manifest; |
25 | 25 |
26 jlong Initialize(JNIEnv* env, jobject obj, jobject java_web_contents) { | 26 jlong Initialize(JNIEnv* env, jobject obj, jobject java_web_contents) { |
| 27 #if !defined(USE_AURA) |
27 content::WebContents* web_contents = | 28 content::WebContents* web_contents = |
28 content::WebContents::FromJavaWebContents(java_web_contents); | 29 content::WebContents::FromJavaWebContents(java_web_contents); |
29 ShortcutHelper* shortcut_helper = new ShortcutHelper(env, obj, web_contents); | 30 ShortcutHelper* shortcut_helper = new ShortcutHelper(env, obj, web_contents); |
30 return reinterpret_cast<intptr_t>(shortcut_helper); | 31 return reinterpret_cast<intptr_t>(shortcut_helper); |
| 32 #else |
| 33 return reinterpret_cast<intptr_t>(1); |
| 34 #endif |
31 } | 35 } |
32 | 36 |
33 ShortcutHelper::ShortcutHelper(JNIEnv* env, | 37 ShortcutHelper::ShortcutHelper(JNIEnv* env, |
34 jobject obj, | 38 jobject obj, |
35 content::WebContents* web_contents) | 39 content::WebContents* web_contents) |
36 : add_shortcut_pending_(false), | 40 : add_shortcut_pending_(false), |
37 data_fetcher_(new ShortcutDataFetcher(web_contents, this)) { | 41 data_fetcher_(new ShortcutDataFetcher(web_contents, this)) { |
38 java_ref_.Reset(env, obj); | 42 java_ref_.Reset(env, obj); |
39 } | 43 } |
40 | 44 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 content::WebContents* web_contents = data_fetcher_->web_contents(); | 181 content::WebContents* web_contents = data_fetcher_->web_contents(); |
178 if (!web_contents) | 182 if (!web_contents) |
179 return; | 183 return; |
180 | 184 |
181 AppBannerSettingsHelper::RecordBannerEvent( | 185 AppBannerSettingsHelper::RecordBannerEvent( |
182 web_contents, web_contents->GetURL(), | 186 web_contents, web_contents->GetURL(), |
183 data_fetcher_->shortcut_info().url.spec(), | 187 data_fetcher_->shortcut_info().url.spec(), |
184 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, | 188 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, |
185 base::Time::Now()); | 189 base::Time::Now()); |
186 } | 190 } |
OLD | NEW |