| 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" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "base/version.h" | 17 #include "base/version.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/debugger/devtools_window.h" | 19 #include "chrome/browser/debugger/devtools_window.h" |
| 20 #include "chrome/browser/extensions/crx_installer.h" | 20 #include "chrome/browser/extensions/crx_installer.h" |
| 21 #include "chrome/browser/extensions/extension_disabled_ui.h" | 21 #include "chrome/browser/extensions/extension_disabled_ui.h" |
| 22 #include "chrome/browser/extensions/extension_error_reporter.h" | 22 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 23 #include "chrome/browser/extensions/extension_host.h" | 23 #include "chrome/browser/extensions/extension_host.h" |
| 24 #include "chrome/browser/extensions/extension_service.h" | 24 #include "chrome/browser/extensions/extension_service.h" |
| 25 #include "chrome/browser/extensions/extension_system.h" | 25 #include "chrome/browser/extensions/extension_system.h" |
| 26 #include "chrome/browser/extensions/extension_warning_set.h" | |
| 27 #include "chrome/browser/extensions/lazy_background_task_queue.h" | 26 #include "chrome/browser/extensions/lazy_background_task_queue.h" |
| 28 #include "chrome/browser/extensions/shell_window_registry.h" | 27 #include "chrome/browser/extensions/shell_window_registry.h" |
| 29 #include "chrome/browser/extensions/unpacked_installer.h" | 28 #include "chrome/browser/extensions/unpacked_installer.h" |
| 30 #include "chrome/browser/extensions/updater/extension_updater.h" | 29 #include "chrome/browser/extensions/updater/extension_updater.h" |
| 31 #include "chrome/browser/google/google_util.h" | 30 #include "chrome/browser/google/google_util.h" |
| 32 #include "chrome/browser/managed_mode.h" | 31 #include "chrome/browser/managed_mode.h" |
| 33 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
| 34 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
| 35 #include "chrome/browser/tab_contents/background_contents.h" | 34 #include "chrome/browser/tab_contents/background_contents.h" |
| 36 #include "chrome/browser/ui/browser_finder.h" | 35 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 59 #include "grit/chromium_strings.h" | 58 #include "grit/chromium_strings.h" |
| 60 #include "grit/generated_resources.h" | 59 #include "grit/generated_resources.h" |
| 61 #include "grit/theme_resources.h" | 60 #include "grit/theme_resources.h" |
| 62 #include "ui/base/l10n/l10n_util.h" | 61 #include "ui/base/l10n/l10n_util.h" |
| 63 #include "ui/base/resource/resource_bundle.h" | 62 #include "ui/base/resource/resource_bundle.h" |
| 64 | 63 |
| 65 using content::RenderViewHost; | 64 using content::RenderViewHost; |
| 66 using content::WebContents; | 65 using content::WebContents; |
| 67 using extensions::Extension; | 66 using extensions::Extension; |
| 68 using extensions::ExtensionUpdater; | 67 using extensions::ExtensionUpdater; |
| 68 using extensions::ExtensionWarning; |
| 69 using extensions::ManagementPolicy; | 69 using extensions::ManagementPolicy; |
| 70 | 70 |
| 71 /////////////////////////////////////////////////////////////////////////////// | 71 /////////////////////////////////////////////////////////////////////////////// |
| 72 // | 72 // |
| 73 // ExtensionSettingsHandler | 73 // ExtensionSettingsHandler |
| 74 // | 74 // |
| 75 /////////////////////////////////////////////////////////////////////////////// | 75 /////////////////////////////////////////////////////////////////////////////// |
| 76 | 76 |
| 77 ExtensionSettingsHandler::ExtensionSettingsHandler() | 77 ExtensionSettingsHandler::ExtensionSettingsHandler() |
| 78 : extension_service_(NULL), | 78 : extension_service_(NULL), |
| 79 management_policy_(NULL), | 79 management_policy_(NULL), |
| 80 ignore_notifications_(false), | 80 ignore_notifications_(false), |
| 81 deleting_rvh_(NULL), | 81 deleting_rvh_(NULL), |
| 82 registered_for_notifications_(false) { | 82 registered_for_notifications_(false) { |
| 83 } | 83 } |
| 84 | 84 |
| 85 ExtensionSettingsHandler::~ExtensionSettingsHandler() { | 85 ExtensionSettingsHandler::~ExtensionSettingsHandler() { |
| 86 // There may be pending file dialogs, we need to tell them that we've gone | 86 // There may be pending file dialogs, we need to tell them that we've gone |
| 87 // away so they don't try and call back to us. | 87 // away so they don't try and call back to us. |
| 88 if (load_extension_dialog_) | 88 if (load_extension_dialog_) |
| 89 load_extension_dialog_->ListenerDestroyed(); | 89 load_extension_dialog_->ListenerDestroyed(); |
| 90 | 90 |
| 91 registrar_.RemoveAll(); | 91 registrar_.RemoveAll(); |
| 92 |
| 93 if (registered_for_notifications_) { |
| 94 Profile* profile = Profile::FromWebUI(web_ui()); |
| 95 extensions::ExtensionWarningSet* warnings = |
| 96 extensions::ExtensionSystem::Get(profile)->warning_set(); |
| 97 warnings->RemoveObserver(this); |
| 98 } |
| 92 } | 99 } |
| 93 | 100 |
| 94 ExtensionSettingsHandler::ExtensionSettingsHandler(ExtensionService* service, | 101 ExtensionSettingsHandler::ExtensionSettingsHandler(ExtensionService* service, |
| 95 ManagementPolicy* policy) | 102 ManagementPolicy* policy) |
| 96 : extension_service_(service), | 103 : extension_service_(service), |
| 97 management_policy_(policy), | 104 management_policy_(policy), |
| 98 ignore_notifications_(false), | 105 ignore_notifications_(false), |
| 99 deleting_rvh_(NULL), | 106 deleting_rvh_(NULL), |
| 100 registered_for_notifications_(false) { | 107 registered_for_notifications_(false) { |
| 101 } | 108 } |
| 102 | 109 |
| 103 // static | 110 // static |
| 104 void ExtensionSettingsHandler::RegisterUserPrefs(PrefService* prefs) { | 111 void ExtensionSettingsHandler::RegisterUserPrefs(PrefService* prefs) { |
| 105 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, | 112 prefs->RegisterBooleanPref(prefs::kExtensionsUIDeveloperMode, |
| 106 false, | 113 false, |
| 107 PrefService::SYNCABLE_PREF); | 114 PrefService::SYNCABLE_PREF); |
| 108 } | 115 } |
| 109 | 116 |
| 110 DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( | 117 DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( |
| 111 const Extension* extension, | 118 const Extension* extension, |
| 112 const std::vector<ExtensionPage>& pages, | 119 const std::vector<ExtensionPage>& pages, |
| 113 const ExtensionWarningSet* warnings_set) { | 120 const extensions::ExtensionWarningSet* warnings_set) { |
| 114 DictionaryValue* extension_data = new DictionaryValue(); | 121 DictionaryValue* extension_data = new DictionaryValue(); |
| 115 bool enabled = extension_service_->IsExtensionEnabled(extension->id()); | 122 bool enabled = extension_service_->IsExtensionEnabled(extension->id()); |
| 116 extension->GetBasicInfo(enabled, extension_data); | 123 extension->GetBasicInfo(enabled, extension_data); |
| 117 | 124 |
| 118 extension_data->SetBoolean("userModifiable", | 125 extension_data->SetBoolean("userModifiable", |
| 119 management_policy_->UserMayModifySettings(extension, NULL)); | 126 management_policy_->UserMayModifySettings(extension, NULL)); |
| 120 | 127 |
| 121 GURL icon = | 128 GURL icon = |
| 122 ExtensionIconSource::GetIconURL(extension, | 129 ExtensionIconSource::GetIconURL(extension, |
| 123 extension_misc::EXTENSION_ICON_MEDIUM, | 130 extension_misc::EXTENSION_ICON_MEDIUM, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 view_value->SetInteger("renderProcessId", iter->render_process_id); | 179 view_value->SetInteger("renderProcessId", iter->render_process_id); |
| 173 view_value->SetBoolean("incognito", iter->incognito); | 180 view_value->SetBoolean("incognito", iter->incognito); |
| 174 views->Append(view_value); | 181 views->Append(view_value); |
| 175 } | 182 } |
| 176 extension_data->Set("views", views); | 183 extension_data->Set("views", views); |
| 177 extension_data->SetBoolean("hasPopupAction", | 184 extension_data->SetBoolean("hasPopupAction", |
| 178 extension->browser_action() || extension->page_action()); | 185 extension->browser_action() || extension->page_action()); |
| 179 | 186 |
| 180 // Add warnings. | 187 // Add warnings. |
| 181 if (warnings_set) { | 188 if (warnings_set) { |
| 182 std::set<ExtensionWarningSet::WarningType> warnings; | 189 std::vector<std::string> warnings; |
| 183 warnings_set->GetWarningsAffectingExtension(extension->id(), &warnings); | 190 warnings_set->GetWarningMessagesForExtension(extension->id(), &warnings); |
| 184 | 191 |
| 185 if (!warnings.empty()) { | 192 if (!warnings.empty()) { |
| 186 ListValue* warnings_list = new ListValue; | 193 ListValue* warnings_list = new ListValue; |
| 187 for (std::set<ExtensionWarningSet::WarningType>::const_iterator iter = | 194 for (std::vector<std::string>::const_iterator iter = warnings.begin(); |
| 188 warnings.begin(); | 195 iter != warnings.end(); ++iter) { |
| 189 iter != warnings.end(); | 196 warnings_list->Append(Value::CreateStringValue(*iter)); |
| 190 ++iter) { | |
| 191 string16 warning_string( | |
| 192 ExtensionWarningSet::GetLocalizedWarning(*iter)); | |
| 193 warnings_list->Append(Value::CreateStringValue(warning_string)); | |
| 194 } | 197 } |
| 195 extension_data->Set("warnings", warnings_list); | 198 extension_data->Set("warnings", warnings_list); |
| 196 } | 199 } |
| 197 } | 200 } |
| 198 | 201 |
| 199 // Add install warnings (these are not the same as warnings!). | 202 // Add install warnings (these are not the same as warnings!). |
| 200 if (extension->location() == Extension::LOAD) { | 203 if (extension->location() == Extension::LOAD) { |
| 201 const Extension::InstallWarningVector& install_warnings = | 204 const Extension::InstallWarningVector& install_warnings = |
| 202 extension->install_warnings(); | 205 extension->install_warnings(); |
| 203 if (!install_warnings.empty()) { | 206 if (!install_warnings.empty()) { |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 case chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED: | 410 case chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED: |
| 408 case chrome::NOTIFICATION_EXTENSION_HOST_CREATED: | 411 case chrome::NOTIFICATION_EXTENSION_HOST_CREATED: |
| 409 source_profile = content::Source<Profile>(source).ptr(); | 412 source_profile = content::Source<Profile>(source).ptr(); |
| 410 if (!profile->IsSameProfile(source_profile)) | 413 if (!profile->IsSameProfile(source_profile)) |
| 411 return; | 414 return; |
| 412 MaybeUpdateAfterNotification(); | 415 MaybeUpdateAfterNotification(); |
| 413 break; | 416 break; |
| 414 case chrome::NOTIFICATION_EXTENSION_LOADED: | 417 case chrome::NOTIFICATION_EXTENSION_LOADED: |
| 415 case chrome::NOTIFICATION_EXTENSION_UNLOADED: | 418 case chrome::NOTIFICATION_EXTENSION_UNLOADED: |
| 416 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: | 419 case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: |
| 417 case chrome::NOTIFICATION_EXTENSION_WARNING_CHANGED: | |
| 418 case chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED: | 420 case chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED: |
| 419 case chrome::NOTIFICATION_PREF_CHANGED: | 421 case chrome::NOTIFICATION_PREF_CHANGED: |
| 420 MaybeUpdateAfterNotification(); | 422 MaybeUpdateAfterNotification(); |
| 421 break; | 423 break; |
| 422 default: | 424 default: |
| 423 NOTREACHED(); | 425 NOTREACHED(); |
| 424 } | 426 } |
| 425 } | 427 } |
| 426 | 428 |
| 427 void ExtensionSettingsHandler::ExtensionUninstallAccepted() { | 429 void ExtensionSettingsHandler::ExtensionUninstallAccepted() { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 449 // There will be no EXTENSION_UNLOADED notification for terminated | 451 // There will be no EXTENSION_UNLOADED notification for terminated |
| 450 // extensions as they were already unloaded. | 452 // extensions as they were already unloaded. |
| 451 if (was_terminated) | 453 if (was_terminated) |
| 452 HandleRequestExtensionsData(NULL); | 454 HandleRequestExtensionsData(NULL); |
| 453 } | 455 } |
| 454 | 456 |
| 455 void ExtensionSettingsHandler::ExtensionUninstallCanceled() { | 457 void ExtensionSettingsHandler::ExtensionUninstallCanceled() { |
| 456 extension_id_prompting_ = ""; | 458 extension_id_prompting_ = ""; |
| 457 } | 459 } |
| 458 | 460 |
| 461 void ExtensionSettingsHandler::ExtensionWarningsChanged() { |
| 462 MaybeUpdateAfterNotification(); |
| 463 } |
| 464 |
| 459 void ExtensionSettingsHandler::ReloadUnpackedExtensions() { | 465 void ExtensionSettingsHandler::ReloadUnpackedExtensions() { |
| 460 const ExtensionSet* extensions = extension_service_->extensions(); | 466 const ExtensionSet* extensions = extension_service_->extensions(); |
| 461 std::vector<const Extension*> unpacked_extensions; | 467 std::vector<const Extension*> unpacked_extensions; |
| 462 for (ExtensionSet::const_iterator extension = extensions->begin(); | 468 for (ExtensionSet::const_iterator extension = extensions->begin(); |
| 463 extension != extensions->end(); ++extension) { | 469 extension != extensions->end(); ++extension) { |
| 464 if ((*extension)->location() == Extension::LOAD) | 470 if ((*extension)->location() == Extension::LOAD) |
| 465 unpacked_extensions.push_back(*extension); | 471 unpacked_extensions.push_back(*extension); |
| 466 } | 472 } |
| 467 | 473 |
| 468 for (std::vector<const Extension*>::iterator iter = | 474 for (std::vector<const Extension*>::iterator iter = |
| 469 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) { | 475 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) { |
| 470 extension_service_->ReloadExtension((*iter)->id()); | 476 extension_service_->ReloadExtension((*iter)->id()); |
| 471 } | 477 } |
| 472 } | 478 } |
| 473 | 479 |
| 474 void ExtensionSettingsHandler::HandleRequestExtensionsData( | 480 void ExtensionSettingsHandler::HandleRequestExtensionsData( |
| 475 const ListValue* args) { | 481 const ListValue* args) { |
| 476 DictionaryValue results; | 482 DictionaryValue results; |
| 477 | 483 |
| 484 Profile* profile = Profile::FromWebUI(web_ui()); |
| 485 |
| 478 // Add the extensions to the results structure. | 486 // Add the extensions to the results structure. |
| 479 ListValue *extensions_list = new ListValue(); | 487 ListValue *extensions_list = new ListValue(); |
| 480 | 488 |
| 481 ExtensionWarningSet* warnings = extension_service_->extension_warnings(); | 489 extensions::ExtensionWarningSet* warnings = |
| 490 extensions::ExtensionSystem::Get(profile)->warning_set(); |
| 482 | 491 |
| 483 const ExtensionSet* extensions = extension_service_->extensions(); | 492 const ExtensionSet* extensions = extension_service_->extensions(); |
| 484 for (ExtensionSet::const_iterator extension = extensions->begin(); | 493 for (ExtensionSet::const_iterator extension = extensions->begin(); |
| 485 extension != extensions->end(); ++extension) { | 494 extension != extensions->end(); ++extension) { |
| 486 if ((*extension)->ShouldDisplayInExtensionSettings()) { | 495 if ((*extension)->ShouldDisplayInExtensionSettings()) { |
| 487 extensions_list->Append(CreateExtensionDetailValue( | 496 extensions_list->Append(CreateExtensionDetailValue( |
| 488 *extension, | 497 *extension, |
| 489 GetInspectablePagesForExtension(*extension, true), | 498 GetInspectablePagesForExtension(*extension, true), |
| 490 warnings)); | 499 warnings)); |
| 491 } | 500 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 511 warnings)); | 520 warnings)); |
| 512 } | 521 } |
| 513 } | 522 } |
| 514 results.Set("extensions", extensions_list); | 523 results.Set("extensions", extensions_list); |
| 515 | 524 |
| 516 if (ManagedMode::IsInManagedMode()) { | 525 if (ManagedMode::IsInManagedMode()) { |
| 517 results.SetBoolean("managedMode", true); | 526 results.SetBoolean("managedMode", true); |
| 518 results.SetBoolean("developerMode", false); | 527 results.SetBoolean("developerMode", false); |
| 519 } else { | 528 } else { |
| 520 results.SetBoolean("managedMode", false); | 529 results.SetBoolean("managedMode", false); |
| 521 Profile* profile = Profile::FromWebUI(web_ui()); | 530 |
| 522 bool developer_mode = | 531 bool developer_mode = |
| 523 profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode); | 532 profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode); |
| 524 results.SetBoolean("developerMode", developer_mode); | 533 results.SetBoolean("developerMode", developer_mode); |
| 525 } | 534 } |
| 526 | 535 |
| 527 bool load_unpacked_disabled = | 536 bool load_unpacked_disabled = |
| 528 extension_service_->extension_prefs()->ExtensionsBlacklistedByDefault(); | 537 extension_service_->extension_prefs()->ExtensionsBlacklistedByDefault(); |
| 529 results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled); | 538 results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled); |
| 530 | 539 |
| 531 web_ui()->CallJavascriptFunction("ExtensionSettings.returnExtensionsData", | 540 web_ui()->CallJavascriptFunction("ExtensionSettings.returnExtensionsData", |
| 532 results); | 541 results); |
| 533 content::WebContentsObserver::Observe(web_ui()->GetWebContents()); | 542 content::WebContentsObserver::Observe(web_ui()->GetWebContents()); |
| 534 | 543 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 registered_for_notifications_ = true; | 784 registered_for_notifications_ = true; |
| 776 Profile* profile = Profile::FromWebUI(web_ui()); | 785 Profile* profile = Profile::FromWebUI(web_ui()); |
| 777 | 786 |
| 778 // Register for notifications that we need to reload the page. | 787 // Register for notifications that we need to reload the page. |
| 779 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 788 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 780 content::Source<Profile>(profile)); | 789 content::Source<Profile>(profile)); |
| 781 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 790 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 782 content::Source<Profile>(profile)); | 791 content::Source<Profile>(profile)); |
| 783 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, | 792 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, |
| 784 content::Source<Profile>(profile)); | 793 content::Source<Profile>(profile)); |
| 785 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_WARNING_CHANGED, | |
| 786 content::Source<Profile>(profile)); | |
| 787 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 794 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
| 788 content::NotificationService::AllBrowserContextsAndSources()); | 795 content::NotificationService::AllBrowserContextsAndSources()); |
| 789 registrar_.Add(this, | 796 registrar_.Add(this, |
| 790 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, | 797 content::NOTIFICATION_RENDER_VIEW_HOST_CREATED, |
| 791 content::NotificationService::AllBrowserContextsAndSources()); | 798 content::NotificationService::AllBrowserContextsAndSources()); |
| 792 registrar_.Add(this, | 799 registrar_.Add(this, |
| 793 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, | 800 content::NOTIFICATION_RENDER_VIEW_HOST_DELETED, |
| 794 content::NotificationService::AllBrowserContextsAndSources()); | 801 content::NotificationService::AllBrowserContextsAndSources()); |
| 795 registrar_.Add(this, | 802 registrar_.Add(this, |
| 796 chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, | 803 chrome::NOTIFICATION_BACKGROUND_CONTENTS_NAVIGATED, |
| 797 content::NotificationService::AllBrowserContextsAndSources()); | 804 content::NotificationService::AllBrowserContextsAndSources()); |
| 798 registrar_.Add(this, | 805 registrar_.Add(this, |
| 799 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, | 806 chrome::NOTIFICATION_BACKGROUND_CONTENTS_DELETED, |
| 800 content::NotificationService::AllBrowserContextsAndSources()); | 807 content::NotificationService::AllBrowserContextsAndSources()); |
| 801 registrar_.Add( | 808 registrar_.Add( |
| 802 this, | 809 this, |
| 803 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, | 810 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_VISIBILITY_CHANGED, |
| 804 content::Source<extensions::ExtensionPrefs>( | 811 content::Source<extensions::ExtensionPrefs>( |
| 805 profile->GetExtensionService()->extension_prefs())); | 812 profile->GetExtensionService()->extension_prefs())); |
| 806 | 813 |
| 814 extensions::ExtensionWarningSet* warnings = |
| 815 extensions::ExtensionSystem::Get(profile)->warning_set(); |
| 816 warnings->AddObserver(this); |
| 817 |
| 807 pref_registrar_.Init(profile->GetPrefs()); | 818 pref_registrar_.Init(profile->GetPrefs()); |
| 808 pref_registrar_.Add(prefs::kExtensionInstallDenyList, this); | 819 pref_registrar_.Add(prefs::kExtensionInstallDenyList, this); |
| 809 local_state_pref_registrar_.Init(g_browser_process->local_state()); | 820 local_state_pref_registrar_.Init(g_browser_process->local_state()); |
| 810 local_state_pref_registrar_.Add(prefs::kInManagedMode, this); | 821 local_state_pref_registrar_.Add(prefs::kInManagedMode, this); |
| 811 } | 822 } |
| 812 | 823 |
| 813 std::vector<ExtensionPage> | 824 std::vector<ExtensionPage> |
| 814 ExtensionSettingsHandler::GetInspectablePagesForExtension( | 825 ExtensionSettingsHandler::GetInspectablePagesForExtension( |
| 815 const Extension* extension, bool extension_is_enabled) { | 826 const Extension* extension, bool extension_is_enabled) { |
| 816 std::vector<ExtensionPage> result; | 827 std::vector<ExtensionPage> result; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 std::vector<std::string> requirement_errors) { | 930 std::vector<std::string> requirement_errors) { |
| 920 if (requirement_errors.empty()) { | 931 if (requirement_errors.empty()) { |
| 921 extension_service_->EnableExtension(extension_id); | 932 extension_service_->EnableExtension(extension_id); |
| 922 } else { | 933 } else { |
| 923 ExtensionErrorReporter::GetInstance()->ReportError( | 934 ExtensionErrorReporter::GetInstance()->ReportError( |
| 924 UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 935 UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
| 925 true /* be noisy */); | 936 true /* be noisy */); |
| 926 } | 937 } |
| 927 requirements_checker_.reset(); | 938 requirements_checker_.reset(); |
| 928 } | 939 } |
| OLD | NEW |