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/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
15 class FindNotificationDetails
;
18 struct FileChooserParams
;
30 // Chromium Android specific WebContentsDelegate.
31 // Should contain any WebContentsDelegate implementations required by
32 // the Chromium Android port but not to be shared with WebView.
33 class ChromeWebContentsDelegateAndroid
34 : public web_contents_delegate_android::WebContentsDelegateAndroid
,
35 public content::NotificationObserver
{
37 ChromeWebContentsDelegateAndroid(JNIEnv
* env
, jobject obj
);
38 ~ChromeWebContentsDelegateAndroid() override
;
40 void LoadingStateChanged(content::WebContents
* source
,
41 bool to_different_document
) override
;
42 void RunFileChooser(content::WebContents
* web_contents
,
43 const content::FileChooserParams
& params
) override
;
44 void CloseContents(content::WebContents
* web_contents
) override
;
45 blink::WebDisplayMode
GetDisplayMode(
46 const content::WebContents
* web_contents
) const override
;
47 void FindReply(content::WebContents
* web_contents
,
49 int number_of_matches
,
50 const gfx::Rect
& selection_rect
,
51 int active_match_ordinal
,
52 bool final_update
) override
;
53 void FindMatchRectsReply(content::WebContents
* web_contents
,
55 const std::vector
<gfx::RectF
>& rects
,
56 const gfx::RectF
& active_rect
) override
;
57 content::JavaScriptDialogManager
* GetJavaScriptDialogManager(
58 content::WebContents
* source
) override
;
59 void RequestMediaAccessPermission(
60 content::WebContents
* web_contents
,
61 const content::MediaStreamRequest
& request
,
62 const content::MediaResponseCallback
& callback
) override
;
63 bool CheckMediaAccessPermission(content::WebContents
* web_contents
,
64 const GURL
& security_origin
,
65 content::MediaStreamType type
) override
;
66 bool RequestPpapiBrokerPermission(
67 content::WebContents
* web_contents
,
69 const base::FilePath
& plugin_path
,
70 const base::Callback
<void(bool)>& callback
) override
;
71 content::WebContents
* OpenURLFromTab(
72 content::WebContents
* source
,
73 const content::OpenURLParams
& params
) override
;
74 bool ShouldResumeRequestsForCreatedWindow() override
;
75 void AddNewContents(content::WebContents
* source
,
76 content::WebContents
* new_contents
,
77 WindowOpenDisposition disposition
,
78 const gfx::Rect
& initial_rect
,
80 bool* was_blocked
) override
;
83 // NotificationObserver implementation.
84 void Observe(int type
,
85 const content::NotificationSource
& source
,
86 const content::NotificationDetails
& details
) override
;
88 void OnFindResultAvailable(content::WebContents
* web_contents
,
89 const FindNotificationDetails
* find_result
);
91 content::NotificationRegistrar notification_registrar_
;
94 // Register the native methods through JNI.
95 bool RegisterChromeWebContentsDelegateAndroid(JNIEnv
* env
);
97 } // namespace android
100 #endif // CHROME_BROWSER_ANDROID_CHROME_WEB_CONTENTS_DELEGATE_ANDROID_H_