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

Unified Diff: chrome/browser/extensions/extension_webnavigation_api.cc

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: works now Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_webnavigation_api.cc
diff --git a/chrome/browser/extensions/extension_webnavigation_api.cc b/chrome/browser/extensions/extension_webnavigation_api.cc
index bf395ab8933cd43852c34edbf20a0955ba2d25a7..089a37a741f7dcf5b4ccfca1d5f3de6ed512116c 100644
--- a/chrome/browser/extensions/extension_webnavigation_api.cc
+++ b/chrome/browser/extensions/extension_webnavigation_api.cc
@@ -44,9 +44,10 @@ double MilliSecondsFromTime(const base::Time& time) {
}
// Dispatches events to the extension message service.
-void DispatchEvent(Profile* profile,
+void DispatchEvent(content::BrowserContext* context,
const char* event_name,
const std::string& json_args) {
+ Profile* profile = static_cast<Profile*>(context);
if (profile && profile->GetExtensionEventRouter()) {
profile->GetExtensionEventRouter()->DispatchEventToRenderers(
event_name, json_args, profile, GURL());
@@ -72,7 +73,7 @@ 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->context(), keys::kOnBeforeNavigate, json_args);
}
// Constructs and dispatches an onCommitted event.
@@ -102,7 +103,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->context(), keys::kOnCommitted, json_args);
}
// Constructs and dispatches an onDOMContentLoaded event.
@@ -122,7 +123,7 @@ 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->context(), keys::kOnDOMContentLoaded, json_args);
}
// Constructs and dispatches an onCompleted event.
@@ -142,7 +143,7 @@ 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->context(), keys::kOnCompleted, json_args);
}
// Constructs and dispatches an onBeforeRetarget event.
@@ -279,9 +280,10 @@ void ExtensionWebNavigationEventRouter::Observe(
void ExtensionWebNavigationEventRouter::CreatingNewWindow(
TabContents* tab_contents,
const ViewHostMsg_CreateWindow_Params* details) {
- if (profile_->IsSameProfile(tab_contents->profile())) {
+ Profile* tab_profile = static_cast<Profile*>(tab_contents->context());
+ if (profile_->IsSameProfile(tab_profile)) {
DispatchOnBeforeRetarget(tab_contents,
- tab_contents->profile(),
+ tab_profile,
details->opener_url,
details->target_url);
}
@@ -352,7 +354,7 @@ void ExtensionWebNavigationTabObserver::DidFailProvisionalLoad(
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
navigation_state_.ErrorOccurredInFrame(frame_id);
- DispatchEvent(tab_contents()->profile(), keys::kOnErrorOccurred, json_args);
+ DispatchEvent(tab_contents()->context(), keys::kOnErrorOccurred, json_args);
}
void ExtensionWebNavigationTabObserver::DocumentLoadedInFrame(
@@ -391,7 +393,7 @@ void ExtensionWebNavigationTabObserver::DidOpenURL(
disposition != OFF_THE_RECORD) {
return;
}
- Profile* profile = tab_contents()->profile();
+ Profile* profile = static_cast<Profile*>(tab_contents()->context());
if (disposition == OFF_THE_RECORD) {
if (!profile->HasOffTheRecordProfile()) {
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698