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

Side by Side Diff: chrome/common/extensions/permissions/permissions_data.cc

Issue 22938005: Add ErrorConsole UI for Extension Install Warnings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dc_ec_install_warnings
Patch Set: More robust highlighting + testing Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/permissions/permissions_data.h" 5 #include "chrome/common/extensions/permissions/permissions_data.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // chrome://thumbnail, so add them back in to host_permissions separately. 224 // chrome://thumbnail, so add them back in to host_permissions separately.
225 if (pattern.match_all_urls()) 225 if (pattern.match_all_urls())
226 host_permissions->AddPatterns(GetPermittedChromeSchemeHosts( 226 host_permissions->AddPatterns(GetPermittedChromeSchemeHosts(
227 extension, *api_permissions)); 227 extension, *api_permissions));
228 continue; 228 continue;
229 } 229 }
230 230
231 // It's probably an unknown API permission. Do not throw an error so 231 // It's probably an unknown API permission. Do not throw an error so
232 // extensions can retain backwards compatability (http://crbug.com/42742). 232 // extensions can retain backwards compatability (http://crbug.com/42742).
233 extension->AddInstallWarning(InstallWarning( 233 extension->AddInstallWarning(InstallWarning(
234 base::StringPrintf( 234 ErrorUtils::FormatErrorMessage(
235 "Permission '%s' is unknown or URL pattern is malformed.", 235 errors::kPermissionUnknownOrMalformed,
236 permission_str.c_str()), 236 permission_str),
237 key, 237 key,
238 permission_str)); 238 permission_str));
239 } 239 }
240 240
241 return true; 241 return true;
242 } 242 }
243 243
244 // Returns true if this extension id is from a trusted provider. 244 // Returns true if this extension id is from a trusted provider.
245 bool IsTrustedId(const std::string& extension_id) { 245 bool IsTrustedId(const std::string& extension_id) {
246 // See http://b/4946060 for more details. 246 // See http://b/4946060 for more details.
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 optional_permission_set_ = new PermissionSet( 635 optional_permission_set_ = new PermissionSet(
636 initial_optional_permissions_->api_permissions, 636 initial_optional_permissions_->api_permissions,
637 initial_optional_permissions_->host_permissions, 637 initial_optional_permissions_->host_permissions,
638 URLPatternSet()); 638 URLPatternSet());
639 639
640 initial_required_permissions_.reset(); 640 initial_required_permissions_.reset();
641 initial_optional_permissions_.reset(); 641 initial_optional_permissions_.reset();
642 } 642 }
643 643
644 } // namespace extensions 644 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698