#include "browser_main_parts_efl.h"
#include "browser_context_efl.h"
#include "web_contents_delegate_efl.h"
-#include "resource_dispatcher_host_delegate_efl.h"
#include "browser/web_contents/web_contents_view_efl.h"
#include "browser/geolocation/access_token_store_efl.h"
#include "browser/renderer_host/render_message_filter_efl.h"
+#include "browser/resource_dispatcher_host_delegate_efl.h"
#include "browser/vibration/vibration_message_filter.h"
#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/common/show_desktop_notification_params.h"
#include "common/web_contents_utils.h"
#include "components/editing/content/browser/editor_client_observer.h"
+#if defined(OS_TIZEN)
+#include "browser/geolocation/location_provider_efl.h"
+#endif
+
+#include "tizen_webview/public/tw_notification.h"
+#include "tizen_webview/public/tw_security_origin.h"
+#include "tizen_webview/public/tw_url.h"
+#include "tizen_webview/tw_misc_utility.h"
+
using web_contents_utils::WebContentsFromFrameID;
+using web_contents_utils::WebContentsFromViewID;
+using tizen_webview::NotificationPermissionRequest;
+using tizen_webview::URL;
+using tizen_webview::Security_Origin;
+
+#warning "[M38] tempoary disable notification. remove below line"
+#undef ENABLE_NOTIFICATIONS
namespace content {
ContentBrowserClientEfl::ContentBrowserClientEfl()
- : browser_main_parts_efl_(NULL) {
+ : web_context_(NULL), browser_main_parts_efl_(NULL) {
}
BrowserMainParts* ContentBrowserClientEfl::CreateBrowserMainParts(
return browser_main_parts_efl_;
}
-WebContentsView* ContentBrowserClientEfl::OverrideCreateWebContentsView(
- WebContents* web_contents,
- RenderViewHostDelegateView** delegate_view) {
- WebContentsViewEfl* view = new WebContentsViewEfl(web_contents);
- *delegate_view = view;
- return view;
-}
-
net::URLRequestContextGetter* ContentBrowserClientEfl::CreateRequestContext(
- BrowserContext* browser_context, ProtocolHandlerMap* protocol_handlers) {
+ BrowserContext* browser_context,
+ ProtocolHandlerMap* protocol_handlers,
+ URLRequestInterceptorScopedVector request_interceptors) {
if (browser_context->IsOffTheRecord()) {
LOG(ERROR) << "off the record browser context not implemented";
return NULL;
}
return static_cast<BrowserContextEfl*>(browser_context)->
- CreateRequestContext(protocol_handlers);
+ CreateRequestContext(protocol_handlers, request_interceptors.Pass());
}
AccessTokenStore* ContentBrowserClientEfl::CreateAccessTokenStore() {
void ContentBrowserClientEfl::AllowCertificateError(
int render_process_id, int render_frame_id, int cert_error,
const net::SSLInfo& ssl_info, const GURL& request_url,
- ResourceType::Type resource_type, bool overridable,
+ ResourceType resource_type, bool overridable,
bool strict_enforcement, const base::Callback<void(bool)>& callback,
CertificateRequestResultType* result) {
}
void ContentBrowserClientEfl::RequestDesktopNotificationPermission(
- const GURL& source_origin, int callback_context,
- int render_process_id, int render_view_id) {
-#if defined(ENABLE_NOTIFICATIONS)
+ const GURL& source_origin,
+ content::RenderFrameHost* render_frame_host,
+ const base::Callback<void(blink::WebNotificationPermission)>& callback) {
+#if defined(ENABLE_NOTIFICATIONS) && !defined(EWK_BRINGUP)
WebContents* web_contents = WebContentsFromViewID(render_process_id,
render_view_id);
if (!web_contents)
BrowserContextEfl* browser_context =
static_cast<BrowserContextEfl*>(web_contents->GetBrowserContext());
- Ewk_Notification_Permission_Request* notification_permission =
- new Ewk_Notification_Permission_Request(
- delegate->web_view()->evas_object(), callback_context, source_origin);
-
- if (browser_context->GetNotificationController()->
- IsDefaultAllowed(notification_permission->origin->host)) {
- browser_context->GetNotificationController()->
- SetPermissionForNotification(notification_permission, true);
- delete notification_permission;
- } else {
- delegate->web_view()->
+ NotificationPermissionRequest* notification_permission
+ = new NotificationPermissionRequest(delegate->web_view()->evas_object(),
+ callback_context,
+ tizen_webview::GetURL(source_origin));
+
+ delegate->web_view()->
SmartCallback<EWebViewCallbacks::NotificationPermissionRequest>()
.call(notification_permission);
- }
+ // A smart callback cannot have ownership for data because the callback may
+ // not ever exist. Therefore new resource should be deleted in the call site.
+ // [sns.park] TODO: uncomment below if no side effect.
+ //delete notification_permission;
#else
NOTIMPLEMENTED();
#endif
}
void ContentBrowserClientEfl::ShowDesktopNotification(
- const ShowDesktopNotificationHostMsgParams& params,
- int render_process_id, int render_view_id, bool /*worker*/) {
-#if defined(ENABLE_NOTIFICATIONS)
+ const content::ShowDesktopNotificationHostMsgParams& params,
+ content::RenderFrameHost* render_frame_host,
+ content::DesktopNotificationDelegate* delegate,
+ base::Closure* cancel_callback) {
+#if defined(ENABLE_NOTIFICATIONS) && !defined(EWK_BRINGUP)
WebContents* web_contents = WebContentsFromViewID(render_process_id, render_view_id);
if (!web_contents)
return;
browser_context->GetNotificationController()->
AddNotification(params.notification_id, render_process_id,
render_view_id, params.replace_id);
- Ewk_Notification* notification = new Ewk_Notification(params);
+ tizen_webview::Notification* notification =
+ new tizen_webview::Notification(base::UTF16ToUTF8(params.body),
+ params.icon_url.spec(),
+ base::UTF16ToUTF8(params.replace_id),
+ base::UTF16ToUTF8(params.title),
+ params.notification_id,
+ URL(params.origin.host(),
+ params.origin.scheme(),
+ atoi(params.origin.port().c_str())));
+
delegate->web_view()->
SmartCallback<EWebViewCallbacks::NotificationShow>().call(notification);
+ // A smart callback cannot have ownership for data because the callback may
+ // not ever exist. Therefore new resource should be deleted in the call site.
+ // [sns.park] TODO: uncomment below if no side effect.
+ //delete notification;
#else
NOTIMPLEMENTED();
#endif
BrowserContextEfl* browser_context = static_cast<BrowserContextEfl*>(
host->GetBrowserContext());
+
+ // TODO: is this situation possible? Should it ever happen?
+ DCHECK(browser_context);
+
if (browser_context)
web_context_ = browser_context->WebContext();