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

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

Powered by Google App Engine
This is Rietveld 408576698