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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 void WebIntentPickerController::SetIntentsDispatcher( | 187 void WebIntentPickerController::SetIntentsDispatcher( |
188 content::WebIntentsDispatcher* intents_dispatcher) { | 188 content::WebIntentsDispatcher* intents_dispatcher) { |
189 intents_dispatcher_ = intents_dispatcher; | 189 intents_dispatcher_ = intents_dispatcher; |
190 intents_dispatcher_->RegisterReplyNotification( | 190 intents_dispatcher_->RegisterReplyNotification( |
191 base::Bind(&WebIntentPickerController::OnSendReturnMessage, | 191 base::Bind(&WebIntentPickerController::OnSendReturnMessage, |
192 weak_ptr_factory_.GetWeakPtr())); | 192 weak_ptr_factory_.GetWeakPtr())); |
193 } | 193 } |
194 void WebIntentPickerController::ShowDialog(const string16& action, | 194 void WebIntentPickerController::ShowDialog(const string16& action, |
195 const string16& type) { | 195 const string16& type) { |
196 | 196 |
197 // As soon as the dialog is requested, block all input events | |
198 // on the original tab. | |
199 tab_contents_->constrained_window_tab_helper()->BlockTabContent(true); | |
200 | |
201 // Only show a picker once. | 197 // Only show a picker once. |
202 // TODO(gbillock): There's a hole potentially admitting multiple | 198 // TODO(gbillock): There's a hole potentially admitting multiple |
203 // in-flight dispatches since we don't create the picker | 199 // in-flight dispatches since we don't create the picker |
204 // in this method, but only after calling the registry. | 200 // in this method, but only after calling the registry. |
205 if (picker_shown_) { | 201 if (picker_shown_) { |
206 if (intents_dispatcher_) { | 202 if (intents_dispatcher_) { |
207 intents_dispatcher_->SendReplyMessage( | 203 intents_dispatcher_->SendReplyMessage( |
208 webkit_glue::WEB_INTENT_REPLY_FAILURE, | 204 webkit_glue::WEB_INTENT_REPLY_FAILURE, |
209 ASCIIToUTF16("Simultaneous intent invocation.")); | 205 ASCIIToUTF16("Simultaneous intent invocation.")); |
210 } | 206 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // required to find disposition set by service.) | 240 // required to find disposition set by service.) |
245 pending_async_count_++; | 241 pending_async_count_++; |
246 GetWebIntentsRegistry(tab_contents_)->GetIntentServices( | 242 GetWebIntentsRegistry(tab_contents_)->GetIntentServices( |
247 action, type, base::Bind( | 243 action, type, base::Bind( |
248 &WebIntentPickerController::WebIntentServicesForExplicitIntent, | 244 &WebIntentPickerController::WebIntentServicesForExplicitIntent, |
249 weak_ptr_factory_.GetWeakPtr())); | 245 weak_ptr_factory_.GetWeakPtr())); |
250 return; | 246 return; |
251 } | 247 } |
252 } | 248 } |
253 | 249 |
| 250 // As soon as the dialog is requested, block all input events |
| 251 // on the original tab. |
| 252 tab_contents_->constrained_window_tab_helper()->BlockTabContent(true); |
254 SetDialogState(kPickerSetup); | 253 SetDialogState(kPickerSetup); |
255 | 254 |
256 pending_async_count_++; | 255 pending_async_count_++; |
257 pending_registry_calls_count_++; | 256 pending_registry_calls_count_++; |
258 GetWebIntentsRegistry(tab_contents_)->GetIntentServices( | 257 GetWebIntentsRegistry(tab_contents_)->GetIntentServices( |
259 action, type, | 258 action, type, |
260 base::Bind(&WebIntentPickerController::OnWebIntentServicesAvailable, | 259 base::Bind(&WebIntentPickerController::OnWebIntentServicesAvailable, |
261 weak_ptr_factory_.GetWeakPtr())); | 260 weak_ptr_factory_.GetWeakPtr())); |
262 | 261 |
263 GURL invoking_url = tab_contents_->web_contents()->GetURL(); | 262 GURL invoking_url = tab_contents_->web_contents()->GetURL(); |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 picker_->SetActionString(GetIntentActionString( | 941 picker_->SetActionString(GetIntentActionString( |
943 UTF16ToUTF8(picker_model_->action()))); | 942 UTF16ToUTF8(picker_model_->action()))); |
944 picker_shown_ = true; | 943 picker_shown_ = true; |
945 } | 944 } |
946 | 945 |
947 void WebIntentPickerController::ClosePicker() { | 946 void WebIntentPickerController::ClosePicker() { |
948 SetDialogState(kPickerHidden); | 947 SetDialogState(kPickerHidden); |
949 if (picker_) | 948 if (picker_) |
950 picker_->Close(); | 949 picker_->Close(); |
951 } | 950 } |
OLD | NEW |