| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "athena/extensions/public/extension_app_model_builder.h" | 5 #include "athena/extensions/public/extension_app_model_builder.h" |
| 6 | 6 |
| 7 #include "athena/activity/public/activity_factory.h" | 7 #include "athena/activity/public/activity_factory.h" |
| 8 #include "athena/activity/public/activity_manager.h" | 8 #include "athena/activity/public/activity_manager.h" |
| 9 #include "athena/extensions/public/extensions_delegate.h" | 9 #include "athena/extensions/public/extensions_delegate.h" |
| 10 #include "extensions/browser/extension_icon_image.h" | 10 #include "extensions/browser/extension_icon_image.h" |
| 11 #include "extensions/common/constants.h" | 11 #include "extensions/common/constants.h" |
| 12 #include "extensions/common/extension_set.h" | 12 #include "extensions/common/extension_set.h" |
| 13 #include "extensions/common/manifest_handlers/icons_handler.h" | 13 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 14 #include "extensions/grit/extensions_browser_resources.h" | 14 #include "extensions/grit/extensions_browser_resources.h" |
| 15 #include "ui/app_list/app_list_item.h" | 15 #include "ui/app_list/app_list_item.h" |
| 16 #include "ui/app_list/app_list_model.h" | 16 #include "ui/app_list/app_list_model.h" |
| 17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| 18 | 18 |
| 19 namespace athena { | 19 namespace athena { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 // Copied from chrome/common/extensions/extension_constants.h |
| 24 // TODO(mukai): move constants to src/extensions |
| 25 const char kChromeAppId[] = "mgndgikekgjfcpckkfioiadnlibdjbkf"; |
| 26 |
| 23 class AppItem : public app_list::AppListItem { | 27 class AppItem : public app_list::AppListItem { |
| 24 public: | 28 public: |
| 25 AppItem(scoped_refptr<const extensions::Extension> extension, | 29 AppItem(scoped_refptr<const extensions::Extension> extension, |
| 26 content::BrowserContext* browser_context) | 30 content::BrowserContext* browser_context) |
| 27 : app_list::AppListItem(extension->id()), | 31 : app_list::AppListItem(extension->id()), |
| 28 extension_(extension), | 32 extension_(extension), |
| 29 browser_context_(browser_context), | 33 browser_context_(browser_context), |
| 30 icon_image_(browser_context_, | 34 icon_image_(browser_context_, |
| 31 extension.get(), | 35 extension.get(), |
| 32 extensions::IconsInfo::GetIcons(extension.get()), | 36 extensions::IconsInfo::GetIcons(extension.get()), |
| (...skipping 28 matching lines...) Expand all Loading... |
| 61 | 65 |
| 62 ExtensionAppModelBuilder::~ExtensionAppModelBuilder() { | 66 ExtensionAppModelBuilder::~ExtensionAppModelBuilder() { |
| 63 } | 67 } |
| 64 | 68 |
| 65 void ExtensionAppModelBuilder::PopulateApps(app_list::AppListModel* model) { | 69 void ExtensionAppModelBuilder::PopulateApps(app_list::AppListModel* model) { |
| 66 ExtensionsDelegate* bridge = ExtensionsDelegate::Get(browser_context_); | 70 ExtensionsDelegate* bridge = ExtensionsDelegate::Get(browser_context_); |
| 67 const extensions::ExtensionSet& extensions = bridge->GetInstalledExtensions(); | 71 const extensions::ExtensionSet& extensions = bridge->GetInstalledExtensions(); |
| 68 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); | 72 for (extensions::ExtensionSet::const_iterator iter = extensions.begin(); |
| 69 iter != extensions.end(); | 73 iter != extensions.end(); |
| 70 ++iter) { | 74 ++iter) { |
| 75 // Chrome icon is currently disabled for homecard since it's not meaningful. |
| 76 // http://crbug.com/421677 |
| 71 // TODO(mukai): use chrome/browser/extension_ui_util. | 77 // TODO(mukai): use chrome/browser/extension_ui_util. |
| 72 if ((*iter)->ShouldDisplayInAppLauncher()) { | 78 if ((*iter)->ShouldDisplayInAppLauncher() && |
| 79 (*iter)->id() != kChromeAppId) { |
| 73 model->AddItem(scoped_ptr<app_list::AppListItem>( | 80 model->AddItem(scoped_ptr<app_list::AppListItem>( |
| 74 new AppItem(*iter, browser_context_))); | 81 new AppItem(*iter, browser_context_))); |
| 75 } | 82 } |
| 76 } | 83 } |
| 77 } | 84 } |
| 78 | 85 |
| 79 } // namespace athena | 86 } // namespace athena |
| OLD | NEW |