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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 // Binds this WebContentsDelegateAndroid to the passed WebContents instance, | 51 // Binds this WebContentsDelegateAndroid to the passed WebContents instance, |
52 // such that when that WebContents is destroyed, this | 52 // such that when that WebContents is destroyed, this |
53 // WebContentsDelegateAndroid instance will be destroyed too. | 53 // WebContentsDelegateAndroid instance will be destroyed too. |
54 void SetOwnerWebContents(content::WebContents* contents); | 54 void SetOwnerWebContents(content::WebContents* contents); |
55 | 55 |
56 // Overridden from WebContentsDelegate: | 56 // Overridden from WebContentsDelegate: |
57 virtual content::WebContents* OpenURLFromTab( | 57 virtual content::WebContents* OpenURLFromTab( |
58 content::WebContents* source, | 58 content::WebContents* source, |
59 const content::OpenURLParams& params) OVERRIDE; | 59 const content::OpenURLParams& params) OVERRIDE; |
60 | 60 |
61 // Don't merge back. | |
62 // TODO(mkosiba): Upstream base class's implementaion of this method. | |
63 virtual bool ShouldIgnoreNavigation( | |
64 content::WebContents* source, | |
65 const GURL& url, | |
66 const content::Referrer& referrer, | |
67 WindowOpenDisposition disposition, | |
68 content::PageTransition transition_type); | |
69 virtual void NavigationStateChanged(const content::WebContents* source, | 61 virtual void NavigationStateChanged(const content::WebContents* source, |
70 unsigned changed_flags) OVERRIDE; | 62 unsigned changed_flags) OVERRIDE; |
71 virtual void AddNewContents(content::WebContents* source, | 63 virtual void AddNewContents(content::WebContents* source, |
72 content::WebContents* new_contents, | 64 content::WebContents* new_contents, |
73 WindowOpenDisposition disposition, | 65 WindowOpenDisposition disposition, |
74 const gfx::Rect& initial_pos, | 66 const gfx::Rect& initial_pos, |
75 bool user_gesture, | 67 bool user_gesture, |
76 bool* was_blocked) OVERRIDE; | 68 bool* was_blocked) OVERRIDE; |
77 virtual void ActivateContents(content::WebContents* contents) OVERRIDE; | 69 virtual void ActivateContents(content::WebContents* contents) OVERRIDE; |
78 virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; | 70 virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; |
79 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; | 71 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; |
80 virtual void LoadProgressChanged(content::WebContents* source, | 72 virtual void LoadProgressChanged(content::WebContents* source, |
81 double load_progress) OVERRIDE; | 73 double load_progress) OVERRIDE; |
82 virtual void CloseContents(content::WebContents* source) OVERRIDE; | 74 virtual void CloseContents(content::WebContents* source) OVERRIDE; |
83 virtual void MoveContents(content::WebContents* source, | 75 virtual void MoveContents(content::WebContents* source, |
84 const gfx::Rect& pos) OVERRIDE; | 76 const gfx::Rect& pos) OVERRIDE; |
85 virtual bool AddMessageToConsole(content::WebContents* source, | 77 virtual bool AddMessageToConsole(content::WebContents* source, |
86 int32 level, | 78 int32 level, |
87 const string16& message, | 79 const string16& message, |
88 int32 line_no, | 80 int32 line_no, |
89 const string16& source_id) OVERRIDE; | 81 const string16& source_id) OVERRIDE; |
90 // TODO(merge): WARNING! method no longer available on the base class. | 82 // TODO(merge): WARNING! method no longer available on the base class. |
91 // See http://crbug.com/149477 | 83 // See http://crbug.com/149477 |
92 virtual void URLStarredChanged(content::WebContents* source, bool starred); | 84 virtual void URLStarredChanged(content::WebContents* source, bool starred); |
93 virtual void UpdateTargetURL(content::WebContents* source, | 85 virtual void UpdateTargetURL(content::WebContents* source, |
94 int32 page_id, | 86 int32 page_id, |
95 const GURL& url) OVERRIDE; | 87 const GURL& url) OVERRIDE; |
96 virtual bool ShouldOverrideLoading(const GURL& url) OVERRIDE; | |
97 virtual void HandleKeyboardEvent( | 88 virtual void HandleKeyboardEvent( |
98 content::WebContents* source, | 89 content::WebContents* source, |
99 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 90 const content::NativeWebKeyboardEvent& event) OVERRIDE; |
100 virtual bool TakeFocus(content::WebContents* source, bool reverse) OVERRIDE; | 91 virtual bool TakeFocus(content::WebContents* source, bool reverse) OVERRIDE; |
101 | 92 |
102 protected: | 93 protected: |
103 base::android::ScopedJavaLocalRef<jobject> GetJavaDelegate(JNIEnv* env) const; | 94 base::android::ScopedJavaLocalRef<jobject> GetJavaDelegate(JNIEnv* env) const; |
104 | 95 |
105 private: | 96 private: |
106 // We depend on the java side user of WebContentDelegateAndroid to hold a | 97 // We depend on the java side user of WebContentDelegateAndroid to hold a |
107 // strong reference to that object as long as they want to receive callbacks | 98 // strong reference to that object as long as they want to receive callbacks |
108 // on it. Using a weak ref here allows it to be correctly GCed. | 99 // on it. Using a weak ref here allows it to be correctly GCed. |
109 JavaObjectWeakGlobalRef weak_java_delegate_; | 100 JavaObjectWeakGlobalRef weak_java_delegate_; |
110 }; | 101 }; |
111 | 102 |
112 bool RegisterWebContentsDelegateAndroid(JNIEnv* env); | 103 bool RegisterWebContentsDelegateAndroid(JNIEnv* env); |
113 | 104 |
114 } // namespace web_contents_delegate_android | 105 } // namespace web_contents_delegate_android |
115 | 106 |
116 #endif // CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_D
ELEGATE_ANDROID_H_ | 107 #endif // CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_D
ELEGATE_ANDROID_H_ |
OLD | NEW |