| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 } | 278 } |
| 279 | 279 |
| 280 void ExtensionSettingsHandler::RegisterMessages() { | 280 void ExtensionSettingsHandler::RegisterMessages() { |
| 281 Profile* profile = Profile::FromWebUI(web_ui())->GetOriginalProfile(); | 281 Profile* profile = Profile::FromWebUI(web_ui())->GetOriginalProfile(); |
| 282 extension_service_ = | 282 extension_service_ = |
| 283 extensions::ExtensionSystem::Get(profile)->extension_service(); | 283 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 284 // Clear the preference for the ADT Promo before fully removing it. | 284 // Clear the preference for the ADT Promo before fully removing it. |
| 285 // TODO(devlin): Take this out when everyone's been updated. | 285 // TODO(devlin): Take this out when everyone's been updated. |
| 286 Profile::FromWebUI(web_ui())->GetPrefs()->ClearPref( | 286 Profile::FromWebUI(web_ui())->GetPrefs()->ClearPref( |
| 287 prefs::kExtensionsUIDismissedADTPromo); | 287 prefs::kExtensionsUIDismissedADTPromo); |
| 288 |
| 289 content::WebContentsObserver::Observe(web_ui()->GetWebContents()); |
| 288 } | 290 } |
| 289 | 291 |
| 290 void ExtensionSettingsHandler::ReloadUnpackedExtensions() { | 292 void ExtensionSettingsHandler::ReloadUnpackedExtensions() { |
| 291 ExtensionRegistry* registry = | 293 ExtensionRegistry* registry = |
| 292 ExtensionRegistry::Get(extension_service_->profile()); | 294 ExtensionRegistry::Get(extension_service_->profile()); |
| 293 std::vector<const Extension*> unpacked_extensions; | 295 std::vector<const Extension*> unpacked_extensions; |
| 294 for (const scoped_refptr<const extensions::Extension>& extension : | 296 for (const scoped_refptr<const extensions::Extension>& extension : |
| 295 registry->enabled_extensions()) { | 297 registry->enabled_extensions()) { |
| 296 if (Manifest::IsUnpackedLocation(extension->location())) | 298 if (Manifest::IsUnpackedLocation(extension->location())) |
| 297 unpacked_extensions.push_back(extension.get()); | 299 unpacked_extensions.push_back(extension.get()); |
| 298 } | 300 } |
| 299 | 301 |
| 300 for (std::vector<const Extension*>::iterator iter = | 302 for (std::vector<const Extension*>::iterator iter = |
| 301 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) { | 303 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) { |
| 302 extension_service_->ReloadExtensionWithQuietFailure((*iter)->id()); | 304 extension_service_->ReloadExtensionWithQuietFailure((*iter)->id()); |
| 303 } | 305 } |
| 304 } | 306 } |
| 305 | 307 |
| 306 } // namespace extensions | 308 } // namespace extensions |
| OLD | NEW |