| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 content::Source<content::NavigationController>(controller)); | 198 content::Source<content::NavigationController>(controller)); |
| 199 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, | 199 registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING, |
| 200 content::Source<content::NavigationController>(controller)); | 200 content::Source<content::NavigationController>(controller)); |
| 201 native_services_.reset(new web_intents::NativeServiceFactory()); | 201 native_services_.reset(new web_intents::NativeServiceFactory()); |
| 202 #if defined(TOOLKIT_VIEWS) | 202 #if defined(TOOLKIT_VIEWS) |
| 203 cancelled_ = true; | 203 cancelled_ = true; |
| 204 #endif | 204 #endif |
| 205 } | 205 } |
| 206 | 206 |
| 207 WebIntentPickerController::~WebIntentPickerController() { | 207 WebIntentPickerController::~WebIntentPickerController() { |
| 208 if (picker_) |
| 209 picker_->InvalidateDelegate(); |
| 208 } | 210 } |
| 209 | 211 |
| 210 // TODO(gbillock): combine this with ShowDialog. | 212 // TODO(gbillock): combine this with ShowDialog. |
| 211 void WebIntentPickerController::SetIntentsDispatcher( | 213 void WebIntentPickerController::SetIntentsDispatcher( |
| 212 content::WebIntentsDispatcher* intents_dispatcher) { | 214 content::WebIntentsDispatcher* intents_dispatcher) { |
| 213 // TODO(gbillock): This is to account for multiple dispatches in the same tab. | 215 // TODO(gbillock): This is to account for multiple dispatches in the same tab. |
| 214 // That is currently not a well-handled case, and this is a band-aid. | 216 // That is currently not a well-handled case, and this is a band-aid. |
| 215 dispatcher_factory_.InvalidateWeakPtrs(); | 217 dispatcher_factory_.InvalidateWeakPtrs(); |
| 216 intents_dispatcher_ = intents_dispatcher; | 218 intents_dispatcher_ = intents_dispatcher; |
| 217 intents_dispatcher_->RegisterReplyNotification( | 219 intents_dispatcher_->RegisterReplyNotification( |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 content::DownloadManager* download_manager = | 1131 content::DownloadManager* download_manager = |
| 1130 content::BrowserContext::GetDownloadManager(profile); | 1132 content::BrowserContext::GetDownloadManager(profile); |
| 1131 if (!download_manager) | 1133 if (!download_manager) |
| 1132 return; | 1134 return; |
| 1133 content::DownloadItem* item = | 1135 content::DownloadItem* item = |
| 1134 download_manager->GetDownload(download_id_.local()); | 1136 download_manager->GetDownload(download_id_.local()); |
| 1135 if (item) | 1137 if (item) |
| 1136 item->Cancel(true); | 1138 item->Cancel(true); |
| 1137 download_id_ = content::DownloadId(); | 1139 download_id_ = content::DownloadId(); |
| 1138 } | 1140 } |
| OLD | NEW |