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

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

Issue 309533007: Refactor PermissionsData pt1 (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 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2223 return false; 2223 return false;
2224 } 2224 }
2225 2225
2226 // We allow to subscribe to patterns that are broader than the host 2226 // We allow to subscribe to patterns that are broader than the host
2227 // permissions. E.g., we could subscribe to http://www.example.com/* 2227 // permissions. E.g., we could subscribe to http://www.example.com/*
2228 // while having host permissions for http://www.example.com/foo/* and 2228 // while having host permissions for http://www.example.com/foo/* and
2229 // http://www.example.com/bar/*. 2229 // http://www.example.com/bar/*.
2230 // For this reason we do only a coarse check here to warn the extension 2230 // For this reason we do only a coarse check here to warn the extension
2231 // developer if he does something obviously wrong. 2231 // developer if he does something obviously wrong.
2232 if (!is_web_view_guest && 2232 if (!is_web_view_guest &&
2233 extensions::PermissionsData::GetEffectiveHostPermissions( 2233 extensions::PermissionsData::ForExtension(extension)
2234 extension).is_empty()) { 2234 ->GetEffectiveHostPermissions()
2235 .is_empty()) {
2235 error_ = keys::kHostPermissionsRequired; 2236 error_ = keys::kHostPermissionsRequired;
2236 return false; 2237 return false;
2237 } 2238 }
2238 2239
2239 bool success = 2240 bool success =
2240 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( 2241 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
2241 profile_id(), extension_id(), extension_name, 2242 profile_id(), extension_id(), extension_name,
2242 event_name, sub_event_name, filter, extra_info_spec, 2243 event_name, sub_event_name, filter, extra_info_spec,
2243 embedder_process_id, webview_instance_id, ipc_sender_weak()); 2244 embedder_process_id, webview_instance_id, ipc_sender_weak());
2244 EXTENSION_FUNCTION_VALIDATE(success); 2245 EXTENSION_FUNCTION_VALIDATE(success);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2473 } else if ((*it)->name().find("AdBlock") != std::string::npos) { 2474 } else if ((*it)->name().find("AdBlock") != std::string::npos) {
2474 adblock = true; 2475 adblock = true;
2475 } else { 2476 } else {
2476 other = true; 2477 other = true;
2477 } 2478 }
2478 } 2479 }
2479 } 2480 }
2480 2481
2481 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); 2482 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other));
2482 } 2483 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698