Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: chrome/common/extensions/extension.cc

Issue 6879077: Make sure that extensions can launch web urls with web safe schemes only. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/common/extensions/extension_manifests_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/extensions/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 } 1271 }
1272 1272
1273 launch_local_path_ = launch_path; 1273 launch_local_path_ = launch_path;
1274 } else if (manifest->Get(keys::kLaunchWebURL, &temp)) { 1274 } else if (manifest->Get(keys::kLaunchWebURL, &temp)) {
1275 std::string launch_url; 1275 std::string launch_url;
1276 if (!temp->GetAsString(&launch_url)) { 1276 if (!temp->GetAsString(&launch_url)) {
1277 *error = errors::kInvalidLaunchWebURL; 1277 *error = errors::kInvalidLaunchWebURL;
1278 return false; 1278 return false;
1279 } 1279 }
1280 1280
1281 // Ensure the launch URL is a valid absolute URL. 1281 // Ensure the launch URL is a valid absolute URL and web extent scheme.
1282 if (!GURL(launch_url).is_valid()) { 1282 GURL url(launch_url);
1283 URLPattern pattern(kValidWebExtentSchemes);
1284 if (!url.is_valid() || !pattern.SetScheme(url.scheme())) {
1283 *error = errors::kInvalidLaunchWebURL; 1285 *error = errors::kInvalidLaunchWebURL;
1284 return false; 1286 return false;
1285 } 1287 }
1286 1288
1287 launch_web_url_ = launch_url; 1289 launch_web_url_ = launch_url;
1288 } else if (is_app()) { 1290 } else if (is_app()) {
1289 *error = errors::kLaunchURLRequired; 1291 *error = errors::kLaunchURLRequired;
1290 return false; 1292 return false;
1291 } 1293 }
1292 1294
(...skipping 1633 matching lines...) Expand 10 before | Expand all | Expand 10 after
2926 2928
2927 UninstalledExtensionInfo::~UninstalledExtensionInfo() {} 2929 UninstalledExtensionInfo::~UninstalledExtensionInfo() {}
2928 2930
2929 2931
2930 UnloadedExtensionInfo::UnloadedExtensionInfo( 2932 UnloadedExtensionInfo::UnloadedExtensionInfo(
2931 const Extension* extension, 2933 const Extension* extension,
2932 Reason reason) 2934 Reason reason)
2933 : reason(reason), 2935 : reason(reason),
2934 already_disabled(false), 2936 already_disabled(false),
2935 extension(extension) {} 2937 extension(extension) {}
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/extension_manifests_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698