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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 } | 803 } |
804 } | 804 } |
805 | 805 |
806 void WebIntentPickerController::LocationBarPickerButtonClicked() { | 806 void WebIntentPickerController::LocationBarPickerButtonClicked() { |
807 DCHECK(web_contents_); | 807 DCHECK(web_contents_); |
808 if (window_disposition_source_ && source_intents_dispatcher_) { | 808 if (window_disposition_source_ && source_intents_dispatcher_) { |
809 Browser* service_browser = | 809 Browser* service_browser = |
810 chrome::FindBrowserWithWebContents(web_contents_); | 810 chrome::FindBrowserWithWebContents(web_contents_); |
811 if (!service_browser) return; | 811 if (!service_browser) return; |
812 | 812 |
813 TabContents* client_tab = | |
814 TabContents::FromWebContents(window_disposition_source_); | |
815 Browser* client_browser = | 813 Browser* client_browser = |
816 chrome::FindBrowserWithWebContents(window_disposition_source_); | 814 chrome::FindBrowserWithWebContents(window_disposition_source_); |
817 if (!client_browser || !client_tab) return; | 815 if (!client_browser) |
818 int client_index = | 816 return; |
819 client_browser->tab_strip_model()->GetIndexOfTabContents(client_tab); | 817 int client_index = client_browser->tab_strip_model()->GetIndexOfWebContents( |
| 818 window_disposition_source_); |
820 DCHECK(client_index != TabStripModel::kNoTab); | 819 DCHECK(client_index != TabStripModel::kNoTab); |
821 | 820 |
822 source_intents_dispatcher_->ResetDispatch(); | 821 source_intents_dispatcher_->ResetDispatch(); |
823 | 822 |
824 WebIntentPickerController* client_controller = | 823 WebIntentPickerController* client_controller = |
825 WebIntentPickerController::FromWebContents(window_disposition_source_); | 824 WebIntentPickerController::FromWebContents(window_disposition_source_); |
826 DCHECK(client_controller); | 825 DCHECK(client_controller); |
827 | 826 |
828 // This call deletes this object, so anything below here needs to | 827 // This call deletes this object, so anything below here needs to |
829 // use stack variables. | 828 // use stack variables. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 content::DownloadManager* download_manager = | 966 content::DownloadManager* download_manager = |
968 content::BrowserContext::GetDownloadManager(profile); | 967 content::BrowserContext::GetDownloadManager(profile); |
969 if (!download_manager) | 968 if (!download_manager) |
970 return; | 969 return; |
971 content::DownloadItem* item = | 970 content::DownloadItem* item = |
972 download_manager->GetDownload(download_id_.local()); | 971 download_manager->GetDownload(download_id_.local()); |
973 if (item) | 972 if (item) |
974 item->Cancel(true); | 973 item->Cancel(true); |
975 download_id_ = content::DownloadId(); | 974 download_id_ = content::DownloadId(); |
976 } | 975 } |
OLD | NEW |