| 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/extensions/external_provider_impl.h" | 5 #include "chrome/browser/extensions/external_provider_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
| 16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
| 17 #include "base/stl_util.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
| 19 #include "base/values.h" | 20 #include "base/values.h" |
| 20 #include "base/version.h" | 21 #include "base/version.h" |
| 21 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 22 #include "chrome/browser/app_mode/app_mode_utils.h" | 23 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 23 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/browser_process_platform_part.h" | 25 #include "chrome/browser/browser_process_platform_part.h" |
| 25 #include "chrome/browser/extensions/extension_management.h" | 26 #include "chrome/browser/extensions/extension_management.h" |
| 26 #include "chrome/browser/extensions/extension_migrator.h" | 27 #include "chrome/browser/extensions/extension_migrator.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 l10n_util::GetParentLocales(g_browser_process->GetApplicationLocale(), | 240 l10n_util::GetParentLocales(g_browser_process->GetApplicationLocale(), |
| 240 &browser_locales); | 241 &browser_locales); |
| 241 | 242 |
| 242 size_t num_locales = supported_locales->GetSize(); | 243 size_t num_locales = supported_locales->GetSize(); |
| 243 bool locale_supported = false; | 244 bool locale_supported = false; |
| 244 for (size_t j = 0; j < num_locales; j++) { | 245 for (size_t j = 0; j < num_locales; j++) { |
| 245 std::string current_locale; | 246 std::string current_locale; |
| 246 if (supported_locales->GetString(j, ¤t_locale) && | 247 if (supported_locales->GetString(j, ¤t_locale) && |
| 247 l10n_util::IsValidLocaleSyntax(current_locale)) { | 248 l10n_util::IsValidLocaleSyntax(current_locale)) { |
| 248 current_locale = l10n_util::NormalizeLocale(current_locale); | 249 current_locale = l10n_util::NormalizeLocale(current_locale); |
| 249 if (std::find(browser_locales.begin(), browser_locales.end(), | 250 if (ContainsValue(browser_locales, current_locale)) { |
| 250 current_locale) != browser_locales.end()) { | |
| 251 locale_supported = true; | 251 locale_supported = true; |
| 252 break; | 252 break; |
| 253 } | 253 } |
| 254 } else { | 254 } else { |
| 255 LOG(WARNING) << "Unrecognized locale '" << current_locale | 255 LOG(WARNING) << "Unrecognized locale '" << current_locale |
| 256 << "' found as supported locale for extension: " | 256 << "' found as supported locale for extension: " |
| 257 << extension_id; | 257 << extension_id; |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 new ExternalProviderImpl( | 740 new ExternalProviderImpl( |
| 741 service, | 741 service, |
| 742 new ExternalComponentLoader(profile), | 742 new ExternalComponentLoader(profile), |
| 743 profile, | 743 profile, |
| 744 Manifest::INVALID_LOCATION, | 744 Manifest::INVALID_LOCATION, |
| 745 Manifest::EXTERNAL_COMPONENT, | 745 Manifest::EXTERNAL_COMPONENT, |
| 746 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); | 746 Extension::FROM_WEBSTORE | Extension::WAS_INSTALLED_BY_DEFAULT))); |
| 747 } | 747 } |
| 748 | 748 |
| 749 } // namespace extensions | 749 } // namespace extensions |
| OLD | NEW |