summaryrefslogtreecommitdiffstats
path: root/chrome/browser/background
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-24 23:12:15 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-24 23:12:15 +0000
commitcc2a2a22ebb171ff4c1eb528b3f8d7e551512732 (patch)
tree9a010de6ab6210b43e4bc7cfa187ef3a80312a0b /chrome/browser/background
parent8af3b22a0f64133ba32f4deaedc6540060520ff7 (diff)
downloadchromium_src-cc2a2a22ebb171ff4c1eb528b3f8d7e551512732.zip
chromium_src-cc2a2a22ebb171ff4c1eb528b3f8d7e551512732.tar.gz
chromium_src-cc2a2a22ebb171ff4c1eb528b3f8d7e551512732.tar.bz2
Revert 242455 "Revert 242449 "Update some uses of UTF conversion..."
> Revert 242449 "Update some uses of UTF conversions in chrome/bro..." > > > Update some uses of UTF conversions in chrome/browser to use the base:: namespace. > > > > BUG=330556 > > TEST=no change > > TBR=ben@chromium.org > > > > Review URL: https://codereview.chromium.org/120943002 > > TBR=avi@chromium.org > > Review URL: https://codereview.chromium.org/103853007 TBR=avi@chromium.org Review URL: https://codereview.chromium.org/120993002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@242463 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/background')
-rw-r--r--chrome/browser/background/background_contents_service.cc51
-rw-r--r--chrome/browser/background/background_contents_service_unittest.cc18
-rw-r--r--chrome/browser/background/background_mode_manager.cc2
-rw-r--r--chrome/browser/background/background_mode_manager_unittest.cc32
-rw-r--r--chrome/browser/background/background_mode_manager_win.cc2
5 files changed, 57 insertions, 48 deletions
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index b3c6a6a..337141f 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -119,9 +119,11 @@ class CrashNotificationDelegate : public NotificationDelegate {
// loading the background page.
BackgroundContentsService* service =
BackgroundContentsServiceFactory::GetForProfile(profile_);
- if (!service->GetAppBackgroundContents(ASCIIToUTF16(copied_extension_id)))
+ if (!service->GetAppBackgroundContents(
+ base::ASCIIToUTF16(copied_extension_id))) {
service->LoadBackgroundContentsForExtension(profile_,
copied_extension_id);
+ }
} else if (is_platform_app_) {
apps::AppLoadService::Get(profile_)->
RestartApplication(copied_extension_id);
@@ -192,7 +194,7 @@ void ShowBalloon(const Extension* extension, Profile* profile) {
const base::string16 message = l10n_util::GetStringFUTF16(
extension->is_app() ? IDS_BACKGROUND_CRASHED_APP_BALLOON_MESSAGE :
IDS_BACKGROUND_CRASHED_EXTENSION_BALLOON_MESSAGE,
- UTF8ToUTF16(extension->name()));
+ base::UTF8ToUTF16(extension->name()));
extension_misc::ExtensionIcons size(extension_misc::EXTENSION_ICON_MEDIUM);
extensions::ExtensionResource resource =
extensions::IconsInfo::GetIconResource(
@@ -372,8 +374,8 @@ void BackgroundContentsService::Observe(
extensions::ExtensionSystem::Get(profile)->extension_service();
// extension_service can be NULL when running tests.
if (extension_service) {
- const Extension* extension =
- extension_service->GetExtensionById(UTF16ToUTF8(appid), false);
+ const Extension* extension = extension_service->GetExtensionById(
+ base::UTF16ToUTF8(appid), false);
if (extension && BackgroundInfo::HasBackgroundPage(extension))
break;
}
@@ -388,7 +390,8 @@ void BackgroundContentsService::Observe(
BackgroundInfo::HasBackgroundPage(extension)) {
// If there is a background page specified in the manifest for a hosted
// app, then blow away registered urls in the pref.
- ShutdownAssociatedBackgroundContents(ASCIIToUTF16(extension->id()));
+ ShutdownAssociatedBackgroundContents(
+ base::ASCIIToUTF16(extension->id()));
ExtensionService* service =
extensions::ExtensionSystem::Get(profile)->extension_service();
@@ -398,8 +401,8 @@ void BackgroundContentsService::Observe(
// EXTENSIONS_READY callback.
LoadBackgroundContents(profile,
BackgroundInfo::GetBackgroundURL(extension),
- ASCIIToUTF16("background"),
- UTF8ToUTF16(extension->id()));
+ base::ASCIIToUTF16("background"),
+ base::UTF8ToUTF16(extension->id()));
}
}
@@ -445,8 +448,8 @@ void BackgroundContentsService::Observe(
case UnloadedExtensionInfo::REASON_TERMINATE: // Fall through.
case UnloadedExtensionInfo::REASON_UNINSTALL: // Fall through.
case UnloadedExtensionInfo::REASON_BLACKLIST:
- ShutdownAssociatedBackgroundContents(
- ASCIIToUTF16(content::Details<UnloadedExtensionInfo>(details)->
+ ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16(
+ content::Details<UnloadedExtensionInfo>(details)->
extension->id()));
SendChangeNotification(content::Source<Profile>(source).ptr());
break;
@@ -459,14 +462,16 @@ void BackgroundContentsService::Observe(
// from the LOADED callback.
const Extension* extension =
content::Details<UnloadedExtensionInfo>(details)->extension;
- if (BackgroundInfo::HasBackgroundPage(extension))
- ShutdownAssociatedBackgroundContents(ASCIIToUTF16(extension->id()));
+ if (BackgroundInfo::HasBackgroundPage(extension)) {
+ ShutdownAssociatedBackgroundContents(
+ base::ASCIIToUTF16(extension->id()));
+ }
break;
}
default:
NOTREACHED();
- ShutdownAssociatedBackgroundContents(
- ASCIIToUTF16(content::Details<UnloadedExtensionInfo>(details)->
+ ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16(
+ content::Details<UnloadedExtensionInfo>(details)->
extension->id()));
break;
}
@@ -544,8 +549,8 @@ void BackgroundContentsService::LoadBackgroundContentsForExtension(
if (extension && BackgroundInfo::HasBackgroundPage(extension)) {
LoadBackgroundContents(profile,
BackgroundInfo::GetBackgroundURL(extension),
- ASCIIToUTF16("background"),
- UTF8ToUTF16(extension->id()));
+ base::ASCIIToUTF16("background"),
+ base::UTF8ToUTF16(extension->id()));
return;
}
@@ -579,7 +584,7 @@ void BackgroundContentsService::LoadBackgroundContentsFromDictionary(
LoadBackgroundContents(profile,
GURL(url),
frame_name,
- UTF8ToUTF16(extension_id));
+ base::UTF8ToUTF16(extension_id));
}
void BackgroundContentsService::LoadBackgroundContentsFromManifests(
@@ -594,8 +599,8 @@ void BackgroundContentsService::LoadBackgroundContentsFromManifests(
BackgroundInfo::HasBackgroundPage(extension)) {
LoadBackgroundContents(profile,
BackgroundInfo::GetBackgroundURL(extension),
- ASCIIToUTF16("background"),
- UTF8ToUTF16(extension->id()));
+ base::ASCIIToUTF16("background"),
+ base::UTF8ToUTF16(extension->id()));
}
}
}
@@ -669,21 +674,23 @@ void BackgroundContentsService::RegisterBackgroundContents(
base::DictionaryValue* pref = update.Get();
const base::string16& appid = GetParentApplicationId(background_contents);
base::DictionaryValue* current;
- if (pref->GetDictionaryWithoutPathExpansion(UTF16ToUTF8(appid), &current))
+ if (pref->GetDictionaryWithoutPathExpansion(base::UTF16ToUTF8(appid),
+ &current)) {
return;
+ }
// No entry for this application yet, so add one.
base::DictionaryValue* dict = new base::DictionaryValue();
dict->SetString(kUrlKey, background_contents->GetURL().spec());
dict->SetString(kFrameNameKey, contents_map_[appid].frame_name);
- pref->SetWithoutPathExpansion(UTF16ToUTF8(appid), dict);
+ pref->SetWithoutPathExpansion(base::UTF16ToUTF8(appid), dict);
}
bool BackgroundContentsService::HasRegisteredBackgroundContents(
const base::string16& app_id) {
if (!prefs_)
return false;
- std::string app = UTF16ToUTF8(app_id);
+ std::string app = base::UTF16ToUTF8(app_id);
const base::DictionaryValue* contents =
prefs_->GetDictionary(prefs::kRegisteredBackgroundContents);
return contents->HasKey(app);
@@ -696,7 +703,7 @@ void BackgroundContentsService::UnregisterBackgroundContents(
DCHECK(IsTracked(background_contents));
const base::string16 appid = GetParentApplicationId(background_contents);
DictionaryPrefUpdate update(prefs_, prefs::kRegisteredBackgroundContents);
- update.Get()->RemoveWithoutPathExpansion(UTF16ToUTF8(appid), NULL);
+ update.Get()->RemoveWithoutPathExpansion(base::UTF16ToUTF8(appid), NULL);
}
void BackgroundContentsService::ShutdownAssociatedBackgroundContents(
diff --git a/chrome/browser/background/background_contents_service_unittest.cc b/chrome/browser/background/background_contents_service_unittest.cc
index fcb81cb..0148254 100644
--- a/chrome/browser/background/background_contents_service_unittest.cc
+++ b/chrome/browser/background/background_contents_service_unittest.cc
@@ -39,9 +39,9 @@ class BackgroundContentsServiceTest : public testing::Test {
// Returns the stored pref URL for the passed app id.
std::string GetPrefURLForApp(Profile* profile, const base::string16& appid) {
const base::DictionaryValue* pref = GetPrefs(profile);
- EXPECT_TRUE(pref->HasKey(UTF16ToUTF8(appid)));
+ EXPECT_TRUE(pref->HasKey(base::UTF16ToUTF8(appid)));
const base::DictionaryValue* value;
- pref->GetDictionaryWithoutPathExpansion(UTF16ToUTF8(appid), &value);
+ pref->GetDictionaryWithoutPathExpansion(base::UTF16ToUTF8(appid), &value);
std::string url;
value->GetString("url", &url);
return url;
@@ -53,16 +53,16 @@ class BackgroundContentsServiceTest : public testing::Test {
class MockBackgroundContents : public BackgroundContents {
public:
explicit MockBackgroundContents(Profile* profile)
- : appid_(ASCIIToUTF16("app_id")),
+ : appid_(base::ASCIIToUTF16("app_id")),
profile_(profile) {
}
MockBackgroundContents(Profile* profile, const std::string& id)
- : appid_(ASCIIToUTF16(id)),
+ : appid_(base::ASCIIToUTF16(id)),
profile_(profile) {
}
void SendOpenedNotification(BackgroundContentsService* service) {
- base::string16 frame_name = ASCIIToUTF16("background");
+ base::string16 frame_name = base::ASCIIToUTF16("background");
BackgroundContentsOpenedDetails details = {
this, frame_name, appid_ };
service->BackgroundContentsOpened(&details);
@@ -207,7 +207,8 @@ TEST_F(BackgroundContentsServiceTest, TestApplicationIDLinkage) {
BackgroundContentsServiceFactory::GetInstance()->
RegisterUserPrefsOnBrowserContextForTest(&profile);
- EXPECT_EQ(NULL, service.GetAppBackgroundContents(ASCIIToUTF16("appid")));
+ EXPECT_EQ(NULL,
+ service.GetAppBackgroundContents(base::ASCIIToUTF16("appid")));
MockBackgroundContents* contents = new MockBackgroundContents(&profile,
"appid");
scoped_ptr<MockBackgroundContents> contents2(
@@ -227,9 +228,10 @@ TEST_F(BackgroundContentsServiceTest, TestApplicationIDLinkage) {
EXPECT_EQ(1U, GetPrefs(&profile)->size());
contents2->Navigate(url2);
EXPECT_EQ(2U, GetPrefs(&profile)->size());
- service.ShutdownAssociatedBackgroundContents(ASCIIToUTF16("appid"));
+ service.ShutdownAssociatedBackgroundContents(base::ASCIIToUTF16("appid"));
EXPECT_FALSE(service.IsTracked(contents));
- EXPECT_EQ(NULL, service.GetAppBackgroundContents(ASCIIToUTF16("appid")));
+ EXPECT_EQ(NULL,
+ service.GetAppBackgroundContents(base::ASCIIToUTF16("appid")));
EXPECT_EQ(1U, GetPrefs(&profile)->size());
EXPECT_EQ(url2.spec(), GetPrefURLForApp(&profile, contents2->appid()));
}
diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/browser/background/background_mode_manager.cc
index 71711cc..0df7a3e 100644
--- a/chrome/browser/background/background_mode_manager.cc
+++ b/chrome/browser/background/background_mode_manager.cc
@@ -123,7 +123,7 @@ void BackgroundModeManager::BackgroundModeData::BuildProfileMenu(
// Check that the command ID is within the dynamic range.
DCHECK(command_id < IDC_MinimumLabelValue);
command_id_extension_vector_->push_back(position);
- menu->AddItem(command_id, UTF8ToUTF16(name));
+ menu->AddItem(command_id, base::UTF8ToUTF16(name));
if (icon)
menu->SetIcon(menu->GetItemCount() - 1, gfx::Image(*icon));
diff --git a/chrome/browser/background/background_mode_manager_unittest.cc b/chrome/browser/background/background_mode_manager_unittest.cc
index 9eb09d2..cdbe6bf 100644
--- a/chrome/browser/background/background_mode_manager_unittest.cc
+++ b/chrome/browser/background/background_mode_manager_unittest.cc
@@ -362,7 +362,7 @@ TEST_F(BackgroundModeManagerTest, ProfileInfoCacheObserver) {
profile1->GetPath(),
manager.GetBackgroundModeData(profile1)->name());
- EXPECT_EQ(UTF8ToUTF16("p1"),
+ EXPECT_EQ(base::UTF8ToUTF16("p1"),
manager.GetBackgroundModeData(profile1)->name());
TestingProfile* profile2 = profile_manager->CreateTestingProfile("p2");
@@ -370,14 +370,14 @@ TEST_F(BackgroundModeManagerTest, ProfileInfoCacheObserver) {
EXPECT_EQ(2, manager.NumberOfBackgroundModeData());
manager.OnProfileAdded(profile2->GetPath());
- EXPECT_EQ(UTF8ToUTF16("p2"),
+ EXPECT_EQ(base::UTF8ToUTF16("p2"),
manager.GetBackgroundModeData(profile2)->name());
manager.OnProfileWillBeRemoved(profile2->GetPath());
EXPECT_EQ(1, manager.NumberOfBackgroundModeData());
// Check that the background mode data we think is in the map actually is.
- EXPECT_EQ(UTF8ToUTF16("p1"),
+ EXPECT_EQ(base::UTF8ToUTF16("p1"),
manager.GetBackgroundModeData(profile1)->name());
}
@@ -497,19 +497,19 @@ TEST_F(BackgroundModeManagerTest, BackgroundMenuGeneration) {
bmd->BuildProfileMenu(submenu.get(), menu.get());
EXPECT_TRUE(
submenu->GetLabelAt(0) ==
- UTF8ToUTF16("Component Extension"));
+ base::UTF8ToUTF16("Component Extension"));
EXPECT_FALSE(submenu->IsCommandIdEnabled(submenu->GetCommandIdAt(0)));
EXPECT_TRUE(
submenu->GetLabelAt(1) ==
- UTF8ToUTF16("Component Extension with Options"));
+ base::UTF8ToUTF16("Component Extension with Options"));
EXPECT_TRUE(submenu->IsCommandIdEnabled(submenu->GetCommandIdAt(1)));
EXPECT_TRUE(
submenu->GetLabelAt(2) ==
- UTF8ToUTF16("Regular Extension"));
+ base::UTF8ToUTF16("Regular Extension"));
EXPECT_TRUE(submenu->IsCommandIdEnabled(submenu->GetCommandIdAt(2)));
EXPECT_TRUE(
submenu->GetLabelAt(3) ==
- UTF8ToUTF16("Regular Extension with Options"));
+ base::UTF8ToUTF16("Regular Extension with Options"));
EXPECT_TRUE(submenu->IsCommandIdEnabled(submenu->GetCommandIdAt(3)));
// We have to destroy the profile now because we created it with real thread
@@ -644,12 +644,12 @@ TEST_F(BackgroundModeManagerTest, BackgroundMenuGenerationMultipleProfile) {
EXPECT_TRUE(context_menu != NULL);
// Background Profile Enable Checks
- EXPECT_TRUE(context_menu->GetLabelAt(3) == UTF8ToUTF16("p1"));
+ EXPECT_TRUE(context_menu->GetLabelAt(3) == base::UTF8ToUTF16("p1"));
EXPECT_TRUE(
context_menu->IsCommandIdEnabled(context_menu->GetCommandIdAt(3)));
EXPECT_TRUE(context_menu->GetCommandIdAt(3) == 4);
- EXPECT_TRUE(context_menu->GetLabelAt(4) == UTF8ToUTF16("p2"));
+ EXPECT_TRUE(context_menu->GetLabelAt(4) == base::UTF8ToUTF16("p2"));
EXPECT_TRUE(
context_menu->IsCommandIdEnabled(context_menu->GetCommandIdAt(4)));
EXPECT_TRUE(context_menu->GetCommandIdAt(4) == 8);
@@ -659,28 +659,28 @@ TEST_F(BackgroundModeManagerTest, BackgroundMenuGenerationMultipleProfile) {
static_cast<StatusIconMenuModel*>(context_menu->GetSubmenuModelAt(3));
EXPECT_TRUE(
profile1_submenu->GetLabelAt(0) ==
- UTF8ToUTF16("Component Extension"));
+ base::UTF8ToUTF16("Component Extension"));
EXPECT_FALSE(
profile1_submenu->IsCommandIdEnabled(
profile1_submenu->GetCommandIdAt(0)));
EXPECT_TRUE(profile1_submenu->GetCommandIdAt(0) == 0);
EXPECT_TRUE(
profile1_submenu->GetLabelAt(1) ==
- UTF8ToUTF16("Component Extension with Options"));
+ base::UTF8ToUTF16("Component Extension with Options"));
EXPECT_TRUE(
profile1_submenu->IsCommandIdEnabled(
profile1_submenu->GetCommandIdAt(1)));
EXPECT_TRUE(profile1_submenu->GetCommandIdAt(1) == 1);
EXPECT_TRUE(
profile1_submenu->GetLabelAt(2) ==
- UTF8ToUTF16("Regular Extension"));
+ base::UTF8ToUTF16("Regular Extension"));
EXPECT_TRUE(
profile1_submenu->IsCommandIdEnabled(
profile1_submenu->GetCommandIdAt(2)));
EXPECT_TRUE(profile1_submenu->GetCommandIdAt(2) == 2);
EXPECT_TRUE(
profile1_submenu->GetLabelAt(3) ==
- UTF8ToUTF16("Regular Extension with Options"));
+ base::UTF8ToUTF16("Regular Extension with Options"));
EXPECT_TRUE(
profile1_submenu->IsCommandIdEnabled(
profile1_submenu->GetCommandIdAt(3)));
@@ -691,21 +691,21 @@ TEST_F(BackgroundModeManagerTest, BackgroundMenuGenerationMultipleProfile) {
static_cast<StatusIconMenuModel*>(context_menu->GetSubmenuModelAt(4));
EXPECT_TRUE(
profile2_submenu->GetLabelAt(0) ==
- UTF8ToUTF16("Component Extension"));
+ base::UTF8ToUTF16("Component Extension"));
EXPECT_FALSE(
profile2_submenu->IsCommandIdEnabled(
profile2_submenu->GetCommandIdAt(0)));
EXPECT_TRUE(profile2_submenu->GetCommandIdAt(0) == 5);
EXPECT_TRUE(
profile2_submenu->GetLabelAt(1) ==
- UTF8ToUTF16("Regular Extension"));
+ base::UTF8ToUTF16("Regular Extension"));
EXPECT_TRUE(
profile2_submenu->IsCommandIdEnabled(
profile2_submenu->GetCommandIdAt(1)));
EXPECT_TRUE(profile2_submenu->GetCommandIdAt(1) == 6);
EXPECT_TRUE(
profile2_submenu->GetLabelAt(2) ==
- UTF8ToUTF16("Regular Extension with Options"));
+ base::UTF8ToUTF16("Regular Extension with Options"));
EXPECT_TRUE(
profile2_submenu->IsCommandIdEnabled(
profile2_submenu->GetCommandIdAt(2)));
diff --git a/chrome/browser/background/background_mode_manager_win.cc b/chrome/browser/background/background_mode_manager_win.cc
index e8865e9..4dd0728 100644
--- a/chrome/browser/background/background_mode_manager_win.cc
+++ b/chrome/browser/background/background_mode_manager_win.cc
@@ -42,7 +42,7 @@ void BackgroundModeManager::DisplayAppInstalledNotification(
l10n_util::GetStringUTF16(IDS_BACKGROUND_APP_INSTALLED_BALLOON_TITLE),
l10n_util::GetStringFUTF16(
IDS_BACKGROUND_APP_INSTALLED_BALLOON_BODY,
- UTF8ToUTF16(extension->name()),
+ base::UTF8ToUTF16(extension->name()),
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
}