| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 ALLOW_THIS_IN_INITIALIZER_LIST(dispatcher_factory_(this)) { | 184 ALLOW_THIS_IN_INITIALIZER_LIST(dispatcher_factory_(this)) { |
| 185 native_services_.reset(new web_intents::NativeServiceFactory()); | 185 native_services_.reset(new web_intents::NativeServiceFactory()); |
| 186 #if defined(TOOLKIT_VIEWS) | 186 #if defined(TOOLKIT_VIEWS) |
| 187 cancelled_ = true; | 187 cancelled_ = true; |
| 188 #endif | 188 #endif |
| 189 icon_loader_.reset( | 189 icon_loader_.reset( |
| 190 new web_intents::IconLoader(profile_, picker_model_.get())); | 190 new web_intents::IconLoader(profile_, picker_model_.get())); |
| 191 } | 191 } |
| 192 | 192 |
| 193 WebIntentPickerController::~WebIntentPickerController() { | 193 WebIntentPickerController::~WebIntentPickerController() { |
| 194 if (picker_) |
| 195 picker_->InvalidateDelegate(); |
| 194 } | 196 } |
| 195 | 197 |
| 196 // TODO(gbillock): combine this with ShowDialog. | 198 // TODO(gbillock): combine this with ShowDialog. |
| 197 void WebIntentPickerController::SetIntentsDispatcher( | 199 void WebIntentPickerController::SetIntentsDispatcher( |
| 198 content::WebIntentsDispatcher* intents_dispatcher) { | 200 content::WebIntentsDispatcher* intents_dispatcher) { |
| 199 // TODO(gbillock): This is to account for multiple dispatches in the same tab. | 201 // TODO(gbillock): This is to account for multiple dispatches in the same tab. |
| 200 // That is currently not a well-handled case, and this is a band-aid. | 202 // That is currently not a well-handled case, and this is a band-aid. |
| 201 dispatcher_factory_.InvalidateWeakPtrs(); | 203 dispatcher_factory_.InvalidateWeakPtrs(); |
| 202 intents_dispatcher_ = intents_dispatcher; | 204 intents_dispatcher_ = intents_dispatcher; |
| 203 intents_dispatcher_->RegisterReplyNotification( | 205 intents_dispatcher_->RegisterReplyNotification( |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 content::DownloadManager* download_manager = | 1090 content::DownloadManager* download_manager = |
| 1089 content::BrowserContext::GetDownloadManager(profile); | 1091 content::BrowserContext::GetDownloadManager(profile); |
| 1090 if (!download_manager) | 1092 if (!download_manager) |
| 1091 return; | 1093 return; |
| 1092 content::DownloadItem* item = | 1094 content::DownloadItem* item = |
| 1093 download_manager->GetDownload(download_id_.local()); | 1095 download_manager->GetDownload(download_id_.local()); |
| 1094 if (item) | 1096 if (item) |
| 1095 item->Cancel(true); | 1097 item->Cancel(true); |
| 1096 download_id_ = content::DownloadId(); | 1098 download_id_ = content::DownloadId(); |
| 1097 } | 1099 } |
| OLD | NEW |