Commit 908a14ac authored by nancy's avatar nancy Committed by Commit Bot

Get the title for extensions.

AppService doesn't have the extensions information, so the tilte for
extensions on shelf is empty when launch extensions.

Modify LauncherControllerHelper::GetAppTitle. If the app can't be found
from AppService, call extensions to get the title.

BUG=1059732

Change-Id: Ib2766671e85c049c17c98f0a524e79f457706979
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2096416Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748913}
parent e01ae31d
......@@ -143,13 +143,27 @@ base::string16 LauncherControllerHelper::GetAppTitle(
apps::AppServiceProxy* proxy =
apps::AppServiceProxyFactory::GetForProfile(profile);
if (!proxy)
return base::string16();
if (proxy) {
std::string name;
proxy->AppRegistryCache().ForOneApp(
app_id, [&name](const apps::AppUpdate& update) { name = update.Name(); });
app_id,
[&name](const apps::AppUpdate& update) { name = update.Name(); });
if (!name.empty())
return base::UTF8ToUTF16(name);
}
// Get the title for the extension which is not managed by AppService.
extensions::ExtensionRegistry* registry =
extensions::ExtensionRegistry::Get(profile);
if (!registry)
return base::string16();
auto* extension = registry->GetExtensionById(
app_id, extensions::ExtensionRegistry::EVERYTHING);
if (extension)
return base::UTF8ToUTF16(extension->name());
return base::string16();
}
std::string LauncherControllerHelper::GetAppID(content::WebContents* tab) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment