summaryrefslogtreecommitdiffstats
path: root/extensions/common/manifest_handlers
diff options
context:
space:
mode:
authorrockot <rockot@chromium.org>2014-12-11 17:59:47 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-12 02:00:13 +0000
commite261b16ec7149db6debc70a47f93b20abc8de334 (patch)
tree5193b8df17b2bbced97553fa515e7ab363edde98 /extensions/common/manifest_handlers
parent09a7a5528847ce83687584adee700d23744491ca (diff)
downloadchromium_src-e261b16ec7149db6debc70a47f93b20abc8de334.zip
chromium_src-e261b16ec7149db6debc70a47f93b20abc8de334.tar.gz
chromium_src-e261b16ec7149db6debc70a47f93b20abc8de334.tar.bz2
Implement clipboardRead/Write content capabilities
This adds support for clipboardRead and clipboardWrite capability grants from white-listed extensions to web contents. BUG=409269 R=kalman@chromium.org Review URL: https://codereview.chromium.org/789063002 Cr-Commit-Position: refs/heads/master@{#308022}
Diffstat (limited to 'extensions/common/manifest_handlers')
-rw-r--r--extensions/common/manifest_handlers/content_capabilities_handler.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/extensions/common/manifest_handlers/content_capabilities_handler.cc b/extensions/common/manifest_handlers/content_capabilities_handler.cc
index a55bb82..05144f5 100644
--- a/extensions/common/manifest_handlers/content_capabilities_handler.cc
+++ b/extensions/common/manifest_handlers/content_capabilities_handler.cc
@@ -4,11 +4,13 @@
#include "extensions/common/manifest_handlers/content_capabilities_handler.h"
+#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
+#include "content/public/common/content_switches.h"
#include "extensions/common/api/extensions_manifest_types.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/install_warning.h"
@@ -61,11 +63,17 @@ bool ContentCapabilitiesHandler::Parse(Extension* extension,
if (!capabilities)
return false;
+ int supported_schemes = URLPattern::SCHEME_HTTPS;
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) {
+ // We don't have a suitable HTTPS test server, so this will have to do.
+ supported_schemes |= URLPattern::SCHEME_HTTP;
+ }
+
std::string url_error;
URLPatternSet potential_url_patterns;
- if (!potential_url_patterns.Populate(capabilities->matches,
- URLPattern::SCHEME_HTTPS, false /* allow_file_access */,
- &url_error)) {
+ if (!potential_url_patterns.Populate(capabilities->matches, supported_schemes,
+ false /* allow_file_access */,
+ &url_error)) {
*error = ErrorUtils::FormatErrorMessageUTF16(
errors::kInvalidContentCapabilitiesMatch, url_error);
return false;