summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-28 18:34:56 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-28 18:34:56 +0000
commitcafe4ad25440a7752f5a4d230adf29b16a4766b0 (patch)
tree125f3d638cbaf3a3db61c91904c0eddae1e8ad34 /chrome/browser/extensions
parent96561cb87ad2679df630ddc0d1561949d78bbcff (diff)
downloadchromium_src-cafe4ad25440a7752f5a4d230adf29b16a4766b0.zip
chromium_src-cafe4ad25440a7752f5a4d230adf29b16a4766b0.tar.gz
chromium_src-cafe4ad25440a7752f5a4d230adf29b16a4766b0.tar.bz2
Removal of Profile from content part 3.
BUG=76788 TEST=no change visible Review URL: http://codereview.chromium.org/7522018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94511 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.cc7
-rw-r--r--chrome/browser/extensions/extension_debugger_api.cc10
-rw-r--r--chrome/browser/extensions/extension_tab_helper.cc9
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc2
-rw-r--r--chrome/browser/extensions/extension_webnavigation_api.cc27
-rw-r--r--chrome/browser/extensions/extensions_ui.cc7
-rw-r--r--chrome/browser/extensions/theme_installed_infobar_delegate.cc2
7 files changed, 40 insertions, 24 deletions
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc
index fb9f6ba..976c251 100644
--- a/chrome/browser/extensions/extension_browser_event_router.cc
+++ b/chrome/browser/extensions/extension_browser_event_router.cc
@@ -245,8 +245,8 @@ void ExtensionBrowserEventRouter::OnBrowserSetLastActive(
void ExtensionBrowserEventRouter::TabCreatedAt(TabContents* contents,
int index,
bool active) {
- DispatchEventWithTab(contents->profile(), "", events::kOnTabCreated,
- contents, active);
+ Profile* profile = Profile::FromBrowserContext(contents->browser_context());
+ DispatchEventWithTab(profile, "", events::kOnTabCreated, contents, active);
RegisterForTabNotifications(contents);
}
@@ -476,7 +476,8 @@ void ExtensionBrowserEventRouter::DispatchTabUpdatedEvent(
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
- DispatchEvent(contents->profile(), events::kOnTabUpdated, json_args);
+ Profile* profile = Profile::FromBrowserContext(contents->browser_context());
+ DispatchEvent(profile, events::kOnTabUpdated, json_args);
}
ExtensionBrowserEventRouter::TabEntry* ExtensionBrowserEventRouter::GetTabEntry(
diff --git a/chrome/browser/extensions/extension_debugger_api.cc b/chrome/browser/extensions/extension_debugger_api.cc
index 3a694cb..5afef7c 100644
--- a/chrome/browser/extensions/extension_debugger_api.cc
+++ b/chrome/browser/extensions/extension_debugger_api.cc
@@ -117,8 +117,10 @@ ExtensionDevToolsClientHost::ExtensionDevToolsClientHost(
AttachedClientHosts::GetInstance()->Add(this);
// Detach from debugger when extension unloads.
+ Profile* profile =
+ Profile::FromBrowserContext(tab_contents_->browser_context());
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
- Source<Profile>(tab_contents_->profile()));
+ Source<Profile>(profile));
// Attach to debugger and tell it we are ready.
DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor(
@@ -142,7 +144,8 @@ bool ExtensionDevToolsClientHost::MatchesContentsAndExtensionId(
// DevToolsClientHost interface
void ExtensionDevToolsClientHost::InspectedTabClosing() {
// Tell extension that this client host has been detached.
- Profile* profile = tab_contents_->profile();
+ Profile* profile =
+ Profile::FromBrowserContext(tab_contents_->browser_context());
if (profile != NULL && profile->GetExtensionEventRouter()) {
ListValue args;
args.Append(Value::CreateIntegerValue(tab_id_));
@@ -205,7 +208,8 @@ void ExtensionDevToolsClientHost::Observe(
void ExtensionDevToolsClientHost::OnDispatchOnInspectorFrontend(
const std::string& data) {
- Profile* profile = tab_contents_->profile();
+ Profile* profile =
+ Profile::FromBrowserContext(tab_contents_->browser_context());
if (profile == NULL || !profile->GetExtensionEventRouter())
return;
diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc
index 5495e6e..e3dc992 100644
--- a/chrome/browser/extensions/extension_tab_helper.cc
+++ b/chrome/browser/extensions/extension_tab_helper.cc
@@ -63,8 +63,9 @@ void ExtensionTabHelper::SetExtensionAppById(
if (extension_app_id.empty())
return;
- ExtensionService* extension_service =
- tab_contents()->profile()->GetExtensionService();
+ Profile* profile =
+ Profile::FromBrowserContext(tab_contents()->browser_context());
+ ExtensionService* extension_service = profile->GetExtensionService();
if (!extension_service || !extension_service->is_ready())
return;
@@ -87,7 +88,9 @@ void ExtensionTabHelper::DidNavigateMainFramePostCommit(
if (details.is_in_page)
return;
- ExtensionService* service = tab_contents()->profile()->GetExtensionService();
+ Profile* profile =
+ Profile::FromBrowserContext(tab_contents()->browser_context());
+ ExtensionService* service = profile->GetExtensionService();
if (!service)
return;
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index f7d2dea..b0472e1 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -201,7 +201,7 @@ DictionaryValue* ExtensionTabUtil::CreateTabValue(const TabContents* contents,
tab_strip && tab_strip->IsTabPinned(tab_index));
result->SetString(keys::kTitleKey, contents->GetTitle());
result->SetBoolean(keys::kIncognitoKey,
- contents->profile()->IsOffTheRecord());
+ contents->browser_context()->IsOffTheRecord());
if (!is_loading) {
NavigationEntry* entry = contents->controller().GetActiveEntry();
diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc
index 2ffb663..1736110 100644
--- a/chrome/browser/extensions/extension_webnavigation_api.cc
+++ b/chrome/browser/extensions/extension_webnavigation_api.cc
@@ -56,9 +56,10 @@ double MilliSecondsFromTime(const base::Time& time) {
}
// Dispatches events to the extension message service.
-void DispatchEvent(Profile* profile,
+void DispatchEvent(content::BrowserContext* browser_context,
const char* event_name,
const std::string& json_args) {
+ Profile* profile = Profile::FromBrowserContext(browser_context);
if (profile && profile->GetExtensionEventRouter()) {
profile->GetExtensionEventRouter()->DispatchEventToRenderers(
event_name, json_args, profile, GURL());
@@ -81,7 +82,9 @@ void DispatchOnBeforeNavigate(TabContents* tab_contents,
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
- DispatchEvent(tab_contents->profile(), keys::kOnBeforeNavigate, json_args);
+ DispatchEvent(tab_contents->browser_context(),
+ keys::kOnBeforeNavigate,
+ json_args);
}
// Constructs and dispatches an onCommitted event.
@@ -111,7 +114,7 @@ void DispatchOnCommitted(TabContents* tab_contents,
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
- DispatchEvent(tab_contents->profile(), keys::kOnCommitted, json_args);
+ DispatchEvent(tab_contents->browser_context(), keys::kOnCommitted, json_args);
}
// Constructs and dispatches an onDOMContentLoaded event.
@@ -130,7 +133,9 @@ void DispatchOnDOMContentLoaded(TabContents* tab_contents,
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
- DispatchEvent(tab_contents->profile(), keys::kOnDOMContentLoaded, json_args);
+ DispatchEvent(tab_contents->browser_context(),
+ keys::kOnDOMContentLoaded,
+ json_args);
}
// Constructs and dispatches an onCompleted event.
@@ -149,12 +154,12 @@ void DispatchOnCompleted(TabContents* tab_contents,
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
- DispatchEvent(tab_contents->profile(), keys::kOnCompleted, json_args);
+ DispatchEvent(tab_contents->browser_context(), keys::kOnCompleted, json_args);
}
// Constructs and dispatches an onBeforeRetarget event.
void DispatchOnBeforeRetarget(TabContents* tab_contents,
- Profile* profile,
+ content::BrowserContext* browser_context,
int64 source_frame_id,
bool source_frame_is_main_frame,
TabContents* target_tab_contents,
@@ -173,7 +178,7 @@ void DispatchOnBeforeRetarget(TabContents* tab_contents,
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
- DispatchEvent(profile, keys::kOnBeforeRetarget, json_args);
+ DispatchEvent(browser_context, keys::kOnBeforeRetarget, json_args);
}
// Constructs and dispatches an onErrorOccurred event.
@@ -194,7 +199,9 @@ void DispatchOnErrorOccurred(TabContents* tab_contents,
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
- DispatchEvent(tab_contents->profile(), keys::kOnErrorOccurred, json_args);
+ DispatchEvent(tab_contents->browser_context(),
+ keys::kOnErrorOccurred,
+ json_args);
}
} // namespace
@@ -389,7 +396,7 @@ void ExtensionWebNavigationEventRouter::Retargeting(
} else {
DispatchOnBeforeRetarget(
details->source_tab_contents,
- details->target_tab_contents->profile(),
+ details->target_tab_contents->browser_context(),
details->source_frame_id,
frame_navigation_state.IsMainFrame(details->source_frame_id),
details->target_tab_contents,
@@ -404,7 +411,7 @@ void ExtensionWebNavigationEventRouter::TabAdded(TabContents* tab_contents) {
return;
DispatchOnBeforeRetarget(iter->second.source_tab_contents,
- iter->second.target_tab_contents->profile(),
+ iter->second.target_tab_contents->browser_context(),
iter->second.source_frame_id,
iter->second.source_frame_is_main_frame,
iter->second.target_tab_contents,
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index c10ad0d..a5e9140 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -778,15 +778,16 @@ ExtensionsDOMHandler::~ExtensionsDOMHandler() {
// ExtensionsDOMHandler, public: -----------------------------------------------
ExtensionsUI::ExtensionsUI(TabContents* contents) : ChromeWebUI(contents) {
- ExtensionService *exstension_service =
+ ExtensionService *extension_service =
GetProfile()->GetOriginalProfile()->GetExtensionService();
- ExtensionsDOMHandler* handler = new ExtensionsDOMHandler(exstension_service);
+ ExtensionsDOMHandler* handler = new ExtensionsDOMHandler(extension_service);
AddMessageHandler(handler);
handler->Attach(this);
// Set up the chrome://extensions/ source.
- contents->profile()->GetChromeURLDataManager()->AddDataSource(
+ Profile* profile = Profile::FromBrowserContext(contents->browser_context());
+ profile->GetChromeURLDataManager()->AddDataSource(
CreateExtensionsUIHTMLSource());
}
diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
index 27e9c03..ed8462b 100644
--- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc
+++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
@@ -26,7 +26,7 @@ ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate(
const std::string& previous_theme_id,
bool previous_using_native_theme)
: ConfirmInfoBarDelegate(tab_contents),
- profile_(tab_contents->profile()),
+ profile_(Profile::FromBrowserContext(tab_contents->browser_context())),
theme_service_(ThemeServiceFactory::GetForProfile(profile_)),
name_(new_theme->name()),
theme_id_(new_theme->id()),