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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.cc

Issue 1536213002: [Extension UI] Observing WebContentsObserver from extension_settings_handler.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« 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/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
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
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