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/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 NOTREACHED(); | 401 NOTREACHED(); |
402 } | 402 } |
403 } | 403 } |
404 | 404 |
405 void ExtensionBrowserEventRouter::TabChangedAt(TabContents* contents, | 405 void ExtensionBrowserEventRouter::TabChangedAt(TabContents* contents, |
406 int index, | 406 int index, |
407 TabChangeType change_type) { | 407 TabChangeType change_type) { |
408 TabUpdated(contents, false); | 408 TabUpdated(contents, false); |
409 } | 409 } |
410 | 410 |
411 void ExtensionBrowserEventRouter::TabReplacedAt(TabContents* old_contents, | |
412 TabContents* new_contents, | |
413 int index) { | |
414 // TODO: 32913, consider adding better notification for this event. | |
415 TabInsertedAt(new_contents, index, false); | |
416 } | |
417 | |
418 void ExtensionBrowserEventRouter::TabStripEmpty() {} | 411 void ExtensionBrowserEventRouter::TabStripEmpty() {} |
419 | 412 |
420 void ExtensionBrowserEventRouter::DispatchOldPageActionEvent( | 413 void ExtensionBrowserEventRouter::DispatchOldPageActionEvent( |
421 Profile* profile, | 414 Profile* profile, |
422 const std::string& extension_id, | 415 const std::string& extension_id, |
423 const std::string& page_action_id, | 416 const std::string& page_action_id, |
424 int tab_id, | 417 int tab_id, |
425 const std::string& url, | 418 const std::string& url, |
426 int button) { | 419 int button) { |
427 ListValue args; | 420 ListValue args; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 453 |
461 void ExtensionBrowserEventRouter::BrowserActionExecuted( | 454 void ExtensionBrowserEventRouter::BrowserActionExecuted( |
462 Profile* profile, const std::string& extension_id, Browser* browser) { | 455 Profile* profile, const std::string& extension_id, Browser* browser) { |
463 TabContents* tab_contents = NULL; | 456 TabContents* tab_contents = NULL; |
464 int tab_id = 0; | 457 int tab_id = 0; |
465 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) | 458 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) |
466 return; | 459 return; |
467 std::string event_name = std::string("browserAction/") + extension_id; | 460 std::string event_name = std::string("browserAction/") + extension_id; |
468 DispatchEventWithTab(profile, event_name.c_str(), tab_contents); | 461 DispatchEventWithTab(profile, event_name.c_str(), tab_contents); |
469 } | 462 } |
OLD | NEW |