Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 24 #include "chrome/common/extensions/api/extension_action/action_info.h" | 24 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 25 #include "chrome/common/extensions/extension_constants.h" | 25 #include "chrome/common/extensions/extension_constants.h" |
| 26 #include "content/public/browser/navigation_controller.h" | 26 #include "content/public/browser/navigation_controller.h" |
| 27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 28 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
| 29 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
| 30 | 30 |
| 31 namespace events = extensions::event_names; | 31 namespace events = extensions::event_names; |
| 32 namespace tab_keys = extensions::tabs_constants; | 32 namespace tab_keys = extensions::tabs_constants; |
| 33 namespace page_action_keys = extension_page_actions_api_constants; | 33 namespace extension_action_keys = extension_page_actions_api_constants; |
|
Yoyo Zhou
2013/01/02 21:56:05
I think this should also go back to being page_act
Devlin
2013/01/16 21:07:31
Done.
| |
| 34 | 34 |
| 35 using content::NavigationController; | 35 using content::NavigationController; |
| 36 using content::WebContents; | 36 using content::WebContents; |
| 37 | 37 |
| 38 namespace extensions { | 38 namespace extensions { |
| 39 | 39 |
| 40 BrowserEventRouter::TabEntry::TabEntry() | 40 BrowserEventRouter::TabEntry::TabEntry() |
| 41 : complete_waiting_on_load_(false), | 41 : complete_waiting_on_load_(false), |
| 42 url_() { | 42 url_() { |
| 43 } | 43 } |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 496 const std::string& page_action_id, | 496 const std::string& page_action_id, |
| 497 int tab_id, | 497 int tab_id, |
| 498 const std::string& url, | 498 const std::string& url, |
| 499 int button) { | 499 int button) { |
| 500 scoped_ptr<ListValue> args(new ListValue()); | 500 scoped_ptr<ListValue> args(new ListValue()); |
| 501 args->Append(Value::CreateStringValue(page_action_id)); | 501 args->Append(Value::CreateStringValue(page_action_id)); |
| 502 | 502 |
| 503 DictionaryValue* data = new DictionaryValue(); | 503 DictionaryValue* data = new DictionaryValue(); |
| 504 data->Set(tab_keys::kTabIdKey, Value::CreateIntegerValue(tab_id)); | 504 data->Set(tab_keys::kTabIdKey, Value::CreateIntegerValue(tab_id)); |
| 505 data->Set(tab_keys::kTabUrlKey, Value::CreateStringValue(url)); | 505 data->Set(tab_keys::kTabUrlKey, Value::CreateStringValue(url)); |
| 506 data->Set(page_action_keys::kButtonKey, Value::CreateIntegerValue(button)); | 506 data->Set(extension_action_keys::kButtonKey, |
| 507 Value::CreateIntegerValue(button)); | |
| 507 args->Append(data); | 508 args->Append(data); |
| 508 | 509 |
| 509 DispatchEventToExtension(profile, extension_id, "pageActions", args.Pass(), | 510 DispatchEventToExtension(profile, extension_id, "pageActions", args.Pass(), |
| 510 EventRouter::USER_GESTURE_ENABLED); | 511 EventRouter::USER_GESTURE_ENABLED); |
| 511 } | 512 } |
| 512 | 513 |
| 513 void BrowserEventRouter::BrowserActionExecuted( | 514 void BrowserEventRouter::BrowserActionExecuted( |
| 514 const ExtensionAction& browser_action, | 515 const ExtensionAction& browser_action, |
| 515 Browser* browser) { | 516 Browser* browser) { |
| 516 Profile* profile = browser->profile(); | 517 Profile* profile = browser->profile(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 | 578 |
| 578 DispatchEventToExtension(profile, | 579 DispatchEventToExtension(profile, |
| 579 extension_action.extension_id(), | 580 extension_action.extension_id(), |
| 580 event_name, | 581 event_name, |
| 581 args.Pass(), | 582 args.Pass(), |
| 582 EventRouter::USER_GESTURE_ENABLED); | 583 EventRouter::USER_GESTURE_ENABLED); |
| 583 } | 584 } |
| 584 } | 585 } |
| 585 | 586 |
| 586 } // namespace extensions | 587 } // namespace extensions |
| OLD | NEW |