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" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 bool ShortcutBuilder::OnMessageReceived(const IPC::Message& message) { | 107 bool ShortcutBuilder::OnMessageReceived(const IPC::Message& message) { |
108 bool handled = true; | 108 bool handled = true; |
109 IPC_BEGIN_MESSAGE_MAP(ShortcutBuilder, message) | 109 IPC_BEGIN_MESSAGE_MAP(ShortcutBuilder, message) |
110 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidRetrieveWebappInformation, | 110 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidRetrieveWebappInformation, |
111 OnDidRetrieveWebappInformation) | 111 OnDidRetrieveWebappInformation) |
112 IPC_MESSAGE_UNHANDLED(handled = false) | 112 IPC_MESSAGE_UNHANDLED(handled = false) |
113 IPC_END_MESSAGE_MAP() | 113 IPC_END_MESSAGE_MAP() |
114 return handled; | 114 return handled; |
115 } | 115 } |
116 | 116 |
117 void ShortcutBuilder::WebContentsDestroyed(content::WebContents* web_contents) { | 117 void ShortcutBuilder::WebContentsDestroyed() { |
118 Destroy(); | 118 Destroy(); |
119 } | 119 } |
120 | 120 |
121 void ShortcutBuilder::Destroy() { | 121 void ShortcutBuilder::Destroy() { |
122 if (cancelable_task_tracker_.HasTrackedTasks()) { | 122 if (cancelable_task_tracker_.HasTrackedTasks()) { |
123 cancelable_task_tracker_.TryCancelAll(); | 123 cancelable_task_tracker_.TryCancelAll(); |
124 } | 124 } |
125 delete this; | 125 delete this; |
126 } | 126 } |
127 | 127 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 jclass clazz, | 204 jclass clazz, |
205 jlong tab_android_ptr, | 205 jlong tab_android_ptr, |
206 jstring title, | 206 jstring title, |
207 jint launcher_large_icon_size) { | 207 jint launcher_large_icon_size) { |
208 TabAndroid* tab = reinterpret_cast<TabAndroid*>(tab_android_ptr); | 208 TabAndroid* tab = reinterpret_cast<TabAndroid*>(tab_android_ptr); |
209 ShortcutHelper::AddShortcut( | 209 ShortcutHelper::AddShortcut( |
210 tab->web_contents(), | 210 tab->web_contents(), |
211 base::android::ConvertJavaStringToUTF16(env, title), | 211 base::android::ConvertJavaStringToUTF16(env, title), |
212 launcher_large_icon_size); | 212 launcher_large_icon_size); |
213 } | 213 } |
OLD | NEW |