| Index: chrome/browser/ui/app_list/app_list_view_delegate.cc
|
| diff --git a/chrome/browser/ui/app_list/app_list_view_delegate.cc b/chrome/browser/ui/app_list/app_list_view_delegate.cc
|
| index 7e7a94b65efe7c864bc1d6c9f2d30816f95e35f6..be225dea64b5c34119d9d4d0822c48a950b9a963 100644
|
| --- a/chrome/browser/ui/app_list/app_list_view_delegate.cc
|
| +++ b/chrome/browser/ui/app_list/app_list_view_delegate.cc
|
| @@ -40,6 +40,9 @@
|
| #include "content/public/browser/web_contents.h"
|
| #include "extensions/browser/extension_registry.h"
|
| #include "extensions/common/constants.h"
|
| +#include "extensions/common/extension_set.h"
|
| +#include "extensions/common/manifest.h"
|
| +#include "extensions/common/manifest_constants.h"
|
| #include "grit/theme_resources.h"
|
| #include "ui/app_list/app_list_switches.h"
|
| #include "ui/app_list/app_list_view_delegate_observer.h"
|
| @@ -106,7 +109,8 @@ void PopulateUsers(const ProfileInfoCache& profile_info,
|
| // Gets a list of URLs of the custom launcher pages to show in the launcher.
|
| // Returns a URL for each installed launcher page. If --custom-launcher-page is
|
| // specified and valid, also includes that URL.
|
| -void GetCustomLauncherPageUrls(std::vector<GURL>* urls) {
|
| +void GetCustomLauncherPageUrls(content::BrowserContext* browser_context,
|
| + std::vector<GURL>* urls) {
|
| // First, check the command line.
|
| base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
| if (app_list::switches::IsExperimentalAppListEnabled() &&
|
| @@ -117,13 +121,35 @@ void GetCustomLauncherPageUrls(std::vector<GURL>* urls) {
|
| if (custom_launcher_page_url.SchemeIs(extensions::kExtensionScheme)) {
|
| urls->push_back(custom_launcher_page_url);
|
| } else {
|
| + // TODO(mgiuca): Add a proper manifest parser to catch this error properly
|
| + // and display it on the extensions page.
|
| LOG(ERROR) << "Invalid custom launcher page URL: "
|
| << custom_launcher_page_url.possibly_invalid_spec();
|
| }
|
| }
|
|
|
| - // TODO(mgiuca): Search the list of installed extensions and add any with a
|
| - // 'launcher_page' attribute in its manifest.
|
| + // Search the list of installed extensions for ones with 'launcher_page'.
|
| + extensions::ExtensionRegistry* extension_registry =
|
| + extensions::ExtensionRegistry::Get(browser_context);
|
| + const extensions::ExtensionSet& enabled_extensions =
|
| + extension_registry->enabled_extensions();
|
| + for (extensions::ExtensionSet::const_iterator it = enabled_extensions.begin();
|
| + it != enabled_extensions.end();
|
| + ++it) {
|
| + const extensions::Extension* extension = it->get();
|
| + const extensions::Manifest* manifest = extension->manifest();
|
| + if (!manifest->HasKey(extensions::manifest_keys::kLauncherPage))
|
| + continue;
|
| + std::string launcher_page_page;
|
| + if (!manifest->GetString(extensions::manifest_keys::kLauncherPagePage,
|
| + &launcher_page_page)) {
|
| + LOG(ERROR) << "Extension " << extension->id() << ": "
|
| + << extensions::manifest_keys::kLauncherPage
|
| + << " has no 'page' attribute; will be ignored.";
|
| + continue;
|
| + }
|
| + urls->push_back(extension->GetResourceURL(launcher_page_page));
|
| + }
|
| }
|
|
|
| } // namespace
|
| @@ -173,7 +199,7 @@ AppListViewDelegate::AppListViewDelegate(Profile* profile,
|
|
|
| // Set up the custom launcher pages.
|
| std::vector<GURL> custom_launcher_page_urls;
|
| - GetCustomLauncherPageUrls(&custom_launcher_page_urls);
|
| + GetCustomLauncherPageUrls(profile, &custom_launcher_page_urls);
|
| for (std::vector<GURL>::const_iterator it = custom_launcher_page_urls.begin();
|
| it != custom_launcher_page_urls.end();
|
| ++it) {
|
|
|