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 COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROID_H
_ | 5 #ifndef COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROID_H
_ |
6 #define COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROID_H
_ | 6 #define COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROID_H
_ |
7 | 7 |
8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 virtual ~WebContentsDelegateAndroid(); | 46 virtual ~WebContentsDelegateAndroid(); |
47 | 47 |
48 // Binds this WebContentsDelegateAndroid to the passed WebContents instance, | 48 // Binds this WebContentsDelegateAndroid to the passed WebContents instance, |
49 // such that when that WebContents is destroyed, this | 49 // such that when that WebContents is destroyed, this |
50 // WebContentsDelegateAndroid instance will be destroyed too. | 50 // WebContentsDelegateAndroid instance will be destroyed too. |
51 void SetOwnerWebContents(content::WebContents* contents); | 51 void SetOwnerWebContents(content::WebContents* contents); |
52 | 52 |
53 // Overridden from WebContentsDelegate: | 53 // Overridden from WebContentsDelegate: |
54 virtual content::WebContents* OpenURLFromTab( | 54 virtual content::WebContents* OpenURLFromTab( |
55 content::WebContents* source, | 55 content::WebContents* source, |
56 const content::OpenURLParams& params) OVERRIDE; | 56 const content::OpenURLParams& params) override; |
57 virtual content::ColorChooser* OpenColorChooser( | 57 virtual content::ColorChooser* OpenColorChooser( |
58 content::WebContents* source, | 58 content::WebContents* source, |
59 SkColor color, | 59 SkColor color, |
60 const std::vector<content::ColorSuggestion>& suggestions) OVERRIDE; | 60 const std::vector<content::ColorSuggestion>& suggestions) override; |
61 virtual void NavigationStateChanged( | 61 virtual void NavigationStateChanged( |
62 const content::WebContents* source, | 62 const content::WebContents* source, |
63 content::InvalidateTypes changed_flags) OVERRIDE; | 63 content::InvalidateTypes changed_flags) override; |
64 virtual void VisibleSSLStateChanged( | 64 virtual void VisibleSSLStateChanged( |
65 const content::WebContents* source) OVERRIDE; | 65 const content::WebContents* source) override; |
66 virtual void ActivateContents(content::WebContents* contents) OVERRIDE; | 66 virtual void ActivateContents(content::WebContents* contents) override; |
67 virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; | 67 virtual void DeactivateContents(content::WebContents* contents) override; |
68 virtual void LoadingStateChanged(content::WebContents* source, | 68 virtual void LoadingStateChanged(content::WebContents* source, |
69 bool to_different_document) OVERRIDE; | 69 bool to_different_document) override; |
70 virtual void LoadProgressChanged(content::WebContents* source, | 70 virtual void LoadProgressChanged(content::WebContents* source, |
71 double load_progress) OVERRIDE; | 71 double load_progress) override; |
72 virtual void RendererUnresponsive(content::WebContents* source) OVERRIDE; | 72 virtual void RendererUnresponsive(content::WebContents* source) override; |
73 virtual void RendererResponsive(content::WebContents* source) OVERRIDE; | 73 virtual void RendererResponsive(content::WebContents* source) override; |
74 virtual void CloseContents(content::WebContents* source) OVERRIDE; | 74 virtual void CloseContents(content::WebContents* source) override; |
75 virtual void MoveContents(content::WebContents* source, | 75 virtual void MoveContents(content::WebContents* source, |
76 const gfx::Rect& pos) OVERRIDE; | 76 const gfx::Rect& pos) override; |
77 virtual bool AddMessageToConsole(content::WebContents* source, | 77 virtual bool AddMessageToConsole(content::WebContents* source, |
78 int32 level, | 78 int32 level, |
79 const base::string16& message, | 79 const base::string16& message, |
80 int32 line_no, | 80 int32 line_no, |
81 const base::string16& source_id) OVERRIDE; | 81 const base::string16& source_id) override; |
82 virtual void UpdateTargetURL(content::WebContents* source, | 82 virtual void UpdateTargetURL(content::WebContents* source, |
83 const GURL& url) OVERRIDE; | 83 const GURL& url) override; |
84 virtual void HandleKeyboardEvent( | 84 virtual void HandleKeyboardEvent( |
85 content::WebContents* source, | 85 content::WebContents* source, |
86 const content::NativeWebKeyboardEvent& event) OVERRIDE; | 86 const content::NativeWebKeyboardEvent& event) override; |
87 virtual bool TakeFocus(content::WebContents* source, bool reverse) OVERRIDE; | 87 virtual bool TakeFocus(content::WebContents* source, bool reverse) override; |
88 virtual void ShowRepostFormWarningDialog( | 88 virtual void ShowRepostFormWarningDialog( |
89 content::WebContents* source) OVERRIDE; | 89 content::WebContents* source) override; |
90 virtual void ToggleFullscreenModeForTab(content::WebContents* web_contents, | 90 virtual void ToggleFullscreenModeForTab(content::WebContents* web_contents, |
91 bool enter_fullscreen) OVERRIDE; | 91 bool enter_fullscreen) override; |
92 virtual bool IsFullscreenForTabOrPending( | 92 virtual bool IsFullscreenForTabOrPending( |
93 const content::WebContents* web_contents) const OVERRIDE; | 93 const content::WebContents* web_contents) const override; |
94 virtual void ShowValidationMessage(content::WebContents* web_contents, | 94 virtual void ShowValidationMessage(content::WebContents* web_contents, |
95 const gfx::Rect& anchor_in_root_view, | 95 const gfx::Rect& anchor_in_root_view, |
96 const base::string16& main_text, | 96 const base::string16& main_text, |
97 const base::string16& sub_text) OVERRIDE; | 97 const base::string16& sub_text) override; |
98 virtual void HideValidationMessage( | 98 virtual void HideValidationMessage( |
99 content::WebContents* web_contents) OVERRIDE; | 99 content::WebContents* web_contents) override; |
100 virtual void MoveValidationMessage( | 100 virtual void MoveValidationMessage( |
101 content::WebContents* web_contents, | 101 content::WebContents* web_contents, |
102 const gfx::Rect& anchor_in_root_view) OVERRIDE; | 102 const gfx::Rect& anchor_in_root_view) override; |
103 | 103 |
104 protected: | 104 protected: |
105 base::android::ScopedJavaLocalRef<jobject> GetJavaDelegate(JNIEnv* env) const; | 105 base::android::ScopedJavaLocalRef<jobject> GetJavaDelegate(JNIEnv* env) const; |
106 | 106 |
107 private: | 107 private: |
108 // We depend on the java side user of WebContentDelegateAndroid to hold a | 108 // We depend on the java side user of WebContentDelegateAndroid to hold a |
109 // strong reference to that object as long as they want to receive callbacks | 109 // strong reference to that object as long as they want to receive callbacks |
110 // on it. Using a weak ref here allows it to be correctly GCed. | 110 // on it. Using a weak ref here allows it to be correctly GCed. |
111 JavaObjectWeakGlobalRef weak_java_delegate_; | 111 JavaObjectWeakGlobalRef weak_java_delegate_; |
112 | 112 |
113 scoped_ptr<ValidationMessageBubbleAndroid> validation_message_bubble_; | 113 scoped_ptr<ValidationMessageBubbleAndroid> validation_message_bubble_; |
114 }; | 114 }; |
115 | 115 |
116 bool RegisterWebContentsDelegateAndroid(JNIEnv* env); | 116 bool RegisterWebContentsDelegateAndroid(JNIEnv* env); |
117 | 117 |
118 } // namespace web_contents_delegate_android | 118 } // namespace web_contents_delegate_android |
119 | 119 |
120 #endif // COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROI
D_H_ | 120 #endif // COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROI
D_H_ |
OLD | NEW |