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

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

Issue 10831308: Revert 151036 - Speculative revert to see if this change introduced a performance regression on Mac… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months 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
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 298
299 switch (disposition) { 299 switch (disposition) {
300 case WebIntentPickerModel::DISPOSITION_INLINE: 300 case WebIntentPickerModel::DISPOSITION_INLINE:
301 // Set the model to inline disposition. It will notify the picker which 301 // Set the model to inline disposition. It will notify the picker which
302 // will respond (via OnInlineDispositionWebContentsCreated) with the 302 // will respond (via OnInlineDispositionWebContentsCreated) with the
303 // WebContents to dispatch the intent to. 303 // WebContents to dispatch the intent to.
304 picker_model_->SetInlineDisposition(url); 304 picker_model_->SetInlineDisposition(url);
305 break; 305 break;
306 306
307 case WebIntentPickerModel::DISPOSITION_WINDOW: { 307 case WebIntentPickerModel::DISPOSITION_WINDOW: {
308 int index = TabStripModel::kNoTab; 308 Browser* browser = browser::FindBrowserWithWebContents(
309 Browser* browser = browser::FindBrowserForController( 309 tab_contents_->web_contents());
310 &tab_contents_->web_contents()->GetController(), &index);
311 TabContents* contents = chrome::TabContentsFactory( 310 TabContents* contents = chrome::TabContentsFactory(
312 tab_contents_->profile(), 311 tab_contents_->profile(),
313 tab_util::GetSiteInstanceForNewTab( 312 tab_util::GetSiteInstanceForNewTab(
314 tab_contents_->profile(), url), 313 tab_contents_->profile(), url),
315 MSG_ROUTING_NONE, NULL); 314 MSG_ROUTING_NONE, NULL);
316 315
317 // Let the controller for the target TabContents know that it is hosting a 316 // Let the controller for the target TabContents know that it is hosting a
318 // web intents service. 317 // web intents service.
319 contents->web_intent_picker_controller()->SetWindowDispositionSource( 318 contents->web_intent_picker_controller()->SetWindowDispositionSource(
320 tab_contents_->web_contents(), intents_dispatcher_); 319 tab_contents_->web_contents(), intents_dispatcher_);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 picker_->OnExtensionInstallFailure(id); 460 picker_->OnExtensionInstallFailure(id);
462 AsyncOperationFinished(); 461 AsyncOperationFinished();
463 } 462 }
464 463
465 void WebIntentPickerController::OnSendReturnMessage( 464 void WebIntentPickerController::OnSendReturnMessage(
466 webkit_glue::WebIntentReplyType reply_type) { 465 webkit_glue::WebIntentReplyType reply_type) {
467 ClosePicker(); 466 ClosePicker();
468 467
469 if (service_tab_ && 468 if (service_tab_ &&
470 reply_type != webkit_glue::WEB_INTENT_SERVICE_CONTENTS_CLOSED) { 469 reply_type != webkit_glue::WEB_INTENT_SERVICE_CONTENTS_CLOSED) {
471 int index = TabStripModel::kNoTab; 470 Browser* browser = browser::FindBrowserWithWebContents(service_tab_);
472 Browser* browser = browser::FindBrowserForController(
473 &service_tab_->GetController(), &index);
474 if (browser) { 471 if (browser) {
472 int index = browser->tab_strip_model()->GetIndexOfWebContents(
473 service_tab_);
475 browser->tab_strip_model()->CloseTabContentsAt( 474 browser->tab_strip_model()->CloseTabContentsAt(
476 index, TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); 475 index, TabStripModel::CLOSE_CREATE_HISTORICAL_TAB);
477 476
478 // Activate source tab. 477 // Activate source tab.
479 Browser* source_browser = 478 Browser* source_browser =
480 browser::FindBrowserWithWebContents(tab_contents_->web_contents()); 479 browser::FindBrowserWithWebContents(tab_contents_->web_contents());
481 if (source_browser) { 480 if (source_browser) {
482 int source_index = source_browser->tab_strip_model()-> 481 int source_index = source_browser->tab_strip_model()->
483 GetIndexOfTabContents(tab_contents_); 482 GetIndexOfTabContents(tab_contents_);
484 chrome::ActivateTabAt(source_browser, source_index, false); 483 chrome::ActivateTabAt(source_browser, source_index, false);
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 // If picker is non-NULL, it was set by a test. 766 // If picker is non-NULL, it was set by a test.
768 if (picker_ == NULL) 767 if (picker_ == NULL)
769 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); 768 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get());
770 picker_shown_ = true; 769 picker_shown_ = true;
771 } 770 }
772 771
773 void WebIntentPickerController::ClosePicker() { 772 void WebIntentPickerController::ClosePicker() {
774 if (picker_) 773 if (picker_)
775 picker_->Close(); 774 picker_->Close();
776 } 775 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698