| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/app_list/extension_app_item.h" | 5 #include "chrome/browser/ui/app_list/extension_app_item.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/metrics/user_metrics.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "chrome/browser/extensions/extension_util.h" | 12 #include "chrome/browser/extensions/extension_util.h" |
| 12 #include "chrome/browser/extensions/launch_util.h" | 13 #include "chrome/browser/extensions/launch_util.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 15 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 15 #include "chrome/browser/ui/app_list/extension_app_context_menu.h" | 16 #include "chrome/browser/ui/app_list/extension_app_context_menu.h" |
| 16 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 17 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 17 #include "chrome/common/extensions/extension_constants.h" | 18 #include "chrome/common/extensions/extension_constants.h" |
| 18 #include "chrome/common/extensions/extension_metrics.h" | 19 #include "chrome/common/extensions/extension_metrics.h" |
| 19 #include "chrome/grit/theme_resources.h" | 20 #include "chrome/grit/theme_resources.h" |
| 20 #include "components/prefs/pref_service.h" | 21 #include "components/prefs/pref_service.h" |
| 21 #include "components/sync/model/string_ordinal.h" | 22 #include "components/sync/model/string_ordinal.h" |
| 22 #include "content/public/browser/user_metrics.h" | |
| 23 #include "extensions/browser/app_sorting.h" | 23 #include "extensions/browser/app_sorting.h" |
| 24 #include "extensions/browser/extension_prefs.h" | 24 #include "extensions/browser/extension_prefs.h" |
| 25 #include "extensions/browser/extension_registry.h" | 25 #include "extensions/browser/extension_registry.h" |
| 26 #include "extensions/common/extension.h" | 26 #include "extensions/common/extension.h" |
| 27 #include "extensions/common/extension_icon_set.h" | 27 #include "extensions/common/extension_icon_set.h" |
| 28 #include "extensions/common/manifest_handlers/icons_handler.h" | 28 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 29 #include "extensions/common/manifest_url_handlers.h" | 29 #include "extensions/common/manifest_url_handlers.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 31 #include "ui/events/event_constants.h" | 31 #include "ui/events/event_constants.h" |
| 32 #include "ui/gfx/canvas.h" | 32 #include "ui/gfx/canvas.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 if (!extension) | 272 if (!extension) |
| 273 return; | 273 return; |
| 274 | 274 |
| 275 // Don't auto-enable apps that cannot be launched. | 275 // Don't auto-enable apps that cannot be launched. |
| 276 if (!extensions::util::IsAppLaunchable(extension_id(), profile())) | 276 if (!extensions::util::IsAppLaunchable(extension_id(), profile())) |
| 277 return; | 277 return; |
| 278 | 278 |
| 279 if (RunExtensionEnableFlow()) | 279 if (RunExtensionEnableFlow()) |
| 280 return; | 280 return; |
| 281 | 281 |
| 282 content::RecordAction(base::UserMetricsAction("AppList_ClickOnApp")); | 282 base::RecordAction(base::UserMetricsAction("AppList_ClickOnApp")); |
| 283 extensions::RecordAppListMainLaunch(extension); | 283 extensions::RecordAppListMainLaunch(extension); |
| 284 GetController()->ActivateApp(profile(), | 284 GetController()->ActivateApp(profile(), |
| 285 extension, | 285 extension, |
| 286 AppListControllerDelegate::LAUNCH_FROM_APP_LIST, | 286 AppListControllerDelegate::LAUNCH_FROM_APP_LIST, |
| 287 event_flags); | 287 event_flags); |
| 288 } | 288 } |
| 289 | 289 |
| 290 ui::MenuModel* ExtensionAppItem::GetContextMenuModel() { | 290 ui::MenuModel* ExtensionAppItem::GetContextMenuModel() { |
| 291 context_menu_.reset(new app_list::ExtensionAppContextMenu(this, | 291 context_menu_.reset(new app_list::ExtensionAppContextMenu(this, |
| 292 profile(), | 292 profile(), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 304 // static | 304 // static |
| 305 const char ExtensionAppItem::kItemType[] = "ExtensionAppItem"; | 305 const char ExtensionAppItem::kItemType[] = "ExtensionAppItem"; |
| 306 | 306 |
| 307 const char* ExtensionAppItem::GetItemType() const { | 307 const char* ExtensionAppItem::GetItemType() const { |
| 308 return ExtensionAppItem::kItemType; | 308 return ExtensionAppItem::kItemType; |
| 309 } | 309 } |
| 310 | 310 |
| 311 void ExtensionAppItem::ExecuteLaunchCommand(int event_flags) { | 311 void ExtensionAppItem::ExecuteLaunchCommand(int event_flags) { |
| 312 Launch(event_flags); | 312 Launch(event_flags); |
| 313 } | 313 } |
| OLD | NEW |