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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_api.cc

Issue 10675007: Move each permission classes to its own files in extensions/permissions (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase again Created 8 years, 5 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) 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/browser/extensions/api/web_request/web_request_api.h" 5 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 extension_info_map()->extensions().GetByID(extension_id()); 1570 extension_info_map()->extensions().GetByID(extension_id());
1571 std::string extension_name = extension ? extension->name() : extension_id(); 1571 std::string extension_name = extension ? extension->name() : extension_id();
1572 1572
1573 // We check automatically whether the extension has the 'webRequest' 1573 // We check automatically whether the extension has the 'webRequest'
1574 // permission. For blocking calls we require the additional permission 1574 // permission. For blocking calls we require the additional permission
1575 // 'webRequestBlocking'. 1575 // 'webRequestBlocking'.
1576 if ((extra_info_spec & 1576 if ((extra_info_spec &
1577 (ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING | 1577 (ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING |
1578 ExtensionWebRequestEventRouter::ExtraInfoSpec::ASYNC_BLOCKING)) && 1578 ExtensionWebRequestEventRouter::ExtraInfoSpec::ASYNC_BLOCKING)) &&
1579 !extension->HasAPIPermission( 1579 !extension->HasAPIPermission(
1580 ExtensionAPIPermission::kWebRequestBlocking)) { 1580 extensions::APIPermission::kWebRequestBlocking)) {
1581 error_ = keys::kBlockingPermissionRequired; 1581 error_ = keys::kBlockingPermissionRequired;
1582 return false; 1582 return false;
1583 } 1583 }
1584 1584
1585 // We allow to subscribe to patterns that are broader than the host 1585 // We allow to subscribe to patterns that are broader than the host
1586 // permissions. E.g., we could subscribe to http://www.example.com/* 1586 // permissions. E.g., we could subscribe to http://www.example.com/*
1587 // while having host permissions for http://www.example.com/foo/* and 1587 // while having host permissions for http://www.example.com/foo/* and
1588 // http://www.example.com/bar/*. 1588 // http://www.example.com/bar/*.
1589 // For this reason we do only a coarse check here to warn the extension 1589 // For this reason we do only a coarse check here to warn the extension
1590 // developer if he does something obviously wrong. 1590 // developer if he does something obviously wrong.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 } else if ((*it)->name().find("AdBlock") != std::string::npos) { 1771 } else if ((*it)->name().find("AdBlock") != std::string::npos) {
1772 adblock = true; 1772 adblock = true;
1773 } else { 1773 } else {
1774 other = true; 1774 other = true;
1775 } 1775 }
1776 } 1776 }
1777 } 1777 }
1778 1778
1779 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); 1779 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other));
1780 } 1780 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs.cc ('k') | chrome/browser/extensions/bundle_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698