OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PROXY_H_ |
6 #define CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_ANDROID_H_ | 6 #define CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_PROXY_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.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 RenderViewHost; | 20 class RenderViewHost; |
21 class WebContents; | 21 class WebContents; |
22 | 22 |
23 // Extends WebContentsObserver for providing a public Java API for some of the | 23 // Extends WebContentsObserver for providing a public Java API for some of the |
24 // the calls it receives. | 24 // the calls it receives. |
25 class WebContentsObserverAndroid : public WebContentsObserver { | 25 class WebContentsObserverProxy : public WebContentsObserver { |
26 public: | 26 public: |
27 WebContentsObserverAndroid(JNIEnv* env, | 27 WebContentsObserverProxy(JNIEnv* env, jobject obj, WebContents* web_contents); |
28 jobject obj, | 28 ~WebContentsObserverProxy() override; |
29 WebContents* web_contents); | |
30 ~WebContentsObserverAndroid() override; | |
31 | 29 |
32 void Destroy(JNIEnv* env, jobject obj); | 30 void Destroy(JNIEnv* env, jobject obj); |
33 | 31 |
34 private: | 32 private: |
35 void RenderViewReady() override; | 33 void RenderViewReady() override; |
36 void RenderProcessGone(base::TerminationStatus termination_status) override; | 34 void RenderProcessGone(base::TerminationStatus termination_status) override; |
37 void DidStartLoading(RenderViewHost* render_view_host) override; | 35 void DidStartLoading(RenderViewHost* render_view_host) override; |
38 void DidStopLoading(RenderViewHost* render_view_host) override; | 36 void DidStopLoading(RenderViewHost* render_view_host) override; |
39 void DidFailProvisionalLoad(RenderFrameHost* render_frame_host, | 37 void DidFailProvisionalLoad(RenderFrameHost* render_frame_host, |
40 const GURL& validated_url, | 38 const GURL& validated_url, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 NavigationController::ReloadType reload_type) override; | 71 NavigationController::ReloadType reload_type) override; |
74 | 72 |
75 void DidFailLoadInternal(bool is_provisional_load, | 73 void DidFailLoadInternal(bool is_provisional_load, |
76 bool is_main_frame, | 74 bool is_main_frame, |
77 int error_code, | 75 int error_code, |
78 const base::string16& description, | 76 const base::string16& description, |
79 const GURL& url); | 77 const GURL& url); |
80 | 78 |
81 JavaObjectWeakGlobalRef weak_java_observer_; | 79 JavaObjectWeakGlobalRef weak_java_observer_; |
82 | 80 |
83 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverAndroid); | 81 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverProxy); |
84 }; | 82 }; |
85 | 83 |
86 bool RegisterWebContentsObserverAndroid(JNIEnv* env); | 84 bool RegisterWebContentsObserverProxy(JNIEnv* env); |
87 } // namespace content | 85 } // namespace content |
88 | 86 |
89 #endif // CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_ANDROID_H_ | 87 #endif // CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_PROXY_H_ |
OLD | NEW |