Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / content / browser / android / interstitial_page_delegate_android.h
blobbd28d381c9dfb4d0d166a746959780d8d45d11f2
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_INTERSTITIAL_PAGE_DELEGATE_ANDROID_H_
6 #define CONTENT_BROWSER_ANDROID_INTERSTITIAL_PAGE_DELEGATE_ANDROID_H_
8 #include <jni.h>
9 #include <string>
11 #include "base/android/jni_weak_ref.h"
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "content/common/content_export.h"
15 #include "content/public/browser/interstitial_page_delegate.h"
17 namespace content {
19 class InterstitialPage;
20 class WebContents;
22 // Native counterpart that allows interstitial pages to be constructed and
23 // managed from Java.
24 class InterstitialPageDelegateAndroid : public InterstitialPageDelegate {
25 public:
26 InterstitialPageDelegateAndroid(JNIEnv* env,
27 jobject obj,
28 const std::string& html_content);
29 ~InterstitialPageDelegateAndroid() override;
31 void set_interstitial_page(InterstitialPage* page) { page_ = page; }
33 // Methods called from Java.
34 void Proceed(JNIEnv* env, jobject obj);
35 void DontProceed(JNIEnv* env, jobject obj);
37 // Implementation of InterstitialPageDelegate
38 std::string GetHTMLContents() override;
39 void OnProceed() override;
40 void OnDontProceed() override;
41 void CommandReceived(const std::string& command) override;
43 static bool RegisterInterstitialPageDelegateAndroid(JNIEnv* env);
45 private:
46 JavaObjectWeakGlobalRef weak_java_obj_;
48 std::string html_content_;
49 InterstitialPage* page_; // Owns this.
51 DISALLOW_COPY_AND_ASSIGN(InterstitialPageDelegateAndroid);
54 } // namespace content
56 #endif // CONTENT_BROWSER_ANDROID_INTERSTITIAL_PAGE_DELEGATE_ANDROID_H_