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

Side by Side Diff: chrome/browser/extensions/extension_browser_event_router.cc

Issue 500138: [Mac] Implements popups for Page Actions, plus fixes a leak within the Browse... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_browser_event_router.h" 5 #include "chrome/browser/extensions/extension_browser_event_router.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 void ExtensionBrowserEventRouter::OnBrowserSetLastActive( 207 void ExtensionBrowserEventRouter::OnBrowserSetLastActive(
208 const Browser* browser) { 208 const Browser* browser) {
209 DispatchSimpleBrowserEvent(browser->profile(), 209 DispatchSimpleBrowserEvent(browser->profile(),
210 ExtensionTabUtil::GetWindowId(browser), 210 ExtensionTabUtil::GetWindowId(browser),
211 events::kOnWindowFocusedChanged); 211 events::kOnWindowFocusedChanged);
212 } 212 }
213 213
214 void ExtensionBrowserEventRouter::TabCreatedAt(TabContents* contents, 214 void ExtensionBrowserEventRouter::TabCreatedAt(TabContents* contents,
215 int index, 215 int index,
216 bool foreground) { 216 bool foreground) {
217 DispatchEventWithTab(contents->profile(), events::kOnTabCreated, contents); 217 DispatchEventWithTab(contents->profile(), events::kOnTabCreated, contents);
218 218
219 RegisterForTabNotifications(contents); 219 RegisterForTabNotifications(contents);
220 } 220 }
221 221
222 void ExtensionBrowserEventRouter::TabInsertedAt(TabContents* contents, 222 void ExtensionBrowserEventRouter::TabInsertedAt(TabContents* contents,
223 int index, 223 int index,
224 bool foreground) { 224 bool foreground) {
225 // If tab is new, send created event. 225 // If tab is new, send created event.
226 int tab_id = ExtensionTabUtil::GetTabId(contents); 226 int tab_id = ExtensionTabUtil::GetTabId(contents);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 441
442 void ExtensionBrowserEventRouter::BrowserActionExecuted( 442 void ExtensionBrowserEventRouter::BrowserActionExecuted(
443 Profile* profile, const std::string& extension_id, Browser* browser) { 443 Profile* profile, const std::string& extension_id, Browser* browser) {
444 TabContents* tab_contents = NULL; 444 TabContents* tab_contents = NULL;
445 int tab_id = 0; 445 int tab_id = 0;
446 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) 446 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id))
447 return; 447 return;
448 std::string event_name = std::string("browserAction/") + extension_id; 448 std::string event_name = std::string("browserAction/") + extension_id;
449 DispatchEventWithTab(profile, event_name.c_str(), tab_contents); 449 DispatchEventWithTab(profile, event_name.c_str(), tab_contents);
450 } 450 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698