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

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: browser_context 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 28ee146c82ce7f2d477ec7a77230cd568c2a5637..91327ad8354b776091df2f2142e4e94e70326c90 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* browser_context,
const char* event_name,
const std::string& json_args) {
+ Profile* profile = static_cast<Profile*>(browser_context);
if (profile && profile->GetExtensionEventRouter()) {
profile->GetExtensionEventRouter()->DispatchEventToRenderers(
event_name, json_args, profile, GURL());
@@ -69,7 +70,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.
@@ -99,7 +102,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.
@@ -119,7 +122,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.
@@ -139,7 +144,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->browser_context(), keys::kOnCompleted, json_args);
}
// Constructs and dispatches an onBeforeRetarget event.
@@ -276,9 +281,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->browser_context());
+ if (profile_->IsSameProfile(tab_profile)) {
DispatchOnBeforeRetarget(tab_contents,
- tab_contents->profile(),
+ tab_profile,
details->opener_url,
details->target_url);
}
@@ -349,7 +355,9 @@ 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()->browser_context(),
+ keys::kOnErrorOccurred,
+ json_args);
}
void ExtensionWebNavigationTabObserver::DocumentLoadedInFrame(
@@ -388,7 +396,7 @@ void ExtensionWebNavigationTabObserver::DidOpenURL(
disposition != OFF_THE_RECORD) {
return;
}
- Profile* profile = tab_contents()->profile();
+ Profile* profile = static_cast<Profile*>(tab_contents()->browser_context());
if (disposition == OFF_THE_RECORD) {
if (!profile->HasOffTheRecordProfile()) {
NOTREACHED();

Powered by Google App Engine
This is Rietveld 408576698