| 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), | 190 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), |
| 191 ALLOW_THIS_IN_INITIALIZER_LIST(timer_factory_(this)), | 191 ALLOW_THIS_IN_INITIALIZER_LIST(timer_factory_(this)), |
| 192 ALLOW_THIS_IN_INITIALIZER_LIST(dispatcher_factory_(this)) { | 192 ALLOW_THIS_IN_INITIALIZER_LIST(dispatcher_factory_(this)) { |
| 193 native_services_.reset(new web_intents::NativeServiceFactory()); | 193 native_services_.reset(new web_intents::NativeServiceFactory()); |
| 194 #if defined(TOOLKIT_VIEWS) | 194 #if defined(TOOLKIT_VIEWS) |
| 195 cancelled_ = true; | 195 cancelled_ = true; |
| 196 #endif | 196 #endif |
| 197 } | 197 } |
| 198 | 198 |
| 199 WebIntentPickerController::~WebIntentPickerController() { | 199 WebIntentPickerController::~WebIntentPickerController() { |
| 200 if (picker_) |
| 201 picker_->InvalidateDelegate(); |
| 200 } | 202 } |
| 201 | 203 |
| 202 // TODO(gbillock): combine this with ShowDialog. | 204 // TODO(gbillock): combine this with ShowDialog. |
| 203 void WebIntentPickerController::SetIntentsDispatcher( | 205 void WebIntentPickerController::SetIntentsDispatcher( |
| 204 content::WebIntentsDispatcher* intents_dispatcher) { | 206 content::WebIntentsDispatcher* intents_dispatcher) { |
| 205 // TODO(gbillock): This is to account for multiple dispatches in the same tab. | 207 // TODO(gbillock): This is to account for multiple dispatches in the same tab. |
| 206 // That is currently not a well-handled case, and this is a band-aid. | 208 // That is currently not a well-handled case, and this is a band-aid. |
| 207 dispatcher_factory_.InvalidateWeakPtrs(); | 209 dispatcher_factory_.InvalidateWeakPtrs(); |
| 208 intents_dispatcher_ = intents_dispatcher; | 210 intents_dispatcher_ = intents_dispatcher; |
| 209 intents_dispatcher_->RegisterReplyNotification( | 211 intents_dispatcher_->RegisterReplyNotification( |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 content::DownloadManager* download_manager = | 1117 content::DownloadManager* download_manager = |
| 1116 content::BrowserContext::GetDownloadManager(profile); | 1118 content::BrowserContext::GetDownloadManager(profile); |
| 1117 if (!download_manager) | 1119 if (!download_manager) |
| 1118 return; | 1120 return; |
| 1119 content::DownloadItem* item = | 1121 content::DownloadItem* item = |
| 1120 download_manager->GetDownload(download_id_.local()); | 1122 download_manager->GetDownload(download_id_.local()); |
| 1121 if (item) | 1123 if (item) |
| 1122 item->Cancel(true); | 1124 item->Cancel(true); |
| 1123 download_id_ = content::DownloadId(); | 1125 download_id_ = content::DownloadId(); |
| 1124 } | 1126 } |
| OLD | NEW |