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

Side by Side Diff: chrome/browser/ui/app_list/extension_app_item.cc

Issue 725853002: Move app launch metric recording code from NTP to chrome/common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More mac Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
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 "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_util.h" 9 #include "chrome/browser/extensions/extension_util.h"
10 #include "chrome/browser/extensions/launch_util.h" 10 #include "chrome/browser/extensions/launch_util.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/app_list/app_context_menu.h" 12 #include "chrome/browser/ui/app_list/app_context_menu.h"
13 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" 13 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
14 #include "chrome/browser/ui/app_list/app_list_service.h" 14 #include "chrome/browser/ui/app_list/app_list_service.h"
15 #include "chrome/browser/ui/extensions/extension_enable_flow.h" 15 #include "chrome/browser/ui/extensions/extension_enable_flow.h"
16 #include "chrome/browser/ui/host_desktop.h" 16 #include "chrome/browser/ui/host_desktop.h"
17 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
18 #include "chrome/common/extensions/extension_constants.h" 17 #include "chrome/common/extensions/extension_constants.h"
18 #include "chrome/common/extensions/extension_metrics.h"
19 #include "content/public/browser/user_metrics.h" 19 #include "content/public/browser/user_metrics.h"
20 #include "extensions/browser/app_sorting.h" 20 #include "extensions/browser/app_sorting.h"
21 #include "extensions/browser/extension_prefs.h" 21 #include "extensions/browser/extension_prefs.h"
22 #include "extensions/browser/extension_system.h" 22 #include "extensions/browser/extension_system.h"
23 #include "extensions/common/extension.h" 23 #include "extensions/common/extension.h"
24 #include "extensions/common/extension_icon_set.h" 24 #include "extensions/common/extension_icon_set.h"
25 #include "extensions/common/manifest_handlers/icons_handler.h" 25 #include "extensions/common/manifest_handlers/icons_handler.h"
26 #include "extensions/common/manifest_url_handlers.h" 26 #include "extensions/common/manifest_url_handlers.h"
27 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
28 #include "sync/api/string_ordinal.h" 28 #include "sync/api/string_ordinal.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 return; 311 return;
312 312
313 // Don't auto-enable apps that cannot be launched. 313 // Don't auto-enable apps that cannot be launched.
314 if (!extensions::util::IsAppLaunchable(extension_id_, profile_)) 314 if (!extensions::util::IsAppLaunchable(extension_id_, profile_))
315 return; 315 return;
316 316
317 if (RunExtensionEnableFlow()) 317 if (RunExtensionEnableFlow())
318 return; 318 return;
319 319
320 content::RecordAction(base::UserMetricsAction("AppList_ClickOnApp")); 320 content::RecordAction(base::UserMetricsAction("AppList_ClickOnApp"));
321 CoreAppLauncherHandler::RecordAppListMainLaunch(extension); 321 extensions::RecordAppListMainLaunch(extension);
322 GetController()->ActivateApp(profile_, 322 GetController()->ActivateApp(profile_,
323 extension, 323 extension,
324 AppListControllerDelegate::LAUNCH_FROM_APP_LIST, 324 AppListControllerDelegate::LAUNCH_FROM_APP_LIST,
325 event_flags); 325 event_flags);
326 } 326 }
327 327
328 ui::MenuModel* ExtensionAppItem::GetContextMenuModel() { 328 ui::MenuModel* ExtensionAppItem::GetContextMenuModel() {
329 context_menu_.reset(new app_list::AppContextMenu( 329 context_menu_.reset(new app_list::AppContextMenu(
330 this, profile_, extension_id_, GetController())); 330 this, profile_, extension_id_, GetController()));
331 context_menu_->set_is_platform_app(is_platform_app_); 331 context_menu_->set_is_platform_app(is_platform_app_);
(...skipping 24 matching lines...) Expand all
356 const syncer::StringOrdinal& launch = 356 const syncer::StringOrdinal& launch =
357 GetAppSorting(profile_)->GetAppLaunchOrdinal(extension_id_); 357 GetAppSorting(profile_)->GetAppLaunchOrdinal(extension_id_);
358 set_position(syncer::StringOrdinal( 358 set_position(syncer::StringOrdinal(
359 page.ToInternalValue() + launch.ToInternalValue())); 359 page.ToInternalValue() + launch.ToInternalValue()));
360 } 360 }
361 361
362 AppListControllerDelegate* ExtensionAppItem::GetController() { 362 AppListControllerDelegate* ExtensionAppItem::GetController() {
363 return AppListService::Get(chrome::GetActiveDesktop())-> 363 return AppListService::Get(chrome::GetActiveDesktop())->
364 GetControllerDelegate(); 364 GetControllerDelegate();
365 } 365 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/tab_restore_service_helper.cc ('k') | chrome/browser/ui/app_list/search/app_result.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698