| 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/extension_app_item.h" | 5 #include "chrome/browser/ui/app_list/extension_app_item.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/extensions/extension_util.h" | 8 #include "chrome/browser/extensions/extension_util.h" |
| 9 #include "chrome/browser/extensions/launch_util.h" | 9 #include "chrome/browser/extensions/launch_util.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/app_list/app_context_menu.h" | 11 #include "chrome/browser/ui/app_list/app_context_menu.h" |
| 12 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 12 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 13 #include "chrome/browser/ui/app_list/app_list_service.h" | |
| 14 #include "chrome/browser/ui/extensions/extension_enable_flow.h" | 13 #include "chrome/browser/ui/extensions/extension_enable_flow.h" |
| 15 #include "chrome/browser/ui/host_desktop.h" | |
| 16 #include "chrome/common/extensions/extension_constants.h" | 14 #include "chrome/common/extensions/extension_constants.h" |
| 17 #include "chrome/common/extensions/extension_metrics.h" | 15 #include "chrome/common/extensions/extension_metrics.h" |
| 18 #include "content/public/browser/user_metrics.h" | 16 #include "content/public/browser/user_metrics.h" |
| 19 #include "extensions/browser/app_sorting.h" | 17 #include "extensions/browser/app_sorting.h" |
| 20 #include "extensions/browser/extension_prefs.h" | 18 #include "extensions/browser/extension_prefs.h" |
| 21 #include "extensions/browser/extension_registry.h" | 19 #include "extensions/browser/extension_registry.h" |
| 22 #include "extensions/browser/extension_system.h" | |
| 23 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
| 24 #include "extensions/common/extension_icon_set.h" | 21 #include "extensions/common/extension_icon_set.h" |
| 25 #include "extensions/common/manifest_handlers/icons_handler.h" | 22 #include "extensions/common/manifest_handlers/icons_handler.h" |
| 26 #include "extensions/common/manifest_url_handlers.h" | 23 #include "extensions/common/manifest_url_handlers.h" |
| 27 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
| 28 #include "sync/api/string_ordinal.h" | 25 #include "sync/api/string_ordinal.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
| 31 #include "ui/gfx/color_utils.h" | |
| 32 #include "ui/gfx/geometry/rect.h" | 28 #include "ui/gfx/geometry/rect.h" |
| 33 #include "ui/gfx/image/canvas_image_source.h" | 29 #include "ui/gfx/image/canvas_image_source.h" |
| 34 #include "ui/gfx/image/image_skia_operations.h" | |
| 35 | 30 |
| 36 using extensions::Extension; | 31 using extensions::Extension; |
| 37 | 32 |
| 38 namespace { | 33 namespace { |
| 39 | 34 |
| 40 // Overlays a shortcut icon over the bottom left corner of a given image. | 35 // Overlays a shortcut icon over the bottom left corner of a given image. |
| 41 class ShortcutOverlayImageSource : public gfx::CanvasImageSource { | 36 class ShortcutOverlayImageSource : public gfx::CanvasImageSource { |
| 42 public: | 37 public: |
| 43 explicit ShortcutOverlayImageSource(const gfx::ImageSkia& icon) | 38 explicit ShortcutOverlayImageSource(const gfx::ImageSkia& icon) |
| 44 : gfx::CanvasImageSource(icon.size(), false), | 39 : gfx::CanvasImageSource(icon.size(), false), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 masking_paint.setXfermodeMode(SkXfermode::kDstIn_Mode); | 89 masking_paint.setXfermodeMode(SkXfermode::kDstIn_Mode); |
| 95 canvas->DrawImageInt( | 90 canvas->DrawImageInt( |
| 96 gfx::ImageSkia(masking_canvas->ExtractImageRep()), 0, 0, masking_paint); | 91 gfx::ImageSkia(masking_canvas->ExtractImageRep()), 0, 0, masking_paint); |
| 97 } | 92 } |
| 98 | 93 |
| 99 gfx::ImageSkia icon_; | 94 gfx::ImageSkia icon_; |
| 100 | 95 |
| 101 DISALLOW_COPY_AND_ASSIGN(RoundedCornersImageSource); | 96 DISALLOW_COPY_AND_ASSIGN(RoundedCornersImageSource); |
| 102 }; | 97 }; |
| 103 | 98 |
| 104 extensions::AppSorting* GetAppSorting(Profile* profile) { | |
| 105 return extensions::ExtensionSystem::Get(profile)->app_sorting(); | |
| 106 } | |
| 107 | |
| 108 gfx::ImageSkia CreateDisabledIcon(const gfx::ImageSkia& icon) { | |
| 109 const color_utils::HSL shift = {-1, 0, 0.6}; | |
| 110 return gfx::ImageSkiaOperations::CreateHSLShiftedImage(icon, shift); | |
| 111 } | |
| 112 | |
| 113 } // namespace | 99 } // namespace |
| 114 | 100 |
| 115 ExtensionAppItem::ExtensionAppItem( | 101 ExtensionAppItem::ExtensionAppItem( |
| 116 Profile* profile, | 102 Profile* profile, |
| 117 const app_list::AppListSyncableService::SyncItem* sync_item, | 103 const app_list::AppListSyncableService::SyncItem* sync_item, |
| 118 const std::string& extension_id, | 104 const std::string& extension_id, |
| 119 const std::string& extension_name, | 105 const std::string& extension_name, |
| 120 const gfx::ImageSkia& installing_icon, | 106 const gfx::ImageSkia& installing_icon, |
| 121 bool is_platform_app) | 107 bool is_platform_app) |
| 122 : app_list::AppListItem(extension_id), | 108 : ChromeAppListItem(profile, extension_id), |
| 123 profile_(profile), | |
| 124 extension_id_(extension_id), | |
| 125 extension_enable_flow_controller_(NULL), | 109 extension_enable_flow_controller_(NULL), |
| 126 extension_name_(extension_name), | 110 extension_name_(extension_name), |
| 127 installing_icon_(CreateDisabledIcon(installing_icon)), | 111 installing_icon_(CreateDisabledIcon(installing_icon)), |
| 128 is_platform_app_(is_platform_app), | 112 is_platform_app_(is_platform_app), |
| 129 has_overlay_(false) { | 113 has_overlay_(false) { |
| 130 Reload(); | 114 Reload(); |
| 131 if (sync_item && sync_item->item_ordinal.IsValid()) { | 115 if (sync_item && sync_item->item_ordinal.IsValid()) { |
| 132 // An existing synced position exists, use that. | 116 UpdateFromSync(sync_item); |
| 133 set_position(sync_item->item_ordinal); | 117 } else { |
| 134 // Only set the name from the sync item if it is empty. | 118 GetAppSorting()->EnsureValidOrdinals(extension_id, |
| 135 if (name().empty()) | 119 syncer::StringOrdinal()); |
| 136 SetName(sync_item->item_name); | 120 UpdatePositionFromOrdering(); |
| 137 return; | |
| 138 } | 121 } |
| 139 GetAppSorting(profile_)->EnsureValidOrdinals(extension_id_, | |
| 140 syncer::StringOrdinal()); | |
| 141 UpdatePositionFromExtensionOrdering(); | |
| 142 } | 122 } |
| 143 | 123 |
| 144 ExtensionAppItem::~ExtensionAppItem() { | 124 ExtensionAppItem::~ExtensionAppItem() { |
| 145 } | 125 } |
| 146 | 126 |
| 147 bool ExtensionAppItem::NeedsOverlay() const { | 127 bool ExtensionAppItem::NeedsOverlay() const { |
| 148 #if defined(OS_CHROMEOS) | 128 #if defined(OS_CHROMEOS) |
| 149 // The overlay is disabled completely in ChromeOS. | 129 // The overlay is disabled completely in ChromeOS. |
| 150 return false; | 130 return false; |
| 151 #endif | 131 #endif |
| 152 | 132 |
| 153 extensions::LaunchType launch_type = | 133 extensions::LaunchType launch_type = GetExtension() |
| 154 GetExtension() | 134 ? extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile()), |
| 155 ? extensions::GetLaunchType(extensions::ExtensionPrefs::Get(profile_), | 135 GetExtension()) |
| 156 GetExtension()) | 136 : extensions::LAUNCH_TYPE_WINDOW; |
| 157 : extensions::LAUNCH_TYPE_WINDOW; | |
| 158 | 137 |
| 159 // The overlay icon is disabled for hosted apps in windowed mode with | 138 // The overlay icon is disabled for hosted apps in windowed mode with |
| 160 // bookmark apps enabled. | 139 // bookmark apps enabled. |
| 161 return !is_platform_app_ && extension_id_ != extension_misc::kChromeAppId && | 140 return !is_platform_app_ && extension_id() != extension_misc::kChromeAppId && |
| 162 (!extensions::util::IsNewBookmarkAppsEnabled() || | 141 (!extensions::util::IsNewBookmarkAppsEnabled() || |
| 163 launch_type != extensions::LAUNCH_TYPE_WINDOW); | 142 launch_type != extensions::LAUNCH_TYPE_WINDOW); |
| 164 } | 143 } |
| 165 | 144 |
| 166 void ExtensionAppItem::Reload() { | 145 void ExtensionAppItem::Reload() { |
| 167 const Extension* extension = GetExtension(); | 146 const Extension* extension = GetExtension(); |
| 168 bool is_installing = !extension; | 147 bool is_installing = !extension; |
| 169 SetIsInstalling(is_installing); | 148 SetIsInstalling(is_installing); |
| 170 if (is_installing) { | 149 if (is_installing) { |
| 171 SetName(extension_name_); | 150 SetName(extension_name_); |
| 172 UpdateIcon(); | 151 UpdateIcon(); |
| 173 return; | 152 return; |
| 174 } | 153 } |
| 175 SetNameAndShortName(extension->name(), extension->short_name()); | 154 SetNameAndShortName(extension->name(), extension->short_name()); |
| 176 LoadImage(extension); | 155 LoadImage(extension); |
| 177 } | 156 } |
| 178 | 157 |
| 179 void ExtensionAppItem::UpdateIcon() { | 158 void ExtensionAppItem::UpdateIcon() { |
| 180 gfx::ImageSkia icon = installing_icon_; | 159 gfx::ImageSkia icon = installing_icon_; |
| 181 | 160 |
| 182 // Use the app icon if the app exists. Turn the image greyscale if the app is | 161 // Use the app icon if the app exists. Turn the image greyscale if the app is |
| 183 // not launchable. | 162 // not launchable. |
| 184 if (GetExtension() && icon_) { | 163 if (GetExtension() && icon_) { |
| 185 icon = icon_->image_skia(); | 164 icon = icon_->image_skia(); |
| 186 const bool enabled = extensions::util::IsAppLaunchable(extension_id_, | 165 const bool enabled = extensions::util::IsAppLaunchable(extension_id(), |
| 187 profile_); | 166 profile()); |
| 188 if (!enabled) | 167 if (!enabled) |
| 189 icon = CreateDisabledIcon(icon); | 168 icon = CreateDisabledIcon(icon); |
| 190 | 169 |
| 191 if (GetExtension()->from_bookmark()) | 170 if (GetExtension()->from_bookmark()) |
| 192 icon = gfx::ImageSkia(new RoundedCornersImageSource(icon), icon.size()); | 171 icon = gfx::ImageSkia(new RoundedCornersImageSource(icon), icon.size()); |
| 193 } | 172 } |
| 194 // Paint the shortcut overlay if necessary. | 173 // Paint the shortcut overlay if necessary. |
| 195 has_overlay_ = NeedsOverlay(); | 174 has_overlay_ = NeedsOverlay(); |
| 196 if (has_overlay_) | 175 if (has_overlay_) |
| 197 icon = gfx::ImageSkia(new ShortcutOverlayImageSource(icon), icon.size()); | 176 icon = gfx::ImageSkia(new ShortcutOverlayImageSource(icon), icon.size()); |
| 198 | 177 |
| 199 SetIcon(icon); | 178 SetIcon(icon); |
| 200 } | 179 } |
| 201 | 180 |
| 202 void ExtensionAppItem::Move(const ExtensionAppItem* prev, | 181 void ExtensionAppItem::Move(const ExtensionAppItem* prev, |
| 203 const ExtensionAppItem* next) { | 182 const ExtensionAppItem* next) { |
| 204 if (!prev && !next) | 183 if (!prev && !next) |
| 205 return; // No reordering necessary | 184 return; // No reordering necessary |
| 206 | 185 |
| 207 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); | 186 extensions::ExtensionPrefs* prefs = |
| 208 extensions::AppSorting* sorting = GetAppSorting(profile_); | 187 extensions::ExtensionPrefs::Get(profile()); |
| 188 extensions::AppSorting* sorting = GetAppSorting(); |
| 209 | 189 |
| 210 syncer::StringOrdinal page; | 190 syncer::StringOrdinal page; |
| 211 std::string prev_id, next_id; | 191 std::string prev_id, next_id; |
| 212 if (!prev) { | 192 if (!prev) { |
| 213 next_id = next->extension_id(); | 193 next_id = next->extension_id(); |
| 214 page = sorting->GetPageOrdinal(next_id); | 194 page = sorting->GetPageOrdinal(next_id); |
| 215 } else if (!next) { | 195 } else if (!next) { |
| 216 prev_id = prev->extension_id(); | 196 prev_id = prev->extension_id(); |
| 217 page = sorting->GetPageOrdinal(prev_id); | 197 page = sorting->GetPageOrdinal(prev_id); |
| 218 } else { | 198 } else { |
| 219 prev_id = prev->extension_id(); | 199 prev_id = prev->extension_id(); |
| 220 page = sorting->GetPageOrdinal(prev_id); | 200 page = sorting->GetPageOrdinal(prev_id); |
| 221 // Only set |next_id| if on the same page, otherwise just insert after prev. | 201 // Only set |next_id| if on the same page, otherwise just insert after prev. |
| 222 if (page.Equals(sorting->GetPageOrdinal(next->extension_id()))) | 202 if (page.Equals(sorting->GetPageOrdinal(next->extension_id()))) |
| 223 next_id = next->extension_id(); | 203 next_id = next->extension_id(); |
| 224 } | 204 } |
| 225 prefs->SetAppDraggedByUser(extension_id_); | 205 prefs->SetAppDraggedByUser(extension_id()); |
| 226 sorting->SetPageOrdinal(extension_id_, page); | 206 sorting->SetPageOrdinal(extension_id(), page); |
| 227 sorting->OnExtensionMoved(extension_id_, prev_id, next_id); | 207 sorting->OnExtensionMoved(extension_id(), prev_id, next_id); |
| 228 UpdatePositionFromExtensionOrdering(); | 208 UpdatePositionFromOrdering(); |
| 229 } | 209 } |
| 230 | 210 |
| 231 const Extension* ExtensionAppItem::GetExtension() const { | 211 const Extension* ExtensionAppItem::GetExtension() const { |
| 232 const extensions::ExtensionRegistry* registry = | 212 const extensions::ExtensionRegistry* registry = |
| 233 extensions::ExtensionRegistry::Get(profile_); | 213 extensions::ExtensionRegistry::Get(profile()); |
| 234 const Extension* extension = registry->GetInstalledExtension( | 214 const Extension* extension = registry->GetInstalledExtension( |
| 235 extension_id_); | 215 extension_id()); |
| 236 return extension; | 216 return extension; |
| 237 } | 217 } |
| 238 | 218 |
| 239 void ExtensionAppItem::LoadImage(const Extension* extension) { | 219 void ExtensionAppItem::LoadImage(const Extension* extension) { |
| 240 icon_.reset(new extensions::IconImage( | 220 icon_.reset(new extensions::IconImage( |
| 241 profile_, | 221 profile(), |
| 242 extension, | 222 extension, |
| 243 extensions::IconsInfo::GetIcons(extension), | 223 extensions::IconsInfo::GetIcons(extension), |
| 244 extension_misc::EXTENSION_ICON_MEDIUM, | 224 extension_misc::EXTENSION_ICON_MEDIUM, |
| 245 extensions::util::GetDefaultAppIcon(), | 225 extensions::util::GetDefaultAppIcon(), |
| 246 this)); | 226 this)); |
| 247 UpdateIcon(); | 227 UpdateIcon(); |
| 248 } | 228 } |
| 249 | 229 |
| 250 bool ExtensionAppItem::RunExtensionEnableFlow() { | 230 bool ExtensionAppItem::RunExtensionEnableFlow() { |
| 251 if (extensions::util::IsAppLaunchableWithoutEnabling(extension_id_, profile_)) | 231 if (extensions::util::IsAppLaunchableWithoutEnabling(extension_id(), |
| 232 profile())) |
| 252 return false; | 233 return false; |
| 253 | 234 |
| 254 if (!extension_enable_flow_) { | 235 if (!extension_enable_flow_) { |
| 255 extension_enable_flow_controller_ = GetController(); | 236 extension_enable_flow_controller_ = GetController(); |
| 256 extension_enable_flow_controller_->OnShowChildDialog(); | 237 extension_enable_flow_controller_->OnShowChildDialog(); |
| 257 | 238 |
| 258 extension_enable_flow_.reset(new ExtensionEnableFlow( | 239 extension_enable_flow_.reset(new ExtensionEnableFlow( |
| 259 profile_, extension_id_, this)); | 240 profile(), extension_id(), this)); |
| 260 extension_enable_flow_->StartForNativeWindow( | 241 extension_enable_flow_->StartForNativeWindow( |
| 261 extension_enable_flow_controller_->GetAppListWindow()); | 242 extension_enable_flow_controller_->GetAppListWindow()); |
| 262 } | 243 } |
| 263 return true; | 244 return true; |
| 264 } | 245 } |
| 265 | 246 |
| 266 void ExtensionAppItem::Launch(int event_flags) { | 247 void ExtensionAppItem::Launch(int event_flags) { |
| 267 // |extension| could be NULL when it is being unloaded for updating. | 248 // |extension| could be NULL when it is being unloaded for updating. |
| 268 const Extension* extension = GetExtension(); | 249 const Extension* extension = GetExtension(); |
| 269 if (!extension) | 250 if (!extension) |
| 270 return; | 251 return; |
| 271 | 252 |
| 272 // Don't auto-enable apps that cannot be launched. | 253 // Don't auto-enable apps that cannot be launched. |
| 273 if (!extensions::util::IsAppLaunchable(extension_id_, profile_)) | 254 if (!extensions::util::IsAppLaunchable(extension_id(), profile())) |
| 274 return; | 255 return; |
| 275 | 256 |
| 276 if (RunExtensionEnableFlow()) | 257 if (RunExtensionEnableFlow()) |
| 277 return; | 258 return; |
| 278 | 259 |
| 279 GetController()->LaunchApp(profile_, | 260 GetController()->LaunchApp(profile(), |
| 280 extension, | 261 extension, |
| 281 AppListControllerDelegate::LAUNCH_FROM_APP_LIST, | 262 AppListControllerDelegate::LAUNCH_FROM_APP_LIST, |
| 282 event_flags); | 263 event_flags); |
| 283 } | 264 } |
| 284 | 265 |
| 285 void ExtensionAppItem::OnExtensionIconImageChanged( | 266 void ExtensionAppItem::OnExtensionIconImageChanged( |
| 286 extensions::IconImage* image) { | 267 extensions::IconImage* image) { |
| 287 DCHECK(icon_.get() == image); | 268 DCHECK(icon_.get() == image); |
| 288 UpdateIcon(); | 269 UpdateIcon(); |
| 289 } | 270 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 303 extension_enable_flow_controller_ = NULL; | 284 extension_enable_flow_controller_ = NULL; |
| 304 } | 285 } |
| 305 | 286 |
| 306 void ExtensionAppItem::Activate(int event_flags) { | 287 void ExtensionAppItem::Activate(int event_flags) { |
| 307 // |extension| could be NULL when it is being unloaded for updating. | 288 // |extension| could be NULL when it is being unloaded for updating. |
| 308 const Extension* extension = GetExtension(); | 289 const Extension* extension = GetExtension(); |
| 309 if (!extension) | 290 if (!extension) |
| 310 return; | 291 return; |
| 311 | 292 |
| 312 // Don't auto-enable apps that cannot be launched. | 293 // Don't auto-enable apps that cannot be launched. |
| 313 if (!extensions::util::IsAppLaunchable(extension_id_, profile_)) | 294 if (!extensions::util::IsAppLaunchable(extension_id(), profile())) |
| 314 return; | 295 return; |
| 315 | 296 |
| 316 if (RunExtensionEnableFlow()) | 297 if (RunExtensionEnableFlow()) |
| 317 return; | 298 return; |
| 318 | 299 |
| 319 content::RecordAction(base::UserMetricsAction("AppList_ClickOnApp")); | 300 content::RecordAction(base::UserMetricsAction("AppList_ClickOnApp")); |
| 320 extensions::RecordAppListMainLaunch(extension); | 301 extensions::RecordAppListMainLaunch(extension); |
| 321 GetController()->ActivateApp(profile_, | 302 GetController()->ActivateApp(profile(), |
| 322 extension, | 303 extension, |
| 323 AppListControllerDelegate::LAUNCH_FROM_APP_LIST, | 304 AppListControllerDelegate::LAUNCH_FROM_APP_LIST, |
| 324 event_flags); | 305 event_flags); |
| 325 } | 306 } |
| 326 | 307 |
| 327 ui::MenuModel* ExtensionAppItem::GetContextMenuModel() { | 308 ui::MenuModel* ExtensionAppItem::GetContextMenuModel() { |
| 328 context_menu_.reset(new app_list::AppContextMenu( | 309 context_menu_.reset(new app_list::AppContextMenu( |
| 329 this, profile_, extension_id_, GetController())); | 310 this, profile(), extension_id(), GetController())); |
| 330 context_menu_->set_is_platform_app(is_platform_app_); | 311 context_menu_->set_is_platform_app(is_platform_app_); |
| 331 if (IsInFolder()) | 312 if (IsInFolder()) |
| 332 context_menu_->set_is_in_folder(true); | 313 context_menu_->set_is_in_folder(true); |
| 333 return context_menu_->GetMenuModel(); | 314 return context_menu_->GetMenuModel(); |
| 334 } | 315 } |
| 335 | 316 |
| 336 void ExtensionAppItem::OnExtensionPreferenceChanged() { | 317 void ExtensionAppItem::OnExtensionPreferenceChanged() { |
| 337 if (has_overlay_ != NeedsOverlay()) | 318 if (has_overlay_ != NeedsOverlay()) |
| 338 UpdateIcon(); | 319 UpdateIcon(); |
| 339 } | 320 } |
| 340 | 321 |
| 341 // static | 322 // static |
| 342 const char ExtensionAppItem::kItemType[] = "ExtensionAppItem"; | 323 const char ExtensionAppItem::kItemType[] = "ExtensionAppItem"; |
| 343 | 324 |
| 344 const char* ExtensionAppItem::GetItemType() const { | 325 const char* ExtensionAppItem::GetItemType() const { |
| 345 return ExtensionAppItem::kItemType; | 326 return ExtensionAppItem::kItemType; |
| 346 } | 327 } |
| 347 | 328 |
| 348 void ExtensionAppItem::ExecuteLaunchCommand(int event_flags) { | 329 void ExtensionAppItem::ExecuteLaunchCommand(int event_flags) { |
| 349 Launch(event_flags); | 330 Launch(event_flags); |
| 350 } | 331 } |
| 351 | 332 |
| 352 void ExtensionAppItem::UpdatePositionFromExtensionOrdering() { | 333 void ExtensionAppItem::UpdatePositionFromOrdering() { |
| 353 const syncer::StringOrdinal& page = | 334 const syncer::StringOrdinal& page = |
| 354 GetAppSorting(profile_)->GetPageOrdinal(extension_id_); | 335 GetAppSorting()->GetPageOrdinal(extension_id()); |
| 355 const syncer::StringOrdinal& launch = | 336 const syncer::StringOrdinal& launch = |
| 356 GetAppSorting(profile_)->GetAppLaunchOrdinal(extension_id_); | 337 GetAppSorting()->GetAppLaunchOrdinal(extension_id()); |
| 357 set_position(syncer::StringOrdinal( | 338 set_position(syncer::StringOrdinal( |
| 358 page.ToInternalValue() + launch.ToInternalValue())); | 339 page.ToInternalValue() + launch.ToInternalValue())); |
| 359 } | 340 } |
| 360 | |
| 361 AppListControllerDelegate* ExtensionAppItem::GetController() { | |
| 362 return AppListService::Get(chrome::GetActiveDesktop())-> | |
| 363 GetControllerDelegate(); | |
| 364 } | |
| OLD | NEW |