OLD | NEW |
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/app_window.h" | 9 #include "apps/app_window.h" |
10 #include "apps/app_window_registry.h" | 10 #include "apps/app_window_registry.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/common/extensions/manifest_url_handler.h" | 44 #include "chrome/common/extensions/manifest_url_handler.h" |
45 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
46 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
47 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
48 #include "content/public/browser/render_process_host.h" | 48 #include "content/public/browser/render_process_host.h" |
49 #include "content/public/browser/render_view_host.h" | 49 #include "content/public/browser/render_view_host.h" |
50 #include "content/public/browser/site_instance.h" | 50 #include "content/public/browser/site_instance.h" |
51 #include "content/public/browser/storage_partition.h" | 51 #include "content/public/browser/storage_partition.h" |
52 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
53 #include "extensions/browser/extension_error.h" | 53 #include "extensions/browser/extension_error.h" |
| 54 #include "extensions/browser/extension_prefs.h" |
54 #include "extensions/browser/extension_registry.h" | 55 #include "extensions/browser/extension_registry.h" |
55 #include "extensions/browser/extension_system.h" | 56 #include "extensions/browser/extension_system.h" |
56 #include "extensions/browser/management_policy.h" | 57 #include "extensions/browser/management_policy.h" |
57 #include "extensions/browser/view_type_utils.h" | 58 #include "extensions/browser/view_type_utils.h" |
58 #include "extensions/common/constants.h" | 59 #include "extensions/common/constants.h" |
59 #include "extensions/common/extension_resource.h" | 60 #include "extensions/common/extension_resource.h" |
60 #include "extensions/common/extension_set.h" | 61 #include "extensions/common/extension_set.h" |
61 #include "extensions/common/install_warning.h" | 62 #include "extensions/common/install_warning.h" |
62 #include "extensions/common/manifest_handlers/background_info.h" | 63 #include "extensions/common/manifest_handlers/background_info.h" |
63 #include "extensions/common/manifest_handlers/incognito_info.h" | 64 #include "extensions/common/manifest_handlers/incognito_info.h" |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 bool enable = params->enable; | 776 bool enable = params->enable; |
776 if (!policy->UserMayModifySettings(extension, NULL) || | 777 if (!policy->UserMayModifySettings(extension, NULL) || |
777 (!enable && policy->MustRemainEnabled(extension, NULL)) || | 778 (!enable && policy->MustRemainEnabled(extension, NULL)) || |
778 (enable && policy->MustRemainDisabled(extension, NULL, NULL))) { | 779 (enable && policy->MustRemainDisabled(extension, NULL, NULL))) { |
779 LOG(ERROR) << "Attempt to change enable state denied by management policy. " | 780 LOG(ERROR) << "Attempt to change enable state denied by management policy. " |
780 << "Extension id: " << extension_id.c_str(); | 781 << "Extension id: " << extension_id.c_str(); |
781 return false; | 782 return false; |
782 } | 783 } |
783 | 784 |
784 if (enable) { | 785 if (enable) { |
785 ExtensionPrefs* prefs = service->extension_prefs(); | 786 ExtensionPrefs* prefs = ExtensionPrefs::Get(GetProfile()); |
786 if (prefs->DidExtensionEscalatePermissions(extension_id)) { | 787 if (prefs->DidExtensionEscalatePermissions(extension_id)) { |
787 AppWindowRegistry* registry = AppWindowRegistry::Get(GetProfile()); | 788 AppWindowRegistry* registry = AppWindowRegistry::Get(GetProfile()); |
788 CHECK(registry); | 789 CHECK(registry); |
789 AppWindow* app_window = | 790 AppWindow* app_window = |
790 registry->GetAppWindowForRenderViewHost(render_view_host()); | 791 registry->GetAppWindowForRenderViewHost(render_view_host()); |
791 if (!app_window) { | 792 if (!app_window) { |
792 return false; | 793 return false; |
793 } | 794 } |
794 | 795 |
795 ShowExtensionDisabledDialog( | 796 ShowExtensionDisabledDialog( |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 } | 1343 } |
1343 | 1344 |
1344 error_ui_util::HandleOpenDevTools(dict); | 1345 error_ui_util::HandleOpenDevTools(dict); |
1345 | 1346 |
1346 return true; | 1347 return true; |
1347 } | 1348 } |
1348 | 1349 |
1349 } // namespace api | 1350 } // namespace api |
1350 | 1351 |
1351 } // namespace extensions | 1352 } // namespace extensions |
OLD | NEW |