| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 int tab_id, | 447 int tab_id, |
| 448 const std::string& url, | 448 const std::string& url, |
| 449 int button) { | 449 int button) { |
| 450 DispatchOldPageActionEvent(profile, extension_id, page_action_id, tab_id, url, | 450 DispatchOldPageActionEvent(profile, extension_id, page_action_id, tab_id, url, |
| 451 button); | 451 button); |
| 452 TabContents* tab_contents = NULL; | 452 TabContents* tab_contents = NULL; |
| 453 if (!ExtensionTabUtil::GetTabById(tab_id, profile, profile->IsOffTheRecord(), | 453 if (!ExtensionTabUtil::GetTabById(tab_id, profile, profile->IsOffTheRecord(), |
| 454 NULL, NULL, &tab_contents, NULL)) { | 454 NULL, NULL, &tab_contents, NULL)) { |
| 455 return; | 455 return; |
| 456 } | 456 } |
| 457 std::string event_name = std::string("pageAction/") + extension_id; | 457 std::string event_name = ExtensionMessageService::GetPerExtensionEventName( |
| 458 "pageAction.onClicked", extension_id); |
| 458 DispatchEventWithTab(profile, event_name.c_str(), tab_contents); | 459 DispatchEventWithTab(profile, event_name.c_str(), tab_contents); |
| 459 } | 460 } |
| 460 | 461 |
| 461 void ExtensionBrowserEventRouter::BrowserActionExecuted( | 462 void ExtensionBrowserEventRouter::BrowserActionExecuted( |
| 462 Profile* profile, const std::string& extension_id, Browser* browser) { | 463 Profile* profile, const std::string& extension_id, Browser* browser) { |
| 463 TabContents* tab_contents = NULL; | 464 TabContents* tab_contents = NULL; |
| 464 int tab_id = 0; | 465 int tab_id = 0; |
| 465 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) | 466 if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id)) |
| 466 return; | 467 return; |
| 467 std::string event_name = std::string("browserAction/") + extension_id; | 468 std::string event_name = ExtensionMessageService::GetPerExtensionEventName( |
| 469 "browserAction.onClicked", extension_id); |
| 468 DispatchEventWithTab(profile, event_name.c_str(), tab_contents); | 470 DispatchEventWithTab(profile, event_name.c_str(), tab_contents); |
| 469 } | 471 } |
| OLD | NEW |