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

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

Issue 7033048: Multi-tab: Adding new Notification when tab selection changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_event_names.h" 9 #include "chrome/browser/extensions/extension_event_names.h"
10 #include "chrome/browser/extensions/extension_event_router.h" 10 #include "chrome/browser/extensions/extension_event_router.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 DCHECK_GT(removed_count, 0); 296 DCHECK_GT(removed_count, 0);
297 297
298 UnregisterForTabNotifications(contents->tab_contents()); 298 UnregisterForTabNotifications(contents->tab_contents());
299 } 299 }
300 300
301 void ExtensionBrowserEventRouter::ActiveTabChanged( 301 void ExtensionBrowserEventRouter::ActiveTabChanged(
302 TabContentsWrapper* old_contents, 302 TabContentsWrapper* old_contents,
303 TabContentsWrapper* new_contents, 303 TabContentsWrapper* new_contents,
304 int index, 304 int index,
305 bool user_gesture) { 305 bool user_gesture) {
306 if (old_contents == new_contents)
307 return;
308
309 ListValue args; 306 ListValue args;
310 args.Append(Value::CreateIntegerValue( 307 args.Append(Value::CreateIntegerValue(
311 ExtensionTabUtil::GetTabId(new_contents->tab_contents()))); 308 ExtensionTabUtil::GetTabId(new_contents->tab_contents())));
312 309
313 DictionaryValue* object_args = new DictionaryValue(); 310 DictionaryValue* object_args = new DictionaryValue();
314 object_args->Set(tab_keys::kWindowIdKey, Value::CreateIntegerValue( 311 object_args->Set(tab_keys::kWindowIdKey, Value::CreateIntegerValue(
315 ExtensionTabUtil::GetWindowIdOfTab(new_contents->tab_contents()))); 312 ExtensionTabUtil::GetWindowIdOfTab(new_contents->tab_contents())));
316 args.Append(object_args); 313 args.Append(object_args);
317 314
318 std::string json_args; 315 std::string json_args;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 545
549 void ExtensionBrowserEventRouter::BrowserActionExecuted( 546 void ExtensionBrowserEventRouter::BrowserActionExecuted(
550 Profile* profile, const std::string& extension_id, Browser* browser) { 547 Profile* profile, const std::string& extension_id, Browser* browser) {
551 TabContentsWrapper* tab_contents = NULL; 548 TabContentsWrapper* tab_contents = NULL;
552 int tab_id = 0; 549 int tab_id = 0;
553 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) 550 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id))
554 return; 551 return;
555 DispatchEventWithTab(profile, extension_id, "browserAction.onClicked", 552 DispatchEventWithTab(profile, extension_id, "browserAction.onClicked",
556 tab_contents->tab_contents()); 553 tab_contents->tab_contents());
557 } 554 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698