Commit a837f5e3 authored by vandebo@chromium.org's avatar vandebo@chromium.org

Move MediaGalleries.getMediaFileSystems back to experimental for M22

BUG=110823

Review URL: https://chromiumcodereview.appspot.com/10823193

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150164 0039d316-1c4b-4281-b951-d872f2087c98
parent f49b7a09
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/media_gallery/media_file_system_registry.h" #include "chrome/browser/media_gallery/media_file_system_registry.h"
#include "chrome/common/extensions/api/experimental_media_galleries.h" #include "chrome/common/extensions/api/experimental_media_galleries.h"
#include "chrome/common/extensions/api/media_galleries.h"
#include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
...@@ -33,7 +32,7 @@ const char kInvalidInteractive[] = "Unknown value for interactive."; ...@@ -33,7 +32,7 @@ const char kInvalidInteractive[] = "Unknown value for interactive.";
using chrome::MediaFileSystemRegistry; using chrome::MediaFileSystemRegistry;
using content::ChildProcessSecurityPolicy; using content::ChildProcessSecurityPolicy;
namespace MediaGalleries = extensions::api::media_galleries; namespace MediaGalleries = extensions::api::experimental_media_galleries;
namespace GetMediaFileSystems = MediaGalleries::GetMediaFileSystems; namespace GetMediaFileSystems = MediaGalleries::GetMediaFileSystems;
MediaGalleriesGetMediaFileSystemsFunction:: MediaGalleriesGetMediaFileSystemsFunction::
......
...@@ -14,7 +14,8 @@ namespace extensions { ...@@ -14,7 +14,8 @@ namespace extensions {
class MediaGalleriesGetMediaFileSystemsFunction : public SyncExtensionFunction { class MediaGalleriesGetMediaFileSystemsFunction : public SyncExtensionFunction {
public: public:
DECLARE_EXTENSION_FUNCTION_NAME("mediaGalleries.getMediaFileSystems") DECLARE_EXTENSION_FUNCTION_NAME(
"experimental.mediaGalleries.getMediaFileSystems")
protected: protected:
virtual ~MediaGalleriesGetMediaFileSystemsFunction(); virtual ~MediaGalleriesGetMediaFileSystemsFunction();
......
...@@ -20,6 +20,14 @@ ...@@ -20,6 +20,14 @@
namespace { namespace {
class ExperimentalMediaGalleriesAppBrowserTest : public PlatformAppBrowserTest {
public:
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
PlatformAppBrowserTest::SetUpCommandLine(command_line);
command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
}
};
class ExperimentalMediaGalleriesApiTest : public ExtensionApiTest { class ExperimentalMediaGalleriesApiTest : public ExtensionApiTest {
public: public:
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
...@@ -67,18 +75,20 @@ class EnsurePictureDirectoryExists { ...@@ -67,18 +75,20 @@ class EnsurePictureDirectoryExists {
} // namespace } // namespace
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, NoGalleries) { IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesAppBrowserTest, NoGalleries) {
ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_galleries")) ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_galleries"))
<< message_; << message_;
} }
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MediaGalleriesRead) { IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesAppBrowserTest,
MediaGalleriesRead) {
EnsurePictureDirectoryExists picture_directory; EnsurePictureDirectoryExists picture_directory;
ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/read_access")) ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/read_access"))
<< message_; << message_;
} }
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MediaGalleriesNoAccess) { IN_PROC_BROWSER_TEST_F(ExperimentalMediaGalleriesAppBrowserTest,
MediaGalleriesNoAccess) {
EnsurePictureDirectoryExists picture_directory; EnsurePictureDirectoryExists picture_directory;
ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_access")) ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/no_access"))
<< message_; << message_;
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
'experimental_serial.idl', 'experimental_serial.idl',
'experimental_usb.idl', 'experimental_usb.idl',
'file_system.idl', 'file_system.idl',
'media_galleries.idl',
'socket.idl', 'socket.idl',
], ],
'cc_dir': 'chrome/common/extensions/api', 'cc_dir': 'chrome/common/extensions/api',
......
...@@ -6,10 +6,37 @@ ...@@ -6,10 +6,37 @@
namespace experimental.mediaGalleries { namespace experimental.mediaGalleries {
[inline_doc] enum GetMediaFileSystemsInteractivity {
// Do not act interactively.
no,
// Ask the user to manage permitted media galleries.
yes,
// Ask the user to manage permitted galleries only if the return set would
// otherwise be empty.
if_needed
};
[inline_doc] dictionary MediaFileSystemsDetails {
// Whether to prompt the user for permission to additional media galleries
// before returning the permitted set. Default is silent. If the value
// 'yes' is passed, or if the application has not been granted access to
// any media galleries and the value 'if_needed' is passed, then the
// media gallery configuration dialog will be displayed.
GetMediaFileSystemsInteractivity? interactive;
};
callback MediaFileSystemsCallback =
void ([instanceOf=LocalFileSystem] optional object[] mediaFileSystems);
callback AssembleMediaFileCallback = callback AssembleMediaFileCallback =
void ([instanceOf=Blob] optional object mediaFile); void ([instanceOf=Blob] optional object mediaFile);
interface Functions { interface Functions {
// Get the media galleries configured in this user agent. If none are
// configured or available, the callback will receive an empty array.
static void getMediaFileSystems(optional MediaFileSystemsDetails details,
MediaFileSystemsCallback callback);
// Create a new MediaFile setting the metadata in the Blob to the supplied // Create a new MediaFile setting the metadata in the Blob to the supplied
// values, overriding any existing metadata in the media file. If user agent // values, overriding any existing metadata in the media file. If user agent
// does not recognize the Blob as a supported file format, it will fail. // does not recognize the Blob as a supported file format, it will fail.
......
// Copyright (c) 2012 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 file.
// File-level comment to appease parser. Eventually this will not be necessary.
namespace mediaGalleries {
[inline_doc] enum GetMediaFileSystemsInteractivity {
// Do not act interactively.
no,
// Ask the user to manage permitted media galleries.
yes,
// Ask the user to manage permitted galleries only if the return set would
// otherwise be empty.
if_needed
};
[inline_doc] dictionary MediaFileSystemsDetails {
// Whether to prompt the user for permission to additional media galleries
// before returning the permitted set. Default is silent. If the value
// 'yes' is passed, or if the application has not been granted access to
// any media galleries and the value 'if_needed' is passed, then the
// media gallery configuration dialog will be displayed.
GetMediaFileSystemsInteractivity? interactive;
};
callback MediaFileSystemsCallback =
void ([instanceOf=LocalFileSystem] optional object[] mediaFileSystems);
interface Functions {
// Get the media galleries configured in this user agent. If none are
// configured or available, the callback will receive an empty array.
static void getMediaFileSystems(optional MediaFileSystemsDetails details,
MediaFileSystemsCallback callback);
};
};
...@@ -208,7 +208,6 @@ Here are the supported chrome.* APIs: ...@@ -208,7 +208,6 @@ Here are the supported chrome.* APIs:
</li><li><a href="fileSystem.html" js="">fileSystem</a> </li><li><a href="fileSystem.html" js="">fileSystem</a>
</li><li><a href="i18n.html" js="">i18n</a> </li><li><a href="i18n.html" js="">i18n</a>
</li><li><a href="idle.html" js="">idle</a> </li><li><a href="idle.html" js="">idle</a>
</li><li><a href="mediaGalleries.html" js="">mediaGalleries</a>
</li><li><a href="permissions.html" js="">permissions</a> </li><li><a href="permissions.html" js="">permissions</a>
</li><li><a href="runtime.html" js="">runtime</a> </li><li><a href="runtime.html" js="">runtime</a>
</li><li><a href="socket.html" js="">socket</a> </li><li><a href="socket.html" js="">socket</a>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<script type="text/javascript" src="../js/api_page_generator.js"></script> <script type="text/javascript" src="../js/api_page_generator.js"></script>
<script type="text/javascript" src="../js/bootstrap.js"></script> <script type="text/javascript" src="../js/bootstrap.js"></script>
<script type="text/javascript" src="../js/sidebar.js"></script> <script type="text/javascript" src="../js/sidebar.js"></script>
<meta name="description" content="Documentation for the chrome.experimental.mediaGalleries module, which is part of the Google Chrome extension APIs."><title>chrome.experimental.mediaGalleries - Google Chrome Extensions - Google Code</title></head> <meta name="description" content="Documentation for the chrome.experimental.mediaGalleries module, which is part of the Google Chrome extension APIs."><title>Media Galleries - Google Chrome Extensions - Google Code</title></head>
<body doc-family="apps"> <link href="../css/ApiRefStyles.css" rel="stylesheet" type="text/css"> <body doc-family="apps"> <link href="../css/ApiRefStyles.css" rel="stylesheet" type="text/css">
<link href="../css/prettify.css" rel="stylesheet" type="text/css"> <link href="../css/prettify.css" rel="stylesheet" type="text/css">
<link href="../css/shared.css" rel="stylesheet" type="text/css"> <link href="../css/shared.css" rel="stylesheet" type="text/css">
...@@ -157,12 +157,17 @@ ...@@ -157,12 +157,17 @@
</script> </script>
<div class="g-unit" id="gc-pagecontent"> <div class="g-unit" id="gc-pagecontent">
<div id="pageTitle"> <div id="pageTitle">
<h1 class="page_title">chrome.experimental.mediaGalleries</h1> <h1 class="page_title">Media Galleries</h1>
</div> </div>
<!-- TABLE OF CONTENTS --> <!-- TABLE OF CONTENTS -->
<div id="toc"> <div id="toc">
<h2>Contents</h2> <h2>Contents</h2>
<ol> <ol>
<li>
<a href="#manifest">Manifest</a>
<ol>
</ol>
</li>
<li> <li>
<a href="#apiReference">API reference: chrome.experimental.mediaGalleries</a> <a href="#apiReference">API reference: chrome.experimental.mediaGalleries</a>
<ol> <ol>
...@@ -173,6 +178,8 @@ ...@@ -173,6 +178,8 @@
<a href="#method-assembleMediaFile">assembleMediaFile</a> <a href="#method-assembleMediaFile">assembleMediaFile</a>
</li><li> </li><li>
<a href="#method-extractEmbeddedThumbnails">extractEmbeddedThumbnails</a> <a href="#method-extractEmbeddedThumbnails">extractEmbeddedThumbnails</a>
</li><li>
<a href="#method-getMediaFileSystems">getMediaFileSystems</a>
</li> </li>
</ol> </ol>
</li> </li>
...@@ -182,11 +189,53 @@ ...@@ -182,11 +189,53 @@
</div> </div>
<!-- /TABLE OF CONTENTS --> <!-- /TABLE OF CONTENTS -->
<!-- Standard content lead-in for experimental API pages --> <!-- Standard content lead-in for experimental API pages -->
<p id="classSummary">
For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page.
</p>
<!-- STATIC CONTENT PLACEHOLDER --> <!-- STATIC CONTENT PLACEHOLDER -->
<div id="static"></div> <div id="static"><div id="pageData-name" class="pageData">Media Galleries</div>
<!-- BEGIN AUTHORED CONTENT -->
<p>
The media galleries API allows you to access media files (images,
video, audio) from the user's local disks (with the user's consent).
</p>
<p>
Using the API, you can prompt the user for permission to access the media
galleries. The permission dialog will contain common media locations for
the platform and will allow the user to add additional locations. From those
locations, only media files will be present in the file system objects.
</p>
<h2 id="manifest">Manifest</h2>
<p>The media galleries API has two axes of permissions; the locations that
can be accessed, and the type of access (read-only, read-write, add-files).</p>
<p>On the location axis, specifying no location-type permission means that
no media galleries are accessible until the user grants permission to
specific media galleries at runtime using the media gallery configuration
dialog. This dialog can be programmatically triggered. Alternatively,
specifying the "mediaGalleriesAllGalleries" permission grants access to all
auto-detected media galleries on the user's computer. However, this
permission displays an install time prompt indicating that the extension
will have access to all of the user's media files.</p>
<p>On the access type axis, the "mediaGalleriesRead" permission grants the
extension the right to read files. This permission does not trigger an install
time permission prompt because the user must still grant access to particular
galleries, either with the "mediaGalleriesAllGalleries" permission or at
runtime by using the media gallery management dialog. For example:</p>
<pre>{
"name": "My extension",
...
"permissions": [
<b>"mediaGalleriesAllGalleries"</b>
<b>"mediaGalleriesRead"</b>
],
...
}</pre>
<p>This set of permissions will trigger an install time permission prompt
and let the extension read from all auto-detected media galleries on the
user's computer. The user may add or remove galleries using the
media gallery management dialog, after which the extension will be able
to read all the media files from galleries that the user has selected.</p>
<p>Currently "mediaGalleriesRead" is the only access type supported by
this API. Read-write and add-file access with be implemented soon.</p>
<!-- END AUTHORED CONTENT -->
</div>
<!-- API PAGE --> <!-- API PAGE -->
<div class="apiPage"> <div class="apiPage">
<a name="apiReference"></a> <a name="apiReference"></a>
...@@ -361,6 +410,149 @@ ...@@ -361,6 +410,149 @@
<!-- OBJECT METHODS --> <!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS --> <!-- OBJECT EVENT FIELDS -->
<!-- FUNCTION PARAMETERS --> <!-- FUNCTION PARAMETERS -->
</div>
</div>
</dl>
<!-- RETURNS -->
<dl>
</dl>
<!-- CALLBACK -->
<!-- MIN_VERSION -->
</div> <!-- /description -->
</div><div class="apiItem">
<a name="method-getMediaFileSystems"></a> <!-- method-anchor -->
<h4>getMediaFileSystems</h4>
<div class="summary">
<!-- Note: intentionally longer 80 columns -->
<span>chrome.experimental.mediaGalleries.getMediaFileSystems</span>(<span class="optional"><span>object</span>
<var><span>details</span></var></span><span class="null"><span>, </span><span>function</span>
<var><span>MediaFileSystemsCallback</span></var></span>)</div>
<div class="description">
<p>Get the media galleries configured in this user agent. If none are configured or available, the callback will receive an empty array.</p>
<!-- PARAMETERS -->
<h4>Parameters</h4>
<dl>
<div>
<div>
<dt>
<var>details</var>
<em>
<!-- TYPE -->
<div style="display:inline">
(
<span class="optional">optional</span>
<span id="typeTemplate">
<span>
<span>object</span>
</span>
</span>
)
</div>
</em>
</dt>
<dd class="todo">
Undocumented.
</dd>
<!-- OBJECT PROPERTIES -->
<dd>
<dl>
<div>
<div>
<dt>
<var>interactive</var>
<em>
<!-- TYPE -->
<div style="display:inline">
(
<span class="optional">optional</span>
<span class="enum">enumerated</span>
<span id="typeTemplate">
<span>
<span>string</span>
<span>["no", "yes", "if_needed"]</span>
</span>
</span>
)
</div>
</em>
</dt>
<dd>Whether to prompt the user for permission to additional media galleries before returning the permitted set. Default is silent. If the value 'yes' is passed, or if the application has not been granted access to any media galleries and the value 'if_needed' is passed, then the media gallery configuration dialog will be displayed.</dd>
<!-- OBJECT PROPERTIES -->
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
<!-- FUNCTION PARAMETERS -->
</div>
</div>
</dl>
</dd>
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
<!-- FUNCTION PARAMETERS -->
</div>
</div><div>
<div>
<dt>
<var>MediaFileSystemsCallback</var>
<em>
<!-- TYPE -->
<div style="display:inline">
(
<span id="typeTemplate">
<span>
<span>function</span>
</span>
</span>
)
</div>
</em>
</dt>
<dd class="todo">
Undocumented.
</dd>
<!-- OBJECT PROPERTIES -->
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
<!-- FUNCTION PARAMETERS -->
<dd>
<div>
<h5>Parameters</h5>
<dl>
<div>
<div>
<dt>
<var>mediaFileSystems</var>
<em>
<!-- TYPE -->
<div style="display:inline">
(
<span class="optional">optional</span>
<span id="typeTemplate">
<span>
<span>
array of <span><span>
<span>
<span>LocalFileSystem</span>
</span>
</span></span>
</span>
</span>
</span>
)
</div>
</em>
</dt>
<dd class="todo">
Undocumented.
</dd>
<!-- OBJECT PROPERTIES -->
<!-- OBJECT METHODS -->
<!-- OBJECT EVENT FIELDS -->
<!-- FUNCTION PARAMETERS -->
</div>
</div>
</dl>
</div>
</dd>
</div> </div>
</div> </div>
</dl> </dl>
......
This diff is collapsed.
...@@ -250,7 +250,6 @@ on the following experimental APIs: ...@@ -250,7 +250,6 @@ on the following experimental APIs:
<a href="experimental.discovery.html">experimental.discovery</a></li><li> <a href="experimental.discovery.html">experimental.discovery</a></li><li>
<a href="experimental.identity.html">experimental.identity</a></li><li> <a href="experimental.identity.html">experimental.identity</a></li><li>
<a href="experimental.infobars.html">experimental.infobars</a></li><li> <a href="experimental.infobars.html">experimental.infobars</a></li><li>
<a href="experimental.mediaGalleries.html">experimental.mediaGalleries</a></li><li>
<a href="experimental.offscreenTabs.html">experimental.offscreenTabs</a></li><li> <a href="experimental.offscreenTabs.html">experimental.offscreenTabs</a></li><li>
<a href="experimental.processes.html">experimental.processes</a></li><li> <a href="experimental.processes.html">experimental.processes</a></li><li>
<a href="experimental.serial.html">experimental.serial</a></li><li> <a href="experimental.serial.html">experimental.serial</a></li><li>
......
...@@ -330,8 +330,6 @@ ...@@ -330,8 +330,6 @@
<a href="javascript:void(0);" onclick="setFilter('chrome.input.ime', this)">chrome.input.ime</a><span>, </span> <a href="javascript:void(0);" onclick="setFilter('chrome.input.ime', this)">chrome.input.ime</a><span>, </span>
</span><span> </span><span>
<a href="javascript:void(0);" onclick="setFilter('chrome.management', this)">chrome.management</a><span>, </span> <a href="javascript:void(0);" onclick="setFilter('chrome.management', this)">chrome.management</a><span>, </span>
</span><span>
<a href="javascript:void(0);" onclick="setFilter('chrome.mediaGalleries', this)">chrome.mediaGalleries</a><span>, </span>
</span><span> </span><span>
<a href="javascript:void(0);" onclick="setFilter('chrome.omnibox', this)">chrome.omnibox</a><span>, </span> <a href="javascript:void(0);" onclick="setFilter('chrome.omnibox', this)">chrome.omnibox</a><span>, </span>
</span><span> </span><span>
......
...@@ -157,6 +157,7 @@ ...@@ -157,6 +157,7 @@
"chrome.experimental.infobars.show": "experimental.infobars.html#method-show", "chrome.experimental.infobars.show": "experimental.infobars.html#method-show",
"chrome.experimental.mediaGalleries.assembleMediaFile": "experimental.mediaGalleries.html#method-assembleMediaFile", "chrome.experimental.mediaGalleries.assembleMediaFile": "experimental.mediaGalleries.html#method-assembleMediaFile",
"chrome.experimental.mediaGalleries.extractEmbeddedThumbnails": "experimental.mediaGalleries.html#method-extractEmbeddedThumbnails", "chrome.experimental.mediaGalleries.extractEmbeddedThumbnails": "experimental.mediaGalleries.html#method-extractEmbeddedThumbnails",
"chrome.experimental.mediaGalleries.getMediaFileSystems": "experimental.mediaGalleries.html#method-getMediaFileSystems",
"chrome.experimental.offscreenTabs.create": "experimental.offscreenTabs.html#method-create", "chrome.experimental.offscreenTabs.create": "experimental.offscreenTabs.html#method-create",
"chrome.experimental.offscreenTabs.get": "experimental.offscreenTabs.html#method-get", "chrome.experimental.offscreenTabs.get": "experimental.offscreenTabs.html#method-get",
"chrome.experimental.offscreenTabs.getAll": "experimental.offscreenTabs.html#method-getAll", "chrome.experimental.offscreenTabs.getAll": "experimental.offscreenTabs.html#method-getAll",
...@@ -272,7 +273,6 @@ ...@@ -272,7 +273,6 @@
"chrome.management.onUninstalled": "management.html#event-onUninstalled", "chrome.management.onUninstalled": "management.html#event-onUninstalled",
"chrome.management.setEnabled": "management.html#method-setEnabled", "chrome.management.setEnabled": "management.html#method-setEnabled",
"chrome.management.uninstall": "management.html#method-uninstall", "chrome.management.uninstall": "management.html#method-uninstall",
"chrome.mediaGalleries.getMediaFileSystems": "mediaGalleries.html#method-getMediaFileSystems",
"chrome.omnibox.onInputCancelled": "omnibox.html#event-onInputCancelled", "chrome.omnibox.onInputCancelled": "omnibox.html#event-onInputCancelled",
"chrome.omnibox.onInputChanged": "omnibox.html#event-onInputChanged", "chrome.omnibox.onInputChanged": "omnibox.html#event-onInputChanged",
"chrome.omnibox.onInputEntered": "omnibox.html#event-onInputEntered", "chrome.omnibox.onInputEntered": "omnibox.html#event-onInputEntered",
......
...@@ -623,6 +623,8 @@ void ExtensionDispatcher::RegisterNativeHandlers(ModuleSystem* module_system, ...@@ -623,6 +623,8 @@ void ExtensionDispatcher::RegisterNativeHandlers(ModuleSystem* module_system,
new ExtensionCustomBindings(this))); new ExtensionCustomBindings(this)));
module_system->RegisterNativeHandler("experimental_app", module_system->RegisterNativeHandler("experimental_app",
scoped_ptr<NativeHandler>(new ExperimentalAppCustomBindings())); scoped_ptr<NativeHandler>(new ExperimentalAppCustomBindings()));
module_system->RegisterNativeHandler("experimental_mediaGalleries",
scoped_ptr<NativeHandler>(new MediaGalleryCustomBindings()));
module_system->RegisterNativeHandler("experimental_usb", module_system->RegisterNativeHandler("experimental_usb",
scoped_ptr<NativeHandler>(new ExperimentalUsbCustomBindings())); scoped_ptr<NativeHandler>(new ExperimentalUsbCustomBindings()));
module_system->RegisterNativeHandler("file_browser_handler", module_system->RegisterNativeHandler("file_browser_handler",
...@@ -631,8 +633,6 @@ void ExtensionDispatcher::RegisterNativeHandlers(ModuleSystem* module_system, ...@@ -631,8 +633,6 @@ void ExtensionDispatcher::RegisterNativeHandlers(ModuleSystem* module_system,
scoped_ptr<NativeHandler>(new FileBrowserPrivateCustomBindings())); scoped_ptr<NativeHandler>(new FileBrowserPrivateCustomBindings()));
module_system->RegisterNativeHandler("i18n", module_system->RegisterNativeHandler("i18n",
scoped_ptr<NativeHandler>(new I18NCustomBindings())); scoped_ptr<NativeHandler>(new I18NCustomBindings()));
module_system->RegisterNativeHandler("mediaGalleries",
scoped_ptr<NativeHandler>(new MediaGalleryCustomBindings()));
module_system->RegisterNativeHandler("page_actions", module_system->RegisterNativeHandler("page_actions",
scoped_ptr<NativeHandler>( scoped_ptr<NativeHandler>(
new PageActionsCustomBindings(this))); new PageActionsCustomBindings(this)));
...@@ -697,8 +697,6 @@ void ExtensionDispatcher::PopulateSourceMap() { ...@@ -697,8 +697,6 @@ void ExtensionDispatcher::PopulateSourceMap() {
IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS); IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS);
source_map_.RegisterSource("i18n", IDR_I18N_CUSTOM_BINDINGS_JS); source_map_.RegisterSource("i18n", IDR_I18N_CUSTOM_BINDINGS_JS);
source_map_.RegisterSource("input.ime", IDR_INPUT_IME_CUSTOM_BINDINGS_JS); source_map_.RegisterSource("input.ime", IDR_INPUT_IME_CUSTOM_BINDINGS_JS);
source_map_.RegisterSource("mediaGalleries",
IDR_MEDIA_GALLERY_CUSTOM_BINDINGS_JS);
source_map_.RegisterSource("omnibox", IDR_OMNIBOX_CUSTOM_BINDINGS_JS); source_map_.RegisterSource("omnibox", IDR_OMNIBOX_CUSTOM_BINDINGS_JS);
source_map_.RegisterSource("pageActions", source_map_.RegisterSource("pageActions",
IDR_PAGE_ACTIONS_CUSTOM_BINDINGS_JS); IDR_PAGE_ACTIONS_CUSTOM_BINDINGS_JS);
......
...@@ -56,7 +56,6 @@ without changes to the corresponding grd file. fb9 --> ...@@ -56,7 +56,6 @@ without changes to the corresponding grd file. fb9 -->
<include name="IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS" file="resources\extensions\file_system_custom_bindings.js" type="BINDATA" /> <include name="IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS" file="resources\extensions\file_system_custom_bindings.js" type="BINDATA" />
<include name="IDR_I18N_CUSTOM_BINDINGS_JS" file="resources\extensions\i18n_custom_bindings.js" type="BINDATA" /> <include name="IDR_I18N_CUSTOM_BINDINGS_JS" file="resources\extensions\i18n_custom_bindings.js" type="BINDATA" />
<include name="IDR_INPUT_IME_CUSTOM_BINDINGS_JS" file="resources\extensions\input.ime_custom_bindings.js" type="BINDATA" /> <include name="IDR_INPUT_IME_CUSTOM_BINDINGS_JS" file="resources\extensions\input.ime_custom_bindings.js" type="BINDATA" />
<include name="IDR_MEDIA_GALLERY_CUSTOM_BINDINGS_JS" file="resources\extensions\media_galleries_custom_bindings.js" type="BINDATA" />
<include name="IDR_OMNIBOX_CUSTOM_BINDINGS_JS" file="resources\extensions\omnibox_custom_bindings.js" type="BINDATA" /> <include name="IDR_OMNIBOX_CUSTOM_BINDINGS_JS" file="resources\extensions\omnibox_custom_bindings.js" type="BINDATA" />
<include name="IDR_PAGE_ACTIONS_CUSTOM_BINDINGS_JS" file="resources\extensions\page_actions_custom_bindings.js" type="BINDATA" /> <include name="IDR_PAGE_ACTIONS_CUSTOM_BINDINGS_JS" file="resources\extensions\page_actions_custom_bindings.js" type="BINDATA" />
<include name="IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS" file="resources\extensions\page_action_custom_bindings.js" type="BINDATA" /> <include name="IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS" file="resources\extensions\page_action_custom_bindings.js" type="BINDATA" />
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Custom bindings for the Media Gallery API. // Custom bindings for the Media Gallery API.
var mediaGalleriesNatives = requireNative('mediaGalleries'); var mediaGalleriesNatives = requireNative('experimental_mediaGalleries');
var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
...@@ -12,6 +12,23 @@ chromeHidden.registerCustomHook('experimental.mediaGalleries', ...@@ -12,6 +12,23 @@ chromeHidden.registerCustomHook('experimental.mediaGalleries',
function(bindingsAPI, extensionId) { function(bindingsAPI, extensionId) {
var apiFunctions = bindingsAPI.apiFunctions; var apiFunctions = bindingsAPI.apiFunctions;
// getMediaFileSystems uses a custom callback so that it can instantiate and
// return an array of file system objects.
apiFunctions.setCustomCallback('getMediaFileSystems',
function(name, request, response) {
var result = null;
if (response) {
result = [];
for (var i = 0; i < response.length; i++) {
result.push(mediaGalleriesNatives.GetMediaFileSystemObject(
response[i].fsid, response[i].name));
}
}
if (request.callback)
request.callback(result);
request.callback = null;
});
// extractEmbeddedThumbnails uses a renderer side handler so that it can // extractEmbeddedThumbnails uses a renderer side handler so that it can
// synchronously return a result. The result object's state is computable // synchronously return a result. The result object's state is computable
// from the function's input. // from the function's input.
......
// Copyright (c) 2012 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 file.
// Custom bindings for the Media Gallery API.
var mediaGalleriesNatives = requireNative('mediaGalleries');
var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
chromeHidden.registerCustomHook('mediaGalleries',
function(bindingsAPI, extensionId) {
var apiFunctions = bindingsAPI.apiFunctions;
// getMediaFileSystems uses a custom callback so that it can instantiate and
// return an array of file system objects.
apiFunctions.setCustomCallback('getMediaFileSystems',
function(name, request, response) {
var result = null;
if (response) {
result = [];
for (var i = 0; i < response.length; i++) {
result.push(mediaGalleriesNatives.GetMediaFileSystemObject(
response[i].fsid, response[i].name));
}
}
if (request.callback)
request.callback(result);
request.callback = null;
});
});
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
"name": "chrome.mediaGalleries.no_access", "name": "chrome.mediaGalleries.no_access",
"version": "0.1", "version": "0.1",
"manifest_version": 2, "manifest_version": 2,
"description": "test having no access for chrome.mediaGalleries.getMediaFileSystems fails appropriately", "description": "test having no access for chrome.experimental.mediaGalleries.getMediaFileSystems fails appropriately",
"app": { "app": {
"background": { "background": {
"scripts": ["test.js"] "scripts": ["test.js"]
} }
}, },
"permissions": ["mediaGalleries", "mediaGalleriesAllGalleries"] "permissions": ["experimental", "mediaGalleries", "mediaGalleriesAllGalleries"]
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
var mediaGalleries = chrome.mediaGalleries; var mediaGalleries = chrome.experimental.mediaGalleries;
var mediaFileSystemsDirectoryEntryCallback = function(entries) { var mediaFileSystemsDirectoryEntryCallback = function(entries) {
chrome.test.fail("Shouldn't have been able to get a directory listing."); chrome.test.fail("Shouldn't have been able to get a directory listing.");
......
...@@ -8,5 +8,5 @@ ...@@ -8,5 +8,5 @@
"scripts": ["test.js"] "scripts": ["test.js"]
} }
}, },
"permissions": ["mediaGalleriesRead"] "permissions": ["experimental", "mediaGalleriesRead"]
} }
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
var mediaGalleries = chrome.mediaGalleries; var mediaGalleries = chrome.experimental.mediaGalleries;
var mediaFileSystemsListCallback = function(results) { var mediaFileSystemsListCallback = function(results) {
chrome.test.assertEq(0, results.length); chrome.test.assertEq(0, results.length);
}; };
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
"name": "chrome.mediaGalleries.read_access", "name": "chrome.mediaGalleries.read_access",
"version": "0.1", "version": "0.1",
"manifest_version": 2, "manifest_version": 2,
"description": "test read access for chrome.mediaGalleries.getMediaFileSystems", "description": "test read access for chrome.experimental.mediaGalleries.getMediaFileSystems",
"app": { "app": {
"background": { "background": {
"scripts": ["test.js"] "scripts": ["test.js"]
} }
}, },
"permissions": ["mediaGalleriesRead", "mediaGalleriesAllGalleries"] "permissions": ["experimental", "mediaGalleriesRead", "mediaGalleriesAllGalleries"]
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
var mediaGalleries = chrome.mediaGalleries; var mediaGalleries = chrome.experimental.mediaGalleries;
var mediaFileSystemsDirectoryErrorCallback = function(err) { var mediaFileSystemsDirectoryErrorCallback = function(err) {
chrome.test.fail("Couldn't read from directory: " + err); chrome.test.fail("Couldn't read from directory: " + err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment