<label>Chromium-efl MiniBrowser</label>
<label xml:lang="en-us">Chromium-efl MiniBrowser</label>
</ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/location</privilege>
+ <privilege>http://tizen.org/privilege/internet</privilege>
+ <privilege>http://tizen.org/privilege/network.get</privilege>
+ </privileges>
</manifest>
-// Copyright 2013 Samsung Electronics. All rights reserved.
+// Copyright 2014 Samsung Electronics. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace content {
-void GeolocationPermissionContextEfl::RequestGeolocationPermissionOnUIThread(int render_process_id,
- int render_view_id,
- int /*bridge_id*/,
- const GURL& requesting_frame,
- base::Callback<void(bool)> callback) {
- CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+GeolocationPermissionContextEfl::GeolocationPermissionContextEfl()
+ : weak_ptr_factory_(this) {
+}
+
+void GeolocationPermissionContextEfl::RequestPermissionOnUIThread(
+ int render_process_id,
+ int render_view_id,
+ const GURL& requesting_frame,
+ base::Callback<void(bool)> callback) const {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
WebContents* web_contents = WebContentsFromViewID(render_process_id, render_view_id);
if (!web_contents)
return;
callback.Run(false);
}
-void GeolocationPermissionContextEfl::RequestGeolocationPermission(int render_process_id,
- int render_view_id,
- int bridge_id,
- const GURL& requesting_frame,
- base::Callback<void(bool)> callback) {
- content::BrowserThread::PostTask(content::BrowserThread::UI,
- FROM_HERE,
- base::Bind(&GeolocationPermissionContextEfl::RequestGeolocationPermissionOnUIThread,
- base::Unretained(this),
- render_process_id,
- render_view_id,
- bridge_id,
- requesting_frame,
- callback));
+void GeolocationPermissionContextEfl::RequestPermission(
+ int render_process_id,
+ int render_view_id,
+ const GURL& requesting_frame,
+ base::Callback<void(bool)> callback) const {
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(
+ &GeolocationPermissionContextEfl::RequestPermissionOnUIThread,
+ weak_ptr_factory_.GetWeakPtr(),
+ render_process_id,
+ render_view_id,
+ requesting_frame,
+ callback));
}
-void GeolocationPermissionContextEfl::CancelGeolocationPermissionRequest(int /*render_process_id*/,
- int /*render_view_id*/,
- int /*bridge_id*/,
- const GURL& /*requesting_frame*/) {
- // There is currently no mechanism to inform the application that a permission request should be canceled.
+void GeolocationPermissionContextEfl::CancelPermissionRequest(
+ int /*render_process_id*/,
+ int /*render_view_id*/,
+ int /*bridge_id*/,
+ const GURL& /*requesting_frame*/) const {
+ // There is currently no mechanism to inform the application
+ // that a permission request should be canceled.
// To be implemented in the future.
}
-}//namespace
+} // namespace content
-// Copyright 2013 Samsung Electronics. All rights reserved.
+// Copyright 2014 Samsung Electronics. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef GEOLOCATION_PERMISSION_CONTEXT_EFL_H
#define GEOLOCATION_PERMISSION_CONTEXT_EFL_H
-#include "content/public/browser/geolocation_permission_context.h"
+#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
-namespace content {
-
-class BrowserContext;
-
-class GeolocationPermissionContextEfl : public GeolocationPermissionContext {
-public:
- GeolocationPermissionContextEfl() { }
+class GURL;
- virtual void RequestGeolocationPermission(int, int, int, const GURL&, base::Callback<void(bool)>) override;
-
- // The renderer is cancelling a pending permission request.
- virtual void CancelGeolocationPermissionRequest(int, int, int, const GURL&) override;
+namespace content {
-private:
- void RequestGeolocationPermissionOnUIThread(int, int, int, const GURL&, base::Callback<void(bool)>);
+// This includes both prompting the user and persisting results, as required.
+class GeolocationPermissionContextEfl final {
+ public:
+ GeolocationPermissionContextEfl();
+
+ // The renderer is requesting permission to use Geolocation.
+ // When the answer to a permission request has been determined, |callback|
+ // should be called with the result.
+ void RequestPermission(int render_process_id,
+ int render_view_id,
+ const GURL& requesting_frame,
+ base::Callback<void(bool)> callback) const;
+
+ // The renderer is cancelling a pending permission request.
+ void CancelPermissionRequest(int render_process_id,
+ int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame) const;
+
+ private:
+ void RequestPermissionOnUIThread(int render_process_id,
+ int render_view_id,
+ const GURL& requesting_frame,
+ base::Callback<void(bool)> callback) const;
+
+ mutable base::WeakPtrFactory<GeolocationPermissionContextEfl>
+ weak_ptr_factory_;
};
-} // namespace
+} // namespace content
#endif // GEOLOCATION_PERMISSION_CONTEXT_EFL_H
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
+#include "browser/geolocation/geolocation_permission_context_efl.h"
#include "components/visitedlink/browser/visitedlink_master.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_view_host.h"
return NULL;
}
+const GeolocationPermissionContextEfl&
+ BrowserContextEfl::GetGeolocationPermissionContext() const {
+ if (!geolocation_permission_context_.get()) {
+ geolocation_permission_context_.reset(
+ new GeolocationPermissionContextEfl());
+ }
+
+ return *(geolocation_permission_context_.get());
+}
+
}
#include "base/memory/scoped_ptr.h"
#include "base/files/scoped_temp_dir.h"
+#include "browser/download_manager_delegate_efl.h"
+#include "browser/geolocation/geolocation_permission_context_efl.h"
+#include "browser/notification/notification_controller_efl.h"
#include "components/visitedlink/browser/visitedlink_delegate.h"
#include "components/visitedlink/browser/visitedlink_master.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/resource_context.h"
#include "url_request_context_getter_efl.h"
-#include "browser/notification/notification_controller_efl.h"
-#include "browser/download_manager_delegate_efl.h"
+
#include "net/url_request/url_request_context.h"
class EWebContext;
virtual PushMessagingService* GetPushMessagingService() override
{ return 0; }
+ virtual const GeolocationPermissionContextEfl&
+ GetGeolocationPermissionContext() const;
+
virtual base::FilePath GetPath() const override;
net::URLRequestContextGetter* CreateRequestContext(
private:
static void ReadCertificateAndAdd(base::FilePath* file_path);
virtual SSLHostStateDelegate* GetSSLHostStateDelegate() override;
-
+ mutable scoped_ptr<GeolocationPermissionContextEfl>
+ geolocation_permission_context_;
scoped_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;
ResourceContextEfl* resource_context_;
scoped_refptr<URLRequestContextGetterEfl> request_context_getter_;
'browser/favicon/favicon_service.h',
'browser/geolocation/access_token_store_efl.cc',
'browser/geolocation/access_token_store_efl.h',
- # [M37] Geolocation related code changed. Figure out how to fix it.
- #'browser/geolocation/geolocation_permission_context_efl.cc',
- #'browser/geolocation/geolocation_permission_context_efl.h',
+ 'browser/geolocation/geolocation_permission_context_efl.cc',
+ 'browser/geolocation/geolocation_permission_context_efl.h',
'browser/geolocation/location_provider_efl.cc',
'browser/geolocation/location_provider_efl.h',
'browser/inputpicker/InputPicker.cc',
#include "devtools_manager_delegate_efl.h"
#include "browser/web_contents/web_contents_view_efl.h"
#include "browser/geolocation/access_token_store_efl.h"
+#include "browser/geolocation/geolocation_permission_context_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"
host->AddFilter(new editing::EditorClientObserver(host->GetID()));
}
+void ContentBrowserClientEfl::RequestPermission(
+ content::PermissionType permission,
+ content::WebContents* web_contents,
+ int bridge_id,
+ const GURL& requesting_frame,
+ bool user_gesture,
+ const base::Callback<void(bool)>& result_callback) {
+ int render_process_id = web_contents->GetRenderProcessHost()->GetID();
+ int render_view_id = web_contents->GetRenderViewHost()->GetRoutingID();
+
+ GURL origin = requesting_frame.GetOrigin();
+ BrowserContextEfl* browser_context =
+ static_cast<BrowserContextEfl*>(web_contents->GetBrowserContext());
+ const GeolocationPermissionContextEfl& geolocation_permission_context =
+ browser_context->GetGeolocationPermissionContext();
+
+ switch (permission) {
+ case content::PERMISSION_GEOLOCATION:
+ if (!browser_context) {
+ LOG(ERROR) << "Dropping GeolocationPermission request";
+ result_callback.Run(false);
+ return;
+ }
+
+ geolocation_permission_context.RequestPermission(render_process_id,
+ render_view_id,
+ requesting_frame,
+ result_callback);
+ break;
+ case content::PERMISSION_PROTECTED_MEDIA:
+ case content::PERMISSION_MIDI_SYSEX:
+ case content::PERMISSION_NOTIFICATIONS:
+ case content::PERMISSION_PUSH_MESSAGING:
+ NOTIMPLEMENTED() << "RequestPermission not implemented for "
+ << permission;
+ break;
+ default:
+ NOTREACHED() << "Invalid RequestPermission for " << permission;
+ }
+}
+
content::DevToolsManagerDelegate* ContentBrowserClientEfl::GetDevToolsManagerDelegate() {
return new DevToolsManagerDelegateEfl();
}
virtual void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
+ void RequestPermission(
+ content::PermissionType permission,
+ content::WebContents* web_contents,
+ int bridge_id,
+ const GURL& requesting_frame,
+ bool user_gesture,
+ const base::Callback<void(bool)>& result_callback) override;
+
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
private: