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/app_list_controller_delegate.h" | 5 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/extension_system.h" | 8 #include "chrome/browser/extensions/extension_system.h" |
9 #include "chrome/browser/extensions/extension_util.h" | 9 #include "chrome/browser/extensions/extension_util.h" |
10 #include "chrome/browser/extensions/install_tracker_factory.h" | 10 #include "chrome/browser/extensions/install_tracker_factory.h" |
| 11 #include "chrome/browser/extensions/launch_util.h" |
11 #include "chrome/browser/ui/app_list/extension_uninstaller.h" | 12 #include "chrome/browser/ui/app_list/extension_uninstaller.h" |
12 #include "chrome/browser/ui/browser_navigator.h" | 13 #include "chrome/browser/ui/browser_navigator.h" |
13 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
14 #include "chrome/common/extensions/extension_set.h" | 15 #include "chrome/common/extensions/extension_set.h" |
15 #include "chrome/common/extensions/manifest_url_handler.h" | 16 #include "chrome/common/extensions/manifest_url_handler.h" |
16 #include "extensions/browser/management_policy.h" | 17 #include "extensions/browser/management_policy.h" |
17 #include "extensions/common/extension.h" | 18 #include "extensions/common/extension.h" |
18 #include "net/base/url_util.h" | 19 #include "net/base/url_util.h" |
19 | 20 |
20 namespace { | 21 namespace { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 if (!extension) | 120 if (!extension) |
120 return; | 121 return; |
121 | 122 |
122 chrome::NavigateParams params( | 123 chrome::NavigateParams params( |
123 profile, | 124 profile, |
124 extensions::ManifestURL::GetOptionsPage(extension), | 125 extensions::ManifestURL::GetOptionsPage(extension), |
125 content::PAGE_TRANSITION_LINK); | 126 content::PAGE_TRANSITION_LINK); |
126 chrome::Navigate(¶ms); | 127 chrome::Navigate(¶ms); |
127 } | 128 } |
128 | 129 |
129 extensions::ExtensionPrefs::LaunchType | 130 extensions::LaunchType AppListControllerDelegate::GetExtensionLaunchType( |
130 AppListControllerDelegate::GetExtensionLaunchType( | |
131 Profile* profile, | 131 Profile* profile, |
132 const std::string& app_id) { | 132 const std::string& app_id) { |
133 ExtensionService* service = | 133 ExtensionService* service = |
134 extensions::ExtensionSystem::Get(profile)->extension_service(); | 134 extensions::ExtensionSystem::Get(profile)->extension_service(); |
135 return service->extension_prefs()-> | 135 return extensions::GetLaunchType(service->extension_prefs(), |
136 GetLaunchType(GetExtension(profile, app_id)); | 136 GetExtension(profile, app_id)); |
137 } | 137 } |
138 | 138 |
139 void AppListControllerDelegate::SetExtensionLaunchType( | 139 void AppListControllerDelegate::SetExtensionLaunchType( |
140 Profile* profile, | 140 Profile* profile, |
141 const std::string& extension_id, | 141 const std::string& extension_id, |
142 extensions::ExtensionPrefs::LaunchType launch_type) { | 142 extensions::LaunchType launch_type) { |
143 ExtensionService* service = | 143 ExtensionService* service = |
144 extensions::ExtensionSystem::Get(profile)->extension_service(); | 144 extensions::ExtensionSystem::Get(profile)->extension_service(); |
145 service->extension_prefs()->SetLaunchType(extension_id, launch_type); | 145 extensions::SetLaunchType( |
| 146 service->extension_prefs(), extension_id, launch_type); |
146 } | 147 } |
147 | 148 |
148 bool AppListControllerDelegate::IsExtensionInstalled( | 149 bool AppListControllerDelegate::IsExtensionInstalled( |
149 Profile* profile, const std::string& app_id) { | 150 Profile* profile, const std::string& app_id) { |
150 return !!GetExtension(profile, app_id); | 151 return !!GetExtension(profile, app_id); |
151 } | 152 } |
152 | 153 |
153 extensions::InstallTracker* AppListControllerDelegate::GetInstallTrackerFor( | 154 extensions::InstallTracker* AppListControllerDelegate::GetInstallTrackerFor( |
154 Profile* profile) { | 155 Profile* profile) { |
155 if (extensions::ExtensionSystem::Get(profile)->extension_service()) | 156 if (extensions::ExtensionSystem::Get(profile)->extension_service()) |
156 return extensions::InstallTrackerFactory::GetForProfile(profile); | 157 return extensions::InstallTrackerFactory::GetForProfile(profile); |
157 return NULL; | 158 return NULL; |
158 } | 159 } |
159 | 160 |
160 void AppListControllerDelegate::GetApps(Profile* profile, | 161 void AppListControllerDelegate::GetApps(Profile* profile, |
161 ExtensionSet* out_apps) { | 162 ExtensionSet* out_apps) { |
162 ExtensionService* service = | 163 ExtensionService* service = |
163 extensions::ExtensionSystem::Get(profile)->extension_service(); | 164 extensions::ExtensionSystem::Get(profile)->extension_service(); |
164 DCHECK(service); | 165 DCHECK(service); |
165 out_apps->InsertAll(*service->extensions()); | 166 out_apps->InsertAll(*service->extensions()); |
166 out_apps->InsertAll(*service->disabled_extensions()); | 167 out_apps->InsertAll(*service->disabled_extensions()); |
167 out_apps->InsertAll(*service->terminated_extensions()); | 168 out_apps->InsertAll(*service->terminated_extensions()); |
168 } | 169 } |
OLD | NEW |