| 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" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } // namespace | 48 } // namespace |
| 49 | 49 |
| 50 AppListControllerDelegate::~AppListControllerDelegate() {} | 50 AppListControllerDelegate::~AppListControllerDelegate() {} |
| 51 | 51 |
| 52 bool AppListControllerDelegate::ForceNativeDesktop() const { | 52 bool AppListControllerDelegate::ForceNativeDesktop() const { |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void AppListControllerDelegate::ViewClosing() {} | 56 void AppListControllerDelegate::ViewClosing() {} |
| 57 | 57 |
| 58 void AppListControllerDelegate::OnShowExtensionPrompt() {} | 58 gfx::Rect AppListControllerDelegate::GetAppListBounds() { |
| 59 void AppListControllerDelegate::OnCloseExtensionPrompt() {} | 59 return gfx::Rect(); |
| 60 } |
| 61 |
| 62 void AppListControllerDelegate::OnShowChildDialog() { |
| 63 } |
| 64 void AppListControllerDelegate::OnCloseChildDialog() { |
| 65 } |
| 60 | 66 |
| 61 std::string AppListControllerDelegate::AppListSourceToString( | 67 std::string AppListControllerDelegate::AppListSourceToString( |
| 62 AppListSource source) { | 68 AppListSource source) { |
| 63 switch (source) { | 69 switch (source) { |
| 64 case LAUNCH_FROM_APP_LIST: | 70 case LAUNCH_FROM_APP_LIST: |
| 65 return extension_urls::kLaunchSourceAppList; | 71 return extension_urls::kLaunchSourceAppList; |
| 66 case LAUNCH_FROM_APP_LIST_SEARCH: | 72 case LAUNCH_FROM_APP_LIST_SEARCH: |
| 67 return extension_urls::kLaunchSourceAppListSearch; | 73 return extension_urls::kLaunchSourceAppListSearch; |
| 68 default: | 74 default: |
| 69 return std::string(); | 75 return std::string(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 92 extensions::ExtensionSystem::Get(profile)->extension_service(); | 98 extensions::ExtensionSystem::Get(profile)->extension_service(); |
| 93 DCHECK(service); | 99 DCHECK(service); |
| 94 const extensions::Extension* extension = service->GetInstalledExtension( | 100 const extensions::Extension* extension = service->GetInstalledExtension( |
| 95 extension_id); | 101 extension_id); |
| 96 DCHECK(extension); | 102 DCHECK(extension); |
| 97 | 103 |
| 98 gfx::NativeWindow parent_window = GetAppListWindow(); | 104 gfx::NativeWindow parent_window = GetAppListWindow(); |
| 99 if (!parent_window) | 105 if (!parent_window) |
| 100 return; | 106 return; |
| 101 | 107 |
| 102 OnShowExtensionPrompt(); | 108 // For the centered app list, inset the dialog further so it appears as a |
| 103 ShowAppInfoDialog( | 109 // vertical column in the center of the app list. |
| 104 parent_window, | 110 const int kAppListDialogHorizontalBorderInsets = |
| 105 profile, | 111 app_list::switches::IsCenteredAppListEnabled() ? 110 : 10; |
| 106 extension, | 112 const int kAppListDialogVerticalBorderInsets = 10; |
| 107 base::Bind(&AppListControllerDelegate::OnCloseExtensionPrompt, | 113 |
| 108 base::Unretained(this))); | 114 gfx::Rect dialog_bounds = GetAppListBounds(); |
| 115 dialog_bounds.Inset(kAppListDialogHorizontalBorderInsets, |
| 116 kAppListDialogVerticalBorderInsets); |
| 117 |
| 118 OnShowChildDialog(); |
| 119 ShowAppInfoDialog(parent_window, |
| 120 dialog_bounds, |
| 121 profile, |
| 122 extension, |
| 123 base::Bind(&AppListControllerDelegate::OnCloseChildDialog, |
| 124 base::Unretained(this))); |
| 109 } | 125 } |
| 110 | 126 |
| 111 void AppListControllerDelegate::UninstallApp(Profile* profile, | 127 void AppListControllerDelegate::UninstallApp(Profile* profile, |
| 112 const std::string& app_id) { | 128 const std::string& app_id) { |
| 113 // ExtensionUninstall deletes itself when done or aborted. | 129 // ExtensionUninstall deletes itself when done or aborted. |
| 114 ExtensionUninstaller* uninstaller = | 130 ExtensionUninstaller* uninstaller = |
| 115 new ExtensionUninstaller(profile, app_id, this); | 131 new ExtensionUninstaller(profile, app_id, this); |
| 116 uninstaller->Run(); | 132 uninstaller->Run(); |
| 117 } | 133 } |
| 118 | 134 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 out_apps->InsertAll(registry->enabled_extensions()); | 222 out_apps->InsertAll(registry->enabled_extensions()); |
| 207 out_apps->InsertAll(registry->disabled_extensions()); | 223 out_apps->InsertAll(registry->disabled_extensions()); |
| 208 out_apps->InsertAll(registry->terminated_extensions()); | 224 out_apps->InsertAll(registry->terminated_extensions()); |
| 209 } | 225 } |
| 210 | 226 |
| 211 void AppListControllerDelegate::OnSearchStarted() { | 227 void AppListControllerDelegate::OnSearchStarted() { |
| 212 #if defined(ENABLE_RLZ) | 228 #if defined(ENABLE_RLZ) |
| 213 RLZTracker::RecordAppListSearch(); | 229 RLZTracker::RecordAppListSearch(); |
| 214 #endif | 230 #endif |
| 215 } | 231 } |
| OLD | NEW |