| 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 #include "content/public/common/manifest.h" |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 class WebContents; | 19 class WebContents; |
| 19 struct Manifest; | |
| 20 } // namespace content | 20 } // namespace content |
| 21 | 21 |
| 22 namespace IPC { | 22 namespace IPC { |
| 23 class Message; | 23 class Message; |
| 24 } | 24 } |
| 25 | 25 |
| 26 class GURL; | 26 class GURL; |
| 27 | 27 |
| 28 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's | 28 // ShortcutHelper is the C++ counterpart of org.chromium.chrome.browser's |
| 29 // 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 61 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
| 62 | 62 |
| 63 // WebContentsObserver | 63 // WebContentsObserver |
| 64 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 64 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 65 virtual void WebContentsDestroyed() OVERRIDE; | 65 virtual void WebContentsDestroyed() OVERRIDE; |
| 66 | 66 |
| 67 // Adds a shortcut to the launcher. Must be called from a WorkerPool task. | 67 // Adds a shortcut to the launcher. Must be called from a WorkerPool task. |
| 68 static void AddShortcutInBackground( | 68 static void AddShortcutInBackground( |
| 69 const GURL& url, | 69 const GURL& url, |
| 70 const base::string16& title, | 70 const base::string16& title, |
| 71 WebApplicationInfo::MobileCapable mobile_capable, | 71 content::Manifest::DisplayMode display, |
| 72 const favicon_base::FaviconRawBitmapResult& bitmap_result); | 72 const favicon_base::FaviconRawBitmapResult& bitmap_result); |
| 73 | 73 |
| 74 // Registers JNI hooks. | 74 // Registers JNI hooks. |
| 75 static bool RegisterShortcutHelper(JNIEnv* env); | 75 static bool RegisterShortcutHelper(JNIEnv* env); |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 virtual ~ShortcutHelper(); | 78 virtual ~ShortcutHelper(); |
| 79 | 79 |
| 80 void Destroy(); | 80 void Destroy(); |
| 81 | 81 |
| 82 JavaObjectWeakGlobalRef java_ref_; | 82 JavaObjectWeakGlobalRef java_ref_; |
| 83 | 83 |
| 84 GURL url_; | 84 GURL url_; |
| 85 base::string16 title_; | 85 base::string16 title_; |
| 86 int launcher_large_icon_size_; | 86 int launcher_large_icon_size_; |
| 87 WebApplicationInfo::MobileCapable web_app_capable_; | 87 content::Manifest::DisplayMode display_; |
| 88 favicon_base::FaviconRawBitmapResult icon_; | 88 favicon_base::FaviconRawBitmapResult icon_; |
| 89 base::CancelableTaskTracker cancelable_task_tracker_; | 89 base::CancelableTaskTracker cancelable_task_tracker_; |
| 90 | 90 |
| 91 base::WeakPtrFactory<ShortcutHelper> weak_ptr_factory_; | 91 base::WeakPtrFactory<ShortcutHelper> weak_ptr_factory_; |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); | 93 DISALLOW_COPY_AND_ASSIGN(ShortcutHelper); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ | 96 #endif // CHROME_BROWSER_ANDROID_SHORTCUT_HELPER_H_ |
| OLD | NEW |