| 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_util.h" | 8 #include "chrome/browser/extensions/extension_util.h" |
| 9 #include "chrome/browser/extensions/install_tracker_factory.h" | 9 #include "chrome/browser/extensions/install_tracker_factory.h" |
| 10 #include "chrome/browser/extensions/launch_util.h" | 10 #include "chrome/browser/extensions/launch_util.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 12 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
| 13 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 13 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
| 14 #include "chrome/browser/ui/app_list/extension_uninstaller.h" | 14 #include "chrome/browser/ui/app_list/extension_uninstaller.h" |
| 15 #include "chrome/browser/ui/apps/app_info_dialog.h" | 15 #include "chrome/browser/ui/apps/app_info_dialog.h" |
| 16 #include "chrome/browser/ui/browser_navigator.h" | 16 #include "chrome/browser/ui/browser_navigator.h" |
| 17 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
| 18 #include "chrome/common/extensions/manifest_url_handler.h" | 18 #include "chrome/common/extensions/manifest_url_handler.h" |
| 19 #include "extensions/browser/extension_prefs.h" | 19 #include "extensions/browser/extension_prefs.h" |
| 20 #include "extensions/browser/extension_registry.h" | 20 #include "extensions/browser/extension_registry.h" |
| 21 #include "extensions/browser/extension_system.h" | 21 #include "extensions/browser/extension_system.h" |
| 22 #include "extensions/browser/management_policy.h" | 22 #include "extensions/browser/management_policy.h" |
| 23 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
| 24 #include "extensions/common/extension_set.h" | 24 #include "extensions/common/extension_set.h" |
| 25 #include "extensions/common/manifest_handlers/options_page_info.h" |
| 25 #include "net/base/url_util.h" | 26 #include "net/base/url_util.h" |
| 26 #include "ui/app_list/app_list_folder_item.h" | 27 #include "ui/app_list/app_list_folder_item.h" |
| 27 #include "ui/app_list/app_list_item.h" | 28 #include "ui/app_list/app_list_item.h" |
| 28 #include "ui/app_list/app_list_model.h" | 29 #include "ui/app_list/app_list_model.h" |
| 29 #include "ui/app_list/app_list_switches.h" | 30 #include "ui/app_list/app_list_switches.h" |
| 30 | 31 |
| 31 #if defined(ENABLE_RLZ) | 32 #if defined(ENABLE_RLZ) |
| 32 #include "chrome/browser/rlz/rlz.h" | 33 #include "chrome/browser/rlz/rlz.h" |
| 33 #endif | 34 #endif |
| 34 | 35 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 source), | 151 source), |
| 151 content::PAGE_TRANSITION_LINK); | 152 content::PAGE_TRANSITION_LINK); |
| 152 chrome::Navigate(¶ms); | 153 chrome::Navigate(¶ms); |
| 153 } | 154 } |
| 154 | 155 |
| 155 bool AppListControllerDelegate::HasOptionsPage( | 156 bool AppListControllerDelegate::HasOptionsPage( |
| 156 Profile* profile, | 157 Profile* profile, |
| 157 const std::string& app_id) { | 158 const std::string& app_id) { |
| 158 const extensions::Extension* extension = GetExtension(profile, app_id); | 159 const extensions::Extension* extension = GetExtension(profile, app_id); |
| 159 return extensions::util::IsAppLaunchableWithoutEnabling(app_id, profile) && | 160 return extensions::util::IsAppLaunchableWithoutEnabling(app_id, profile) && |
| 160 extension && | 161 extension && extensions::OptionsPageInfo::HasOptionsPage(extension); |
| 161 !extensions::ManifestURL::GetOptionsPage(extension).is_empty(); | |
| 162 } | 162 } |
| 163 | 163 |
| 164 void AppListControllerDelegate::ShowOptionsPage( | 164 void AppListControllerDelegate::ShowOptionsPage( |
| 165 Profile* profile, | 165 Profile* profile, |
| 166 const std::string& app_id) { | 166 const std::string& app_id) { |
| 167 const extensions::Extension* extension = GetExtension(profile, app_id); | 167 const extensions::Extension* extension = GetExtension(profile, app_id); |
| 168 if (!extension) | 168 if (!extension) |
| 169 return; | 169 return; |
| 170 | 170 |
| 171 chrome::NavigateParams params( | 171 chrome::NavigateParams params( |
| 172 profile, | 172 profile, |
| 173 extensions::ManifestURL::GetOptionsPage(extension), | 173 extensions::OptionsPageInfo::GetOptionsPage(extension), |
| 174 content::PAGE_TRANSITION_LINK); | 174 content::PAGE_TRANSITION_LINK); |
| 175 chrome::Navigate(¶ms); | 175 chrome::Navigate(¶ms); |
| 176 } | 176 } |
| 177 | 177 |
| 178 extensions::LaunchType AppListControllerDelegate::GetExtensionLaunchType( | 178 extensions::LaunchType AppListControllerDelegate::GetExtensionLaunchType( |
| 179 Profile* profile, | 179 Profile* profile, |
| 180 const std::string& app_id) { | 180 const std::string& app_id) { |
| 181 return extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile), | 181 return extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile), |
| 182 GetExtension(profile, app_id)); | 182 GetExtension(profile, app_id)); |
| 183 } | 183 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 211 out_apps->InsertAll(registry->enabled_extensions()); | 211 out_apps->InsertAll(registry->enabled_extensions()); |
| 212 out_apps->InsertAll(registry->disabled_extensions()); | 212 out_apps->InsertAll(registry->disabled_extensions()); |
| 213 out_apps->InsertAll(registry->terminated_extensions()); | 213 out_apps->InsertAll(registry->terminated_extensions()); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void AppListControllerDelegate::OnSearchStarted() { | 216 void AppListControllerDelegate::OnSearchStarted() { |
| 217 #if defined(ENABLE_RLZ) | 217 #if defined(ENABLE_RLZ) |
| 218 RLZTracker::RecordAppListSearch(); | 218 RLZTracker::RecordAppListSearch(); |
| 219 #endif | 219 #endif |
| 220 } | 220 } |
| OLD | NEW |