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

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

Issue 555323002: Deprecate direct use of legacy extension management preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes addressing #12 Created 6 years, 3 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 unified diff | Download patch
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 "apps/app_load_service.h" 7 #include "apps/app_load_service.h"
8 #include "apps/saved_files_service.h" 8 #include "apps/saved_files_service.h"
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 management_policy_(NULL), 166 management_policy_(NULL),
167 ignore_notifications_(false), 167 ignore_notifications_(false),
168 deleting_rvh_(NULL), 168 deleting_rvh_(NULL),
169 deleting_rwh_id_(-1), 169 deleting_rwh_id_(-1),
170 deleting_rph_id_(-1), 170 deleting_rph_id_(-1),
171 registered_for_notifications_(false), 171 registered_for_notifications_(false),
172 warning_service_observer_(this), 172 warning_service_observer_(this),
173 error_console_observer_(this), 173 error_console_observer_(this),
174 extension_prefs_observer_(this), 174 extension_prefs_observer_(this),
175 extension_registry_observer_(this), 175 extension_registry_observer_(this),
176 extension_management_observer_(this),
176 should_do_verification_check_(false) { 177 should_do_verification_check_(false) {
177 } 178 }
178 179
179 ExtensionSettingsHandler::~ExtensionSettingsHandler() { 180 ExtensionSettingsHandler::~ExtensionSettingsHandler() {
180 } 181 }
181 182
182 ExtensionSettingsHandler::ExtensionSettingsHandler(ExtensionService* service, 183 ExtensionSettingsHandler::ExtensionSettingsHandler(ExtensionService* service,
183 ManagementPolicy* policy) 184 ManagementPolicy* policy)
184 : extension_service_(service), 185 : extension_service_(service),
185 management_policy_(policy), 186 management_policy_(policy),
186 ignore_notifications_(false), 187 ignore_notifications_(false),
187 deleting_rvh_(NULL), 188 deleting_rvh_(NULL),
188 deleting_rwh_id_(-1), 189 deleting_rwh_id_(-1),
189 deleting_rph_id_(-1), 190 deleting_rph_id_(-1),
190 registered_for_notifications_(false), 191 registered_for_notifications_(false),
191 warning_service_observer_(this), 192 warning_service_observer_(this),
192 error_console_observer_(this), 193 error_console_observer_(this),
193 extension_prefs_observer_(this), 194 extension_prefs_observer_(this),
194 extension_registry_observer_(this), 195 extension_registry_observer_(this),
196 extension_management_observer_(this),
195 should_do_verification_check_(false) { 197 should_do_verification_check_(false) {
196 } 198 }
197 199
198 // static 200 // static
199 void ExtensionSettingsHandler::RegisterProfilePrefs( 201 void ExtensionSettingsHandler::RegisterProfilePrefs(
200 user_prefs::PrefRegistrySyncable* registry) { 202 user_prefs::PrefRegistrySyncable* registry) {
201 registry->RegisterBooleanPref( 203 registry->RegisterBooleanPref(
202 prefs::kExtensionsUIDeveloperMode, 204 prefs::kExtensionsUIDeveloperMode,
203 false, 205 false,
204 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 206 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 const Extension* extension, 746 const Extension* extension,
745 extensions::UninstallReason reason) { 747 extensions::UninstallReason reason) {
746 MaybeUpdateAfterNotification(); 748 MaybeUpdateAfterNotification();
747 } 749 }
748 750
749 void ExtensionSettingsHandler::OnExtensionDisableReasonsChanged( 751 void ExtensionSettingsHandler::OnExtensionDisableReasonsChanged(
750 const std::string& extension_id, int disable_reasons) { 752 const std::string& extension_id, int disable_reasons) {
751 MaybeUpdateAfterNotification(); 753 MaybeUpdateAfterNotification();
752 } 754 }
753 755
756 void ExtensionSettingsHandler::OnExtensionManagementSettingsChanged() {
757 MaybeUpdateAfterNotification();
758 }
759
754 void ExtensionSettingsHandler::ExtensionUninstallAccepted() { 760 void ExtensionSettingsHandler::ExtensionUninstallAccepted() {
755 DCHECK(!extension_id_prompting_.empty()); 761 DCHECK(!extension_id_prompting_.empty());
756 762
757 bool was_terminated = false; 763 bool was_terminated = false;
758 764
759 // The extension can be uninstalled in another window while the UI was 765 // The extension can be uninstalled in another window while the UI was
760 // showing. Do nothing in that case. 766 // showing. Do nothing in that case.
761 const Extension* extension = 767 const Extension* extension =
762 extension_service_->GetExtensionById(extension_id_prompting_, true); 768 extension_service_->GetExtensionById(extension_id_prompting_, true);
763 if (!extension) { 769 if (!extension) {
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 1264
1259 extension_registry_observer_.Add(ExtensionRegistry::Get(profile)); 1265 extension_registry_observer_.Add(ExtensionRegistry::Get(profile));
1260 1266
1261 content::WebContentsObserver::Observe(web_ui()->GetWebContents()); 1267 content::WebContentsObserver::Observe(web_ui()->GetWebContents());
1262 1268
1263 warning_service_observer_.Add( 1269 warning_service_observer_.Add(
1264 ExtensionSystem::Get(profile)->warning_service()); 1270 ExtensionSystem::Get(profile)->warning_service());
1265 1271
1266 error_console_observer_.Add(ErrorConsole::Get(profile)); 1272 error_console_observer_.Add(ErrorConsole::Get(profile));
1267 1273
1268 base::Closure callback = base::Bind( 1274 extension_management_observer_.Add(
1269 &ExtensionSettingsHandler::MaybeUpdateAfterNotification, 1275 ExtensionManagementFactory::GetForBrowserContext(profile));
1270 AsWeakPtr());
1271
1272 pref_registrar_.Init(profile->GetPrefs());
1273 pref_registrar_.Add(pref_names::kInstallDenyList, callback);
1274 } 1276 }
1275 1277
1276 std::vector<ExtensionPage> 1278 std::vector<ExtensionPage>
1277 ExtensionSettingsHandler::GetInspectablePagesForExtension( 1279 ExtensionSettingsHandler::GetInspectablePagesForExtension(
1278 const Extension* extension, bool extension_is_enabled) { 1280 const Extension* extension, bool extension_is_enabled) {
1279 std::vector<ExtensionPage> result; 1281 std::vector<ExtensionPage> result;
1280 1282
1281 // Get the extension process's active views. 1283 // Get the extension process's active views.
1282 extensions::ProcessManager* process_manager = 1284 extensions::ProcessManager* process_manager =
1283 ExtensionSystem::Get(extension_service_->profile())->process_manager(); 1285 ExtensionSystem::Get(extension_service_->profile())->process_manager();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 extension_service_->EnableExtension(extension_id); 1416 extension_service_->EnableExtension(extension_id);
1415 } else { 1417 } else {
1416 ExtensionErrorReporter::GetInstance()->ReportError( 1418 ExtensionErrorReporter::GetInstance()->ReportError(
1417 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1419 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1418 true); // Be noisy. 1420 true); // Be noisy.
1419 } 1421 }
1420 requirements_checker_.reset(); 1422 requirements_checker_.reset();
1421 } 1423 }
1422 1424
1423 } // namespace extensions 1425 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/extensions/extension_settings_handler.h ('k') | extensions/browser/extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698