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 #ifndef CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ |
6 #define CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ | 6 #define CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ |
7 | 7 |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/android/jni_weak_ref.h" | 9 #include "base/android/jni_weak_ref.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/task/cancelable_task_tracker.h" | 12 #include "base/task/cancelable_task_tracker.h" |
13 #include "chrome/common/web_application_info.h" | 13 #include "chrome/common/web_application_info.h" |
14 #include "components/favicon_base/favicon_types.h" | 14 #include "components/favicon_base/favicon_types.h" |
15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class WebContents; | 18 class WebContents; |
| 19 struct Manifest; |
19 } // namespace content | 20 } // namespace content |
20 | 21 |
21 namespace IPC { | 22 namespace IPC { |
22 class Message; | 23 class Message; |
23 } | 24 } |
24 | 25 |
25 class GURL; | 26 class GURL; |
26 | 27 |
27 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's | 28 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's |
28 // ShortcutHelper in Java. The object is owned by the Java object. It is created | 29 // ShortcutHelper in Java. The object is owned by the Java object. It is created |
(...skipping 11 matching lines...) Expand all Loading... |
40 // OnDidRetrieveWebappInformation is expected to be called when finished. | 41 // OnDidRetrieveWebappInformation is expected to be called when finished. |
41 void Initialize(); | 42 void Initialize(); |
42 | 43 |
43 // Called by the Java counter part to let the object knows that it can destroy | 44 // Called by the Java counter part to let the object knows that it can destroy |
44 // itself. | 45 // itself. |
45 void TearDown(JNIEnv* env, jobject obj); | 46 void TearDown(JNIEnv* env, jobject obj); |
46 | 47 |
47 // IPC message received when the initialization is finished. | 48 // IPC message received when the initialization is finished. |
48 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info); | 49 void OnDidGetWebApplicationInfo(const WebApplicationInfo& web_app_info); |
49 | 50 |
| 51 // Callback run when the Manifest is ready to be used. |
| 52 void OnDidGetManifest(const content::Manifest& manifest); |
| 53 |
50 // Adds a shortcut to the current URL to the Android home screen. | 54 // Adds a shortcut to the current URL to the Android home screen. |
51 void AddShortcut(JNIEnv* env, | 55 void AddShortcut(JNIEnv* env, |
52 jobject obj, | 56 jobject obj, |
53 jstring title, | 57 jstring title, |
54 jint launcher_large_icon_size); | 58 jint launcher_large_icon_size); |
55 | 59 |
56 void FinishAddingShortcut( | 60 void FinishAddingShortcut( |
57 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 61 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
58 | 62 |
59 // WebContentsObserver | 63 // WebContentsObserver |
(...skipping 17 matching lines...) Expand all Loading... |
77 | 81 |
78 JavaObjectWeakGlobalRef java_ref_; | 82 JavaObjectWeakGlobalRef java_ref_; |
79 | 83 |
80 GURL url_; | 84 GURL url_; |
81 base::string16 title_; | 85 base::string16 title_; |
82 int launcher_large_icon_size_; | 86 int launcher_large_icon_size_; |
83 WebApplicationInfo::MobileCapable web_app_capable_; | 87 WebApplicationInfo::MobileCapable web_app_capable_; |
84 favicon_base::FaviconRawBitmapResult icon_; | 88 favicon_base::FaviconRawBitmapResult icon_; |
85 base::CancelableTaskTracker cancelable_task_tracker_; | 89 base::CancelableTaskTracker cancelable_task_tracker_; |
86 | 90 |
| 91 base::WeakPtrFactory<ShortcutHelper> weak_ptr_factory_; |
| 92 |
87 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); | 93 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); |
88 }; | 94 }; |
89 | 95 |
90 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ | 96 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ |
OLD | NEW |