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

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

Issue 14651017: Move RuntimeData and related permissions out of Extension class (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_permissions
Patch Set: Latest master Created 7 years, 7 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/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 25 matching lines...) Expand all
36 #include "chrome/browser/extensions/extension_warning_service.h" 36 #include "chrome/browser/extensions/extension_warning_service.h"
37 #include "chrome/browser/extensions/extension_warning_set.h" 37 #include "chrome/browser/extensions/extension_warning_set.h"
38 #include "chrome/browser/profiles/profile.h" 38 #include "chrome/browser/profiles/profile.h"
39 #include "chrome/browser/profiles/profile_manager.h" 39 #include "chrome/browser/profiles/profile_manager.h"
40 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" 40 #include "chrome/browser/renderer_host/chrome_render_message_filter.h"
41 #include "chrome/common/extensions/api/web_request.h" 41 #include "chrome/common/extensions/api/web_request.h"
42 #include "chrome/common/extensions/extension.h" 42 #include "chrome/common/extensions/extension.h"
43 #include "chrome/common/extensions/extension_constants.h" 43 #include "chrome/common/extensions/extension_constants.h"
44 #include "chrome/common/extensions/extension_messages.h" 44 #include "chrome/common/extensions/extension_messages.h"
45 #include "chrome/common/extensions/features/feature.h" 45 #include "chrome/common/extensions/features/feature.h"
46 #include "chrome/common/extensions/permissions/permissions_data.h"
46 #include "chrome/common/url_constants.h" 47 #include "chrome/common/url_constants.h"
47 #include "content/public/browser/browser_message_filter.h" 48 #include "content/public/browser/browser_message_filter.h"
48 #include "content/public/browser/browser_thread.h" 49 #include "content/public/browser/browser_thread.h"
49 #include "content/public/browser/render_process_host.h" 50 #include "content/public/browser/render_process_host.h"
50 #include "content/public/browser/resource_request_info.h" 51 #include "content/public/browser/resource_request_info.h"
51 #include "extensions/common/error_utils.h" 52 #include "extensions/common/error_utils.h"
52 #include "extensions/common/event_filtering_info.h" 53 #include "extensions/common/event_filtering_info.h"
53 #include "extensions/common/url_pattern.h" 54 #include "extensions/common/url_pattern.h"
54 #include "googleurl/src/gurl.h" 55 #include "googleurl/src/gurl.h"
55 #include "grit/generated_resources.h" 56 #include "grit/generated_resources.h"
(...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 error_ = keys::kBlockingPermissionRequired; 1991 error_ = keys::kBlockingPermissionRequired;
1991 return false; 1992 return false;
1992 } 1993 }
1993 1994
1994 // We allow to subscribe to patterns that are broader than the host 1995 // We allow to subscribe to patterns that are broader than the host
1995 // permissions. E.g., we could subscribe to http://www.example.com/* 1996 // permissions. E.g., we could subscribe to http://www.example.com/*
1996 // while having host permissions for http://www.example.com/foo/* and 1997 // while having host permissions for http://www.example.com/foo/* and
1997 // http://www.example.com/bar/*. 1998 // http://www.example.com/bar/*.
1998 // For this reason we do only a coarse check here to warn the extension 1999 // For this reason we do only a coarse check here to warn the extension
1999 // developer if he does something obviously wrong. 2000 // developer if he does something obviously wrong.
2000 if (extension->GetEffectiveHostPermissions().is_empty()) { 2001 if (extensions::PermissionsData::GetEffectiveHostPermissions(
2002 extension).is_empty()) {
2001 error_ = keys::kHostPermissionsRequired; 2003 error_ = keys::kHostPermissionsRequired;
2002 return false; 2004 return false;
2003 } 2005 }
2004 2006
2005 bool success = 2007 bool success =
2006 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener( 2008 ExtensionWebRequestEventRouter::GetInstance()->AddEventListener(
2007 profile_id(), extension_id(), extension_name, 2009 profile_id(), extension_id(), extension_name,
2008 event_name, sub_event_name, filter, 2010 event_name, sub_event_name, filter,
2009 extra_info_spec, -1, -1, ipc_sender_weak()); 2011 extra_info_spec, -1, -1, ipc_sender_weak());
2010 EXTENSION_FUNCTION_VALIDATE(success); 2012 EXTENSION_FUNCTION_VALIDATE(success);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 } else if ((*it)->name().find("AdBlock") != std::string::npos) { 2181 } else if ((*it)->name().find("AdBlock") != std::string::npos) {
2180 adblock = true; 2182 adblock = true;
2181 } else { 2183 } else {
2182 other = true; 2184 other = true;
2183 } 2185 }
2184 } 2186 }
2185 } 2187 }
2186 2188
2187 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); 2189 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other));
2188 } 2190 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/usb/usb_api.cc ('k') | chrome/browser/extensions/api/web_request/web_request_permissions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698