| 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 "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/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/extensions/launch_util.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | |
| 14 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | |
| 15 #include "chrome/browser/ui/app_list/extension_uninstaller.h" | 13 #include "chrome/browser/ui/app_list/extension_uninstaller.h" |
| 16 #include "chrome/browser/ui/apps/app_info_dialog.h" | 14 #include "chrome/browser/ui/apps/app_info_dialog.h" |
| 17 #include "chrome/browser/ui/browser_navigator.h" | |
| 18 #include "chrome/common/extensions/extension_constants.h" | 15 #include "chrome/common/extensions/extension_constants.h" |
| 19 #include "chrome/common/extensions/manifest_url_handler.h" | 16 #include "chrome/common/extensions/manifest_url_handler.h" |
| 20 #include "extensions/browser/extension_prefs.h" | 17 #include "extensions/browser/extension_prefs.h" |
| 21 #include "extensions/browser/extension_registry.h" | 18 #include "extensions/browser/extension_registry.h" |
| 22 #include "extensions/browser/extension_system.h" | 19 #include "extensions/browser/extension_system.h" |
| 23 #include "extensions/browser/management_policy.h" | 20 #include "extensions/browser/management_policy.h" |
| 24 #include "extensions/common/extension.h" | 21 #include "extensions/common/extension.h" |
| 25 #include "extensions/common/extension_set.h" | 22 #include "extensions/common/extension_set.h" |
| 26 #include "extensions/common/manifest_handlers/options_page_info.h" | 23 #include "extensions/common/manifest_handlers/options_page_info.h" |
| 27 #include "net/base/url_util.h" | 24 #include "net/base/url_util.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 if (!extension) | 140 if (!extension) |
| 144 return; | 141 return; |
| 145 | 142 |
| 146 const GURL url = extensions::ManifestURL::GetDetailsURL(extension); | 143 const GURL url = extensions::ManifestURL::GetDetailsURL(extension); |
| 147 DCHECK_NE(url, GURL::EmptyGURL()); | 144 DCHECK_NE(url, GURL::EmptyGURL()); |
| 148 | 145 |
| 149 const std::string source = AppListSourceToString( | 146 const std::string source = AppListSourceToString( |
| 150 is_search_result ? | 147 is_search_result ? |
| 151 AppListControllerDelegate::LAUNCH_FROM_APP_LIST_SEARCH : | 148 AppListControllerDelegate::LAUNCH_FROM_APP_LIST_SEARCH : |
| 152 AppListControllerDelegate::LAUNCH_FROM_APP_LIST); | 149 AppListControllerDelegate::LAUNCH_FROM_APP_LIST); |
| 153 chrome::NavigateParams params( | 150 OpenURL(profile, |
| 154 profile, | 151 net::AppendQueryParameter(url, |
| 155 net::AppendQueryParameter(url, | 152 extension_urls::kWebstoreSourceField, |
| 156 extension_urls::kWebstoreSourceField, | 153 source), |
| 157 source), | 154 ui::PAGE_TRANSITION_LINK, |
| 158 ui::PAGE_TRANSITION_LINK); | 155 CURRENT_TAB); |
| 159 chrome::Navigate(¶ms); | |
| 160 } | 156 } |
| 161 | 157 |
| 162 bool AppListControllerDelegate::HasOptionsPage( | 158 bool AppListControllerDelegate::HasOptionsPage( |
| 163 Profile* profile, | 159 Profile* profile, |
| 164 const std::string& app_id) { | 160 const std::string& app_id) { |
| 165 const extensions::Extension* extension = GetExtension(profile, app_id); | 161 const extensions::Extension* extension = GetExtension(profile, app_id); |
| 166 return extensions::util::IsAppLaunchableWithoutEnabling(app_id, profile) && | 162 return extensions::util::IsAppLaunchableWithoutEnabling(app_id, profile) && |
| 167 extension && extensions::OptionsPageInfo::HasOptionsPage(extension); | 163 extension && extensions::OptionsPageInfo::HasOptionsPage(extension); |
| 168 } | 164 } |
| 169 | 165 |
| 170 void AppListControllerDelegate::ShowOptionsPage( | 166 void AppListControllerDelegate::ShowOptionsPage( |
| 171 Profile* profile, | 167 Profile* profile, |
| 172 const std::string& app_id) { | 168 const std::string& app_id) { |
| 173 const extensions::Extension* extension = GetExtension(profile, app_id); | 169 const extensions::Extension* extension = GetExtension(profile, app_id); |
| 174 if (!extension) | 170 if (!extension) |
| 175 return; | 171 return; |
| 176 | 172 |
| 177 chrome::NavigateParams params( | 173 OpenURL(profile, |
| 178 profile, | 174 extensions::OptionsPageInfo::GetOptionsPage(extension), |
| 179 extensions::OptionsPageInfo::GetOptionsPage(extension), | 175 ui::PAGE_TRANSITION_LINK, |
| 180 ui::PAGE_TRANSITION_LINK); | 176 CURRENT_TAB); |
| 181 chrome::Navigate(¶ms); | |
| 182 } | 177 } |
| 183 | 178 |
| 184 extensions::LaunchType AppListControllerDelegate::GetExtensionLaunchType( | 179 extensions::LaunchType AppListControllerDelegate::GetExtensionLaunchType( |
| 185 Profile* profile, | 180 Profile* profile, |
| 186 const std::string& app_id) { | 181 const std::string& app_id) { |
| 187 return extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile), | 182 return extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile), |
| 188 GetExtension(profile, app_id)); | 183 GetExtension(profile, app_id)); |
| 189 } | 184 } |
| 190 | 185 |
| 191 void AppListControllerDelegate::SetExtensionLaunchType( | 186 void AppListControllerDelegate::SetExtensionLaunchType( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 217 out_apps->InsertAll(registry->enabled_extensions()); | 212 out_apps->InsertAll(registry->enabled_extensions()); |
| 218 out_apps->InsertAll(registry->disabled_extensions()); | 213 out_apps->InsertAll(registry->disabled_extensions()); |
| 219 out_apps->InsertAll(registry->terminated_extensions()); | 214 out_apps->InsertAll(registry->terminated_extensions()); |
| 220 } | 215 } |
| 221 | 216 |
| 222 void AppListControllerDelegate::OnSearchStarted() { | 217 void AppListControllerDelegate::OnSearchStarted() { |
| 223 #if defined(ENABLE_RLZ) | 218 #if defined(ENABLE_RLZ) |
| 224 RLZTracker::RecordAppListSearch(); | 219 RLZTracker::RecordAppListSearch(); |
| 225 #endif | 220 #endif |
| 226 } | 221 } |
| OLD | NEW |