Merge pull request #1660 from deepak1556/filesysem_patch
browser: create quota permission context to allow quota request
This commit is contained in:
commit
b238ac5981
7 changed files with 77 additions and 0 deletions
|
@ -78,6 +78,9 @@ void AtomMainDelegate::PreSandboxStartup() {
|
||||||
// Disable renderer sandbox for most of node's functions.
|
// Disable renderer sandbox for most of node's functions.
|
||||||
command_line->AppendSwitch(switches::kNoSandbox);
|
command_line->AppendSwitch(switches::kNoSandbox);
|
||||||
|
|
||||||
|
// Allow file:// URIs to read other file:// URIs by default.
|
||||||
|
command_line->AppendSwitch(switches::kAllowFileAccessFromFiles);
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
// Enable AVFoundation.
|
// Enable AVFoundation.
|
||||||
command_line->AppendSwitch("enable-avfoundation");
|
command_line->AppendSwitch("enable-avfoundation");
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "atom/browser/atom_access_token_store.h"
|
#include "atom/browser/atom_access_token_store.h"
|
||||||
#include "atom/browser/atom_browser_context.h"
|
#include "atom/browser/atom_browser_context.h"
|
||||||
#include "atom/browser/atom_browser_main_parts.h"
|
#include "atom/browser/atom_browser_main_parts.h"
|
||||||
|
#include "atom/browser/atom_quota_permission_context.h"
|
||||||
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
|
#include "atom/browser/atom_resource_dispatcher_host_delegate.h"
|
||||||
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
|
#include "atom/browser/atom_speech_recognition_manager_delegate.h"
|
||||||
#include "atom/browser/native_window.h"
|
#include "atom/browser/native_window.h"
|
||||||
|
@ -221,6 +222,11 @@ void AtomBrowserClient::DidCreatePpapiPlugin(
|
||||||
new chrome::ChromeBrowserPepperHostFactory(browser_host)));
|
new chrome::ChromeBrowserPepperHostFactory(browser_host)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content::QuotaPermissionContext*
|
||||||
|
AtomBrowserClient::CreateQuotaPermissionContext() {
|
||||||
|
return new AtomQuotaPermissionContext;
|
||||||
|
}
|
||||||
|
|
||||||
brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
|
brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts(
|
||||||
const content::MainFunctionParams&) {
|
const content::MainFunctionParams&) {
|
||||||
v8::V8::Initialize(); // Init V8 before creating main parts.
|
v8::V8::Initialize(); // Init V8 before creating main parts.
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
|
|
||||||
#include "brightray/browser/browser_client.h"
|
#include "brightray/browser/browser_client.h"
|
||||||
|
|
||||||
|
namespace content {
|
||||||
|
class QuotaPermissionContext;
|
||||||
|
}
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class AtomResourceDispatcherHostDelegate;
|
class AtomResourceDispatcherHostDelegate;
|
||||||
|
@ -39,6 +43,7 @@ class AtomBrowserClient : public brightray::BrowserClient {
|
||||||
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
||||||
int child_process_id) override;
|
int child_process_id) override;
|
||||||
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
||||||
|
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
brightray::BrowserMainParts* OverrideCreateBrowserMainParts(
|
brightray::BrowserMainParts* OverrideCreateBrowserMainParts(
|
||||||
|
|
24
atom/browser/atom_quota_permission_context.cc
Normal file
24
atom/browser/atom_quota_permission_context.cc
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) 2015 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "atom/browser/atom_quota_permission_context.h"
|
||||||
|
|
||||||
|
#include "storage/common/quota/quota_types.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
AtomQuotaPermissionContext::AtomQuotaPermissionContext() {
|
||||||
|
}
|
||||||
|
|
||||||
|
AtomQuotaPermissionContext::~AtomQuotaPermissionContext() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void AtomQuotaPermissionContext::RequestQuotaPermission(
|
||||||
|
const content::StorageQuotaParams& params,
|
||||||
|
int render_process_id,
|
||||||
|
const PermissionCallback& callback) {
|
||||||
|
callback.Run(response::QUOTA_PERMISSION_RESPONSE_ALLOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace atom
|
31
atom/browser/atom_quota_permission_context.h
Normal file
31
atom/browser/atom_quota_permission_context.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// Copyright (c) 2015 GitHub, Inc.
|
||||||
|
// Use of this source code is governed by the MIT license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef ATOM_BROWSER_ATOM_QUOTA_PERMISSION_CONTEXT_H_
|
||||||
|
#define ATOM_BROWSER_ATOM_QUOTA_PERMISSION_CONTEXT_H_
|
||||||
|
|
||||||
|
#include "content/public/browser/quota_permission_context.h"
|
||||||
|
|
||||||
|
namespace atom {
|
||||||
|
|
||||||
|
class AtomQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||||
|
public:
|
||||||
|
typedef content::QuotaPermissionContext::QuotaPermissionResponse response;
|
||||||
|
|
||||||
|
AtomQuotaPermissionContext();
|
||||||
|
virtual ~AtomQuotaPermissionContext();
|
||||||
|
|
||||||
|
// content::QuotaPermissionContext:
|
||||||
|
void RequestQuotaPermission(
|
||||||
|
const content::StorageQuotaParams& params,
|
||||||
|
int render_process_id,
|
||||||
|
const PermissionCallback& callback) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(AtomQuotaPermissionContext);
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace atom
|
||||||
|
|
||||||
|
#endif // ATOM_BROWSER_ATOM_QUOTA_PERMISSION_CONTEXT_H_
|
|
@ -114,6 +114,8 @@
|
||||||
'atom/browser/atom_browser_main_parts_mac.mm',
|
'atom/browser/atom_browser_main_parts_mac.mm',
|
||||||
'atom/browser/atom_javascript_dialog_manager.cc',
|
'atom/browser/atom_javascript_dialog_manager.cc',
|
||||||
'atom/browser/atom_javascript_dialog_manager.h',
|
'atom/browser/atom_javascript_dialog_manager.h',
|
||||||
|
'atom/browser/atom_quota_permission_context.cc',
|
||||||
|
'atom/browser/atom_quota_permission_context.h',
|
||||||
'atom/browser/atom_resource_dispatcher_host_delegate.cc',
|
'atom/browser/atom_resource_dispatcher_host_delegate.cc',
|
||||||
'atom/browser/atom_resource_dispatcher_host_delegate.h',
|
'atom/browser/atom_resource_dispatcher_host_delegate.h',
|
||||||
'atom/browser/atom_speech_recognition_manager_delegate.cc',
|
'atom/browser/atom_speech_recognition_manager_delegate.cc',
|
||||||
|
|
|
@ -82,3 +82,9 @@ describe 'chromium feature', ->
|
||||||
iframe.onload = ->
|
iframe.onload = ->
|
||||||
assert.equal iframe.contentWindow.test, 'undefined undefined undefined'
|
assert.equal iframe.contentWindow.test, 'undefined undefined undefined'
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
describe 'storage', ->
|
||||||
|
it 'requesting persitent quota works', (done) ->
|
||||||
|
navigator.webkitPersistentStorage.requestQuota 1024 * 1024, (grantedBytes) ->
|
||||||
|
assert.equal grantedBytes, 1048576
|
||||||
|
done()
|
||||||
|
|
Loading…
Reference in a new issue