diff options
author | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 19:18:59 +0000 |
---|---|---|
committer | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 19:18:59 +0000 |
commit | 8aca725a07359b4eac2cce24990268ff10a2c755 (patch) | |
tree | 3a7e47dc5b120443ae4a76810d94bfcac5f4f381 | |
parent | b67a44ea99660b674298c5e1f87a54ad8fe93e93 (diff) | |
download | chromium_src-8aca725a07359b4eac2cce24990268ff10a2c755.zip chromium_src-8aca725a07359b4eac2cce24990268ff10a2c755.tar.gz chromium_src-8aca725a07359b4eac2cce24990268ff10a2c755.tar.bz2 |
Web MIDI: add RequestMIDISysExPermission to BrowserContext
Add RequestMIDISysExPermission to handle Web MIDI API permissions for
system exclusive messages in content embedder.
BUG=163795, 257618
TEST=none
TBR=benm@chromium.org
Review URL: https://chromiumcodereview.appspot.com/18647002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211437 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | android_webview/browser/aw_browser_context.cc | 9 | ||||
-rw-r--r-- | android_webview/browser/aw_browser_context.h | 5 | ||||
-rw-r--r-- | chrome/browser/profiles/off_the_record_profile_impl.cc | 9 | ||||
-rw-r--r-- | chrome/browser/profiles/off_the_record_profile_impl.h | 5 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.cc | 9 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.h | 5 | ||||
-rw-r--r-- | chrome/test/base/testing_profile.cc | 9 | ||||
-rw-r--r-- | chrome/test/base/testing_profile.h | 5 | ||||
-rw-r--r-- | content/browser/download/download_manager_impl_unittest.cc | 5 | ||||
-rw-r--r-- | content/public/browser/browser_context.h | 15 | ||||
-rw-r--r-- | content/public/test/test_browser_context.cc | 9 | ||||
-rw-r--r-- | content/public/test/test_browser_context.h | 5 | ||||
-rw-r--r-- | content/shell/shell_browser_context.cc | 10 | ||||
-rw-r--r-- | content/shell/shell_browser_context.h | 5 |
14 files changed, 101 insertions, 4 deletions
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc index 02fd0c3..43411c6 100644 --- a/android_webview/browser/aw_browser_context.cc +++ b/android_webview/browser/aw_browser_context.cc @@ -180,6 +180,15 @@ net::URLRequestContextGetter* AwBrowserContext::GetMediaRequestContext() { return GetRequestContext(); } +void AwBrowserContext::RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) { + // TODO(toyoshim): Android is not supported yet. + callback.Run(false); +} + net::URLRequestContextGetter* AwBrowserContext::GetMediaRequestContextForRenderProcess( int renderer_child_id) { diff --git a/android_webview/browser/aw_browser_context.h b/android_webview/browser/aw_browser_context.h index 4d672bc..33aa409 100644 --- a/android_webview/browser/aw_browser_context.h +++ b/android_webview/browser/aw_browser_context.h @@ -86,6 +86,11 @@ class AwBrowserContext : public content::BrowserContext, virtual net::URLRequestContextGetter* GetMediaRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory) OVERRIDE; + virtual void RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::DownloadManagerDelegate* GetDownloadManagerDelegate() OVERRIDE; diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 64064a7..52fda4c 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -279,6 +279,15 @@ OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( .get(); } +void OffTheRecordProfileImpl::RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) { + // TODO(toyoshim): Implement. + callback.Run(false); +} + net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContextForExtensions() { return io_data_.GetExtensionsRequestContextGetter().get(); diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h index 9f6ed29..1a7b946 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.h +++ b/chrome/browser/profiles/off_the_record_profile_impl.h @@ -98,6 +98,11 @@ class OffTheRecordProfileImpl : public Profile { GetMediaRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory) OVERRIDE; + virtual void RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::GeolocationPermissionContext* GetGeolocationPermissionContext() OVERRIDE; diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 92e1771..5bf3a34 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -862,6 +862,15 @@ ProfileImpl::GetMediaRequestContextForStoragePartition( .GetIsolatedMediaRequestContextGetter(partition_path, in_memory).get(); } +void ProfileImpl::RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) { + // TODO(toyoshim): Implement. + callback.Run(false); +} + content::ResourceContext* ProfileImpl::GetResourceContext() { return io_data_.GetResourceContext(); } diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index a8ece65..d7520a7 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -74,6 +74,11 @@ class ProfileImpl : public Profile { GetMediaRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory) OVERRIDE; + virtual void RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::GeolocationPermissionContext* GetGeolocationPermissionContext() OVERRIDE; diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index f744641..649d196 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -645,6 +645,15 @@ TestingProfile::GetMediaRequestContextForStoragePartition( return NULL; } +void TestingProfile::RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) { + // Always reject requests for testing. + callback.Run(false); +} + net::URLRequestContextGetter* TestingProfile::GetRequestContextForExtensions() { if (!extensions_request_context_.get()) extensions_request_context_ = new TestExtensionURLRequestContextGetter(); diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h index c8c7faa..c4feca2 100644 --- a/chrome/test/base/testing_profile.h +++ b/chrome/test/base/testing_profile.h @@ -231,6 +231,11 @@ class TestingProfile : public Profile { GetMediaRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory) OVERRIDE; + virtual void RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) OVERRIDE; virtual net::URLRequestContextGetter* CreateRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory, diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc index 9059828..099696f 100644 --- a/content/browser/download/download_manager_impl_unittest.cc +++ b/content/browser/download/download_manager_impl_unittest.cc @@ -397,6 +397,11 @@ class MockBrowserContext : public BrowserContext { MOCK_METHOD2(GetMediaRequestContextForStoragePartition, net::URLRequestContextGetter*( const base::FilePath& partition_path, bool in_memory)); + MOCK_METHOD4(RequestMIDISysExPermission, + void(int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback)); MOCK_METHOD0(GetResourceContext, ResourceContext*()); MOCK_METHOD0(GetDownloadManagerDelegate, DownloadManagerDelegate*()); MOCK_METHOD0(GetGeolocationPermissionContext, diff --git a/content/public/browser/browser_context.h b/content/public/browser/browser_context.h index 1fb1052..c7b916f 100644 --- a/content/public/browser/browser_context.h +++ b/content/public/browser/browser_context.h @@ -44,10 +44,6 @@ class StoragePartition; // thread. class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { public: - // Used in ForEachStoragePartition(). The first argument is the partition id. - // The second argument is the StoragePartition object for that partition id. - typedef base::Callback<void(StoragePartition*)> StoragePartitionCallback; - static DownloadManager* GetDownloadManager(BrowserContext* browser_context); // Returns BrowserContext specific external mount points. It may return NULL @@ -59,6 +55,7 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { BrowserContext* browser_context, SiteInstance* site_instance); static content::StoragePartition* GetStoragePartitionForSite( BrowserContext* browser_context, const GURL& site); + typedef base::Callback<void(StoragePartition*)> StoragePartitionCallback; static void ForEachStoragePartition( BrowserContext* browser_context, const StoragePartitionCallback& callback); @@ -128,6 +125,16 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { const base::FilePath& partition_path, bool in_memory) = 0; + typedef base::Callback<void(bool)> MIDISysExPermissionCallback; + + // Requests a permission to use system exclusive messages in MIDI events. + // |callback| will be invoked when the request is resolved. + virtual void RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) = 0; + // Returns the resource context. virtual ResourceContext* GetResourceContext() = 0; diff --git a/content/public/test/test_browser_context.cc b/content/public/test/test_browser_context.cc index 05f40e8..3e909c2 100644 --- a/content/public/test/test_browser_context.cc +++ b/content/public/test/test_browser_context.cc @@ -99,6 +99,15 @@ TestBrowserContext::GetMediaRequestContextForStoragePartition( return NULL; } +void TestBrowserContext::RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) { + // Always reject requests for testing. + callback.Run(false); +} + ResourceContext* TestBrowserContext::GetResourceContext() { if (!resource_context_) resource_context_.reset(new MockResourceContext()); diff --git a/content/public/test/test_browser_context.h b/content/public/test/test_browser_context.h index 2106938..e877059 100644 --- a/content/public/test/test_browser_context.h +++ b/content/public/test/test_browser_context.h @@ -40,6 +40,11 @@ class TestBrowserContext : public BrowserContext { GetMediaRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory) OVERRIDE; + virtual void RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) OVERRIDE; virtual ResourceContext* GetResourceContext() OVERRIDE; virtual GeolocationPermissionContext* GetGeolocationPermissionContext() OVERRIDE; diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc index 5915285..8d3dc3b 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -170,6 +170,16 @@ net::URLRequestContextGetter* return GetRequestContext(); } +void ShellBrowserContext::RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) { + // Always reject requests for testing. + // TODO(toyoshim): Make it programmable to improve test coverage. + callback.Run(false); +} + net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContextForStoragePartition( const base::FilePath& partition_path, diff --git a/content/shell/shell_browser_context.h b/content/shell/shell_browser_context.h index 800a960..5176b0b 100644 --- a/content/shell/shell_browser_context.h +++ b/content/shell/shell_browser_context.h @@ -43,6 +43,11 @@ class ShellBrowserContext : public BrowserContext { GetMediaRequestContextForStoragePartition( const base::FilePath& partition_path, bool in_memory) OVERRIDE; + virtual void RequestMIDISysExPermission( + int render_process_id, + int render_view_id, + const GURL& requesting_frame, + const MIDISysExPermissionCallback& callback) OVERRIDE; virtual ResourceContext* GetResourceContext() OVERRIDE; virtual GeolocationPermissionContext* GetGeolocationPermissionContext() OVERRIDE; |