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 "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.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" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 if (!extension) | 136 if (!extension) |
137 return; | 137 return; |
138 | 138 |
139 const GURL url = extensions::ManifestURL::GetDetailsURL(extension); | 139 const GURL url = extensions::ManifestURL::GetDetailsURL(extension); |
140 DCHECK_NE(url, GURL::EmptyGURL()); | 140 DCHECK_NE(url, GURL::EmptyGURL()); |
141 | 141 |
142 const std::string source = AppListSourceToString( | 142 const std::string source = AppListSourceToString( |
143 is_search_result ? | 143 is_search_result ? |
144 AppListControllerDelegate::LAUNCH_FROM_APP_LIST_SEARCH : | 144 AppListControllerDelegate::LAUNCH_FROM_APP_LIST_SEARCH : |
145 AppListControllerDelegate::LAUNCH_FROM_APP_LIST); | 145 AppListControllerDelegate::LAUNCH_FROM_APP_LIST); |
146 OpenURL(profile, | 146 OpenURL(profile, net::AppendQueryParameter( |
147 net::AppendQueryParameter(url, | 147 url, extension_urls::kWebstoreSourceField, source), |
148 extension_urls::kWebstoreSourceField, | 148 ui::PAGE_TRANSITION_LINK, WindowOpenDisposition::CURRENT_TAB); |
149 source), | |
150 ui::PAGE_TRANSITION_LINK, | |
151 CURRENT_TAB); | |
152 } | 149 } |
153 | 150 |
154 bool AppListControllerDelegate::HasOptionsPage( | 151 bool AppListControllerDelegate::HasOptionsPage( |
155 Profile* profile, | 152 Profile* profile, |
156 const std::string& app_id) { | 153 const std::string& app_id) { |
157 const extensions::Extension* extension = GetExtension(profile, app_id); | 154 const extensions::Extension* extension = GetExtension(profile, app_id); |
158 return extensions::util::IsAppLaunchableWithoutEnabling(app_id, profile) && | 155 return extensions::util::IsAppLaunchableWithoutEnabling(app_id, profile) && |
159 extension && extensions::OptionsPageInfo::HasOptionsPage(extension); | 156 extension && extensions::OptionsPageInfo::HasOptionsPage(extension); |
160 } | 157 } |
161 | 158 |
162 void AppListControllerDelegate::ShowOptionsPage( | 159 void AppListControllerDelegate::ShowOptionsPage( |
163 Profile* profile, | 160 Profile* profile, |
164 const std::string& app_id) { | 161 const std::string& app_id) { |
165 const extensions::Extension* extension = GetExtension(profile, app_id); | 162 const extensions::Extension* extension = GetExtension(profile, app_id); |
166 if (!extension) | 163 if (!extension) |
167 return; | 164 return; |
168 | 165 |
169 OpenURL(profile, | 166 OpenURL(profile, extensions::OptionsPageInfo::GetOptionsPage(extension), |
170 extensions::OptionsPageInfo::GetOptionsPage(extension), | 167 ui::PAGE_TRANSITION_LINK, WindowOpenDisposition::CURRENT_TAB); |
171 ui::PAGE_TRANSITION_LINK, | |
172 CURRENT_TAB); | |
173 } | 168 } |
174 | 169 |
175 extensions::LaunchType AppListControllerDelegate::GetExtensionLaunchType( | 170 extensions::LaunchType AppListControllerDelegate::GetExtensionLaunchType( |
176 Profile* profile, | 171 Profile* profile, |
177 const std::string& app_id) { | 172 const std::string& app_id) { |
178 return extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile), | 173 return extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile), |
179 GetExtension(profile, app_id)); | 174 GetExtension(profile, app_id)); |
180 } | 175 } |
181 | 176 |
182 void AppListControllerDelegate::SetExtensionLaunchType( | 177 void AppListControllerDelegate::SetExtensionLaunchType( |
(...skipping 22 matching lines...) Expand all Loading... |
205 out_apps->InsertAll(registry->enabled_extensions()); | 200 out_apps->InsertAll(registry->enabled_extensions()); |
206 out_apps->InsertAll(registry->disabled_extensions()); | 201 out_apps->InsertAll(registry->disabled_extensions()); |
207 out_apps->InsertAll(registry->terminated_extensions()); | 202 out_apps->InsertAll(registry->terminated_extensions()); |
208 } | 203 } |
209 | 204 |
210 void AppListControllerDelegate::OnSearchStarted() { | 205 void AppListControllerDelegate::OnSearchStarted() { |
211 #if defined(ENABLE_RLZ) | 206 #if defined(ENABLE_RLZ) |
212 rlz::RLZTracker::RecordAppListSearch(); | 207 rlz::RLZTracker::RecordAppListSearch(); |
213 #endif | 208 #endif |
214 } | 209 } |
OLD | NEW |