| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 } | 459 } |
| 460 } | 460 } |
| 461 | 461 |
| 462 void ExtensionBrowserEventRouter::TabChangedAt(TabContentsWrapper* contents, | 462 void ExtensionBrowserEventRouter::TabChangedAt(TabContentsWrapper* contents, |
| 463 int index, | 463 int index, |
| 464 TabChangeType change_type) { | 464 TabChangeType change_type) { |
| 465 TabUpdated(contents->tab_contents(), false); | 465 TabUpdated(contents->tab_contents(), false); |
| 466 } | 466 } |
| 467 | 467 |
| 468 void ExtensionBrowserEventRouter::TabReplacedAt( | 468 void ExtensionBrowserEventRouter::TabReplacedAt( |
| 469 TabStripModel* tab_strip_model, |
| 469 TabContentsWrapper* old_contents, | 470 TabContentsWrapper* old_contents, |
| 470 TabContentsWrapper* new_contents, | 471 TabContentsWrapper* new_contents, |
| 471 int index) { | 472 int index) { |
| 472 UnregisterForTabNotifications(old_contents->tab_contents()); | 473 TabClosingAt(tab_strip_model, old_contents, index); |
| 473 RegisterForTabNotifications(new_contents->tab_contents()); | 474 TabInsertedAt(new_contents, index, |
| 475 tab_strip_model->selected_index() == index); |
| 474 } | 476 } |
| 475 | 477 |
| 476 void ExtensionBrowserEventRouter::TabPinnedStateChanged( | 478 void ExtensionBrowserEventRouter::TabPinnedStateChanged( |
| 477 TabContentsWrapper* contents, | 479 TabContentsWrapper* contents, |
| 478 int index) { | 480 int index) { |
| 479 TabStripModel* tab_strip = NULL; | 481 TabStripModel* tab_strip = NULL; |
| 480 int tab_index; | 482 int tab_index; |
| 481 | 483 |
| 482 if (ExtensionTabUtil::GetTabStripModel( | 484 if (ExtensionTabUtil::GetTabStripModel( |
| 483 contents->tab_contents(), &tab_strip, &tab_index)) { | 485 contents->tab_contents(), &tab_strip, &tab_index)) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 | 534 |
| 533 void ExtensionBrowserEventRouter::BrowserActionExecuted( | 535 void ExtensionBrowserEventRouter::BrowserActionExecuted( |
| 534 Profile* profile, const std::string& extension_id, Browser* browser) { | 536 Profile* profile, const std::string& extension_id, Browser* browser) { |
| 535 TabContentsWrapper* tab_contents = NULL; | 537 TabContentsWrapper* tab_contents = NULL; |
| 536 int tab_id = 0; | 538 int tab_id = 0; |
| 537 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) | 539 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) |
| 538 return; | 540 return; |
| 539 DispatchEventWithTab(profile, extension_id, "browserAction.onClicked", | 541 DispatchEventWithTab(profile, extension_id, "browserAction.onClicked", |
| 540 tab_contents->tab_contents()); | 542 tab_contents->tab_contents()); |
| 541 } | 543 } |
| OLD | NEW |