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

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

Issue 1130353010: Remove deprecated ExtensionService::GetInstalledExtension() usage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed if to iff Created 5 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 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/app_list_controller_delegate.h" 5 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_util.h" 8 #include "chrome/browser/extensions/extension_util.h"
10 #include "chrome/browser/extensions/install_tracker_factory.h" 9 #include "chrome/browser/extensions/install_tracker_factory.h"
11 #include "chrome/browser/extensions/launch_util.h" 10 #include "chrome/browser/extensions/launch_util.h"
12 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/app_list/extension_uninstaller.h" 12 #include "chrome/browser/ui/app_list/extension_uninstaller.h"
14 #include "chrome/browser/ui/apps/app_info_dialog.h" 13 #include "chrome/browser/ui/apps/app_info_dialog.h"
15 #include "chrome/common/extensions/extension_constants.h" 14 #include "chrome/common/extensions/extension_constants.h"
16 #include "extensions/browser/extension_prefs.h" 15 #include "extensions/browser/extension_prefs.h"
17 #include "extensions/browser/extension_registry.h" 16 #include "extensions/browser/extension_registry.h"
18 #include "extensions/browser/extension_system.h" 17 #include "extensions/browser/extension_system.h"
(...skipping 12 matching lines...) Expand all
31 #if defined(ENABLE_RLZ) 30 #if defined(ENABLE_RLZ)
32 #include "chrome/browser/rlz/rlz.h" 31 #include "chrome/browser/rlz/rlz.h"
33 #endif 32 #endif
34 33
35 using extensions::ExtensionRegistry; 34 using extensions::ExtensionRegistry;
36 35
37 namespace { 36 namespace {
38 37
39 const extensions::Extension* GetExtension(Profile* profile, 38 const extensions::Extension* GetExtension(Profile* profile,
40 const std::string& extension_id) { 39 const std::string& extension_id) {
41 const ExtensionService* service = 40 const ExtensionRegistry* registry = ExtensionRegistry::Get(profile);
42 extensions::ExtensionSystem::Get(profile)->extension_service();
43 const extensions::Extension* extension = 41 const extensions::Extension* extension =
44 service->GetInstalledExtension(extension_id); 42 registry->GetInstalledExtension(extension_id);
45 return extension; 43 return extension;
46 } 44 }
47 45
48 } // namespace 46 } // namespace
49 47
50 AppListControllerDelegate::~AppListControllerDelegate() {} 48 AppListControllerDelegate::~AppListControllerDelegate() {}
51 49
52 bool AppListControllerDelegate::ForceNativeDesktop() const { 50 bool AppListControllerDelegate::ForceNativeDesktop() const {
53 return false; 51 return false;
54 } 52 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 if (!app_list::switches::IsMacViewsAppListEnabled()) 90 if (!app_list::switches::IsMacViewsAppListEnabled())
93 return false; 91 return false;
94 #endif 92 #endif
95 return CanShowAppInfoDialog(); 93 return CanShowAppInfoDialog();
96 } 94 }
97 95
98 void AppListControllerDelegate::DoShowAppInfoFlow( 96 void AppListControllerDelegate::DoShowAppInfoFlow(
99 Profile* profile, 97 Profile* profile,
100 const std::string& extension_id) { 98 const std::string& extension_id) {
101 DCHECK(CanDoShowAppInfoFlow()); 99 DCHECK(CanDoShowAppInfoFlow());
102 ExtensionService* service = 100 const extensions::Extension* extension = GetExtension(profile, extension_id);
103 extensions::ExtensionSystem::Get(profile)->extension_service();
104 DCHECK(service);
105 const extensions::Extension* extension = service->GetInstalledExtension(
106 extension_id);
107 DCHECK(extension); 101 DCHECK(extension);
108 102
109 OnShowChildDialog(); 103 OnShowChildDialog();
110 104
111 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches", 105 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches",
112 AppInfoLaunchSource::FROM_APP_LIST, 106 AppInfoLaunchSource::FROM_APP_LIST,
113 AppInfoLaunchSource::NUM_LAUNCH_SOURCES); 107 AppInfoLaunchSource::NUM_LAUNCH_SOURCES);
114 108
115 // Since the AppListControllerDelegate is a leaky singleton, passing its raw 109 // Since the AppListControllerDelegate is a leaky singleton, passing its raw
116 // pointer around is OK. 110 // pointer around is OK.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 out_apps->InsertAll(registry->enabled_extensions()); 209 out_apps->InsertAll(registry->enabled_extensions());
216 out_apps->InsertAll(registry->disabled_extensions()); 210 out_apps->InsertAll(registry->disabled_extensions());
217 out_apps->InsertAll(registry->terminated_extensions()); 211 out_apps->InsertAll(registry->terminated_extensions());
218 } 212 }
219 213
220 void AppListControllerDelegate::OnSearchStarted() { 214 void AppListControllerDelegate::OnSearchStarted() {
221 #if defined(ENABLE_RLZ) 215 #if defined(ENABLE_RLZ)
222 RLZTracker::RecordAppListSearch(); 216 RLZTracker::RecordAppListSearch();
223 #endif 217 #endif
224 } 218 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | chrome/browser/ui/app_list/app_list_controller_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698