Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / android / chrome_web_contents_delegate_android.h
blob4dcbaaf49c9009021f939a8031f9c8e5fd0d0602
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 CHROME_BROWSER_ANDROID_CHROME_WEB_CONTENTS_DELEGATE_ANDROID_H_
6 #define CHROME_BROWSER_ANDROID_CHROME_WEB_CONTENTS_DELEGATE_ANDROID_H_
8 #include <jni.h>
10 #include "base/files/file_path.h"
11 #include "components/web_contents_delegate_android/web_contents_delegate_android.h"
12 #include "content/public/browser/bluetooth_chooser.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
16 class FindNotificationDetails;
18 namespace content {
19 struct FileChooserParams;
20 class WebContents;
23 namespace gfx {
24 class Rect;
25 class RectF;
28 namespace chrome {
29 namespace android {
31 // Chromium Android specific WebContentsDelegate.
32 // Should contain any WebContentsDelegate implementations required by
33 // the Chromium Android port but not to be shared with WebView.
34 class ChromeWebContentsDelegateAndroid
35 : public web_contents_delegate_android::WebContentsDelegateAndroid,
36 public content::NotificationObserver {
37 public:
38 ChromeWebContentsDelegateAndroid(JNIEnv* env, jobject obj);
39 ~ChromeWebContentsDelegateAndroid() override;
41 void LoadingStateChanged(content::WebContents* source,
42 bool to_different_document) override;
43 void RunFileChooser(content::WebContents* web_contents,
44 const content::FileChooserParams& params) override;
45 scoped_ptr<content::BluetoothChooser> RunBluetoothChooser(
46 content::WebContents* web_contents,
47 const content::BluetoothChooser::EventHandler& event_handler,
48 const GURL& origin) override;
49 void CloseContents(content::WebContents* web_contents) override;
50 blink::WebDisplayMode GetDisplayMode(
51 const content::WebContents* web_contents) const override;
52 void FindReply(content::WebContents* web_contents,
53 int request_id,
54 int number_of_matches,
55 const gfx::Rect& selection_rect,
56 int active_match_ordinal,
57 bool final_update) override;
58 void FindMatchRectsReply(content::WebContents* web_contents,
59 int version,
60 const std::vector<gfx::RectF>& rects,
61 const gfx::RectF& active_rect) override;
62 content::JavaScriptDialogManager* GetJavaScriptDialogManager(
63 content::WebContents* source) override;
64 void RequestMediaAccessPermission(
65 content::WebContents* web_contents,
66 const content::MediaStreamRequest& request,
67 const content::MediaResponseCallback& callback) override;
68 bool CheckMediaAccessPermission(content::WebContents* web_contents,
69 const GURL& security_origin,
70 content::MediaStreamType type) override;
71 bool RequestPpapiBrokerPermission(
72 content::WebContents* web_contents,
73 const GURL& url,
74 const base::FilePath& plugin_path,
75 const base::Callback<void(bool)>& callback) override;
76 content::WebContents* OpenURLFromTab(
77 content::WebContents* source,
78 const content::OpenURLParams& params) override;
79 bool ShouldResumeRequestsForCreatedWindow() override;
80 void AddNewContents(content::WebContents* source,
81 content::WebContents* new_contents,
82 WindowOpenDisposition disposition,
83 const gfx::Rect& initial_rect,
84 bool user_gesture,
85 bool* was_blocked) override;
87 private:
88 // NotificationObserver implementation.
89 void Observe(int type,
90 const content::NotificationSource& source,
91 const content::NotificationDetails& details) override;
93 void OnFindResultAvailable(content::WebContents* web_contents,
94 const FindNotificationDetails* find_result);
96 content::NotificationRegistrar notification_registrar_;
99 // Register the native methods through JNI.
100 bool RegisterChromeWebContentsDelegateAndroid(JNIEnv* env);
102 } // namespace android
103 } // namespace chrome
105 #endif // CHROME_BROWSER_ANDROID_CHROME_WEB_CONTENTS_DELEGATE_ANDROID_H_