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 void FindReply(content::WebContents
* web_contents
,
47 int number_of_matches
,
48 const gfx::Rect
& selection_rect
,
49 int active_match_ordinal
,
50 bool final_update
) override
;
51 void FindMatchRectsReply(content::WebContents
* web_contents
,
53 const std::vector
<gfx::RectF
>& rects
,
54 const gfx::RectF
& active_rect
) override
;
55 content::JavaScriptDialogManager
* GetJavaScriptDialogManager(
56 content::WebContents
* source
) override
;
57 void RequestMediaAccessPermission(
58 content::WebContents
* web_contents
,
59 const content::MediaStreamRequest
& request
,
60 const content::MediaResponseCallback
& callback
) override
;
61 bool CheckMediaAccessPermission(content::WebContents
* web_contents
,
62 const GURL
& security_origin
,
63 content::MediaStreamType type
) override
;
64 bool RequestPpapiBrokerPermission(
65 content::WebContents
* web_contents
,
67 const base::FilePath
& plugin_path
,
68 const base::Callback
<void(bool)>& callback
) override
;
69 content::WebContents
* OpenURLFromTab(
70 content::WebContents
* source
,
71 const content::OpenURLParams
& params
) override
;
72 void AddNewContents(content::WebContents
* source
,
73 content::WebContents
* new_contents
,
74 WindowOpenDisposition disposition
,
75 const gfx::Rect
& initial_rect
,
77 bool* was_blocked
) override
;
80 // NotificationObserver implementation.
81 void Observe(int type
,
82 const content::NotificationSource
& source
,
83 const content::NotificationDetails
& details
) override
;
85 void OnFindResultAvailable(content::WebContents
* web_contents
,
86 const FindNotificationDetails
* find_result
);
88 content::NotificationRegistrar notification_registrar_
;
91 // Register the native methods through JNI.
92 bool RegisterChromeWebContentsDelegateAndroid(JNIEnv
* env
);
94 } // namespace android
97 #endif // CHROME_BROWSER_ANDROID_CHROME_WEB_CONTENTS_DELEGATE_ANDROID_H_