OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELE
GATE_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELE
GATE_ANDROID_H_ |
6 #define CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELE
GATE_ANDROID_H_ | 6 #define CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELE
GATE_ANDROID_H_ |
7 | 7 |
8 #include "base/android/jni_helper.h" | 8 #include "base/android/jni_helper.h" |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 const GURL& url) OVERRIDE; | 96 const GURL& url) OVERRIDE; |
97 virtual bool CanDownload(content::RenderViewHost* source, | 97 virtual bool CanDownload(content::RenderViewHost* source, |
98 int request_id, | 98 int request_id, |
99 const std::string& request_method) OVERRIDE; | 99 const std::string& request_method) OVERRIDE; |
100 virtual void OnStartDownload(content::WebContents* source, | 100 virtual void OnStartDownload(content::WebContents* source, |
101 content::DownloadItem* download) OVERRIDE; | 101 content::DownloadItem* download) OVERRIDE; |
102 virtual bool ShouldOverrideLoading(const GURL& url) OVERRIDE; | 102 virtual bool ShouldOverrideLoading(const GURL& url) OVERRIDE; |
103 virtual void HandleKeyboardEvent( | 103 virtual void HandleKeyboardEvent( |
104 content::WebContents* source, | 104 content::WebContents* source, |
105 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 105 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
106 virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator() | |
107 OVERRIDE; | |
108 virtual bool TakeFocus(content::WebContents* source, bool reverse) OVERRIDE; | 106 virtual bool TakeFocus(content::WebContents* source, bool reverse) OVERRIDE; |
109 | 107 |
110 void SetJavaScriptDialogCreator( | |
111 content::JavaScriptDialogCreator* javascript_dialog_creator) { | |
112 javascript_dialog_creator_ = javascript_dialog_creator; | |
113 } | |
114 | |
115 protected: | 108 protected: |
116 base::android::ScopedJavaLocalRef<jobject> GetJavaDelegate(JNIEnv* env) const; | 109 base::android::ScopedJavaLocalRef<jobject> GetJavaDelegate(JNIEnv* env) const; |
117 | 110 |
118 private: | 111 private: |
119 // We depend on the java side user of WebContentDelegateAndroid to hold a | 112 // We depend on the java side user of WebContentDelegateAndroid to hold a |
120 // strong reference to that object as long as they want to receive callbacks | 113 // strong reference to that object as long as they want to receive callbacks |
121 // on it. Using a weak ref here allows it to be correctly GCed. | 114 // on it. Using a weak ref here allows it to be correctly GCed. |
122 JavaObjectWeakGlobalRef weak_java_delegate_; | 115 JavaObjectWeakGlobalRef weak_java_delegate_; |
123 | |
124 // The object responsible for creating JavaScript dialogs. | |
125 content::JavaScriptDialogCreator* javascript_dialog_creator_; | |
126 }; | 116 }; |
127 | 117 |
128 bool RegisterWebContentsDelegateAndroid(JNIEnv* env); | 118 bool RegisterWebContentsDelegateAndroid(JNIEnv* env); |
129 | 119 |
130 } // namespace web_contents_delegate_android | 120 } // namespace web_contents_delegate_android |
131 | 121 |
132 #endif // CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_D
ELEGATE_ANDROID_H_ | 122 #endif // CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_D
ELEGATE_ANDROID_H_ |
OLD | NEW |