commit
564b9ec56f
13 changed files with 143 additions and 12 deletions
|
@ -190,6 +190,7 @@
|
||||||
'-lportabledeviceguids.lib',
|
'-lportabledeviceguids.lib',
|
||||||
# content_common.gypi:
|
# content_common.gypi:
|
||||||
'-ld3d9.lib',
|
'-ld3d9.lib',
|
||||||
|
'-ld3d11.lib',
|
||||||
'-ldxva2.lib',
|
'-ldxva2.lib',
|
||||||
'-lstrmiids.lib',
|
'-lstrmiids.lib',
|
||||||
'-lmf.lib',
|
'-lmf.lib',
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
},
|
},
|
||||||
'msvs_disabled_warnings': [
|
'msvs_disabled_warnings': [
|
||||||
4100, # unreferenced formal parameter
|
4100, # unreferenced formal parameter
|
||||||
|
4121, # alignment of a member was sensitive to packing
|
||||||
4127, # conditional expression is constant
|
4127, # conditional expression is constant
|
||||||
4189, # local variable is initialized but not referenced
|
4189, # local variable is initialized but not referenced
|
||||||
4244, # 'initializing' : conversion from 'double' to 'size_t', possible loss of data
|
4244, # 'initializing' : conversion from 'double' to 'size_t', possible loss of data
|
||||||
|
|
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,8 +90,6 @@ void BrowserMainParts::PreEarlyInitialization() {
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
OverrideLinuxAppDataPath();
|
OverrideLinuxAppDataPath();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
InitProxyResolverV8();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserMainParts::ToolkitInitialized() {
|
void BrowserMainParts::ToolkitInitialized() {
|
||||||
|
@ -148,8 +146,4 @@ BrowserContext* BrowserMainParts::CreateBrowserContext() {
|
||||||
return new BrowserContext;
|
return new BrowserContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserMainParts::InitProxyResolverV8() {
|
|
||||||
net::ProxyResolverV8::EnsureIsolateCreated();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace brightray
|
||||||
|
|
|
@ -50,9 +50,6 @@ class BrowserMainParts : public content::BrowserMainParts {
|
||||||
// implementation. The caller takes ownership of the returned object.
|
// implementation. The caller takes ownership of the returned object.
|
||||||
virtual BrowserContext* CreateBrowserContext();
|
virtual BrowserContext* CreateBrowserContext();
|
||||||
|
|
||||||
// Override this to change how ProxyResolverV8 is initialized.
|
|
||||||
virtual void InitProxyResolverV8();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
void IncreaseFileDescriptorLimit();
|
void IncreaseFileDescriptorLimit();
|
||||||
|
|
|
@ -140,7 +140,7 @@ void NotificationPresenterLinux::CancelNotification(NotifyNotification* notifica
|
||||||
if (error)
|
if (error)
|
||||||
log_and_clear_error(error, "notify_notification_close");
|
log_and_clear_error(error, "notify_notification_close");
|
||||||
|
|
||||||
GetDelegateFromNotification(notification)->NotificationClosed(false);
|
GetDelegateFromNotification(notification)->NotificationClosed();
|
||||||
DeleteNotification(notification);
|
DeleteNotification(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ void NotificationPresenterLinux::DeleteNotification(NotifyNotification* notifica
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationPresenterLinux::OnNotificationClosed(NotifyNotification* notification) {
|
void NotificationPresenterLinux::OnNotificationClosed(NotifyNotification* notification) {
|
||||||
GetDelegateFromNotification(notification)->NotificationClosed(false);
|
GetDelegateFromNotification(notification)->NotificationClosed();
|
||||||
DeleteNotification(notification);
|
DeleteNotification(notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,10 @@ bool NetworkDelegate::OnCanEnablePrivacyMode(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NetworkDelegate::OnFirstPartyOnlyCookieExperimentEnabled() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool NetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader(
|
bool NetworkDelegate::OnCancelURLRequestWithPolicyViolatingReferrerHeader(
|
||||||
const net::URLRequest& request,
|
const net::URLRequest& request,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
|
|
|
@ -62,6 +62,7 @@ class NetworkDelegate : public net::NetworkDelegate {
|
||||||
bool OnCanEnablePrivacyMode(
|
bool OnCanEnablePrivacyMode(
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
const GURL& first_party_for_cookies) const override;
|
const GURL& first_party_for_cookies) const override;
|
||||||
|
bool OnFirstPartyOnlyCookieExperimentEnabled() const override;
|
||||||
bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
|
bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(
|
||||||
const net::URLRequest& request,
|
const net::URLRequest& request,
|
||||||
const GURL& target_url,
|
const GURL& target_url,
|
||||||
|
|
|
@ -85,7 +85,7 @@ void NotificationPresenterMac::CancelNotification(content::DesktopNotificationDe
|
||||||
for (NSUserNotification* deliveredNotification in center.deliveredNotifications)
|
for (NSUserNotification* deliveredNotification in center.deliveredNotifications)
|
||||||
if ([notification isEqual:deliveredNotification]) {
|
if ([notification isEqual:deliveredNotification]) {
|
||||||
[center removeDeliveredNotification:deliveredNotification];
|
[center removeDeliveredNotification:deliveredNotification];
|
||||||
delegate->NotificationClosed(false);
|
delegate->NotificationClosed();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
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…
Reference in a new issue