| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/search/extension_app_result.h" | 5 #include "chrome/browser/ui/app_list/search/extension_app_result.h" |
| 6 | 6 |
| 7 #include "base/metrics/user_metrics.h" |
| 7 #include "chrome/browser/extensions/extension_util.h" | 8 #include "chrome/browser/extensions/extension_util.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 10 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 10 #include "chrome/browser/ui/app_list/extension_app_context_menu.h" | 11 #include "chrome/browser/ui/app_list/extension_app_context_menu.h" |
| 11 #include "chrome/browser/ui/app_list/search/search_util.h" | 12 #include "chrome/browser/ui/app_list/search/search_util.h" |
| 12 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 13 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 13 #include "chrome/common/extensions/extension_metrics.h" | 14 #include "chrome/common/extensions/extension_metrics.h" |
| 14 #include "content/public/browser/user_metrics.h" | |
| 15 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
| 16 #include "extensions/browser/extension_system_provider.h" | 16 #include "extensions/browser/extension_system_provider.h" |
| 17 #include "extensions/browser/extensions_browser_client.h" | 17 #include "extensions/browser/extensions_browser_client.h" |
| 18 #include "extensions/common/constants.h" | 18 #include "extensions/common/constants.h" |
| 19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
| 20 #include "extensions/common/extension_icon_set.h" | 20 #include "extensions/common/extension_icon_set.h" |
| 21 #include "extensions/common/manifest_handlers/icons_handler.h" | 21 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 22 #include "ui/app_list/app_list_switches.h" | 22 #include "ui/app_list/app_list_switches.h" |
| 23 #include "ui/events/event_constants.h" | 23 #include "ui/events/event_constants.h" |
| 24 #include "ui/gfx/color_utils.h" | 24 #include "ui/gfx/color_utils.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Don't auto-enable apps that cannot be launched. | 71 // Don't auto-enable apps that cannot be launched. |
| 72 if (!extensions::util::IsAppLaunchable(app_id(), profile())) | 72 if (!extensions::util::IsAppLaunchable(app_id(), profile())) |
| 73 return; | 73 return; |
| 74 | 74 |
| 75 // Check if enable flow is already running or should be started | 75 // Check if enable flow is already running or should be started |
| 76 if (RunExtensionEnableFlow()) | 76 if (RunExtensionEnableFlow()) |
| 77 return; | 77 return; |
| 78 | 78 |
| 79 if (display_type() != DISPLAY_RECOMMENDATION) { | 79 if (display_type() != DISPLAY_RECOMMENDATION) { |
| 80 extensions::RecordAppListSearchLaunch(extension); | 80 extensions::RecordAppListSearchLaunch(extension); |
| 81 content::RecordAction( | 81 base::RecordAction(base::UserMetricsAction("AppList_ClickOnAppFromSearch")); |
| 82 base::UserMetricsAction("AppList_ClickOnAppFromSearch")); | |
| 83 } | 82 } |
| 84 | 83 |
| 85 controller()->ActivateApp( | 84 controller()->ActivateApp( |
| 86 profile(), | 85 profile(), |
| 87 extension, | 86 extension, |
| 88 AppListControllerDelegate::LAUNCH_FROM_APP_LIST_SEARCH, | 87 AppListControllerDelegate::LAUNCH_FROM_APP_LIST_SEARCH, |
| 89 event_flags); | 88 event_flags); |
| 90 } | 89 } |
| 91 | 90 |
| 92 std::unique_ptr<SearchResult> ExtensionAppResult::Duplicate() const { | 91 std::unique_ptr<SearchResult> ExtensionAppResult::Duplicate() const { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 const extensions::Extension* extension) { | 185 const extensions::Extension* extension) { |
| 187 UpdateIcon(); | 186 UpdateIcon(); |
| 188 } | 187 } |
| 189 | 188 |
| 190 void ExtensionAppResult::OnShutdown(extensions::ExtensionRegistry* registry) { | 189 void ExtensionAppResult::OnShutdown(extensions::ExtensionRegistry* registry) { |
| 191 DCHECK_EQ(extension_registry_, registry); | 190 DCHECK_EQ(extension_registry_, registry); |
| 192 StopObservingExtensionRegistry(); | 191 StopObservingExtensionRegistry(); |
| 193 } | 192 } |
| 194 | 193 |
| 195 } // namespace app_list | 194 } // namespace app_list |
| OLD | NEW |