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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/public/browser/native_web_keyboard_event.h" | 12 #include "content/public/browser/native_web_keyboard_event.h" |
13 #include "content/public/browser/web_contents_delegate.h" | 13 #include "content/public/browser/web_contents_delegate.h" |
14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
15 #include "content/public/common/javascript_message_type.h" | 15 #include "content/public/common/javascript_message_type.h" |
16 #include "content/public/common/referrer.h" | 16 #include "content/public/common/referrer.h" |
17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class DownloadItem; | |
22 class JavaScriptDialogCreator; | 21 class JavaScriptDialogCreator; |
23 class RenderViewHost; | 22 class RenderViewHost; |
24 class WebContents; | 23 class WebContents; |
25 class WebContentsObserver; | 24 class WebContentsObserver; |
26 struct NativeWebKeyboardEvent; | 25 struct NativeWebKeyboardEvent; |
27 } | 26 } |
28 | 27 |
29 namespace web_contents_delegate_android { | 28 namespace web_contents_delegate_android { |
30 | 29 |
31 enum WebContentsDelegateLogLevel { | 30 enum WebContentsDelegateLogLevel { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 int32 level, | 86 int32 level, |
88 const string16& message, | 87 const string16& message, |
89 int32 line_no, | 88 int32 line_no, |
90 const string16& source_id) OVERRIDE; | 89 const string16& source_id) OVERRIDE; |
91 // TODO(merge): WARNING! method no longer available on the base class. | 90 // TODO(merge): WARNING! method no longer available on the base class. |
92 // See http://crbug.com/149477 | 91 // See http://crbug.com/149477 |
93 virtual void URLStarredChanged(content::WebContents* source, bool starred); | 92 virtual void URLStarredChanged(content::WebContents* source, bool starred); |
94 virtual void UpdateTargetURL(content::WebContents* source, | 93 virtual void UpdateTargetURL(content::WebContents* source, |
95 int32 page_id, | 94 int32 page_id, |
96 const GURL& url) OVERRIDE; | 95 const GURL& url) OVERRIDE; |
97 virtual bool CanDownload(content::RenderViewHost* source, | |
98 int request_id, | |
99 const std::string& request_method) OVERRIDE; | |
100 virtual void OnStartDownload(content::WebContents* source, | |
101 content::DownloadItem* download) OVERRIDE; | |
102 virtual bool ShouldOverrideLoading(const GURL& url) OVERRIDE; | 96 virtual bool ShouldOverrideLoading(const GURL& url) OVERRIDE; |
103 virtual void HandleKeyboardEvent( | 97 virtual void HandleKeyboardEvent( |
104 content::WebContents* source, | 98 content::WebContents* source, |
105 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 99 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
106 virtual bool TakeFocus(content::WebContents* source, bool reverse) OVERRIDE; | 100 virtual bool TakeFocus(content::WebContents* source, bool reverse) OVERRIDE; |
107 | 101 |
108 protected: | 102 protected: |
109 base::android::ScopedJavaLocalRef<jobject> GetJavaDelegate(JNIEnv* env) const; | 103 base::android::ScopedJavaLocalRef<jobject> GetJavaDelegate(JNIEnv* env) const; |
110 | 104 |
111 private: | 105 private: |
112 // We depend on the java side user of WebContentDelegateAndroid to hold a | 106 // We depend on the java side user of WebContentDelegateAndroid to hold a |
113 // strong reference to that object as long as they want to receive callbacks | 107 // strong reference to that object as long as they want to receive callbacks |
114 // on it. Using a weak ref here allows it to be correctly GCed. | 108 // on it. Using a weak ref here allows it to be correctly GCed. |
115 JavaObjectWeakGlobalRef weak_java_delegate_; | 109 JavaObjectWeakGlobalRef weak_java_delegate_; |
116 }; | 110 }; |
117 | 111 |
118 bool RegisterWebContentsDelegateAndroid(JNIEnv* env); | 112 bool RegisterWebContentsDelegateAndroid(JNIEnv* env); |
119 | 113 |
120 } // namespace web_contents_delegate_android | 114 } // namespace web_contents_delegate_android |
121 | 115 |
122 #endif // CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_D
ELEGATE_ANDROID_H_ | 116 #endif // CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_D
ELEGATE_ANDROID_H_ |
OLD | NEW |