diff options
Diffstat (limited to 'extensions')
17 files changed, 60 insertions, 57 deletions
diff --git a/extensions/browser/admin_policy.cc b/extensions/browser/admin_policy.cc index 0513eb9..d961da1 100644 --- a/extensions/browser/admin_policy.cc +++ b/extensions/browser/admin_policy.cc @@ -25,7 +25,7 @@ bool ManagementPolicyImpl(const extensions::Extension* extension, if (error) { *error = l10n_util::GetStringFUTF16( IDS_EXTENSION_CANT_MODIFY_POLICY_REQUIRED, - UTF8ToUTF16(extension->name())); + base::UTF8ToUTF16(extension->name())); } return !modifiable_value; } @@ -35,8 +35,8 @@ bool ReturnLoadError(const extensions::Extension* extension, if (error) { *error = l10n_util::GetStringFUTF16( IDS_EXTENSION_CANT_INSTALL_POLICY_BLOCKED, - UTF8ToUTF16(extension->name()), - UTF8ToUTF16(extension->id())); + base::UTF8ToUTF16(extension->name()), + base::UTF8ToUTF16(extension->id())); } return false; } diff --git a/extensions/browser/management_policy_unittest.cc b/extensions/browser/management_policy_unittest.cc index 20658f1..52373c1 100644 --- a/extensions/browser/management_policy_unittest.cc +++ b/extensions/browser/management_policy_unittest.cc @@ -180,14 +180,14 @@ TEST_F(ManagementPolicyTest, MustRemainDisabled) { TEST_F(ManagementPolicyTest, ErrorHandling) { // The error parameter should be unchanged if no restriction was found. std::string original_error = "Ceci est en effet une erreur."; - base::string16 original_error16 = UTF8ToUTF16(original_error); + base::string16 original_error16 = base::UTF8ToUTF16(original_error); base::string16 error = original_error16; EXPECT_TRUE(policy_.UserMayLoad(NULL, &error)); - EXPECT_EQ(original_error, UTF16ToUTF8(error)); + EXPECT_EQ(original_error, base::UTF16ToUTF8(error)); EXPECT_TRUE(policy_.UserMayModifySettings(NULL, &error)); - EXPECT_EQ(original_error, UTF16ToUTF8(error)); + EXPECT_EQ(original_error, base::UTF16ToUTF8(error)); EXPECT_FALSE(policy_.MustRemainEnabled(NULL, &error)); - EXPECT_EQ(original_error, UTF16ToUTF8(error)); + EXPECT_EQ(original_error, base::UTF16ToUTF8(error)); // Ensure no crashes if no error message was requested. EXPECT_TRUE(policy_.UserMayLoad(NULL, NULL)); @@ -201,11 +201,11 @@ TEST_F(ManagementPolicyTest, ErrorHandling) { // Make sure returned error is correct. error = original_error16; EXPECT_FALSE(policy_.UserMayLoad(NULL, &error)); - EXPECT_EQ(UTF8ToUTF16(TestProvider::expected_error()), error); + EXPECT_EQ(base::UTF8ToUTF16(TestProvider::expected_error()), error); error = original_error16; EXPECT_FALSE(policy_.UserMayModifySettings(NULL, &error)); - EXPECT_EQ(UTF8ToUTF16(TestProvider::expected_error()), error); + EXPECT_EQ(base::UTF8ToUTF16(TestProvider::expected_error()), error); error = original_error16; EXPECT_TRUE(policy_.MustRemainEnabled(NULL, &error)); - EXPECT_EQ(UTF8ToUTF16(TestProvider::expected_error()), error); + EXPECT_EQ(base::UTF8ToUTF16(TestProvider::expected_error()), error); } diff --git a/extensions/browser/test_management_policy.cc b/extensions/browser/test_management_policy.cc index 5c78efe..77ec191 100644 --- a/extensions/browser/test_management_policy.cc +++ b/extensions/browser/test_management_policy.cc @@ -14,13 +14,13 @@ TestManagementPolicyProvider::TestManagementPolicyProvider() must_remain_enabled_(false), must_remain_disabled_(false), disable_reason_(Extension::DISABLE_NONE) { - error_message_ = UTF8ToUTF16(expected_error()); + error_message_ = base::UTF8ToUTF16(expected_error()); } TestManagementPolicyProvider::TestManagementPolicyProvider( int prohibited_actions) { SetProhibitedActions(prohibited_actions); - error_message_ = UTF8ToUTF16(expected_error()); + error_message_ = base::UTF8ToUTF16(expected_error()); } void TestManagementPolicyProvider::SetProhibitedActions( diff --git a/extensions/common/error_utils.cc b/extensions/common/error_utils.cc index c44e216..4c40e20 100644 --- a/extensions/common/error_utils.cc +++ b/extensions/common/error_utils.cc @@ -40,7 +40,7 @@ base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format, const std::string& s1) { std::string ret_val = format; ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); - return UTF8ToUTF16(ret_val); + return base::UTF8ToUTF16(ret_val); } base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format, @@ -49,7 +49,7 @@ base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format, std::string ret_val = format; ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2); - return UTF8ToUTF16(ret_val); + return base::UTF8ToUTF16(ret_val); } base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format, @@ -60,7 +60,7 @@ base::string16 ErrorUtils::FormatErrorMessageUTF16(const std::string& format, ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s1); ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s2); ReplaceFirstSubstringAfterOffset(&ret_val, 0, "*", s3); - return UTF8ToUTF16(ret_val); + return base::UTF8ToUTF16(ret_val); } } // namespace diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc index 2bab533..ceb6a79 100644 --- a/extensions/common/extension.cc +++ b/extensions/common/extension.cc @@ -117,7 +117,7 @@ scoped_refptr<Extension> Extension::Create(const base::FilePath& path, location, scoped_ptr<base::DictionaryValue>(value.DeepCopy()))); if (!InitExtensionID(manifest.get(), path, explicit_id, flags, &error)) { - *utf8_error = UTF16ToUTF8(error); + *utf8_error = base::UTF16ToUTF8(error); return NULL; } @@ -130,7 +130,7 @@ scoped_refptr<Extension> Extension::Create(const base::FilePath& path, extension->install_warnings_.swap(install_warnings); if (!extension->InitFromValue(flags, &error)) { - *utf8_error = UTF16ToUTF8(error); + *utf8_error = base::UTF16ToUTF8(error); return NULL; } @@ -479,7 +479,7 @@ bool Extension::InitExtensionID(extensions::Manifest* manifest, std::string public_key_bytes; if (!manifest->GetString(keys::kPublicKey, &public_key) || !ParsePEMKeyBytes(public_key, &public_key_bytes)) { - *error = ASCIIToUTF16(errors::kInvalidKey); + *error = base::ASCIIToUTF16(errors::kInvalidKey); return false; } std::string extension_id = id_util::GenerateId(public_key_bytes); @@ -488,7 +488,7 @@ bool Extension::InitExtensionID(extensions::Manifest* manifest, } if (creation_flags & REQUIRE_KEY) { - *error = ASCIIToUTF16(errors::kInvalidKey); + *error = base::ASCIIToUTF16(errors::kInvalidKey); return false; } else { // If there is a path, we generate the ID from it. This is useful for @@ -575,24 +575,24 @@ bool Extension::LoadRequiredFeatures(base::string16* error) { bool Extension::LoadName(base::string16* error) { base::string16 localized_name; if (!manifest_->GetString(keys::kName, &localized_name)) { - *error = ASCIIToUTF16(errors::kInvalidName); + *error = base::ASCIIToUTF16(errors::kInvalidName); return false; } - non_localized_name_ = UTF16ToUTF8(localized_name); + non_localized_name_ = base::UTF16ToUTF8(localized_name); base::i18n::AdjustStringForLocaleDirection(&localized_name); - name_ = UTF16ToUTF8(localized_name); + name_ = base::UTF16ToUTF8(localized_name); return true; } bool Extension::LoadVersion(base::string16* error) { std::string version_str; if (!manifest_->GetString(keys::kVersion, &version_str)) { - *error = ASCIIToUTF16(errors::kInvalidVersion); + *error = base::ASCIIToUTF16(errors::kInvalidVersion); return false; } version_.reset(new base::Version(version_str)); if (!version_->IsValid() || version_->components().size() > 4) { - *error = ASCIIToUTF16(errors::kInvalidVersion); + *error = base::ASCIIToUTF16(errors::kInvalidVersion); return false; } return true; @@ -605,13 +605,13 @@ bool Extension::LoadAppFeatures(base::string16* error) { } if (manifest_->HasKey(keys::kDisplayInLauncher) && !manifest_->GetBoolean(keys::kDisplayInLauncher, &display_in_launcher_)) { - *error = ASCIIToUTF16(errors::kInvalidDisplayInLauncher); + *error = base::ASCIIToUTF16(errors::kInvalidDisplayInLauncher); return false; } if (manifest_->HasKey(keys::kDisplayInNewTabPage)) { if (!manifest_->GetBoolean(keys::kDisplayInNewTabPage, &display_in_new_tab_page_)) { - *error = ASCIIToUTF16(errors::kInvalidDisplayInNewTabPage); + *error = base::ASCIIToUTF16(errors::kInvalidDisplayInNewTabPage); return false; } } else { @@ -632,7 +632,7 @@ bool Extension::LoadExtent(const char* key, const base::ListValue* pattern_list = NULL; if (!temp_pattern_value->GetAsList(&pattern_list)) { - *error = ASCIIToUTF16(list_error); + *error = base::ASCIIToUTF16(list_error); return false; } @@ -707,7 +707,7 @@ bool Extension::LoadSharedFeatures(base::string16* error) { bool Extension::LoadDescription(base::string16* error) { if (manifest_->HasKey(keys::kDescription) && !manifest_->GetString(keys::kDescription, &description_)) { - *error = ASCIIToUTF16(errors::kInvalidDescription); + *error = base::ASCIIToUTF16(errors::kInvalidDescription); return false; } return true; @@ -720,7 +720,7 @@ bool Extension::LoadManifestVersion(base::string16* error) { int manifest_version = 1; if (!manifest_->GetInteger(keys::kManifestVersion, &manifest_version) || manifest_version < 1) { - *error = ASCIIToUTF16(errors::kInvalidManifestVersion); + *error = base::ASCIIToUTF16(errors::kInvalidManifestVersion); return false; } } @@ -746,12 +746,12 @@ bool Extension::LoadShortName(base::string16* error) { base::string16 localized_short_name; if (!manifest_->GetString(keys::kShortName, &localized_short_name) || localized_short_name.empty()) { - *error = ASCIIToUTF16(errors::kInvalidShortName); + *error = base::ASCIIToUTF16(errors::kInvalidShortName); return false; } base::i18n::AdjustStringForLocaleDirection(&localized_short_name); - short_name_ = UTF16ToUTF8(localized_short_name); + short_name_ = base::UTF16ToUTF8(localized_short_name); } else { short_name_ = name_; } diff --git a/extensions/common/manifest_handler_unittest.cc b/extensions/common/manifest_handler_unittest.cc index 8eb9fec..1da6b40 100644 --- a/extensions/common/manifest_handler_unittest.cc +++ b/extensions/common/manifest_handler_unittest.cc @@ -112,7 +112,7 @@ class ManifestHandlerTest : public testing::Test { : TestManifestHandler(name, keys, prereqs, watcher) { } virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE { - *error = ASCIIToUTF16(name_); + *error = base::ASCIIToUTF16(name_); return false; } }; diff --git a/extensions/common/manifest_handlers/background_info.cc b/extensions/common/manifest_handlers/background_info.cc index 66a18e5..c7aee90 100644 --- a/extensions/common/manifest_handlers/background_info.cc +++ b/extensions/common/manifest_handlers/background_info.cc @@ -20,6 +20,7 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +using base::ASCIIToUTF16; using base::DictionaryValue; namespace extensions { @@ -275,7 +276,7 @@ bool BackgroundManifestHandler::Validate( extension->GetResource(background_scripts[i]).GetFilePath())) { *error = l10n_util::GetStringFUTF8( IDS_EXTENSION_LOAD_BACKGROUND_SCRIPT_FAILED, - UTF8ToUTF16(background_scripts[i])); + base::UTF8ToUTF16(background_scripts[i])); return false; } } diff --git a/extensions/common/manifest_handlers/csp_info.cc b/extensions/common/manifest_handlers/csp_info.cc index 842a640..2fd74fb 100644 --- a/extensions/common/manifest_handlers/csp_info.cc +++ b/extensions/common/manifest_handlers/csp_info.cc @@ -97,17 +97,17 @@ bool CSPHandler::Parse(Extension* extension, base::string16* error) { std::string content_security_policy; if (!extension->manifest()->GetString(key, &content_security_policy)) { - *error = ASCIIToUTF16(errors::kInvalidContentSecurityPolicy); + *error = base::ASCIIToUTF16(errors::kInvalidContentSecurityPolicy); return false; } if (!ContentSecurityPolicyIsLegal(content_security_policy)) { - *error = ASCIIToUTF16(errors::kInvalidContentSecurityPolicy); + *error = base::ASCIIToUTF16(errors::kInvalidContentSecurityPolicy); return false; } if (extension->manifest_version() >= 2 && !ContentSecurityPolicyIsSecure(content_security_policy, extension->GetType())) { - *error = ASCIIToUTF16(errors::kInsecureContentSecurityPolicy); + *error = base::ASCIIToUTF16(errors::kInsecureContentSecurityPolicy); return false; } diff --git a/extensions/common/manifest_handlers/incognito_info.cc b/extensions/common/manifest_handlers/incognito_info.cc index a56ac6b..02c3b28 100644 --- a/extensions/common/manifest_handlers/incognito_info.cc +++ b/extensions/common/manifest_handlers/incognito_info.cc @@ -48,7 +48,7 @@ bool IncognitoHandler::Parse(Extension* extension, base::string16* error) { bool split_mode = false; std::string incognito_string; if (!extension->manifest()->GetString(keys::kIncognito, &incognito_string)) { - *error = ASCIIToUTF16(manifest_errors::kInvalidIncognitoBehavior); + *error = base::ASCIIToUTF16(manifest_errors::kInvalidIncognitoBehavior); return false; } @@ -57,7 +57,7 @@ bool IncognitoHandler::Parse(Extension* extension, base::string16* error) { else if (incognito_string != manifest_values::kIncognitoSpanning) { // If incognito_string == kIncognitoSpanning, it is valid and // split_mode remains false. - *error = ASCIIToUTF16(manifest_errors::kInvalidIncognitoBehavior); + *error = base::ASCIIToUTF16(manifest_errors::kInvalidIncognitoBehavior); return false; } diff --git a/extensions/common/manifest_handlers/kiosk_mode_info.cc b/extensions/common/manifest_handlers/kiosk_mode_info.cc index 41b0c8c..f5d36af 100644 --- a/extensions/common/manifest_handlers/kiosk_mode_info.cc +++ b/extensions/common/manifest_handlers/kiosk_mode_info.cc @@ -52,19 +52,20 @@ bool KioskModeHandler::Parse(Extension* extension, base::string16* error) { bool kiosk_enabled = false; if (manifest->HasKey(keys::kKioskEnabled) && !manifest->GetBoolean(keys::kKioskEnabled, &kiosk_enabled)) { - *error = ASCIIToUTF16(manifest_errors::kInvalidKioskEnabled); + *error = base::ASCIIToUTF16(manifest_errors::kInvalidKioskEnabled); return false; } bool kiosk_only = false; if (manifest->HasKey(keys::kKioskOnly) && !manifest->GetBoolean(keys::kKioskOnly, &kiosk_only)) { - *error = ASCIIToUTF16(manifest_errors::kInvalidKioskOnly); + *error = base::ASCIIToUTF16(manifest_errors::kInvalidKioskOnly); return false; } if (kiosk_only && !kiosk_enabled) { - *error = ASCIIToUTF16(manifest_errors::kInvalidKioskOnlyButNotEnabled); + *error = base::ASCIIToUTF16( + manifest_errors::kInvalidKioskOnlyButNotEnabled); return false; } diff --git a/extensions/common/manifest_handlers/offline_enabled_info.cc b/extensions/common/manifest_handlers/offline_enabled_info.cc index 7d6bdc9..1d1f8b1 100644 --- a/extensions/common/manifest_handlers/offline_enabled_info.cc +++ b/extensions/common/manifest_handlers/offline_enabled_info.cc @@ -49,7 +49,7 @@ bool OfflineEnabledHandler::Parse(Extension* extension, base::string16* error) { if (!extension->manifest()->GetBoolean(keys::kOfflineEnabled, &offline_enabled)) { - *error = ASCIIToUTF16(manifest_errors::kInvalidOfflineEnabled); + *error = base::ASCIIToUTF16(manifest_errors::kInvalidOfflineEnabled); return false; } diff --git a/extensions/common/manifest_handlers/requirements_info.cc b/extensions/common/manifest_handlers/requirements_info.cc index 7838e82..a775324 100644 --- a/extensions/common/manifest_handlers/requirements_info.cc +++ b/extensions/common/manifest_handlers/requirements_info.cc @@ -72,7 +72,7 @@ bool RequirementsHandler::Parse(Extension* extension, base::string16* error) { const base::DictionaryValue* requirements_value = NULL; if (!extension->manifest()->GetDictionary(keys::kRequirements, &requirements_value)) { - *error = ASCIIToUTF16(errors::kInvalidRequirements); + *error = base::ASCIIToUTF16(errors::kInvalidRequirements); return false; } @@ -129,7 +129,7 @@ bool RequirementsHandler::Parse(Extension* extension, base::string16* error) { } } } else { - *error = ASCIIToUTF16(errors::kInvalidRequirements); + *error = base::ASCIIToUTF16(errors::kInvalidRequirements); return false; } } diff --git a/extensions/common/manifest_handlers/sandboxed_page_info.cc b/extensions/common/manifest_handlers/sandboxed_page_info.cc index d430a8a..2471e93 100644 --- a/extensions/common/manifest_handlers/sandboxed_page_info.cc +++ b/extensions/common/manifest_handlers/sandboxed_page_info.cc @@ -66,7 +66,7 @@ bool SandboxedPageHandler::Parse(Extension* extension, base::string16* error) { const base::ListValue* list_value = NULL; if (!extension->manifest()->GetList(keys::kSandboxedPages, &list_value)) { - *error = ASCIIToUTF16(errors::kInvalidSandboxedPagesList); + *error = base::ASCIIToUTF16(errors::kInvalidSandboxedPagesList); return false; } @@ -93,7 +93,7 @@ bool SandboxedPageHandler::Parse(Extension* extension, base::string16* error) { if (!extension->manifest()->GetString( keys::kSandboxedPagesCSP, &sandboxed_info->content_security_policy)) { - *error = ASCIIToUTF16(errors::kInvalidSandboxedPagesCSP); + *error = base::ASCIIToUTF16(errors::kInvalidSandboxedPagesCSP); return false; } @@ -101,7 +101,7 @@ bool SandboxedPageHandler::Parse(Extension* extension, base::string16* error) { sandboxed_info->content_security_policy) || !csp_validator::ContentSecurityPolicyIsSandboxed( sandboxed_info->content_security_policy, extension->GetType())) { - *error = ASCIIToUTF16(errors::kInvalidSandboxedPagesCSP); + *error = base::ASCIIToUTF16(errors::kInvalidSandboxedPagesCSP); return false; } } else { diff --git a/extensions/common/manifest_handlers/shared_module_info.cc b/extensions/common/manifest_handlers/shared_module_info.cc index 0586719..0c01f75 100644 --- a/extensions/common/manifest_handlers/shared_module_info.cc +++ b/extensions/common/manifest_handlers/shared_module_info.cc @@ -113,19 +113,19 @@ bool SharedModuleInfo::Parse(const Extension* extension, return true; if (has_import && has_export) { - *error = ASCIIToUTF16(errors::kInvalidImportAndExport); + *error = base::ASCIIToUTF16(errors::kInvalidImportAndExport); return false; } if (has_export) { const base::DictionaryValue* export_value = NULL; if (!extension->manifest()->GetDictionary(keys::kExport, &export_value)) { - *error = ASCIIToUTF16(errors::kInvalidExport); + *error = base::ASCIIToUTF16(errors::kInvalidExport); return false; } const base::ListValue* resources_list = NULL; if (!export_value->GetList(keys::kResources, &resources_list)) { - *error = ASCIIToUTF16(errors::kInvalidExportResources); + *error = base::ASCIIToUTF16(errors::kInvalidExportResources); return false; } for (size_t i = 0; i < resources_list->GetSize(); ++i) { @@ -149,13 +149,13 @@ bool SharedModuleInfo::Parse(const Extension* extension, if (has_import) { const base::ListValue* import_list = NULL; if (!extension->manifest()->GetList(keys::kImport, &import_list)) { - *error = ASCIIToUTF16(errors::kInvalidImport); + *error = base::ASCIIToUTF16(errors::kInvalidImport); return false; } for (size_t i = 0; i < import_list->GetSize(); ++i) { const base::DictionaryValue* import_entry = NULL; if (!import_list->GetDictionary(i, &import_entry)) { - *error = ASCIIToUTF16(errors::kInvalidImport); + *error = base::ASCIIToUTF16(errors::kInvalidImport); return false; } std::string extension_id; diff --git a/extensions/common/permissions/permissions_data.cc b/extensions/common/permissions/permissions_data.cc index 3e6e85f..07e8c9e 100644 --- a/extensions/common/permissions/permissions_data.cc +++ b/extensions/common/permissions/permissions_data.cc @@ -152,7 +152,7 @@ bool ParseHelper(Extension* extension, if (iter->id() == APIPermission::kExperimental) { if (!CanSpecifyExperimentalPermission(extension)) { - *error = ASCIIToUTF16(errors::kExperimentalFlagRequired); + *error = base::ASCIIToUTF16(errors::kExperimentalFlagRequired); return false; } } diff --git a/extensions/common/permissions/permissions_data_unittest.cc b/extensions/common/permissions/permissions_data_unittest.cc index c2914e5..294d106 100644 --- a/extensions/common/permissions/permissions_data_unittest.cc +++ b/extensions/common/permissions/permissions_data_unittest.cc @@ -24,6 +24,7 @@ #include "extensions/common/url_pattern_set.h" #include "testing/gtest/include/gtest/gtest.h" +using base::UTF16ToUTF8; using content::SocketPermissionRequest; using extension_test_util::LoadManifest; using extension_test_util::LoadManifestUnchecked; diff --git a/extensions/common/stack_frame_unittest.cc b/extensions/common/stack_frame_unittest.cc index 7dad047..ddd92ae 100644 --- a/extensions/common/stack_frame_unittest.cc +++ b/extensions/common/stack_frame_unittest.cc @@ -21,18 +21,18 @@ void AssertStackFrameValid(const std::string& text, size_t column, const std::string& source, const std::string& function) { - base::string16 utf16_text = UTF8ToUTF16(text); + base::string16 utf16_text = base::UTF8ToUTF16(text); scoped_ptr<StackFrame> frame = StackFrame::CreateFromText(utf16_text); ASSERT_TRUE(frame.get()) << "Failed to create frame from '" << text << "'"; EXPECT_EQ(line, frame->line_number()); EXPECT_EQ(column, frame->column_number()); - EXPECT_EQ(UTF8ToUTF16(source), frame->source()); - EXPECT_EQ(UTF8ToUTF16(function), frame->function()); + EXPECT_EQ(base::UTF8ToUTF16(source), frame->source()); + EXPECT_EQ(base::UTF8ToUTF16(function), frame->function()); } void AssertStackFrameInvalid(const std::string& text) { - base::string16 utf16_text = UTF8ToUTF16(text); + base::string16 utf16_text = base::UTF8ToUTF16(text); scoped_ptr<StackFrame> frame = StackFrame::CreateFromText(utf16_text); ASSERT_FALSE(frame.get()) << "Errantly created frame from '" << text << "'"; } |