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

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: Created 5 years, 7 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 11 matching lines...) Expand all
30 #if defined(ENABLE_RLZ) 29 #if defined(ENABLE_RLZ)
31 #include "chrome/browser/rlz/rlz.h" 30 #include "chrome/browser/rlz/rlz.h"
32 #endif 31 #endif
33 32
34 using extensions::ExtensionRegistry; 33 using extensions::ExtensionRegistry;
35 34
36 namespace { 35 namespace {
37 36
38 const extensions::Extension* GetExtension(Profile* profile, 37 const extensions::Extension* GetExtension(Profile* profile,
39 const std::string& extension_id) { 38 const std::string& extension_id) {
40 const ExtensionService* service = 39 const ExtensionRegistry* registry = ExtensionRegistry::Get(profile);
41 extensions::ExtensionSystem::Get(profile)->extension_service(); 40 const extensions::Extension* extension = registry->GetExtensionById(
42 const extensions::Extension* extension = 41 extension_id, extensions::ExtensionRegistry::EVERYTHING);
43 service->GetInstalledExtension(extension_id);
44 return extension; 42 return extension;
45 } 43 }
46 44
47 } // namespace 45 } // namespace
48 46
49 AppListControllerDelegate::~AppListControllerDelegate() {} 47 AppListControllerDelegate::~AppListControllerDelegate() {}
50 48
51 bool AppListControllerDelegate::ForceNativeDesktop() const { 49 bool AppListControllerDelegate::ForceNativeDesktop() const {
52 return false; 50 return false;
53 } 51 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 84 }
87 85
88 bool AppListControllerDelegate::CanDoShowAppInfoFlow() { 86 bool AppListControllerDelegate::CanDoShowAppInfoFlow() {
89 return CanShowAppInfoDialog(); 87 return CanShowAppInfoDialog();
90 } 88 }
91 89
92 void AppListControllerDelegate::DoShowAppInfoFlow( 90 void AppListControllerDelegate::DoShowAppInfoFlow(
93 Profile* profile, 91 Profile* profile,
94 const std::string& extension_id) { 92 const std::string& extension_id) {
95 DCHECK(CanDoShowAppInfoFlow()); 93 DCHECK(CanDoShowAppInfoFlow());
96 ExtensionService* service = 94 const extensions::Extension* extension = GetExtension(profile, extension_id);
97 extensions::ExtensionSystem::Get(profile)->extension_service();
98 DCHECK(service);
99 const extensions::Extension* extension = service->GetInstalledExtension(
100 extension_id);
101 DCHECK(extension); 95 DCHECK(extension);
102 96
103 OnShowChildDialog(); 97 OnShowChildDialog();
104 98
105 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches", 99 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches",
106 AppInfoLaunchSource::FROM_APP_LIST, 100 AppInfoLaunchSource::FROM_APP_LIST,
107 AppInfoLaunchSource::NUM_LAUNCH_SOURCES); 101 AppInfoLaunchSource::NUM_LAUNCH_SOURCES);
108 102
109 // Since the AppListControllerDelegate is a leaky singleton, passing its raw 103 // Since the AppListControllerDelegate is a leaky singleton, passing its raw
110 // pointer around is OK. 104 // pointer around is OK.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 out_apps->InsertAll(registry->enabled_extensions()); 203 out_apps->InsertAll(registry->enabled_extensions());
210 out_apps->InsertAll(registry->disabled_extensions()); 204 out_apps->InsertAll(registry->disabled_extensions());
211 out_apps->InsertAll(registry->terminated_extensions()); 205 out_apps->InsertAll(registry->terminated_extensions());
212 } 206 }
213 207
214 void AppListControllerDelegate::OnSearchStarted() { 208 void AppListControllerDelegate::OnSearchStarted() {
215 #if defined(ENABLE_RLZ) 209 #if defined(ENABLE_RLZ)
216 RLZTracker::RecordAppListSearch(); 210 RLZTracker::RecordAppListSearch();
217 #endif 211 #endif
218 } 212 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698