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

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

Issue 481433005: Extensions: Move id_util functions to crx_file component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert last patchset. function returns Extension* and can't use an assert. Created 6 years, 4 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"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "chrome/browser/extensions/active_tab_permission_granter.h" 12 #include "chrome/browser/extensions/active_tab_permission_granter.h"
13 #include "chrome/browser/extensions/extension_action.h" 13 #include "chrome/browser/extensions/extension_action.h"
14 #include "chrome/browser/extensions/extension_action_manager.h" 14 #include "chrome/browser/extensions/extension_action_manager.h"
15 #include "chrome/browser/extensions/extension_util.h" 15 #include "chrome/browser/extensions/extension_util.h"
16 #include "chrome/browser/extensions/location_bar_controller.h" 16 #include "chrome/browser/extensions/location_bar_controller.h"
17 #include "chrome/browser/extensions/permissions_updater.h" 17 #include "chrome/browser/extensions/permissions_updater.h"
18 #include "chrome/browser/extensions/tab_helper.h" 18 #include "chrome/browser/extensions/tab_helper.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/sessions/session_tab_helper.h" 20 #include "chrome/browser/sessions/session_tab_helper.h"
21 #include "chrome/common/extensions/api/extension_action/action_info.h" 21 #include "chrome/common/extensions/api/extension_action/action_info.h"
22 #include "components/crx_file/id_util.h"
22 #include "content/public/browser/navigation_controller.h" 23 #include "content/public/browser/navigation_controller.h"
23 #include "content/public/browser/navigation_entry.h" 24 #include "content/public/browser/navigation_entry.h"
24 #include "content/public/browser/render_view_host.h" 25 #include "content/public/browser/render_view_host.h"
25 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
26 #include "extensions/browser/extension_registry.h" 27 #include "extensions/browser/extension_registry.h"
27 #include "extensions/common/extension.h" 28 #include "extensions/common/extension.h"
28 #include "extensions/common/extension_messages.h" 29 #include "extensions/common/extension_messages.h"
29 #include "extensions/common/extension_set.h" 30 #include "extensions/common/extension_set.h"
30 #include "extensions/common/feature_switch.h" 31 #include "extensions/common/feature_switch.h"
31 #include "extensions/common/manifest.h" 32 #include "extensions/common/manifest.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 263 }
263 264
264 // Inform the location bar that the action is now gone. 265 // Inform the location bar that the action is now gone.
265 LocationBarController::NotifyChange(web_contents()); 266 LocationBarController::NotifyChange(web_contents());
266 } 267 }
267 268
268 void ActiveScriptController::OnRequestScriptInjectionPermission( 269 void ActiveScriptController::OnRequestScriptInjectionPermission(
269 const std::string& extension_id, 270 const std::string& extension_id,
270 UserScript::InjectionType script_type, 271 UserScript::InjectionType script_type,
271 int64 request_id) { 272 int64 request_id) {
272 if (!Extension::IdIsValid(extension_id)) { 273 if (!crx_file::id_util::IdIsValid(extension_id)) {
273 NOTREACHED() << "'" << extension_id << "' is not a valid id."; 274 NOTREACHED() << "'" << extension_id << "' is not a valid id.";
274 return; 275 return;
275 } 276 }
276 277
277 const Extension* extension = 278 const Extension* extension =
278 ExtensionRegistry::Get(web_contents()->GetBrowserContext()) 279 ExtensionRegistry::Get(web_contents()->GetBrowserContext())
279 ->enabled_extensions().GetByID(extension_id); 280 ->enabled_extensions().GetByID(extension_id);
280 // We shouldn't allow extensions which are no longer enabled to run any 281 // We shouldn't allow extensions which are no longer enabled to run any
281 // scripts. Ignore the request. 282 // scripts. Ignore the request.
282 if (!extension) 283 if (!extension)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 UMA_HISTOGRAM_COUNTS_100( 347 UMA_HISTOGRAM_COUNTS_100(
347 "Extensions.ActiveScriptController.PermittedExtensions", 348 "Extensions.ActiveScriptController.PermittedExtensions",
348 permitted_extensions_.size()); 349 permitted_extensions_.size());
349 UMA_HISTOGRAM_COUNTS_100( 350 UMA_HISTOGRAM_COUNTS_100(
350 "Extensions.ActiveScriptController.DeniedExtensions", 351 "Extensions.ActiveScriptController.DeniedExtensions",
351 pending_requests_.size()); 352 pending_requests_.size());
352 } 353 }
353 } 354 }
354 355
355 } // namespace extensions 356 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698