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

Unified Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.cc

Issue 1146693004: [Extensions] Move remaining notifications out of ExtensionSettingsHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/extensions/extension_settings_handler.cc
diff --git a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
index 4d718918878cf5cd37e1d615f6b8dacc5e57b852..be76abbe68ff45713156bb405d365a069ab779d4 100644
--- a/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
+++ b/chrome/browser/ui/webui/extensions/extension_settings_handler.cc
@@ -6,57 +6,29 @@
#include <vector>
-#include "base/auto_reset.h"
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/location.h"
-#include "base/message_loop/message_loop.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
-#include "base/version.h"
-#include "chrome/browser/background/background_contents.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/extensions/extension_management.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_ui_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/apps/app_info_dialog.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/extensions/app_launch_params.h"
-#include "chrome/browser/ui/extensions/application_launch.h"
-#include "chrome/browser/ui/webui/extensions/extension_basic_info.h"
-#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/google/core/browser/google_util.h"
#include "components/pref_registry/pref_registry_syncable.h"
-#include "content/public/browser/render_process_host.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
-#include "extensions/browser/api/device_permissions_manager.h"
-#include "extensions/browser/blacklist_state.h"
-#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
-#include "extensions/browser/management_policy.h"
-#include "extensions/browser/notification_types.h"
-#include "extensions/browser/pref_names.h"
-#include "extensions/browser/warning_set.h"
-#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
-#include "extensions/common/extension_icon_set.h"
#include "extensions/common/extension_set.h"
#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest.h"
-#include "extensions/common/permissions/permissions_data.h"
#include "grit/browser_resources.h"
#include "grit/components_strings.h"
#include "grit/theme_resources.h"
@@ -65,17 +37,8 @@
namespace extensions {
-///////////////////////////////////////////////////////////////////////////////
-//
-// ExtensionSettingsHandler
-//
-///////////////////////////////////////////////////////////////////////////////
-
ExtensionSettingsHandler::ExtensionSettingsHandler()
- : extension_service_(NULL),
- warning_service_observer_(this),
- extension_prefs_observer_(this),
- extension_management_observer_(this) {
+ : extension_service_(nullptr) {
}
ExtensionSettingsHandler::~ExtensionSettingsHandler() {
@@ -277,15 +240,6 @@ void ExtensionSettingsHandler::GetLocalizedValues(
l10n_util::GetStringUTF16(IDS_EXTENSIONS_ERROR_NO_CODE_TO_DISPLAY));
}
-void ExtensionSettingsHandler::RenderViewDeleted(
- content::RenderViewHost* render_view_host) {
- Profile* source_profile = Profile::FromBrowserContext(
- render_view_host->GetSiteInstance()->GetBrowserContext());
- if (!Profile::FromWebUI(web_ui())->IsSameProfile(source_profile))
- return;
- MaybeUpdateAfterNotification();
-}
-
void ExtensionSettingsHandler::DidStartNavigationToPendingEntry(
const GURL& url,
content::NavigationController::ReloadType reload_type) {
@@ -297,23 +251,10 @@ void ExtensionSettingsHandler::RegisterMessages() {
Profile* profile = Profile::FromWebUI(web_ui())->GetOriginalProfile();
extension_service_ =
extensions::ExtensionSystem::Get(profile)->extension_service();
-
- web_ui()->RegisterMessageCallback("extensionSettingsRegister",
- base::Bind(&ExtensionSettingsHandler::HandleRegisterMessage,
- AsWeakPtr()));
-}
-
-void ExtensionSettingsHandler::OnExtensionDisableReasonsChanged(
- const std::string& extension_id, int disable_reasons) {
- MaybeUpdateAfterNotification();
-}
-
-void ExtensionSettingsHandler::OnExtensionManagementSettingsChanged() {
- MaybeUpdateAfterNotification();
-}
-
-void ExtensionSettingsHandler::ExtensionWarningsChanged() {
- MaybeUpdateAfterNotification();
+ // Clear the preference for the ADT Promo before fully removing it.
+ // TODO(devlin): Take this out when everyone's been updated.
+ Profile::FromWebUI(web_ui())->GetPrefs()->ClearPref(
+ prefs::kExtensionsUIDismissedADTPromo);
}
void ExtensionSettingsHandler::ReloadUnpackedExtensions() {
@@ -332,29 +273,4 @@ void ExtensionSettingsHandler::ReloadUnpackedExtensions() {
}
}
-void ExtensionSettingsHandler::HandleRegisterMessage(
- const base::ListValue* args) {
- if (content::WebContentsObserver::web_contents())
- return; // Only register once.
-
- content::WebContentsObserver::Observe(web_ui()->GetWebContents());
-
- Profile* profile = Profile::FromWebUI(web_ui());
- warning_service_observer_.Add(WarningService::Get(profile));
- extension_management_observer_.Add(
- ExtensionManagementFactory::GetForBrowserContext(profile));
-
- // Clear the preference for the ADT Promo before fully removing it.
- // TODO(devlin): Take this out when everyone's been updated.
- profile->GetPrefs()->ClearPref(prefs::kExtensionsUIDismissedADTPromo);
-}
-
-void ExtensionSettingsHandler::MaybeUpdateAfterNotification() {
- content::WebContents* contents = web_ui()->GetWebContents();
- if (contents && contents->GetRenderViewHost()) {
- web_ui()->CallJavascriptFunction(
- "extensions.ExtensionSettings.onExtensionsChanged");
- }
-}
-
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698