| 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/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/apps/app_info_dialog.h" | 14 #include "chrome/browser/ui/apps/app_info_dialog.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/common/features.h" | 16 #include "chrome/common/features.h" |
| 17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 19 #include "chrome/grit/browser_resources.h" | 19 #include "chrome/grit/browser_resources.h" |
| 20 #include "chrome/grit/chromium_strings.h" | 20 #include "chrome/grit/chromium_strings.h" |
| 21 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
| 22 #include "chrome/grit/theme_resources.h" | 22 #include "chrome/grit/theme_resources.h" |
| 23 #include "components/google/core/browser/google_util.h" | 23 #include "components/google/core/browser/google_util.h" |
| 24 #include "components/pref_registry/pref_registry_syncable.h" | 24 #include "components/pref_registry/pref_registry_syncable.h" |
| 25 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
| 26 #include "components/strings/grit/components_strings.h" | 26 #include "components/strings/grit/components_strings.h" |
| 27 #include "content/public/browser/navigation_handle.h" |
| 27 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/browser/web_ui.h" | 29 #include "content/public/browser/web_ui.h" |
| 29 #include "content/public/browser/web_ui_data_source.h" | 30 #include "content/public/browser/web_ui_data_source.h" |
| 30 #include "extensions/browser/extension_registry.h" | 31 #include "extensions/browser/extension_registry.h" |
| 31 #include "extensions/browser/extension_system.h" | 32 #include "extensions/browser/extension_system.h" |
| 32 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
| 33 #include "extensions/common/extension_set.h" | 34 #include "extensions/common/extension_set.h" |
| 34 #include "extensions/common/extension_urls.h" | 35 #include "extensions/common/extension_urls.h" |
| 35 #include "extensions/common/manifest.h" | 36 #include "extensions/common/manifest.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 source->AddString("extensionCommandsRegular", | 277 source->AddString("extensionCommandsRegular", |
| 277 l10n_util::GetStringUTF16(IDS_EXTENSION_COMMANDS_NOT_GLOBAL)); | 278 l10n_util::GetStringUTF16(IDS_EXTENSION_COMMANDS_NOT_GLOBAL)); |
| 278 source->AddString("ok", l10n_util::GetStringUTF16(IDS_OK)); | 279 source->AddString("ok", l10n_util::GetStringUTF16(IDS_OK)); |
| 279 | 280 |
| 280 // 'Bubble' text for the controlled-setting-indicator | 281 // 'Bubble' text for the controlled-setting-indicator |
| 281 source->AddString( | 282 source->AddString( |
| 282 "extensionControlledSettingPolicy", | 283 "extensionControlledSettingPolicy", |
| 283 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY)); | 284 l10n_util::GetStringUTF16(IDS_OPTIONS_CONTROLLED_SETTING_POLICY)); |
| 284 } | 285 } |
| 285 | 286 |
| 286 void ExtensionSettingsHandler::DidStartNavigationToPendingEntry( | 287 void ExtensionSettingsHandler::DidStartNavigation( |
| 287 const GURL& url, | 288 content::NavigationHandle* navigation_handle) { |
| 288 content::ReloadType reload_type) { | 289 if (!navigation_handle->IsInMainFrame()) |
| 289 if (reload_type != content::ReloadType::NONE) | 290 return; |
| 291 |
| 292 if (navigation_handle->GetReloadType() != content::ReloadType::NONE) |
| 290 ReloadUnpackedExtensions(); | 293 ReloadUnpackedExtensions(); |
| 291 } | 294 } |
| 292 | 295 |
| 293 void ExtensionSettingsHandler::RegisterMessages() { | 296 void ExtensionSettingsHandler::RegisterMessages() { |
| 294 Profile* profile = Profile::FromWebUI(web_ui())->GetOriginalProfile(); | 297 Profile* profile = Profile::FromWebUI(web_ui())->GetOriginalProfile(); |
| 295 extension_service_ = | 298 extension_service_ = |
| 296 extensions::ExtensionSystem::Get(profile)->extension_service(); | 299 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 297 // Clear the preference for the ADT Promo before fully removing it. | 300 // Clear the preference for the ADT Promo before fully removing it. |
| 298 // TODO(devlin): Take this out when everyone's been updated. | 301 // TODO(devlin): Take this out when everyone's been updated. |
| 299 Profile::FromWebUI(web_ui())->GetPrefs()->ClearPref( | 302 Profile::FromWebUI(web_ui())->GetPrefs()->ClearPref( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 312 unpacked_extensions.push_back(extension.get()); | 315 unpacked_extensions.push_back(extension.get()); |
| 313 } | 316 } |
| 314 | 317 |
| 315 for (std::vector<const Extension*>::iterator iter = | 318 for (std::vector<const Extension*>::iterator iter = |
| 316 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) { | 319 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) { |
| 317 extension_service_->ReloadExtensionWithQuietFailure((*iter)->id()); | 320 extension_service_->ReloadExtensionWithQuietFailure((*iter)->id()); |
| 318 } | 321 } |
| 319 } | 322 } |
| 320 | 323 |
| 321 } // namespace extensions | 324 } // namespace extensions |
| OLD | NEW |