Implement PermissionManager
This commit is contained in:
parent
eee334c7f6
commit
0cbf8b6cd2
5 changed files with 133 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
#include "browser/brightray_paths.h"
|
#include "browser/brightray_paths.h"
|
||||||
#include "browser/inspectable_web_contents_impl.h"
|
#include "browser/inspectable_web_contents_impl.h"
|
||||||
#include "browser/network_delegate.h"
|
#include "browser/network_delegate.h"
|
||||||
|
#include "browser/permission_manager.h"
|
||||||
#include "common/application_info.h"
|
#include "common/application_info.h"
|
||||||
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
|
@ -158,4 +159,10 @@ content::SSLHostStateDelegate* BrowserContext::GetSSLHostStateDelegate() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content::PermissionManager* BrowserContext::GetPermissionManager() {
|
||||||
|
if (!permission_manager_.get())
|
||||||
|
permission_manager_.reset(new PermissionManager);
|
||||||
|
return permission_manager_.get();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#ifndef BRIGHTRAY_BROWSER_BROWSER_CONTEXT_H_
|
#ifndef BRIGHTRAY_BROWSER_BROWSER_CONTEXT_H_
|
||||||
#define BRIGHTRAY_BROWSER_BROWSER_CONTEXT_H_
|
#define BRIGHTRAY_BROWSER_BROWSER_CONTEXT_H_
|
||||||
|
|
||||||
|
#include "browser/permission_manager.h"
|
||||||
#include "browser/url_request_context_getter.h"
|
#include "browser/url_request_context_getter.h"
|
||||||
|
|
||||||
#include "content/public/browser/browser_context.h"
|
#include "content/public/browser/browser_context.h"
|
||||||
|
@ -14,6 +15,8 @@ class PrefService;
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
|
class PermissionManager;
|
||||||
|
|
||||||
class BrowserContext : public content::BrowserContext,
|
class BrowserContext : public content::BrowserContext,
|
||||||
public brightray::URLRequestContextGetter::Delegate {
|
public brightray::URLRequestContextGetter::Delegate {
|
||||||
public:
|
public:
|
||||||
|
@ -63,11 +66,13 @@ class BrowserContext : public content::BrowserContext,
|
||||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||||
content::PushMessagingService* GetPushMessagingService() override;
|
content::PushMessagingService* GetPushMessagingService() override;
|
||||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||||
|
content::PermissionManager* GetPermissionManager() override;
|
||||||
|
|
||||||
base::FilePath path_;
|
base::FilePath path_;
|
||||||
scoped_ptr<ResourceContext> resource_context_;
|
scoped_ptr<ResourceContext> resource_context_;
|
||||||
scoped_refptr<URLRequestContextGetter> url_request_getter_;
|
scoped_refptr<URLRequestContextGetter> url_request_getter_;
|
||||||
scoped_ptr<PrefService> prefs_;
|
scoped_ptr<PrefService> prefs_;
|
||||||
|
scoped_ptr<PermissionManager> permission_manager_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(BrowserContext);
|
DISALLOW_COPY_AND_ASSIGN(BrowserContext);
|
||||||
};
|
};
|
||||||
|
|
65
brightray/browser/permission_manager.cc
Normal file
65
brightray/browser/permission_manager.cc
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE-CHROMIUM file.
|
||||||
|
|
||||||
|
#include "browser/permission_manager.h"
|
||||||
|
|
||||||
|
#include "base/callback.h"
|
||||||
|
#include "content/public/browser/permission_type.h"
|
||||||
|
|
||||||
|
namespace brightray {
|
||||||
|
|
||||||
|
PermissionManager::PermissionManager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
PermissionManager::~PermissionManager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void PermissionManager::RequestPermission(
|
||||||
|
content::PermissionType permission,
|
||||||
|
content::WebContents* web_contents,
|
||||||
|
int request_id,
|
||||||
|
const GURL& requesting_origin,
|
||||||
|
bool user_gesture,
|
||||||
|
const base::Callback<void(content::PermissionStatus)>& callback) {
|
||||||
|
callback.Run(content::PERMISSION_STATUS_GRANTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PermissionManager::CancelPermissionRequest(
|
||||||
|
content::PermissionType permission,
|
||||||
|
content::WebContents* web_contents,
|
||||||
|
int request_id,
|
||||||
|
const GURL& requesting_origin) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void PermissionManager::ResetPermission(
|
||||||
|
content::PermissionType permission,
|
||||||
|
const GURL& requesting_origin,
|
||||||
|
const GURL& embedding_origin) {
|
||||||
|
}
|
||||||
|
|
||||||
|
content::PermissionStatus PermissionManager::GetPermissionStatus(
|
||||||
|
content::PermissionType permission,
|
||||||
|
const GURL& requesting_origin,
|
||||||
|
const GURL& embedding_origin) {
|
||||||
|
return content::PERMISSION_STATUS_GRANTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PermissionManager::RegisterPermissionUsage(
|
||||||
|
content::PermissionType permission,
|
||||||
|
const GURL& requesting_origin,
|
||||||
|
const GURL& embedding_origin) {
|
||||||
|
}
|
||||||
|
|
||||||
|
int PermissionManager::SubscribePermissionStatusChange(
|
||||||
|
content::PermissionType permission,
|
||||||
|
const GURL& requesting_origin,
|
||||||
|
const GURL& embedding_origin,
|
||||||
|
const base::Callback<void(content::PermissionStatus)>& callback) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PermissionManager::UnsubscribePermissionStatusChange(int subscription_id) {
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace brightray
|
54
brightray/browser/permission_manager.h
Normal file
54
brightray/browser/permission_manager.h
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE-CHROMIUM file.
|
||||||
|
|
||||||
|
#ifndef BROWSER_PERMISSION_MANAGER_H_
|
||||||
|
#define BROWSER_PERMISSION_MANAGER_H_
|
||||||
|
|
||||||
|
#include "base/callback_forward.h"
|
||||||
|
#include "base/macros.h"
|
||||||
|
#include "content/public/browser/permission_manager.h"
|
||||||
|
|
||||||
|
namespace brightray {
|
||||||
|
|
||||||
|
class PermissionManager : public content::PermissionManager {
|
||||||
|
public:
|
||||||
|
PermissionManager();
|
||||||
|
~PermissionManager() override;
|
||||||
|
|
||||||
|
// content::PermissionManager:
|
||||||
|
void RequestPermission(
|
||||||
|
content::PermissionType permission,
|
||||||
|
content::WebContents* web_contents,
|
||||||
|
int request_id,
|
||||||
|
const GURL& requesting_origin,
|
||||||
|
bool user_gesture,
|
||||||
|
const base::Callback<void(content::PermissionStatus)>& callback) override;
|
||||||
|
void CancelPermissionRequest(content::PermissionType permission,
|
||||||
|
content::WebContents* web_contents,
|
||||||
|
int request_id,
|
||||||
|
const GURL& requesting_origin) override;
|
||||||
|
void ResetPermission(content::PermissionType permission,
|
||||||
|
const GURL& requesting_origin,
|
||||||
|
const GURL& embedding_origin) override;
|
||||||
|
content::PermissionStatus GetPermissionStatus(
|
||||||
|
content::PermissionType permission,
|
||||||
|
const GURL& requesting_origin,
|
||||||
|
const GURL& embedding_origin) override;
|
||||||
|
void RegisterPermissionUsage(content::PermissionType permission,
|
||||||
|
const GURL& requesting_origin,
|
||||||
|
const GURL& embedding_origin) override;
|
||||||
|
int SubscribePermissionStatusChange(
|
||||||
|
content::PermissionType permission,
|
||||||
|
const GURL& requesting_origin,
|
||||||
|
const GURL& embedding_origin,
|
||||||
|
const base::Callback<void(content::PermissionStatus)>& callback) override;
|
||||||
|
void UnsubscribePermissionStatusChange(int subscription_id) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(PermissionManager);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace brightray
|
||||||
|
|
||||||
|
#endif // BROWSER_PERMISSION_MANAGER_H_
|
|
@ -42,6 +42,8 @@
|
||||||
'browser/notification_presenter.h',
|
'browser/notification_presenter.h',
|
||||||
'browser/notification_presenter_mac.h',
|
'browser/notification_presenter_mac.h',
|
||||||
'browser/notification_presenter_mac.mm',
|
'browser/notification_presenter_mac.mm',
|
||||||
|
'browser/permission_manager.cc',
|
||||||
|
'browser/permission_manager.h',
|
||||||
'browser/platform_notification_service_impl.cc',
|
'browser/platform_notification_service_impl.cc',
|
||||||
'browser/platform_notification_service_impl.h',
|
'browser/platform_notification_service_impl.h',
|
||||||
'browser/linux/notification_presenter_linux.h',
|
'browser/linux/notification_presenter_linux.h',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue