| 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/api/extension_action/extension_action_api.h" | 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 } | 298 } |
| 299 | 299 |
| 300 void ExtensionActionAPI::DispatchEventToExtension( | 300 void ExtensionActionAPI::DispatchEventToExtension( |
| 301 content::BrowserContext* context, | 301 content::BrowserContext* context, |
| 302 const std::string& extension_id, | 302 const std::string& extension_id, |
| 303 const std::string& event_name, | 303 const std::string& event_name, |
| 304 scoped_ptr<base::ListValue> event_args) { | 304 scoped_ptr<base::ListValue> event_args) { |
| 305 if (!EventRouter::Get(context)) | 305 if (!EventRouter::Get(context)) |
| 306 return; | 306 return; |
| 307 | 307 |
| 308 scoped_ptr<Event> event(new Event(event_name, event_args.Pass())); | 308 scoped_ptr<Event> event( |
| 309 new Event(events::UNKNOWN, event_name, event_args.Pass())); |
| 309 event->restrict_to_browser_context = context; | 310 event->restrict_to_browser_context = context; |
| 310 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; | 311 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; |
| 311 EventRouter::Get(context) | 312 EventRouter::Get(context) |
| 312 ->DispatchEventToExtension(extension_id, event.Pass()); | 313 ->DispatchEventToExtension(extension_id, event.Pass()); |
| 313 } | 314 } |
| 314 | 315 |
| 315 void ExtensionActionAPI::ExtensionActionExecuted( | 316 void ExtensionActionAPI::ExtensionActionExecuted( |
| 316 const ExtensionAction& extension_action, | 317 const ExtensionAction& extension_action, |
| 317 WebContents* web_contents) { | 318 WebContents* web_contents) { |
| 318 const char* event_name = NULL; | 319 const char* event_name = NULL; |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || | 677 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || |
| 677 host->extension()->id() != extension_->id()) | 678 host->extension()->id() != extension_->id()) |
| 678 return; | 679 return; |
| 679 | 680 |
| 680 SendResponse(true); | 681 SendResponse(true); |
| 681 response_sent_ = true; | 682 response_sent_ = true; |
| 682 registrar_.RemoveAll(); | 683 registrar_.RemoveAll(); |
| 683 } | 684 } |
| 684 | 685 |
| 685 } // namespace extensions | 686 } // namespace extensions |
| OLD | NEW |