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/ui/webui/extensions/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 const Extension* extension = | 607 const Extension* extension = |
608 extension_service_->GetInstalledExtension(extension_id); | 608 extension_service_->GetInstalledExtension(extension_id); |
609 if (!extension || | 609 if (!extension || |
610 !management_policy_->UserMayModifySettings(extension, NULL)) { | 610 !management_policy_->UserMayModifySettings(extension, NULL)) { |
611 LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable was" | 611 LOG(ERROR) << "Attempt to enable an extension that is non-usermanagable was" |
612 << "made. Extension id: " << extension->id(); | 612 << "made. Extension id: " << extension->id(); |
613 return; | 613 return; |
614 } | 614 } |
615 | 615 |
616 if (enable_str == "true") { | 616 if (enable_str == "true") { |
617 ExtensionPrefs* prefs = extension_service_->extension_prefs(); | 617 extensions::ExtensionPrefs* prefs = extension_service_->extension_prefs(); |
618 if (prefs->DidExtensionEscalatePermissions(extension_id)) { | 618 if (prefs->DidExtensionEscalatePermissions(extension_id)) { |
619 Browser* browser = browser::FindBrowserWithWebContents( | 619 Browser* browser = browser::FindBrowserWithWebContents( |
620 web_ui()->GetWebContents()); | 620 web_ui()->GetWebContents()); |
621 extensions::ShowExtensionDisabledDialog( | 621 extensions::ShowExtensionDisabledDialog( |
622 extension_service_, browser, extension); | 622 extension_service_, browser, extension); |
623 } else { | 623 } else { |
624 extension_service_->EnableExtension(extension_id); | 624 extension_service_->EnableExtension(extension_id); |
625 } | 625 } |
626 } else { | 626 } else { |
627 extension_service_->DisableExtension( | 627 extension_service_->DisableExtension( |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 content::NotificationService::AllBrowserContextsAndSources()); | 785 content::NotificationService::AllBrowserContextsAndSources()); |
786 registrar_.Add(this, | 786 registrar_.Add(this, |
787 chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, | 787 chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, |
788 content::NotificationService::AllBrowserContextsAndSources()); | 788 content::NotificationService::AllBrowserContextsAndSources()); |
789 registrar_.Add(this, | 789 registrar_.Add(this, |
790 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, | 790 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, |
791 content::NotificationService::AllBrowserContextsAndSources()); | 791 content::NotificationService::AllBrowserContextsAndSources()); |
792 registrar_.Add( | 792 registrar_.Add( |
793 this, | 793 this, |
794 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, | 794 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, |
795 content::Source<ExtensionPrefs>(profile->GetExtensionService()-> | 795 content::Source<extensions::ExtensionPrefs>( |
796 extension_prefs())); | 796 profile->GetExtensionService()->extension_prefs())); |
797 | 797 |
798 pref_registrar_.Init(profile->GetPrefs()); | 798 pref_registrar_.Init(profile->GetPrefs()); |
799 pref_registrar_.Add(prefs::kExtensionInstallDenyList, this); | 799 pref_registrar_.Add(prefs::kExtensionInstallDenyList, this); |
800 local_state_pref_registrar_.Init(g_browser_process->local_state()); | 800 local_state_pref_registrar_.Init(g_browser_process->local_state()); |
801 local_state_pref_registrar_.Add(prefs::kInManagedMode, this); | 801 local_state_pref_registrar_.Add(prefs::kInManagedMode, this); |
802 } | 802 } |
803 | 803 |
804 std::vector<ExtensionPage> | 804 std::vector<ExtensionPage> |
805 ExtensionSettingsHandler::GetInspectablePagesForExtension( | 805 ExtensionSettingsHandler::GetInspectablePagesForExtension( |
806 const Extension* extension, bool extension_is_enabled) { | 806 const Extension* extension, bool extension_is_enabled) { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 return extension_uninstall_dialog_.get(); | 873 return extension_uninstall_dialog_.get(); |
874 #else | 874 #else |
875 return NULL; | 875 return NULL; |
876 #endif // !defined(OS_ANDROID) | 876 #endif // !defined(OS_ANDROID) |
877 } | 877 } |
878 | 878 |
879 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { | 879 void ExtensionSettingsHandler::InspectExtensionHost(ExtensionHost* host) { |
880 if (host) | 880 if (host) |
881 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); | 881 DevToolsWindow::OpenDevToolsWindow(host->render_view_host()); |
882 } | 882 } |
OLD | NEW |