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 "base/time.h"
12 #include "components/web_contents_delegate_android/web_contents_delegate_android.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 components::WebContentsDelegateAndroid
,
36 public content::NotificationObserver
{
38 ChromeWebContentsDelegateAndroid(JNIEnv
* env
, jobject obj
);
39 virtual ~ChromeWebContentsDelegateAndroid();
41 virtual void RunFileChooser(content::WebContents
* web_contents
,
42 const content::FileChooserParams
& params
)
44 virtual void CloseContents(content::WebContents
* web_contents
) OVERRIDE
;
45 virtual 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 virtual void FindMatchRectsReply(content::WebContents
* web_contents
,
53 const std::vector
<gfx::RectF
>& rects
,
54 const gfx::RectF
& active_rect
) OVERRIDE
;
55 virtual content::JavaScriptDialogManager
*
56 GetJavaScriptDialogManager() OVERRIDE
;
57 virtual void DidNavigateToPendingEntry(content::WebContents
* source
) OVERRIDE
;
58 virtual void DidNavigateMainFramePostCommit(
59 content::WebContents
* source
) OVERRIDE
;
60 virtual void RequestMediaAccessPermission(
61 content::WebContents
* web_contents
,
62 const content::MediaStreamRequest
& request
,
63 const content::MediaResponseCallback
& callback
) OVERRIDE
;
64 virtual bool RequestPpapiBrokerPermission(
65 content::WebContents
* web_contents
,
67 const base::FilePath
& plugin_path
,
68 const base::Callback
<void(bool)>& callback
) OVERRIDE
;
71 // NotificationObserver implementation.
72 virtual void Observe(int type
,
73 const content::NotificationSource
& source
,
74 const content::NotificationDetails
& details
) OVERRIDE
;
76 void OnFindResultAvailable(content::WebContents
* web_contents
,
77 const FindNotificationDetails
* find_result
);
79 content::NotificationRegistrar notification_registrar_
;
81 base::TimeTicks navigation_start_time_
;
84 // Register the native methods through JNI.
85 bool RegisterChromeWebContentsDelegateAndroid(JNIEnv
* env
);
87 } // namespace android
90 #endif // CHROME_BROWSER_ANDROID_CHROME_WEB_CONTENTS_DELEGATE_ANDROID_H_