| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 this)); | 249 this)); |
| 250 UpdateIcon(); | 250 UpdateIcon(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 bool ExtensionAppItem::RunExtensionEnableFlow() { | 253 bool ExtensionAppItem::RunExtensionEnableFlow() { |
| 254 if (extensions::util::IsAppLaunchableWithoutEnabling(extension_id_, profile_)) | 254 if (extensions::util::IsAppLaunchableWithoutEnabling(extension_id_, profile_)) |
| 255 return false; | 255 return false; |
| 256 | 256 |
| 257 if (!extension_enable_flow_) { | 257 if (!extension_enable_flow_) { |
| 258 extension_enable_flow_controller_ = GetController(); | 258 extension_enable_flow_controller_ = GetController(); |
| 259 extension_enable_flow_controller_->OnShowExtensionPrompt(); | 259 extension_enable_flow_controller_->OnShowChildDialog(); |
| 260 | 260 |
| 261 extension_enable_flow_.reset(new ExtensionEnableFlow( | 261 extension_enable_flow_.reset(new ExtensionEnableFlow( |
| 262 profile_, extension_id_, this)); | 262 profile_, extension_id_, this)); |
| 263 extension_enable_flow_->StartForNativeWindow( | 263 extension_enable_flow_->StartForNativeWindow( |
| 264 extension_enable_flow_controller_->GetAppListWindow()); | 264 extension_enable_flow_controller_->GetAppListWindow()); |
| 265 } | 265 } |
| 266 return true; | 266 return true; |
| 267 } | 267 } |
| 268 | 268 |
| 269 void ExtensionAppItem::Launch(int event_flags) { | 269 void ExtensionAppItem::Launch(int event_flags) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 282 } | 282 } |
| 283 | 283 |
| 284 void ExtensionAppItem::OnExtensionIconImageChanged( | 284 void ExtensionAppItem::OnExtensionIconImageChanged( |
| 285 extensions::IconImage* image) { | 285 extensions::IconImage* image) { |
| 286 DCHECK(icon_.get() == image); | 286 DCHECK(icon_.get() == image); |
| 287 UpdateIcon(); | 287 UpdateIcon(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void ExtensionAppItem::ExtensionEnableFlowFinished() { | 290 void ExtensionAppItem::ExtensionEnableFlowFinished() { |
| 291 extension_enable_flow_.reset(); | 291 extension_enable_flow_.reset(); |
| 292 extension_enable_flow_controller_->OnCloseExtensionPrompt(); | 292 extension_enable_flow_controller_->OnCloseChildDialog(); |
| 293 extension_enable_flow_controller_ = NULL; | 293 extension_enable_flow_controller_ = NULL; |
| 294 | 294 |
| 295 // Automatically launch app after enabling. | 295 // Automatically launch app after enabling. |
| 296 Launch(ui::EF_NONE); | 296 Launch(ui::EF_NONE); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void ExtensionAppItem::ExtensionEnableFlowAborted(bool user_initiated) { | 299 void ExtensionAppItem::ExtensionEnableFlowAborted(bool user_initiated) { |
| 300 extension_enable_flow_.reset(); | 300 extension_enable_flow_.reset(); |
| 301 extension_enable_flow_controller_->OnCloseExtensionPrompt(); | 301 extension_enable_flow_controller_->OnCloseChildDialog(); |
| 302 extension_enable_flow_controller_ = NULL; | 302 extension_enable_flow_controller_ = NULL; |
| 303 } | 303 } |
| 304 | 304 |
| 305 void ExtensionAppItem::Activate(int event_flags) { | 305 void ExtensionAppItem::Activate(int event_flags) { |
| 306 // |extension| could be NULL when it is being unloaded for updating. | 306 // |extension| could be NULL when it is being unloaded for updating. |
| 307 const Extension* extension = GetExtension(); | 307 const Extension* extension = GetExtension(); |
| 308 if (!extension) | 308 if (!extension) |
| 309 return; | 309 return; |
| 310 | 310 |
| 311 if (RunExtensionEnableFlow()) | 311 if (RunExtensionEnableFlow()) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 const syncer::StringOrdinal& launch = | 350 const syncer::StringOrdinal& launch = |
| 351 GetAppSorting(profile_)->GetAppLaunchOrdinal(extension_id_); | 351 GetAppSorting(profile_)->GetAppLaunchOrdinal(extension_id_); |
| 352 set_position(syncer::StringOrdinal( | 352 set_position(syncer::StringOrdinal( |
| 353 page.ToInternalValue() + launch.ToInternalValue())); | 353 page.ToInternalValue() + launch.ToInternalValue())); |
| 354 } | 354 } |
| 355 | 355 |
| 356 AppListControllerDelegate* ExtensionAppItem::GetController() { | 356 AppListControllerDelegate* ExtensionAppItem::GetController() { |
| 357 return AppListService::Get(chrome::GetActiveDesktop())-> | 357 return AppListService::Get(chrome::GetActiveDesktop())-> |
| 358 GetControllerDelegate(); | 358 GetControllerDelegate(); |
| 359 } | 359 } |
| OLD | NEW |