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

Side by Side Diff: chrome/browser/extensions/active_script_controller.cc

Issue 309533007: Refactor PermissionsData pt1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest master 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/active_script_controller.h" 5 #include "chrome/browser/extensions/active_script_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 LocationBarController* location_bar_controller = 66 LocationBarController* location_bar_controller =
67 tab_helper->location_bar_controller(); 67 tab_helper->location_bar_controller();
68 // This should never be NULL. 68 // This should never be NULL.
69 DCHECK(location_bar_controller); 69 DCHECK(location_bar_controller);
70 return location_bar_controller->active_script_controller(); 70 return location_bar_controller->active_script_controller();
71 } 71 }
72 72
73 bool ActiveScriptController::RequiresUserConsentForScriptInjection( 73 bool ActiveScriptController::RequiresUserConsentForScriptInjection(
74 const Extension* extension) { 74 const Extension* extension) {
75 CHECK(extension); 75 CHECK(extension);
76 if (!PermissionsData::RequiresActionForScriptExecution( 76 if (!PermissionsData::ForExtension(extension)
77 extension, 77 ->RequiresActionForScriptExecution(
78 SessionID::IdForTab(web_contents()), 78 extension,
79 web_contents()->GetVisibleURL()) || 79 SessionID::IdForTab(web_contents()),
80 web_contents()->GetVisibleURL()) ||
80 util::AllowedScriptingOnAllUrls(extension->id(), 81 util::AllowedScriptingOnAllUrls(extension->id(),
81 web_contents()->GetBrowserContext())) { 82 web_contents()->GetBrowserContext())) {
82 return false; 83 return false;
83 } 84 }
84 85
85 // If the feature is not enabled, we automatically allow all extensions to 86 // If the feature is not enabled, we automatically allow all extensions to
86 // run scripts. 87 // run scripts.
87 if (!enabled_) 88 if (!enabled_)
88 permitted_extensions_.insert(extension->id()); 89 permitted_extensions_.insert(extension->id());
89 90
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 UMA_HISTOGRAM_COUNTS_100( 291 UMA_HISTOGRAM_COUNTS_100(
291 "Extensions.ActiveScriptController.PermittedExtensions", 292 "Extensions.ActiveScriptController.PermittedExtensions",
292 permitted_extensions_.size()); 293 permitted_extensions_.size());
293 UMA_HISTOGRAM_COUNTS_100( 294 UMA_HISTOGRAM_COUNTS_100(
294 "Extensions.ActiveScriptController.DeniedExtensions", 295 "Extensions.ActiveScriptController.DeniedExtensions",
295 pending_requests_.size()); 296 pending_requests_.size());
296 } 297 }
297 } 298 }
298 299
299 } // namespace extensions 300 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/extensions/active_tab_permission_granter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698