Add remoting and PPAPI tests to GN build
[chromium-blink-merge.git] / content / browser / android / web_contents_observer_android.h
blob3f5d11100e2deb4ec7aaab17211f55fd4cbe85fe
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_ANDROID_H_
6 #define CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_ANDROID_H_
8 #include <jni.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"
16 #include "url/gurl.h"
18 namespace content {
20 class RenderViewHost;
21 class WebContents;
23 // Extends WebContentsObserver for providing a public Java API for some of the
24 // the calls it receives.
25 class WebContentsObserverAndroid : public WebContentsObserver {
26 public:
27 WebContentsObserverAndroid(JNIEnv* env,
28 jobject obj,
29 WebContents* web_contents);
30 ~WebContentsObserverAndroid() override;
32 void Destroy(JNIEnv* env, jobject obj);
34 private:
35 void RenderViewReady() override;
36 void RenderProcessGone(base::TerminationStatus termination_status) override;
37 void DidStartLoading(RenderViewHost* render_view_host) override;
38 void DidStopLoading(RenderViewHost* render_view_host) override;
39 void DidFailProvisionalLoad(RenderFrameHost* render_frame_host,
40 const GURL& validated_url,
41 int error_code,
42 const base::string16& error_description) override;
43 void DidFailLoad(RenderFrameHost* render_frame_host,
44 const GURL& validated_url,
45 int error_code,
46 const base::string16& error_description) override;
47 void DidNavigateMainFrame(const LoadCommittedDetails& details,
48 const FrameNavigateParams& params) override;
49 void DidNavigateAnyFrame(RenderFrameHost* render_frame_host,
50 const LoadCommittedDetails& details,
51 const FrameNavigateParams& params) override;
52 void DocumentAvailableInMainFrame() override;
53 void DidFirstVisuallyNonEmptyPaint() override;
54 void DidStartProvisionalLoadForFrame(RenderFrameHost* render_frame_host,
55 const GURL& validated_url,
56 bool is_error_page,
57 bool is_iframe_srcdoc) override;
58 void DidCommitProvisionalLoadForFrame(
59 RenderFrameHost* render_frame_host,
60 const GURL& url,
61 ui::PageTransition transition_type) override;
62 void DidFinishLoad(RenderFrameHost* render_frame_host,
63 const GURL& validated_url) override;
64 void DocumentLoadedInFrame(RenderFrameHost* render_frame_host) override;
65 void NavigationEntryCommitted(
66 const LoadCommittedDetails& load_details) override;
67 void WebContentsDestroyed() override;
68 void DidAttachInterstitialPage() override;
69 void DidDetachInterstitialPage() override;
70 void DidChangeThemeColor(SkColor color) override;
71 void DidStartNavigationToPendingEntry(
72 const GURL& url,
73 NavigationController::ReloadType reload_type) override;
75 void DidFailLoadInternal(bool is_provisional_load,
76 bool is_main_frame,
77 int error_code,
78 const base::string16& description,
79 const GURL& url);
81 JavaObjectWeakGlobalRef weak_java_observer_;
83 DISALLOW_COPY_AND_ASSIGN(WebContentsObserverAndroid);
86 bool RegisterWebContentsObserverAndroid(JNIEnv* env);
87 } // namespace content
89 #endif // CONTENT_BROWSER_ANDROID_WEB_CONTENTS_OBSERVER_ANDROID_H_