Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Unified Diff: chrome/browser/ui/views/ash/app_list/search_builder.cc

Issue 10652003: chromeos: Make Chrome app a real app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/ash/app_list/extension_app_item.cc ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/ash/app_list/search_builder.cc
diff --git a/chrome/browser/ui/views/ash/app_list/search_builder.cc b/chrome/browser/ui/views/ash/app_list/search_builder.cc
index dcd1cb79050f771bb29cd96b53531853f26d7dad..6b5868a505e1864afd313b09ae926b63dc2a70d6 100644
--- a/chrome/browser/ui/views/ash/app_list/search_builder.cc
+++ b/chrome/browser/ui/views/ash/app_list/search_builder.cc
@@ -74,6 +74,17 @@ void ACMatchClassificationsToTags(
}
}
+const extensions::Extension* GetExtensionByURL(Profile* profile,
+ const GURL& url) {
+ ExtensionService* service = profile->GetExtensionService();
+ // Need to explicitly get chrome app because it does not override new tab and
+ // not having a web extent to include new tab url, thus GetInstalledApp does
+ // not find it.
+ return url.spec() == chrome::kChromeUINewTabURL ?
+ service->extensions()->GetByID(extension_misc::kChromeAppId) :
+ service->GetInstalledApp(url);
+}
+
// SearchBuildResult is an app list SearchResult built from an
// AutocompleteMatch.
class SearchBuilderResult : public app_list::SearchResult,
@@ -94,9 +105,8 @@ class SearchBuilderResult : public app_list::SearchResult,
private:
void UpdateIcon() {
if (match_.type == AutocompleteMatch::EXTENSION_APP) {
- ExtensionService* service = profile_->GetExtensionService();
const extensions::Extension* extension =
- service->GetInstalledApp(match_.destination_url);
+ GetExtensionByURL(profile_, match_.destination_url);
if (extension) {
LoadExtensionIcon(extension);
return;
@@ -220,9 +230,8 @@ void SearchBuilder::OpenResult(const app_list::SearchResult& result,
const AutocompleteMatch& match = builder_result->match();
if (match.type == AutocompleteMatch::EXTENSION_APP) {
- ExtensionService* service = profile_->GetExtensionService();
const extensions::Extension* extension =
- service->GetInstalledApp(match.destination_url);
+ GetExtensionByURL(profile_, match.destination_url);
if (extension)
extension_utils::OpenExtension(profile_, extension, event_flags);
} else {
« no previous file with comments | « chrome/browser/ui/views/ash/app_list/extension_app_item.cc ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698