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

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: @r185803 Created 7 years, 9 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 504
505 // Build up the final vector by concatenating hosts and RCDs. 505 // Build up the final vector by concatenating hosts and RCDs.
506 std::set<std::string> distinct_hosts; 506 std::set<std::string> distinct_hosts;
507 for (HostVector::iterator it = hosts_best_rcd.begin(); 507 for (HostVector::iterator it = hosts_best_rcd.begin();
508 it != hosts_best_rcd.end(); ++it) 508 it != hosts_best_rcd.end(); ++it)
509 distinct_hosts.insert(it->first + it->second); 509 distinct_hosts.insert(it->first + it->second);
510 return distinct_hosts; 510 return distinct_hosts;
511 } 511 }
512 512
513 void PermissionSet::InitImplicitPermissions() { 513 void PermissionSet::InitImplicitPermissions() {
514 // The downloads permission implies the internal version as well.
515 if (apis_.find(APIPermission::kDownloads) != apis_.end())
516 apis_.insert(APIPermission::kDownloadsInternal);
517
514 // The webRequest permission implies the internal version as well. 518 // The webRequest permission implies the internal version as well.
515 if (apis_.find(APIPermission::kWebRequest) != apis_.end()) 519 if (apis_.find(APIPermission::kWebRequest) != apis_.end())
516 apis_.insert(APIPermission::kWebRequestInternal); 520 apis_.insert(APIPermission::kWebRequestInternal);
517 521
518 // The fileBrowserHandler permission implies the internal version as well. 522 // The fileBrowserHandler permission implies the internal version as well.
519 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end()) 523 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end())
520 apis_.insert(APIPermission::kFileBrowserHandlerInternal); 524 apis_.insert(APIPermission::kFileBrowserHandlerInternal);
521 } 525 }
522 526
523 void PermissionSet::InitImplicitExtensionPermissions( 527 void PermissionSet::InitImplicitExtensionPermissions(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 std::set<std::string> new_hosts_only; 605 std::set<std::string> new_hosts_only;
602 606
603 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), 607 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(),
604 old_hosts_set.begin(), old_hosts_set.end(), 608 old_hosts_set.begin(), old_hosts_set.end(),
605 std::inserter(new_hosts_only, new_hosts_only.begin())); 609 std::inserter(new_hosts_only, new_hosts_only.begin()));
606 610
607 return !new_hosts_only.empty(); 611 return !new_hosts_only.empty();
608 } 612 }
609 613
610 } // namespace extensions 614 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698