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

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

Issue 12189018: <webview>: Implement WebRequest API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Diff from latest patch Created 7 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/permission_set.h" 5 #include "chrome/common/extensions/permissions/permission_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <string> 9 #include <string>
10 10
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 514
515 // Build up the final vector by concatenating hosts and RCDs. 515 // Build up the final vector by concatenating hosts and RCDs.
516 std::set<std::string> distinct_hosts; 516 std::set<std::string> distinct_hosts;
517 for (HostVector::iterator it = hosts_best_rcd.begin(); 517 for (HostVector::iterator it = hosts_best_rcd.begin();
518 it != hosts_best_rcd.end(); ++it) 518 it != hosts_best_rcd.end(); ++it)
519 distinct_hosts.insert(it->first + it->second); 519 distinct_hosts.insert(it->first + it->second);
520 return distinct_hosts; 520 return distinct_hosts;
521 } 521 }
522 522
523 void PermissionSet::InitImplicitPermissions() { 523 void PermissionSet::InitImplicitPermissions() {
524 // TODO(fsamuel): Is there a better way to request access to the WebRequest
525 // API without exposing it to the Chrome App?
526 if (apis_.find(APIPermission::kWebView) != apis_.end())
527 apis_.insert(APIPermission::kWebRequestInternal);
528
524 // The webRequest permission implies the internal version as well. 529 // The webRequest permission implies the internal version as well.
525 if (apis_.find(APIPermission::kWebRequest) != apis_.end()) 530 if (apis_.find(APIPermission::kWebRequest) != apis_.end())
526 apis_.insert(APIPermission::kWebRequestInternal); 531 apis_.insert(APIPermission::kWebRequestInternal);
527 532
528 // The fileBrowserHandler permission implies the internal version as well. 533 // The fileBrowserHandler permission implies the internal version as well.
529 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end()) 534 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end())
530 apis_.insert(APIPermission::kFileBrowserHandlerInternal); 535 apis_.insert(APIPermission::kFileBrowserHandlerInternal);
531 } 536 }
532 537
533 void PermissionSet::InitImplicitExtensionPermissions( 538 void PermissionSet::InitImplicitExtensionPermissions(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 std::set<std::string> new_hosts_only; 616 std::set<std::string> new_hosts_only;
612 617
613 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 618 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),
614 old_hosts_set.begin(), old_hosts_set.end(), 619 old_hosts_set.begin(), old_hosts_set.end(),
615 std::inserter(new_hosts_only, new_hosts_only.begin())); 620 std::inserter(new_hosts_only, new_hosts_only.begin()));
616 621
617 return !new_hosts_only.empty(); 622 return !new_hosts_only.empty();
618 } 623 }
619 624
620 } // namespace extensions 625 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698