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 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/intents/web_intents_registry_factory.h" | 24 #include "chrome/browser/intents/web_intents_registry_factory.h" |
25 #include "chrome/browser/intents/web_intents_reporting.h" | 25 #include "chrome/browser/intents/web_intents_reporting.h" |
26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/tab_contents/tab_util.h" | 27 #include "chrome/browser/tab_contents/tab_util.h" |
28 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
29 #include "chrome/browser/ui/browser_finder.h" | 29 #include "chrome/browser/ui/browser_finder.h" |
30 #include "chrome/browser/ui/browser_list.h" | 30 #include "chrome/browser/ui/browser_list.h" |
31 #include "chrome/browser/ui/browser_navigator.h" | 31 #include "chrome/browser/ui/browser_navigator.h" |
32 #include "chrome/browser/ui/browser_tabstrip.h" | 32 #include "chrome/browser/ui/browser_tabstrip.h" |
33 #include "chrome/browser/ui/browser_window.h" | 33 #include "chrome/browser/ui/browser_window.h" |
34 #include "chrome/browser/ui/constrained_window_tab_helper.h" | |
35 #include "chrome/browser/ui/intents/web_intent_icon_loader.h" | 34 #include "chrome/browser/ui/intents/web_intent_icon_loader.h" |
36 #include "chrome/browser/ui/intents/web_intent_picker.h" | 35 #include "chrome/browser/ui/intents/web_intent_picker.h" |
37 #include "chrome/browser/ui/intents/web_intent_picker_model.h" | 36 #include "chrome/browser/ui/intents/web_intent_picker_model.h" |
38 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 37 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 38 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" |
39 #include "chrome/browser/webdata/web_data_service.h" | 39 #include "chrome/browser/webdata/web_data_service.h" |
40 #include "chrome/common/url_constants.h" | 40 #include "chrome/common/url_constants.h" |
41 #include "content/public/browser/browser_thread.h" | 41 #include "content/public/browser/browser_thread.h" |
42 #include "content/public/browser/download_manager.h" | 42 #include "content/public/browser/download_manager.h" |
43 #include "content/public/browser/web_contents.h" | 43 #include "content/public/browser/web_contents.h" |
44 #include "content/public/browser/web_contents_observer.h" | 44 #include "content/public/browser/web_contents_observer.h" |
45 #include "content/public/browser/web_intents_dispatcher.h" | 45 #include "content/public/browser/web_intents_dispatcher.h" |
46 #include "ui/gfx/favicon_size.h" | 46 #include "ui/gfx/favicon_size.h" |
47 #include "ui/gfx/image/image.h" | 47 #include "ui/gfx/image/image.h" |
48 | 48 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 picker_model_->action(), picker_model_->type(), | 232 picker_model_->action(), picker_model_->type(), |
233 base::Bind( | 233 base::Bind( |
234 &WebIntentPickerController:: | 234 &WebIntentPickerController:: |
235 OnWebIntentServicesAvailableForExplicitIntent, | 235 OnWebIntentServicesAvailableForExplicitIntent, |
236 weak_ptr_factory_.GetWeakPtr())); | 236 weak_ptr_factory_.GetWeakPtr())); |
237 return; | 237 return; |
238 } | 238 } |
239 | 239 |
240 // As soon as the dialog is requested, block all input events | 240 // As soon as the dialog is requested, block all input events |
241 // on the original tab. | 241 // on the original tab. |
242 ConstrainedWindowTabHelper* constrained_window_tab_helper = | 242 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
243 ConstrainedWindowTabHelper::FromWebContents(web_contents_); | 243 WebContentsModalDialogManager::FromWebContents(web_contents_); |
244 constrained_window_tab_helper->BlockWebContentsInteraction(true); | 244 web_contents_modal_dialog_manager->BlockWebContentsInteraction(true); |
245 SetDialogState(kPickerSetup); | 245 SetDialogState(kPickerSetup); |
246 | 246 |
247 pending_async_count_++; | 247 pending_async_count_++; |
248 pending_registry_calls_count_++; | 248 pending_registry_calls_count_++; |
249 GetWebIntentsRegistry(profile_)->GetIntentServices( | 249 GetWebIntentsRegistry(profile_)->GetIntentServices( |
250 picker_model_->action(), picker_model_->type(), | 250 picker_model_->action(), picker_model_->type(), |
251 base::Bind(&WebIntentPickerController::OnWebIntentServicesAvailable, | 251 base::Bind(&WebIntentPickerController::OnWebIntentServicesAvailable, |
252 weak_ptr_factory_.GetWeakPtr())); | 252 weak_ptr_factory_.GetWeakPtr())); |
253 | 253 |
254 GURL invoking_url = web_contents_->GetURL(); | 254 GURL invoking_url = web_contents_->GetURL(); |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 | 696 |
697 // Reset picker. | 697 // Reset picker. |
698 icon_loader_.reset(); | 698 icon_loader_.reset(); |
699 picker_model_.reset(new WebIntentPickerModel()); | 699 picker_model_.reset(new WebIntentPickerModel()); |
700 icon_loader_.reset( | 700 icon_loader_.reset( |
701 new web_intents::IconLoader(profile_, picker_model_.get())); | 701 new web_intents::IconLoader(profile_, picker_model_.get())); |
702 | 702 |
703 picker_shown_ = false; | 703 picker_shown_ = false; |
704 | 704 |
705 DCHECK(web_contents_); | 705 DCHECK(web_contents_); |
706 ConstrainedWindowTabHelper* constrained_window_tab_helper = | 706 WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
707 ConstrainedWindowTabHelper::FromWebContents(web_contents_); | 707 WebContentsModalDialogManager::FromWebContents(web_contents_); |
708 constrained_window_tab_helper->BlockWebContentsInteraction(false); | 708 web_contents_modal_dialog_manager->BlockWebContentsInteraction(false); |
709 } | 709 } |
710 | 710 |
711 void WebIntentPickerController::OnShowExtensionInstallDialog( | 711 void WebIntentPickerController::OnShowExtensionInstallDialog( |
712 content::WebContents* parent_web_contents, | 712 content::WebContents* parent_web_contents, |
713 ExtensionInstallPrompt::Delegate* delegate, | 713 ExtensionInstallPrompt::Delegate* delegate, |
714 const ExtensionInstallPrompt::Prompt& prompt) { | 714 const ExtensionInstallPrompt::Prompt& prompt) { |
715 picker_model_->SetPendingExtensionInstallDelegate(delegate); | 715 picker_model_->SetPendingExtensionInstallDelegate(delegate); |
716 picker_model_->SetPendingExtensionInstallPrompt(prompt); | 716 picker_model_->SetPendingExtensionInstallPrompt(prompt); |
717 if (picker_) { | 717 if (picker_) { |
718 picker_->OnShowExtensionInstallDialog( | 718 picker_->OnShowExtensionInstallDialog( |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 content::DownloadManager* download_manager = | 964 content::DownloadManager* download_manager = |
965 content::BrowserContext::GetDownloadManager(profile); | 965 content::BrowserContext::GetDownloadManager(profile); |
966 if (!download_manager) | 966 if (!download_manager) |
967 return; | 967 return; |
968 content::DownloadItem* item = | 968 content::DownloadItem* item = |
969 download_manager->GetDownload(download_id_.local()); | 969 download_manager->GetDownload(download_id_.local()); |
970 if (item) | 970 if (item) |
971 item->Cancel(true); | 971 item->Cancel(true); |
972 download_id_ = content::DownloadId(); | 972 download_id_ = content::DownloadId(); |
973 } | 973 } |
OLD | NEW |