summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 21:50:04 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 21:50:04 +0000
commitf0bc23fa7c2b4fdbfe2b69fd874c63d1c7f27930 (patch)
tree6e4094fb15ae27949000872907e1d3ac329dace5
parentb4f110750aee9a6b99ac8f9eb9f1a2558dc9463c (diff)
downloadchromium_src-f0bc23fa7c2b4fdbfe2b69fd874c63d1c7f27930.zip
chromium_src-f0bc23fa7c2b4fdbfe2b69fd874c63d1c7f27930.tar.gz
chromium_src-f0bc23fa7c2b4fdbfe2b69fd874c63d1c7f27930.tar.bz2
Enable DOM paste for extensions with clipboard access.
BUG=none TEST=browser_tests.exe --gtest_filter=ExtensionApiTest.Clipboard Review URL: http://codereview.chromium.org/1121004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42264 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_host.cc4
-rw-r--r--chrome/test/data/extensions/api_test/clipboard/test.js4
2 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 2470969..350c370 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -505,6 +505,10 @@ WebPreferences ExtensionHost::GetWebkitPrefs() {
if (extension_host_type_ == ViewType::EXTENSION_POPUP ||
extension_host_type_ == ViewType::EXTENSION_INFOBAR)
webkit_prefs.allow_scripts_to_close_windows = true;
+
+ // TODO(dcheng): check kClipboardPermission instead once it's implemented.
+ if (extension_->HasApiPermission(Extension::kExperimentalPermission))
+ webkit_prefs.dom_paste_enabled = true;
return webkit_prefs;
}
diff --git a/chrome/test/data/extensions/api_test/clipboard/test.js b/chrome/test/data/extensions/api_test/clipboard/test.js
index 52f013d..8a50a6f 100644
--- a/chrome/test/data/extensions/api_test/clipboard/test.js
+++ b/chrome/test/data/extensions/api_test/clipboard/test.js
@@ -60,5 +60,9 @@ chrome.test.runTests([
}
);
setupWindow();
+ },
+ function domPaste() {
+ document.body.addEventListener('paste', chrome.test.callbackPass());
+ document.execCommand('paste');
}
]);