| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_event_router.h" | 5 #include "chrome/browser/extensions/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/api/extension_action/extension_page_actions_
api_constants.h" | 9 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_
api_constants.h" |
| 10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 23 #include "chrome/common/extensions/api/extension_action/action_info.h" | 23 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 24 #include "chrome/common/extensions/extension_constants.h" | 24 #include "chrome/common/extensions/extension_constants.h" |
| 25 #include "content/public/browser/navigation_controller.h" | 25 #include "content/public/browser/navigation_controller.h" |
| 26 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
| 27 #include "content/public/browser/notification_types.h" | 27 #include "content/public/browser/notification_types.h" |
| 28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 | 29 |
| 30 namespace events = extensions::event_names; | 30 namespace events = extensions::event_names; |
| 31 namespace tab_keys = extensions::tabs_constants; | 31 namespace tab_keys = extensions::tabs_constants; |
| 32 namespace page_action_keys = extension_page_actions_api_constants; | 32 namespace page_actions_keys = extension_page_actions_api_constants; |
| 33 | 33 |
| 34 using content::NavigationController; | 34 using content::NavigationController; |
| 35 using content::WebContents; | 35 using content::WebContents; |
| 36 | 36 |
| 37 namespace extensions { | 37 namespace extensions { |
| 38 | 38 |
| 39 BrowserEventRouter::TabEntry::TabEntry() | 39 BrowserEventRouter::TabEntry::TabEntry() |
| 40 : complete_waiting_on_load_(false), | 40 : complete_waiting_on_load_(false), |
| 41 url_() { | 41 url_() { |
| 42 } | 42 } |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 const std::string& page_action_id, | 527 const std::string& page_action_id, |
| 528 int tab_id, | 528 int tab_id, |
| 529 const std::string& url, | 529 const std::string& url, |
| 530 int button) { | 530 int button) { |
| 531 scoped_ptr<ListValue> args(new ListValue()); | 531 scoped_ptr<ListValue> args(new ListValue()); |
| 532 args->Append(Value::CreateStringValue(page_action_id)); | 532 args->Append(Value::CreateStringValue(page_action_id)); |
| 533 | 533 |
| 534 DictionaryValue* data = new DictionaryValue(); | 534 DictionaryValue* data = new DictionaryValue(); |
| 535 data->Set(tab_keys::kTabIdKey, Value::CreateIntegerValue(tab_id)); | 535 data->Set(tab_keys::kTabIdKey, Value::CreateIntegerValue(tab_id)); |
| 536 data->Set(tab_keys::kTabUrlKey, Value::CreateStringValue(url)); | 536 data->Set(tab_keys::kTabUrlKey, Value::CreateStringValue(url)); |
| 537 data->Set(page_action_keys::kButtonKey, Value::CreateIntegerValue(button)); | 537 data->Set(page_actions_keys::kButtonKey, |
| 538 Value::CreateIntegerValue(button)); |
| 538 args->Append(data); | 539 args->Append(data); |
| 539 | 540 |
| 540 DispatchEventToExtension(profile, extension_id, "pageActions", args.Pass(), | 541 DispatchEventToExtension(profile, extension_id, "pageActions", args.Pass(), |
| 541 EventRouter::USER_GESTURE_ENABLED); | 542 EventRouter::USER_GESTURE_ENABLED); |
| 542 } | 543 } |
| 543 | 544 |
| 544 void BrowserEventRouter::BrowserActionExecuted( | 545 void BrowserEventRouter::BrowserActionExecuted( |
| 545 const ExtensionAction& browser_action, | 546 const ExtensionAction& browser_action, |
| 546 Browser* browser) { | 547 Browser* browser) { |
| 547 Profile* profile = browser->profile(); | 548 Profile* profile = browser->profile(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 608 |
| 608 DispatchEventToExtension(profile, | 609 DispatchEventToExtension(profile, |
| 609 extension_action.extension_id(), | 610 extension_action.extension_id(), |
| 610 event_name, | 611 event_name, |
| 611 args.Pass(), | 612 args.Pass(), |
| 612 EventRouter::USER_GESTURE_ENABLED); | 613 EventRouter::USER_GESTURE_ENABLED); |
| 613 } | 614 } |
| 614 } | 615 } |
| 615 | 616 |
| 616 } // namespace extensions | 617 } // namespace extensions |
| OLD | NEW |