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_
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
;
19 struct FileChooserParams
;
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
{
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
;
50 void VisibleSSLStateChanged(content::WebContents
* source
) override
;
51 void CloseContents(content::WebContents
* web_contents
) override
;
52 blink::WebDisplayMode
GetDisplayMode(
53 const content::WebContents
* web_contents
) const override
;
54 void FindReply(content::WebContents
* web_contents
,
56 int number_of_matches
,
57 const gfx::Rect
& selection_rect
,
58 int active_match_ordinal
,
59 bool final_update
) override
;
60 void FindMatchRectsReply(content::WebContents
* web_contents
,
62 const std::vector
<gfx::RectF
>& rects
,
63 const gfx::RectF
& active_rect
) override
;
64 content::JavaScriptDialogManager
* GetJavaScriptDialogManager(
65 content::WebContents
* source
) override
;
66 void RequestMediaAccessPermission(
67 content::WebContents
* web_contents
,
68 const content::MediaStreamRequest
& request
,
69 const content::MediaResponseCallback
& callback
) override
;
70 bool CheckMediaAccessPermission(content::WebContents
* web_contents
,
71 const GURL
& security_origin
,
72 content::MediaStreamType type
) override
;
73 bool RequestPpapiBrokerPermission(
74 content::WebContents
* web_contents
,
76 const base::FilePath
& plugin_path
,
77 const base::Callback
<void(bool)>& callback
) override
;
78 content::WebContents
* OpenURLFromTab(
79 content::WebContents
* source
,
80 const content::OpenURLParams
& params
) override
;
81 bool ShouldResumeRequestsForCreatedWindow() override
;
82 void AddNewContents(content::WebContents
* source
,
83 content::WebContents
* new_contents
,
84 WindowOpenDisposition disposition
,
85 const gfx::Rect
& initial_rect
,
87 bool* was_blocked
) override
;
90 // NotificationObserver implementation.
91 void Observe(int type
,
92 const content::NotificationSource
& source
,
93 const content::NotificationDetails
& details
) override
;
95 void OnFindResultAvailable(content::WebContents
* web_contents
,
96 const FindNotificationDetails
* find_result
);
98 content::NotificationRegistrar notification_registrar_
;
101 // Register the native methods through JNI.
102 bool RegisterChromeWebContentsDelegateAndroid(JNIEnv
* env
);
104 } // namespace android
105 } // namespace chrome
107 #endif // CHROME_BROWSER_ANDROID_CHROME_WEB_CONTENTS_DELEGATE_ANDROID_H_