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

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

Issue 11574006: Implement chrome.downloads.onDeterminingFilename() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r177662 Created 7 years, 11 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 509
510 // Build up the final vector by concatenating hosts and RCDs. 510 // Build up the final vector by concatenating hosts and RCDs.
511 std::set<std::string> distinct_hosts; 511 std::set<std::string> distinct_hosts;
512 for (HostVector::iterator it = hosts_best_rcd.begin(); 512 for (HostVector::iterator it = hosts_best_rcd.begin();
513 it != hosts_best_rcd.end(); ++it) 513 it != hosts_best_rcd.end(); ++it)
514 distinct_hosts.insert(it->first + it->second); 514 distinct_hosts.insert(it->first + it->second);
515 return distinct_hosts; 515 return distinct_hosts;
516 } 516 }
517 517
518 void PermissionSet::InitImplicitPermissions() { 518 void PermissionSet::InitImplicitPermissions() {
519 // The downloads permission implies the internal version as well.
520 if (apis_.find(APIPermission::kDownloads) != apis_.end())
521 apis_.insert(APIPermission::kDownloadsInternal);
522
519 // The webRequest permission implies the internal version as well. 523 // The webRequest permission implies the internal version as well.
520 if (apis_.find(APIPermission::kWebRequest) != apis_.end()) 524 if (apis_.find(APIPermission::kWebRequest) != apis_.end())
521 apis_.insert(APIPermission::kWebRequestInternal); 525 apis_.insert(APIPermission::kWebRequestInternal);
522 526
523 // The fileBrowserHandler permission implies the internal version as well. 527 // The fileBrowserHandler permission implies the internal version as well.
524 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end()) 528 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end())
525 apis_.insert(APIPermission::kFileBrowserHandlerInternal); 529 apis_.insert(APIPermission::kFileBrowserHandlerInternal);
526 } 530 }
527 531
528 void PermissionSet::InitImplicitExtensionPermissions( 532 void PermissionSet::InitImplicitExtensionPermissions(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 std::set<std::string> new_hosts_only; 610 std::set<std::string> new_hosts_only;
607 611
608 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 612 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),
609 old_hosts_set.begin(), old_hosts_set.end(), 613 old_hosts_set.begin(), old_hosts_set.end(),
610 std::inserter(new_hosts_only, new_hosts_only.begin())); 614 std::inserter(new_hosts_only, new_hosts_only.begin()));
611 615
612 return !new_hosts_only.empty(); 616 return !new_hosts_only.empty();
613 } 617 }
614 618
615 } // namespace extensions 619 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698