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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_PROXY_H_
6 #define CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_PROXY_H_
10 #include "base/android/jni_weak_ref.h"
11 #include "base/basictypes.h"
12 #include "base/process/kill.h"
13 #include "content/browser/web_contents/web_contents_impl.h"
14 #include "content/public/browser/web_contents_observer.h"
15 #include "content/public/common/frame_navigate_params.h"
23 // Extends WebContentsObserver for providing a public Java API for some of the
24 // the calls it receives.
25 class WebContentsObserverProxy
: public WebContentsObserver
{
27 WebContentsObserverProxy(JNIEnv
* env
, jobject obj
, WebContents
* web_contents
);
28 ~WebContentsObserverProxy() override
;
30 void Destroy(JNIEnv
* env
, jobject obj
);
33 void RenderViewReady() override
;
34 void RenderProcessGone(base::TerminationStatus termination_status
) override
;
35 void DidStartLoading() override
;
36 void DidStopLoading() override
;
37 void DidFailProvisionalLoad(RenderFrameHost
* render_frame_host
,
38 const GURL
& validated_url
,
40 const base::string16
& error_description
) override
;
41 void DidFailLoad(RenderFrameHost
* render_frame_host
,
42 const GURL
& validated_url
,
44 const base::string16
& error_description
) override
;
45 void DidNavigateMainFrame(const LoadCommittedDetails
& details
,
46 const FrameNavigateParams
& params
) override
;
47 void DidNavigateAnyFrame(RenderFrameHost
* render_frame_host
,
48 const LoadCommittedDetails
& details
,
49 const FrameNavigateParams
& params
) override
;
50 void DocumentAvailableInMainFrame() override
;
51 void DidFirstVisuallyNonEmptyPaint() override
;
52 void DidStartProvisionalLoadForFrame(RenderFrameHost
* render_frame_host
,
53 const GURL
& validated_url
,
55 bool is_iframe_srcdoc
) override
;
56 void DidCommitProvisionalLoadForFrame(
57 RenderFrameHost
* render_frame_host
,
59 ui::PageTransition transition_type
) override
;
60 void DidFinishLoad(RenderFrameHost
* render_frame_host
,
61 const GURL
& validated_url
) override
;
62 void DocumentLoadedInFrame(RenderFrameHost
* render_frame_host
) override
;
63 void NavigationEntryCommitted(
64 const LoadCommittedDetails
& load_details
) override
;
65 void WebContentsDestroyed() override
;
66 void DidAttachInterstitialPage() override
;
67 void DidDetachInterstitialPage() override
;
68 void DidChangeThemeColor(SkColor color
) override
;
69 void DidStartNavigationToPendingEntry(
71 NavigationController::ReloadType reload_type
) override
;
73 void DidFailLoadInternal(bool is_provisional_load
,
76 const base::string16
& description
,
79 base::android::ScopedJavaGlobalRef
<jobject
> java_observer_
;
81 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverProxy
);
84 bool RegisterWebContentsObserverProxy(JNIEnv
* env
);
85 } // namespace content
87 #endif // CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_PROXY_H_