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 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 } | 1007 } |
1008 | 1008 |
1009 // TODO(gbillock): this is a bit hacky and exists because in the inline case, | 1009 // TODO(gbillock): this is a bit hacky and exists because in the inline case, |
1010 // the picker currently assumes it exists. | 1010 // the picker currently assumes it exists. |
1011 AddServiceToModel(service); | 1011 AddServiceToModel(service); |
1012 picker_model_->set_show_use_another_service(false); | 1012 picker_model_->set_show_use_another_service(false); |
1013 | 1013 |
1014 if (service.disposition == | 1014 if (service.disposition == |
1015 webkit_glue::WebIntentServiceData::DISPOSITION_INLINE) { | 1015 webkit_glue::WebIntentServiceData::DISPOSITION_INLINE) { |
1016 picker_model_->SetInlineDisposition(service.service_url); | 1016 picker_model_->SetInlineDisposition(service.service_url); |
1017 dialog_state_ = kPickerInline; | 1017 SetDialogState(kPickerInline); |
1018 CreatePicker(); | |
1019 return; | 1018 return; |
1020 } | 1019 } |
1021 | 1020 |
1022 OnServiceChosen(service.service_url, service.disposition, kSuppressDefaults); | 1021 OnServiceChosen(service.service_url, service.disposition, kSuppressDefaults); |
1023 } | 1022 } |
1024 | 1023 |
1025 void WebIntentPickerController::InvokeService( | 1024 void WebIntentPickerController::InvokeService( |
1026 const WebIntentPickerModel::InstalledService& service) { | 1025 const WebIntentPickerModel::InstalledService& service) { |
1027 if (service.disposition == | 1026 if (service.disposition == |
1028 webkit_glue::WebIntentServiceData::DISPOSITION_INLINE) { | 1027 webkit_glue::WebIntentServiceData::DISPOSITION_INLINE) { |
1029 // This call will ensure the picker dialog is created and initialized. | 1028 // This call will ensure the picker dialog is created and initialized. |
| 1029 picker_model_->SetInlineDisposition(service.url); |
1030 SetDialogState(kPickerInline); | 1030 SetDialogState(kPickerInline); |
| 1031 return; |
1031 } | 1032 } |
1032 OnServiceChosen(service.url, service.disposition, kEnableDefaults); | 1033 OnServiceChosen(service.url, service.disposition, kEnableDefaults); |
1033 } | 1034 } |
1034 | 1035 |
1035 void WebIntentPickerController::SetDialogState(WebIntentPickerState state) { | 1036 void WebIntentPickerController::SetDialogState(WebIntentPickerState state) { |
1036 // Ignore events that don't change state. | 1037 // Ignore events that don't change state. |
1037 if (state == dialog_state_) | 1038 if (state == dialog_state_) |
1038 return; | 1039 return; |
1039 | 1040 |
1040 // Any pending timers are abandoned on state changes. | 1041 // Any pending timers are abandoned on state changes. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 content::DownloadManager* download_manager = | 1116 content::DownloadManager* download_manager = |
1116 content::BrowserContext::GetDownloadManager(profile); | 1117 content::BrowserContext::GetDownloadManager(profile); |
1117 if (!download_manager) | 1118 if (!download_manager) |
1118 return; | 1119 return; |
1119 content::DownloadItem* item = | 1120 content::DownloadItem* item = |
1120 download_manager->GetDownload(download_id_.local()); | 1121 download_manager->GetDownload(download_id_.local()); |
1121 if (item) | 1122 if (item) |
1122 item->Cancel(true); | 1123 item->Cancel(true); |
1123 download_id_ = content::DownloadId(); | 1124 download_id_ = content::DownloadId(); |
1124 } | 1125 } |
OLD | NEW |