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

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

Issue 7134035: Make an inserted selected tab selected before calling TabInsertedAt on observers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename foreground to active, and function style Created 9 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/extensions/extension_browser_event_router.cc
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc
index 2e54caaae0b1dace3557173693d0ea49cf20f820..15c6c0fb40f8a36b79ae1605bf6771f6ae877e20 100644
--- a/chrome/browser/extensions/extension_browser_event_router.cc
+++ b/chrome/browser/extensions/extension_browser_event_router.cc
@@ -215,22 +215,22 @@ void ExtensionBrowserEventRouter::OnBrowserSetLastActive(
void ExtensionBrowserEventRouter::TabCreatedAt(TabContents* contents,
int index,
- bool foreground) {
+ bool active) {
DispatchEventWithTab(contents->profile(), "", events::kOnTabCreated,
- contents);
+ contents, active);
RegisterForTabNotifications(contents);
}
void ExtensionBrowserEventRouter::TabInsertedAt(TabContentsWrapper* contents,
int index,
- bool foreground) {
+ bool active) {
// If tab is new, send created event.
int tab_id = ExtensionTabUtil::GetTabId(contents->tab_contents());
if (!GetTabEntry(contents->tab_contents())) {
tab_entries_[tab_id] = TabEntry();
- TabCreatedAt(contents->tab_contents(), index, foreground);
+ TabCreatedAt(contents->tab_contents(), index, active);
return;
}
@@ -386,12 +386,14 @@ void ExtensionBrowserEventRouter::DispatchEventWithTab(
Profile* profile,
const std::string& extension_id,
const char* event_name,
- const TabContents* tab_contents) {
+ const TabContents* tab_contents,
+ bool active) {
if (!profile_->IsSameProfile(profile))
return;
ListValue args;
- args.Append(ExtensionTabUtil::CreateTabValue(tab_contents));
+ args.Append(ExtensionTabUtil::CreateTabValueActive(
+ tab_contents, active));
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
if (!extension_id.empty()) {
@@ -543,7 +545,7 @@ void ExtensionBrowserEventRouter::PageActionExecuted(
return;
}
DispatchEventWithTab(profile, extension_id, "pageAction.onClicked",
- tab_contents->tab_contents());
+ tab_contents->tab_contents(), true);
}
void ExtensionBrowserEventRouter::BrowserActionExecuted(
@@ -553,5 +555,5 @@ void ExtensionBrowserEventRouter::BrowserActionExecuted(
if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id))
return;
DispatchEventWithTab(profile, extension_id, "browserAction.onClicked",
- tab_contents->tab_contents());
+ tab_contents->tab_contents(), true);
}
« no previous file with comments | « chrome/browser/extensions/extension_browser_event_router.h ('k') | chrome/browser/extensions/extension_tabs_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698