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

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

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/platform_app_launcher.h" 14 #include "chrome/browser/extensions/platform_app_launcher.h"
15 #include "chrome/browser/extensions/webstore_installer.h" 15 #include "chrome/browser/extensions/webstore_installer.h"
16 #include "chrome/browser/favicon/favicon_service.h" 16 #include "chrome/browser/favicon/favicon_service.h"
17 #include "chrome/browser/intents/cws_intents_registry_factory.h" 17 #include "chrome/browser/intents/cws_intents_registry_factory.h"
18 #include "chrome/browser/intents/default_web_intent_service.h" 18 #include "chrome/browser/intents/default_web_intent_service.h"
19 #include "chrome/browser/intents/web_intents_registry_factory.h" 19 #include "chrome/browser/intents/web_intents_registry_factory.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/tab_contents/tab_util.h" 21 #include "chrome/browser/tab_contents/tab_util.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_finder.h" 23 #include "chrome/browser/ui/browser_finder.h"
24 #include "chrome/browser/ui/browser_list.h" 24 #include "chrome/browser/ui/browser_list.h"
25 #include "chrome/browser/ui/browser_navigator.h" 25 #include "chrome/browser/ui/browser_navigator.h"
26 #include "chrome/browser/ui/browser_tabstrip.h"
26 #include "chrome/browser/ui/intents/web_intent_picker.h" 27 #include "chrome/browser/ui/intents/web_intent_picker.h"
27 #include "chrome/browser/ui/intents/web_intent_picker_model.h" 28 #include "chrome/browser/ui/intents/web_intent_picker_model.h"
28 #include "chrome/browser/ui/tab_contents/tab_contents.h" 29 #include "chrome/browser/ui/tab_contents/tab_contents.h"
29 #include "chrome/browser/ui/tabs/tab_strip_model.h" 30 #include "chrome/browser/ui/tabs/tab_strip_model.h"
30 #include "chrome/browser/webdata/web_data_service.h" 31 #include "chrome/browser/webdata/web_data_service.h"
31 #include "chrome/common/chrome_notification_types.h" 32 #include "chrome/common/chrome_notification_types.h"
32 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
33 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/navigation_controller.h" 35 #include "content/public/browser/navigation_controller.h"
35 #include "content/public/browser/notification_source.h" 36 #include "content/public/browser/notification_source.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 case WebIntentPickerModel::DISPOSITION_INLINE: 276 case WebIntentPickerModel::DISPOSITION_INLINE:
276 // Set the model to inline disposition. It will notify the picker which 277 // Set the model to inline disposition. It will notify the picker which
277 // will respond (via OnInlineDispositionWebContentsCreated) with the 278 // will respond (via OnInlineDispositionWebContentsCreated) with the
278 // WebContents to dispatch the intent to. 279 // WebContents to dispatch the intent to.
279 picker_model_->SetInlineDisposition(url); 280 picker_model_->SetInlineDisposition(url);
280 break; 281 break;
281 282
282 case WebIntentPickerModel::DISPOSITION_WINDOW: { 283 case WebIntentPickerModel::DISPOSITION_WINDOW: {
283 Browser* browser = browser::FindBrowserWithWebContents( 284 Browser* browser = browser::FindBrowserWithWebContents(
284 tab_contents_->web_contents()); 285 tab_contents_->web_contents());
285 TabContents* contents = Browser::TabContentsFactory( 286 TabContents* contents = chrome::TabContentsFactory(
286 tab_contents_->profile(), 287 tab_contents_->profile(),
287 tab_util::GetSiteInstanceForNewTab( 288 tab_util::GetSiteInstanceForNewTab(
288 tab_contents_->profile(), url), 289 tab_contents_->profile(), url),
289 MSG_ROUTING_NONE, NULL, NULL); 290 MSG_ROUTING_NONE, NULL, NULL);
290 291
291 intents_dispatcher_->DispatchIntent(contents->web_contents()); 292 intents_dispatcher_->DispatchIntent(contents->web_contents());
292 service_tab_ = contents->web_contents(); 293 service_tab_ = contents->web_contents();
293 294
294 // This call performs all the tab strip manipulation, notifications, etc. 295 // This call performs all the tab strip manipulation, notifications, etc.
295 // Since we're passing in a target_contents, it assumes that we will 296 // Since we're passing in a target_contents, it assumes that we will
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 service_tab_); 422 service_tab_);
422 browser->tab_strip_model()->CloseTabContentsAt( 423 browser->tab_strip_model()->CloseTabContentsAt(
423 index, TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); 424 index, TabStripModel::CLOSE_CREATE_HISTORICAL_TAB);
424 425
425 // Activate source tab. 426 // Activate source tab.
426 Browser* source_browser = 427 Browser* source_browser =
427 browser::FindBrowserWithWebContents(tab_contents_->web_contents()); 428 browser::FindBrowserWithWebContents(tab_contents_->web_contents());
428 if (source_browser) { 429 if (source_browser) {
429 int source_index = source_browser->tab_strip_model()-> 430 int source_index = source_browser->tab_strip_model()->
430 GetIndexOfTabContents(tab_contents_); 431 GetIndexOfTabContents(tab_contents_);
431 source_browser->ActivateTabAt(source_index, false); 432 chrome::ActivateTabAt(source_browser, source_index, false);
432 } 433 }
433 } 434 }
434 service_tab_ = NULL; 435 service_tab_ = NULL;
435 } 436 }
436 437
437 intents_dispatcher_ = NULL; 438 intents_dispatcher_ = NULL;
438 } 439 }
439 440
440 void WebIntentPickerController::OnWebIntentServicesAvailable( 441 void WebIntentPickerController::OnWebIntentServicesAvailable(
441 const std::vector<webkit_glue::WebIntentServiceData>& services) { 442 const std::vector<webkit_glue::WebIntentServiceData>& services) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 // If picker is non-NULL, it was set by a test. 706 // If picker is non-NULL, it was set by a test.
706 if (picker_ == NULL) 707 if (picker_ == NULL)
707 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get()); 708 picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get());
708 picker_shown_ = true; 709 picker_shown_ = true;
709 } 710 }
710 711
711 void WebIntentPickerController::ClosePicker() { 712 void WebIntentPickerController::ClosePicker() {
712 if (picker_) 713 if (picker_)
713 picker_->Close(); 714 picker_->Close();
714 } 715 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698