| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 void ExtensionActionAPI::DispatchEventToExtension( | 268 void ExtensionActionAPI::DispatchEventToExtension( |
| 269 content::BrowserContext* context, | 269 content::BrowserContext* context, |
| 270 const std::string& extension_id, | 270 const std::string& extension_id, |
| 271 events::HistogramValue histogram_value, | 271 events::HistogramValue histogram_value, |
| 272 const std::string& event_name, | 272 const std::string& event_name, |
| 273 std::unique_ptr<base::ListValue> event_args) { | 273 std::unique_ptr<base::ListValue> event_args) { |
| 274 if (!EventRouter::Get(context)) | 274 if (!EventRouter::Get(context)) |
| 275 return; | 275 return; |
| 276 | 276 |
| 277 std::unique_ptr<Event> event( | 277 auto event = base::MakeUnique<Event>(histogram_value, event_name, |
| 278 new Event(histogram_value, event_name, std::move(event_args))); | 278 std::move(event_args), context); |
| 279 event->restrict_to_browser_context = context; | |
| 280 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; | 279 event->user_gesture = EventRouter::USER_GESTURE_ENABLED; |
| 281 EventRouter::Get(context) | 280 EventRouter::Get(context) |
| 282 ->DispatchEventToExtension(extension_id, std::move(event)); | 281 ->DispatchEventToExtension(extension_id, std::move(event)); |
| 283 } | 282 } |
| 284 | 283 |
| 285 void ExtensionActionAPI::NotifyPageActionsChanged( | 284 void ExtensionActionAPI::NotifyPageActionsChanged( |
| 286 content::WebContents* web_contents) { | 285 content::WebContents* web_contents) { |
| 287 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 286 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| 288 if (!browser) | 287 if (!browser) |
| 289 return; | 288 return; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || | 614 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || |
| 616 host->extension()->id() != extension_->id()) | 615 host->extension()->id() != extension_->id()) |
| 617 return; | 616 return; |
| 618 | 617 |
| 619 SendResponse(true); | 618 SendResponse(true); |
| 620 response_sent_ = true; | 619 response_sent_ = true; |
| 621 registrar_.RemoveAll(); | 620 registrar_.RemoveAll(); |
| 622 } | 621 } |
| 623 | 622 |
| 624 } // namespace extensions | 623 } // namespace extensions |
| OLD | NEW |