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

Side by Side Diff: chrome/browser/extensions/api/developer_private/developer_private_api.cc

Issue 23496030: [Coverity] Extension pointer can be null in the if clause, so we should rely on extension_id (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/developer_private/developer_private_api. h" 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api. h"
6 6
7 #include "apps/app_load_service.h" 7 #include "apps/app_load_service.h"
8 #include "apps/app_restore_service.h" 8 #include "apps/app_restore_service.h"
9 #include "apps/saved_files_service.h" 9 #include "apps/saved_files_service.h"
10 #include "apps/shell_window.h" 10 #include "apps/shell_window.h"
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 std::string extension_id = params->item_id; 646 std::string extension_id = params->item_id;
647 647
648 ExtensionSystem* system = ExtensionSystem::Get(profile()); 648 ExtensionSystem* system = ExtensionSystem::Get(profile());
649 ManagementPolicy* management_policy = system->management_policy(); 649 ManagementPolicy* management_policy = system->management_policy();
650 ExtensionService* service = profile()->GetExtensionService(); 650 ExtensionService* service = profile()->GetExtensionService();
651 651
652 const Extension* extension = service->GetInstalledExtension(extension_id); 652 const Extension* extension = service->GetInstalledExtension(extension_id);
653 if (!extension || 653 if (!extension ||
654 !management_policy->UserMayModifySettings(extension, NULL)) { 654 !management_policy->UserMayModifySettings(extension, NULL)) {
655 LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable " 655 LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable "
656 "was made. Extension id: " << extension->id(); 656 "was made. Extension id: " << extension_id.c_str();
657 return false; 657 return false;
658 } 658 }
659 659
660 if (params->enable) { 660 if (params->enable) {
661 ExtensionPrefs* prefs = service->extension_prefs(); 661 ExtensionPrefs* prefs = service->extension_prefs();
662 if (prefs->DidExtensionEscalatePermissions(extension_id)) { 662 if (prefs->DidExtensionEscalatePermissions(extension_id)) {
663 ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile()); 663 ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile());
664 CHECK(registry); 664 CHECK(registry);
665 ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost( 665 ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
666 render_view_host()); 666 render_view_host());
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 return true; 1278 return true;
1279 } 1279 }
1280 1280
1281 DeveloperPrivateIsProfileManagedFunction:: 1281 DeveloperPrivateIsProfileManagedFunction::
1282 ~DeveloperPrivateIsProfileManagedFunction() { 1282 ~DeveloperPrivateIsProfileManagedFunction() {
1283 } 1283 }
1284 1284
1285 } // namespace api 1285 } // namespace api
1286 1286
1287 } // namespace extensions 1287 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698