| 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_WEB_CONTENTS_OBSERVER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_ANDROID_H_ | 6 #define CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include "base/android/jni_helper.h" | 10 #include "base/android/jni_helper.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/process/kill.h" | 12 #include "base/process/kill.h" |
| 13 #include "content/browser/web_contents/web_contents_impl.h" | 13 #include "content/browser/web_contents/web_contents_impl.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
| 15 #include "content/public/common/frame_navigate_params.h" | 15 #include "content/public/common/frame_navigate_params.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class ContentViewCore; |
| 20 class RenderViewHost; | 21 class RenderViewHost; |
| 21 class WebContents; | 22 class WebContents; |
| 22 | 23 |
| 23 // Extends WebContentsObserver for providing a public Java API for some of the | 24 // Extends WebContentsObserver for providing a public Java API for some of the |
| 24 // the calls it receives. | 25 // the calls it receives. |
| 25 class WebContentsObserverAndroid : public WebContentsObserver { | 26 class WebContentsObserverAndroid : public WebContentsObserver { |
| 26 public: | 27 public: |
| 27 WebContentsObserverAndroid(JNIEnv* env, | 28 WebContentsObserverAndroid(JNIEnv* env, |
| 28 jobject obj, | 29 jobject obj, |
| 30 ContentViewCore* content_view_core, |
| 29 WebContents* web_contents); | 31 WebContents* web_contents); |
| 30 virtual ~WebContentsObserverAndroid(); | 32 virtual ~WebContentsObserverAndroid(); |
| 31 | 33 |
| 32 void Destroy(JNIEnv* env, jobject obj); | 34 void Destroy(JNIEnv* env, jobject obj); |
| 33 | 35 |
| 34 private: | 36 private: |
| 35 virtual void RenderProcessGone( | 37 virtual void RenderProcessGone( |
| 36 base::TerminationStatus termination_status) OVERRIDE; | 38 base::TerminationStatus termination_status) OVERRIDE; |
| 37 virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE; | 39 virtual void DidStartLoading(RenderViewHost* render_view_host) OVERRIDE; |
| 38 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; | 40 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 virtual void DidChangeVisibleSSLState() OVERRIDE; | 81 virtual void DidChangeVisibleSSLState() OVERRIDE; |
| 80 virtual void DidAttachInterstitialPage() OVERRIDE; | 82 virtual void DidAttachInterstitialPage() OVERRIDE; |
| 81 virtual void DidDetachInterstitialPage() OVERRIDE; | 83 virtual void DidDetachInterstitialPage() OVERRIDE; |
| 82 | 84 |
| 83 void DidFailLoadInternal(bool is_provisional_load, | 85 void DidFailLoadInternal(bool is_provisional_load, |
| 84 bool is_main_frame, | 86 bool is_main_frame, |
| 85 int error_code, | 87 int error_code, |
| 86 const base::string16& description, | 88 const base::string16& description, |
| 87 const GURL& url); | 89 const GURL& url); |
| 88 | 90 |
| 91 ContentViewCore* content_view_core_; |
| 89 JavaObjectWeakGlobalRef weak_java_observer_; | 92 JavaObjectWeakGlobalRef weak_java_observer_; |
| 90 | 93 |
| 91 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverAndroid); | 94 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverAndroid); |
| 92 }; | 95 }; |
| 93 | 96 |
| 94 bool RegisterWebContentsObserverAndroid(JNIEnv* env); | 97 bool RegisterWebContentsObserverAndroid(JNIEnv* env); |
| 95 } // namespace content | 98 } // namespace content |
| 96 | 99 |
| 97 #endif // CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_ANDROID_H_ | 100 #endif // CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_ANDROID_H_ |
| OLD | NEW |