Chromium Code Reviews| 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 CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 6 #define CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/android/jni_helper.h" | 10 #include "base/android/jni_helper.h" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 class ContentViewCoreImpl : public ContentViewCore, | 36 class ContentViewCoreImpl : public ContentViewCore, |
| 37 public NotificationObserver { | 37 public NotificationObserver { |
| 38 public: | 38 public: |
| 39 ContentViewCoreImpl(JNIEnv* env, | 39 ContentViewCoreImpl(JNIEnv* env, |
| 40 jobject obj, | 40 jobject obj, |
| 41 bool hardware_accelerated, | 41 bool hardware_accelerated, |
| 42 bool take_ownership_of_web_contents, | 42 bool take_ownership_of_web_contents, |
| 43 WebContents* web_contents, | 43 WebContents* web_contents, |
| 44 ui::WindowAndroid* window_android); | 44 ui::WindowAndroid* window_android); |
| 45 | 45 |
| 46 // Called from UI thread | |
| 47 void Invalidate(); | |
| 48 void DetachWebContents(WebContents* web_contents); | |
| 49 | |
| 50 // Called from non-UI thread | |
| 51 void PostInvalidate(); | |
| 52 | |
| 53 | |
| 46 // ContentViewCore overrides | 54 // ContentViewCore overrides |
| 47 virtual void Destroy(JNIEnv* env, jobject obj) OVERRIDE; | 55 virtual void Destroy(JNIEnv* env, jobject obj) OVERRIDE; |
| 48 | 56 |
| 57 virtual content::WebContents* AcquireWebContents() OVERRIDE; | |
| 58 virtual void ReplaceWebContents( | |
| 59 content::WebContents* old_web_contents, | |
| 60 content::WebContents* new_web_contents) OVERRIDE; | |
| 61 | |
| 62 // Called when page loading begins. | |
|
Yaron
2012/09/20 04:13:53
Most of this is being refactored by Yusuf: https:/
| |
| 63 virtual void DidStartLoading() OVERRIDE; | |
| 64 | |
| 65 virtual void OnPageStarted(const GURL& validated_url) OVERRIDE; | |
| 66 virtual void OnPageFinished(const GURL& validated_url) OVERRIDE; | |
| 67 virtual void OnPageFailed(int error_code, const string16& description, | |
| 68 const GURL& failingUrl) OVERRIDE; | |
| 69 virtual void OnDidCommitMainFrame(const GURL& url, | |
| 70 const GURL& base_url) OVERRIDE; | |
| 71 void StartContentIntent(const GURL& content_url); | |
| 72 | |
| 49 // -------------------------------------------------------------------------- | 73 // -------------------------------------------------------------------------- |
| 50 // Methods called from Java via JNI | 74 // Methods called from Java via JNI |
| 51 // -------------------------------------------------------------------------- | 75 // -------------------------------------------------------------------------- |
| 52 | 76 |
| 53 // Notifies the ContentViewCore that items were selected in the currently | 77 // Notifies the ContentViewCore that items were selected in the currently |
| 54 // showing select popup. | 78 // showing select popup. |
| 55 void SelectPopupMenuItems(JNIEnv* env, jobject obj, jintArray indices); | 79 void SelectPopupMenuItems(JNIEnv* env, jobject obj, jintArray indices); |
| 56 | 80 |
| 57 void LoadUrl( | 81 void LoadUrl( |
| 58 JNIEnv* env, jobject obj, | 82 JNIEnv* env, jobject obj, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 void ConfirmTouchEvent(bool handled); | 181 void ConfirmTouchEvent(bool handled); |
| 158 void DidSetNeedTouchEvents(bool need_touch_events); | 182 void DidSetNeedTouchEvents(bool need_touch_events); |
| 159 void OnSelectionChanged(const std::string& text); | 183 void OnSelectionChanged(const std::string& text); |
| 160 void OnSelectionBoundsChanged(int startx, | 184 void OnSelectionBoundsChanged(int startx, |
| 161 int starty, | 185 int starty, |
| 162 base::i18n::TextDirection start_dir, | 186 base::i18n::TextDirection start_dir, |
| 163 int endx, | 187 int endx, |
| 164 int endy, | 188 int endy, |
| 165 base::i18n::TextDirection end_dir); | 189 base::i18n::TextDirection end_dir); |
| 166 | 190 |
| 167 // Called when page loading begins. | |
| 168 void DidStartLoading(); | |
| 169 void StartContentIntent(const GURL& content_url); | |
| 170 | |
| 171 // -------------------------------------------------------------------------- | 191 // -------------------------------------------------------------------------- |
| 172 // Methods called from native code | 192 // Methods called from native code |
| 173 // -------------------------------------------------------------------------- | 193 // -------------------------------------------------------------------------- |
| 174 | 194 |
| 175 gfx::Rect GetBounds() const; | 195 gfx::Rect GetBounds() const; |
| 176 | 196 |
| 177 WebContents* web_contents() const { return web_contents_; } | 197 WebContents* web_contents() const { return web_contents_; } |
| 178 | 198 |
| 179 virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE; | 199 virtual void LoadUrl(NavigationController::LoadURLParams& params) OVERRIDE; |
| 180 virtual ui::WindowAndroid* GetWindowAndroid() OVERRIDE; | 200 virtual ui::WindowAndroid* GetWindowAndroid() OVERRIDE; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 206 int x, int y); | 226 int x, int y); |
| 207 | 227 |
| 208 struct JavaObject; | 228 struct JavaObject; |
| 209 JavaObject* java_object_; | 229 JavaObject* java_object_; |
| 210 | 230 |
| 211 // A weak reference to the Java ContentViewCore object. | 231 // A weak reference to the Java ContentViewCore object. |
| 212 JavaObjectWeakGlobalRef java_ref_; | 232 JavaObjectWeakGlobalRef java_ref_; |
| 213 | 233 |
| 214 NotificationRegistrar notification_registrar_; | 234 NotificationRegistrar notification_registrar_; |
| 215 | 235 |
| 236 class ContentViewWebContentsObserver; | |
| 237 scoped_ptr<ContentViewWebContentsObserver> web_contents_observer_; | |
| 238 | |
| 216 // Reference to the current WebContents used to determine how and what to | 239 // Reference to the current WebContents used to determine how and what to |
| 217 // display in the ContentViewCore. | 240 // display in the ContentViewCore. |
| 218 WebContentsImpl* web_contents_; | 241 WebContentsImpl* web_contents_; |
| 219 bool owns_web_contents_; | 242 bool owns_web_contents_; |
| 220 | 243 |
| 221 // We only set this to be the delegate of the web_contents if we own it. | 244 // We only set this to be the delegate of the web_contents if we own it. |
| 222 scoped_ptr<ContentViewClient> content_view_client_; | 245 scoped_ptr<ContentViewClient> content_view_client_; |
| 223 | 246 |
| 224 // Whether the renderer backing this ContentViewCore has crashed. | 247 // Whether the renderer backing this ContentViewCore has crashed. |
| 225 bool tab_crashed_; | 248 bool tab_crashed_; |
| 226 | 249 |
| 227 // The owning window that has a hold of main application activity. | 250 // The owning window that has a hold of main application activity. |
| 228 ui::WindowAndroid* window_android_; | 251 ui::WindowAndroid* window_android_; |
| 229 | 252 |
| 230 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); | 253 DISALLOW_COPY_AND_ASSIGN(ContentViewCoreImpl); |
| 231 }; | 254 }; |
| 232 | 255 |
| 233 bool RegisterContentViewCore(JNIEnv* env); | 256 bool RegisterContentViewCore(JNIEnv* env); |
| 234 | 257 |
| 235 } // namespace content | 258 } // namespace content |
| 236 | 259 |
| 237 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ | 260 #endif // CONTENT_BROWSER_ANDROID_CONTENT_VIEW_CORE_IMPL_H_ |
| OLD | NEW |