Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: chrome/browser/ui/intents/web_intent_picker_controller.cc

Issue 11434074: browser: Move FindBrowserWithWebContents() into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/web_intent_picker_gtk.cc ('k') | chrome/browser/ui/pdf/pdf_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 AsyncOperationFinished(); 549 AsyncOperationFinished();
550 } 550 }
551 551
552 void WebIntentPickerController::OnSendReturnMessage( 552 void WebIntentPickerController::OnSendReturnMessage(
553 webkit_glue::WebIntentReplyType reply_type) { 553 webkit_glue::WebIntentReplyType reply_type) {
554 ClosePicker(); 554 ClosePicker();
555 uma_reporter_->RecordServiceActiveDuration(reply_type); 555 uma_reporter_->RecordServiceActiveDuration(reply_type);
556 556
557 if (service_tab_ && 557 if (service_tab_ &&
558 reply_type != webkit_glue::WEB_INTENT_SERVICE_CONTENTS_CLOSED) { 558 reply_type != webkit_glue::WEB_INTENT_SERVICE_CONTENTS_CLOSED) {
559 Browser* browser = browser::FindBrowserWithWebContents(service_tab_); 559 Browser* browser = chrome::FindBrowserWithWebContents(service_tab_);
560 if (browser) { 560 if (browser) {
561 int index = browser->tab_strip_model()->GetIndexOfWebContents( 561 int index = browser->tab_strip_model()->GetIndexOfWebContents(
562 service_tab_); 562 service_tab_);
563 browser->tab_strip_model()->CloseWebContentsAt( 563 browser->tab_strip_model()->CloseWebContentsAt(
564 index, TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); 564 index, TabStripModel::CLOSE_CREATE_HISTORICAL_TAB);
565 565
566 // Activate source tab. 566 // Activate source tab.
567 Browser* source_browser = 567 Browser* source_browser =
568 browser::FindBrowserWithWebContents(web_contents_); 568 chrome::FindBrowserWithWebContents(web_contents_);
569 if (source_browser) { 569 if (source_browser) {
570 int source_index = source_browser->tab_strip_model()-> 570 int source_index = source_browser->tab_strip_model()->
571 GetIndexOfWebContents(web_contents_); 571 GetIndexOfWebContents(web_contents_);
572 chrome::ActivateTabAt(source_browser, source_index, false); 572 chrome::ActivateTabAt(source_browser, source_index, false);
573 } 573 }
574 } 574 }
575 service_tab_ = NULL; 575 service_tab_ = NULL;
576 } 576 }
577 577
578 intents_dispatcher_ = NULL; 578 intents_dispatcher_ = NULL;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 default: 800 default:
801 NOTREACHED(); 801 NOTREACHED();
802 break; 802 break;
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 browser::FindBrowserWithWebContents(web_contents_); 810 chrome::FindBrowserWithWebContents(web_contents_);
811 if (!service_browser) return; 811 if (!service_browser) return;
812 812
813 TabContents* client_tab = 813 TabContents* client_tab =
814 TabContents::FromWebContents(window_disposition_source_); 814 TabContents::FromWebContents(window_disposition_source_);
815 Browser* client_browser = 815 Browser* client_browser =
816 browser::FindBrowserWithWebContents(window_disposition_source_); 816 chrome::FindBrowserWithWebContents(window_disposition_source_);
817 if (!client_browser || !client_tab) return; 817 if (!client_browser || !client_tab) return;
818 int client_index = 818 int client_index =
819 client_browser->tab_strip_model()->GetIndexOfTabContents(client_tab); 819 client_browser->tab_strip_model()->GetIndexOfTabContents(client_tab);
820 DCHECK(client_index != TabStripModel::kNoTab); 820 DCHECK(client_index != TabStripModel::kNoTab);
821 821
822 source_intents_dispatcher_->ResetDispatch(); 822 source_intents_dispatcher_->ResetDispatch();
823 823
824 WebIntentPickerController* client_controller = 824 WebIntentPickerController* client_controller =
825 WebIntentPickerController::FromWebContents(window_disposition_source_); 825 WebIntentPickerController::FromWebContents(window_disposition_source_);
826 DCHECK(client_controller); 826 DCHECK(client_controller);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 content::DownloadManager* download_manager = 967 content::DownloadManager* download_manager =
968 content::BrowserContext::GetDownloadManager(profile); 968 content::BrowserContext::GetDownloadManager(profile);
969 if (!download_manager) 969 if (!download_manager)
970 return; 970 return;
971 content::DownloadItem* item = 971 content::DownloadItem* item =
972 download_manager->GetDownload(download_id_.local()); 972 download_manager->GetDownload(download_id_.local());
973 if (item) 973 if (item)
974 item->Cancel(true); 974 item->Cancel(true);
975 download_id_ = content::DownloadId(); 975 download_id_ = content::DownloadId();
976 } 976 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/web_intent_picker_gtk.cc ('k') | chrome/browser/ui/pdf/pdf_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698