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

Unified Diff: chrome/browser/ui/intents/web_intent_picker_controller.cc

Issue 10542105: TabContentsWrapper -> TabContents, part 42. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/intents/web_intent_picker_controller.cc
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.cc b/chrome/browser/ui/intents/web_intent_picker_controller.cc
index 8d4bacfcfb2aa7a94e8a100c94018afbd3972c3f..4866beb44a6605fbfa2b703eaae83fa57f3eb127 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller.cc
+++ b/chrome/browser/ui/intents/web_intent_picker_controller.cc
@@ -23,7 +23,7 @@
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/intents/web_intent_picker.h"
#include "chrome/browser/ui/intents/web_intent_picker_model.h"
-#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/chrome_notification_types.h"
@@ -54,18 +54,18 @@ const char kSubscribeActionURL[] = "http://webintents.org/subscribe";
const char kSaveActionURL[] = "http://webintents.org/save";
// Gets the favicon service for the profile in |tab_contents|.
-FaviconService* GetFaviconService(TabContentsWrapper* wrapper) {
- return wrapper->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS);
+FaviconService* GetFaviconService(TabContents* tab_contents) {
+ return tab_contents->profile()->GetFaviconService(Profile::EXPLICIT_ACCESS);
}
// Gets the web intents registry for the profile in |tab_contents|.
-WebIntentsRegistry* GetWebIntentsRegistry(TabContentsWrapper* wrapper) {
- return WebIntentsRegistryFactory::GetForProfile(wrapper->profile());
+WebIntentsRegistry* GetWebIntentsRegistry(TabContents* tab_contents) {
+ return WebIntentsRegistryFactory::GetForProfile(tab_contents->profile());
}
// Gets the Chrome web store intents registry for the profile in |tab_contents|.
-CWSIntentsRegistry* GetCWSIntentsRegistry(TabContentsWrapper* wrapper) {
- return CWSIntentsRegistryFactory::GetForProfile(wrapper->profile());
+CWSIntentsRegistry* GetCWSIntentsRegistry(TabContents* tab_contents) {
+ return CWSIntentsRegistryFactory::GetForProfile(tab_contents->profile());
}
WebIntentPickerModel::Disposition ConvertDisposition(
@@ -134,8 +134,8 @@ void URLFetcherTrampoline::OnURLFetchComplete(
} // namespace
WebIntentPickerController::WebIntentPickerController(
- TabContentsWrapper* wrapper)
- : wrapper_(wrapper),
+ TabContents* tab_contents)
+ : tab_contents_(tab_contents),
picker_(NULL),
picker_model_(new WebIntentPickerModel()),
pending_async_count_(0),
@@ -145,7 +145,7 @@ WebIntentPickerController::WebIntentPickerController(
service_tab_(NULL),
weak_ptr_factory_(this) {
content::NavigationController* controller =
- &wrapper->web_contents()->GetController();
+ &tab_contents->web_contents()->GetController();
registrar_.Add(this, content::NOTIFICATION_LOAD_START,
content::Source<content::NavigationController>(controller));
registrar_.Add(this, chrome::NOTIFICATION_TAB_CLOSING,
@@ -181,7 +181,7 @@ void WebIntentPickerController::ShowDialog(const string16& action,
// TODO(binji): Figure out what to do when intents are invoked from incognito
// mode.
- if (wrapper_->profile()->IsOffTheRecord()) {
+ if (tab_contents_->profile()->IsOffTheRecord()) {
if (intents_dispatcher_) {
intents_dispatcher_->SendReplyMessage(
webkit_glue::WEB_INTENT_REPLY_FAILURE, string16());
@@ -211,7 +211,7 @@ void WebIntentPickerController::ShowDialog(const string16& action,
// page for this action/type if it is permitted to be dispatched. (Also
// required to find disposition set by service.)
pending_async_count_++;
- GetWebIntentsRegistry(wrapper_)->GetIntentServices(
+ GetWebIntentsRegistry(tab_contents_)->GetIntentServices(
action, type, base::Bind(
&WebIntentPickerController::WebIntentServicesForExplicitIntent,
weak_ptr_factory_.GetWeakPtr()));
@@ -222,22 +222,22 @@ void WebIntentPickerController::ShowDialog(const string16& action,
pending_async_count_ += 2;
pending_registry_calls_count_ += 1;
- GetWebIntentsRegistry(wrapper_)->GetIntentServices(
+ GetWebIntentsRegistry(tab_contents_)->GetIntentServices(
action, type,
base::Bind(&WebIntentPickerController::OnWebIntentServicesAvailable,
weak_ptr_factory_.GetWeakPtr()));
- GURL invoking_url = wrapper_->web_contents()->GetURL();
+ GURL invoking_url = tab_contents_->web_contents()->GetURL();
if (invoking_url.is_valid()) {
pending_async_count_++;
pending_registry_calls_count_++;
- GetWebIntentsRegistry(wrapper_)->GetDefaultIntentService(
+ GetWebIntentsRegistry(tab_contents_)->GetDefaultIntentService(
action, type, invoking_url,
base::Bind(&WebIntentPickerController::OnWebIntentDefaultsAvailable,
weak_ptr_factory_.GetWeakPtr()));
}
- GetCWSIntentsRegistry(wrapper_)->GetIntentServices(
+ GetCWSIntentsRegistry(tab_contents_)->GetIntentServices(
action, type,
base::Bind(&WebIntentPickerController::OnCWSIntentServicesAvailable,
weak_ptr_factory_.GetWeakPtr()));
@@ -265,11 +265,11 @@ void WebIntentPickerController::OnServiceChosen(const GURL& url,
case WebIntentPickerModel::DISPOSITION_WINDOW: {
int index = TabStripModel::kNoTab;
Browser* browser = browser::FindBrowserForController(
- &wrapper_->web_contents()->GetController(), &index);
- TabContentsWrapper* contents = Browser::TabContentsFactory(
- wrapper_->profile(),
+ &tab_contents_->web_contents()->GetController(), &index);
+ TabContents* contents = Browser::TabContentsFactory(
+ tab_contents_->profile(),
tab_util::GetSiteInstanceForNewTab(
- wrapper_->profile(), url),
+ tab_contents_->profile(), url),
MSG_ROUTING_NONE, NULL, NULL);
intents_dispatcher_->DispatchIntent(contents->web_contents());
@@ -283,7 +283,7 @@ void WebIntentPickerController::OnServiceChosen(const GURL& url,
content::PAGE_TRANSITION_AUTO_BOOKMARK);
params.target_contents = contents;
params.disposition = NEW_FOREGROUND_TAB;
- params.profile = wrapper_->profile();
+ params.profile = tab_contents_->profile();
browser::Navigate(&params);
service_tab_->GetController().LoadURL(
@@ -310,10 +310,11 @@ void WebIntentPickerController::OnExtensionInstallRequested(
const std::string& id) {
scoped_ptr<WebstoreInstaller::Approval> approval(
WebstoreInstaller::Approval::CreateWithInstallPrompt(
- wrapper_->profile()));
+ tab_contents_->profile()));
scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller(
- wrapper_->profile(), this, &wrapper_->web_contents()->GetController(), id,
+ tab_contents_->profile(), this,
+ &tab_contents_->web_contents()->GetController(), id,
approval.Pass(), WebstoreInstaller::FLAG_INLINE_INSTALL);
pending_async_count_++;
@@ -323,7 +324,7 @@ void WebIntentPickerController::OnExtensionInstallRequested(
void WebIntentPickerController::OnExtensionLinkClicked(const std::string& id) {
// Navigate from source tab.
Browser* browser =
- browser::FindBrowserWithWebContents(wrapper_->web_contents());
+ browser::FindBrowserWithWebContents(tab_contents_->web_contents());
GURL extension_url(extension_urls::GetWebstoreItemDetailURLPrefix() + id);
browser::NavigateParams params(browser, extension_url,
content::PAGE_TRANSITION_AUTO_BOOKMARK);
@@ -334,7 +335,7 @@ void WebIntentPickerController::OnExtensionLinkClicked(const std::string& id) {
void WebIntentPickerController::OnSuggestionsLinkClicked() {
// Navigate from source tab.
Browser* browser =
- browser::FindBrowserWithWebContents(wrapper_->web_contents());
+ browser::FindBrowserWithWebContents(tab_contents_->web_contents());
GURL query_url = extension_urls::GetWebstoreIntentQueryURL(
UTF16ToUTF8(picker_model_->action()),
UTF16ToUTF8(picker_model_->mimetype()));
@@ -375,7 +376,7 @@ void WebIntentPickerController::OnExtensionInstallSuccess(
const std::string& id) {
picker_->OnExtensionInstallSuccess(id);
pending_async_count_++;
- GetWebIntentsRegistry(wrapper_)->GetIntentServicesForExtensionFilter(
+ GetWebIntentsRegistry(tab_contents_)->GetIntentServicesForExtensionFilter(
picker_model_->action(),
picker_model_->mimetype(),
id,
@@ -407,10 +408,10 @@ void WebIntentPickerController::OnSendReturnMessage(
// Activate source tab.
Browser* source_browser =
- browser::FindBrowserWithWebContents(wrapper_->web_contents());
+ browser::FindBrowserWithWebContents(tab_contents_->web_contents());
if (source_browser) {
- int source_index =
- source_browser->tab_strip_model()->GetIndexOfTabContents(wrapper_);
+ int source_index = source_browser->tab_strip_model()->
+ GetIndexOfTabContents(tab_contents_);
source_browser->ActivateTabAt(source_index, false);
}
}
@@ -422,7 +423,7 @@ void WebIntentPickerController::OnSendReturnMessage(
void WebIntentPickerController::OnWebIntentServicesAvailable(
const std::vector<webkit_glue::WebIntentServiceData>& services) {
- FaviconService* favicon_service = GetFaviconService(wrapper_);
+ FaviconService* favicon_service = GetFaviconService(tab_contents_);
for (size_t i = 0; i < services.size(); ++i) {
picker_model_->AddInstalledService(
services[i].title,
@@ -458,7 +459,7 @@ void WebIntentPickerController::WebIntentServicesForExplicitIntent(
ConvertDisposition(services[i].disposition));
pending_async_count_++;
- FaviconService* favicon_service = GetFaviconService(wrapper_);
+ FaviconService* favicon_service = GetFaviconService(tab_contents_);
FaviconService::Handle handle = favicon_service->GetFaviconForURL(
services[i].service_url,
history::FAVICON,
@@ -545,7 +546,7 @@ void WebIntentPickerController::OnFaviconDataAvailable(
void WebIntentPickerController::OnCWSIntentServicesAvailable(
const CWSIntentsRegistry::IntentExtensionList& extensions) {
ExtensionServiceInterface* extension_service =
- wrapper_->profile()->GetExtensionService();
+ tab_contents_->profile()->GetExtensionService();
for (size_t i = 0; i < extensions.size(); ++i) {
const CWSIntentsRegistry::IntentExtensionInfo& info = extensions[i];
if (extension_service->GetExtensionById(UTF16ToUTF8(info.id),
@@ -571,7 +572,7 @@ void WebIntentPickerController::OnCWSIntentServicesAvailable(
icon_url_fetcher->SetLoadFlags(
net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES);
icon_url_fetcher->SetRequestContext(
- wrapper_->profile()->GetRequestContext());
+ tab_contents_->profile()->GetRequestContext());
icon_url_fetcher->Start();
}
@@ -687,7 +688,7 @@ void WebIntentPickerController::AsyncOperationFinished() {
void WebIntentPickerController::CreatePicker() {
// If picker is non-NULL, it was set by a test.
if (picker_ == NULL)
- picker_ = WebIntentPicker::Create(wrapper_, this, picker_model_.get());
+ picker_ = WebIntentPicker::Create(tab_contents_, this, picker_model_.get());
picker_shown_ = true;
}

Powered by Google App Engine
This is Rietveld 408576698