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

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

Issue 10649003: 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 on HEAD 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 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 extension_info_map()->extensions().GetByID(extension_id()); 1567 extension_info_map()->extensions().GetByID(extension_id());
1568 std::string extension_name = extension ? extension->name() : extension_id(); 1568 std::string extension_name = extension ? extension->name() : extension_id();
1569 1569
1570 // We check automatically whether the extension has the 'webRequest' 1570 // We check automatically whether the extension has the 'webRequest'
1571 // permission. For blocking calls we require the additional permission 1571 // permission. For blocking calls we require the additional permission
1572 // 'webRequestBlocking'. 1572 // 'webRequestBlocking'.
1573 if ((extra_info_spec & 1573 if ((extra_info_spec &
1574 (ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING | 1574 (ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING |
1575 ExtensionWebRequestEventRouter::ExtraInfoSpec::ASYNC_BLOCKING)) && 1575 ExtensionWebRequestEventRouter::ExtraInfoSpec::ASYNC_BLOCKING)) &&
1576 !extension->HasAPIPermission( 1576 !extension->HasAPIPermission(
1577 ExtensionAPIPermission::kWebRequestBlocking)) { 1577 extensions::APIPermission::kWebRequestBlocking)) {
1578 error_ = keys::kBlockingPermissionRequired; 1578 error_ = keys::kBlockingPermissionRequired;
1579 return false; 1579 return false;
1580 } 1580 }
1581 1581
1582 // We allow to subscribe to patterns that are broader than the host 1582 // We allow to subscribe to patterns that are broader than the host
1583 // permissions. E.g., we could subscribe to http://www.example.com/* 1583 // permissions. E.g., we could subscribe to http://www.example.com/*
1584 // while having host permissions for http://www.example.com/foo/* and 1584 // while having host permissions for http://www.example.com/foo/* and
1585 // http://www.example.com/bar/*. 1585 // http://www.example.com/bar/*.
1586 // For this reason we do only a coarse check here to warn the extension 1586 // For this reason we do only a coarse check here to warn the extension
1587 // developer if he does something obviously wrong. 1587 // developer if he does something obviously wrong.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 } else if ((*it)->name().find("AdBlock") != std::string::npos) { 1768 } else if ((*it)->name().find("AdBlock") != std::string::npos) {
1769 adblock = true; 1769 adblock = true;
1770 } else { 1770 } else {
1771 other = true; 1771 other = true;
1772 } 1772 }
1773 } 1773 }
1774 } 1774 }
1775 1775
1776 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); 1776 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other));
1777 } 1777 }
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