| 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/intents/web_intent_picker_controller.h" | 5 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 // TODO(smckay): This entire method shold basically be pulled out | 356 // TODO(smckay): This entire method shold basically be pulled out |
| 357 // into a separate class dedicated to the execution of intents. | 357 // into a separate class dedicated to the execution of intents. |
| 358 // The tricky part is with the "INLINE" disposition where we | 358 // The tricky part is with the "INLINE" disposition where we |
| 359 // want to (re)use the picker to handle the intent. A bit of | 359 // want to (re)use the picker to handle the intent. A bit of |
| 360 // artful composition + lazy instantiation should make that possible. | 360 // artful composition + lazy instantiation should make that possible. |
| 361 switch (disposition) { | 361 switch (disposition) { |
| 362 case webkit_glue::WebIntentServiceData::DISPOSITION_NATIVE: { | 362 case webkit_glue::WebIntentServiceData::DISPOSITION_NATIVE: { |
| 363 web_intents::IntentServiceHost* service = | 363 web_intents::IntentServiceHost* service = |
| 364 native_services_->CreateServiceInstance( | 364 native_services_->CreateServiceInstance( |
| 365 url, intents_dispatcher_->GetIntent()); | 365 url, intents_dispatcher_->GetIntent(), web_contents_); |
| 366 DCHECK(service); | 366 DCHECK(service); |
| 367 service->HandleIntent(intents_dispatcher_); | 367 service->HandleIntent(intents_dispatcher_); |
| 368 break; | 368 break; |
| 369 } | 369 } |
| 370 | 370 |
| 371 case webkit_glue::WebIntentServiceData::DISPOSITION_INLINE: { | 371 case webkit_glue::WebIntentServiceData::DISPOSITION_INLINE: { |
| 372 // Set the model to inline disposition. It will notify the picker which | 372 // Set the model to inline disposition. It will notify the picker which |
| 373 // will respond (via OnInlineDispositionWebContentsCreated) with the | 373 // will respond (via OnInlineDispositionWebContentsCreated) with the |
| 374 // WebContents to dispatch the intent to. | 374 // WebContents to dispatch the intent to. |
| 375 picker_model_->SetInlineDisposition(url); | 375 picker_model_->SetInlineDisposition(url); |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 content::DownloadManager* download_manager = | 1120 content::DownloadManager* download_manager = |
| 1121 content::BrowserContext::GetDownloadManager(profile); | 1121 content::BrowserContext::GetDownloadManager(profile); |
| 1122 if (!download_manager) | 1122 if (!download_manager) |
| 1123 return; | 1123 return; |
| 1124 content::DownloadItem* item = | 1124 content::DownloadItem* item = |
| 1125 download_manager->GetDownload(download_id_.local()); | 1125 download_manager->GetDownload(download_id_.local()); |
| 1126 if (item) | 1126 if (item) |
| 1127 item->Cancel(true); | 1127 item->Cancel(true); |
| 1128 download_id_ = content::DownloadId(); | 1128 download_id_ = content::DownloadId(); |
| 1129 } | 1129 } |
| OLD | NEW |