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 virtual ~ChromeWebContentsDelegateAndroid();
40 virtual void LoadingStateChanged(content::WebContents
* source
,
41 bool to_different_document
) OVERRIDE
;
42 virtual void RunFileChooser(content::WebContents
* web_contents
,
43 const content::FileChooserParams
& params
)
45 virtual void CloseContents(content::WebContents
* web_contents
) OVERRIDE
;
46 virtual void FindReply(content::WebContents
* web_contents
,
48 int number_of_matches
,
49 const gfx::Rect
& selection_rect
,
50 int active_match_ordinal
,
51 bool final_update
) OVERRIDE
;
52 virtual void FindMatchRectsReply(content::WebContents
* web_contents
,
54 const std::vector
<gfx::RectF
>& rects
,
55 const gfx::RectF
& active_rect
) OVERRIDE
;
56 virtual content::JavaScriptDialogManager
*
57 GetJavaScriptDialogManager() OVERRIDE
;
58 virtual void RequestMediaAccessPermission(
59 content::WebContents
* web_contents
,
60 const content::MediaStreamRequest
& request
,
61 const content::MediaResponseCallback
& callback
) OVERRIDE
;
62 virtual bool CheckMediaAccessPermission(
63 content::WebContents
* web_contents
,
64 const GURL
& security_origin
,
65 content::MediaStreamType type
) OVERRIDE
;
66 virtual bool RequestPpapiBrokerPermission(
67 content::WebContents
* web_contents
,
69 const base::FilePath
& plugin_path
,
70 const base::Callback
<void(bool)>& callback
) OVERRIDE
;
71 virtual content::WebContents
* OpenURLFromTab(
72 content::WebContents
* source
,
73 const content::OpenURLParams
& params
) OVERRIDE
;
74 virtual void AddNewContents(content::WebContents
* source
,
75 content::WebContents
* new_contents
,
76 WindowOpenDisposition disposition
,
77 const gfx::Rect
& initial_pos
,
79 bool* was_blocked
) OVERRIDE
;
80 virtual void WebContentsCreated(content::WebContents
* source_contents
,
81 int opener_render_frame_id
,
82 const base::string16
& frame_name
,
83 const GURL
& target_url
,
84 content::WebContents
* new_contents
) OVERRIDE
;
86 // NotificationObserver implementation.
87 virtual void Observe(int type
,
88 const content::NotificationSource
& source
,
89 const content::NotificationDetails
& details
) OVERRIDE
;
91 void OnFindResultAvailable(content::WebContents
* web_contents
,
92 const FindNotificationDetails
* find_result
);
94 content::NotificationRegistrar notification_registrar_
;
97 // Register the native methods through JNI.
98 bool RegisterChromeWebContentsDelegateAndroid(JNIEnv
* env
);
100 } // namespace android
101 } // namespace chrome
103 #endif // CHROME_BROWSER_ANDROID_CHROME_WEB_CONTENTS_DELEGATE_ANDROID_H_