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

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

Issue 314113010: Remove deprecated permissions functions from Extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/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/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 2196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2207 ipc_sender.get() ? ipc_sender->render_process_id() : -1; 2207 ipc_sender.get() ? ipc_sender->render_process_id() : -1;
2208 2208
2209 const Extension* extension = 2209 const Extension* extension =
2210 extension_info_map()->extensions().GetByID(extension_id()); 2210 extension_info_map()->extensions().GetByID(extension_id());
2211 std::string extension_name = extension ? extension->name() : extension_id(); 2211 std::string extension_name = extension ? extension->name() : extension_id();
2212 2212
2213 bool is_web_view_guest = webview_instance_id != 0; 2213 bool is_web_view_guest = webview_instance_id != 0;
2214 // We check automatically whether the extension has the 'webRequest' 2214 // We check automatically whether the extension has the 'webRequest'
2215 // permission. For blocking calls we require the additional permission 2215 // permission. For blocking calls we require the additional permission
2216 // 'webRequestBlocking'. 2216 // 'webRequestBlocking'.
2217 if ((!is_web_view_guest && extra_info_spec & 2217 if ((!is_web_view_guest &&
2218 (ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING | 2218 extra_info_spec &
2219 ExtensionWebRequestEventRouter::ExtraInfoSpec::ASYNC_BLOCKING)) && 2219 (ExtensionWebRequestEventRouter::ExtraInfoSpec::BLOCKING |
2220 !extension->HasAPIPermission( 2220 ExtensionWebRequestEventRouter::ExtraInfoSpec::ASYNC_BLOCKING)) &&
2221 extensions::APIPermission::kWebRequestBlocking)) { 2221 !extension->permissions_data()->HasAPIPermission(
2222 extensions::APIPermission::kWebRequestBlocking)) {
2222 error_ = keys::kBlockingPermissionRequired; 2223 error_ = keys::kBlockingPermissionRequired;
2223 return false; 2224 return false;
2224 } 2225 }
2225 2226
2226 // We allow to subscribe to patterns that are broader than the host 2227 // We allow to subscribe to patterns that are broader than the host
2227 // permissions. E.g., we could subscribe to http://www.example.com/* 2228 // permissions. E.g., we could subscribe to http://www.example.com/*
2228 // while having host permissions for http://www.example.com/foo/* and 2229 // while having host permissions for http://www.example.com/foo/* and
2229 // http://www.example.com/bar/*. 2230 // http://www.example.com/bar/*.
2230 // For this reason we do only a coarse check here to warn the extension 2231 // For this reason we do only a coarse check here to warn the extension
2231 // developer if he does something obviously wrong. 2232 // developer if he does something obviously wrong.
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 } else if ((*it)->name().find("AdBlock") != std::string::npos) { 2473 } else if ((*it)->name().find("AdBlock") != std::string::npos) {
2473 adblock = true; 2474 adblock = true;
2474 } else { 2475 } else {
2475 other = true; 2476 other = true;
2476 } 2477 }
2477 } 2478 }
2478 } 2479 }
2479 2480
2480 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); 2481 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other));
2481 } 2482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698