| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "extensions/browser/api/display_source/display_source_event_router.h" | 5 #include "extensions/browser/api/display_source/display_source_event_router.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 #include "extensions/browser/api/display_source/display_source_api.h" | 10 #include "extensions/browser/api/display_source/display_source_api.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 listening_ = should_listen; | 81 listening_ = should_listen; |
| 82 } | 82 } |
| 83 | 83 |
| 84 void DisplaySourceEventRouter::OnSinksUpdated( | 84 void DisplaySourceEventRouter::OnSinksUpdated( |
| 85 const DisplaySourceSinkInfoList& sinks) { | 85 const DisplaySourceSinkInfoList& sinks) { |
| 86 EventRouter* event_router = EventRouter::Get(browser_context_); | 86 EventRouter* event_router = EventRouter::Get(browser_context_); |
| 87 if (!event_router) | 87 if (!event_router) |
| 88 return; | 88 return; |
| 89 scoped_ptr<base::ListValue> args( | 89 std::unique_ptr<base::ListValue> args( |
| 90 api::display_source::OnSinksUpdated::Create(sinks)); | 90 api::display_source::OnSinksUpdated::Create(sinks)); |
| 91 scoped_ptr<Event> sinks_updated_event(new Event( | 91 std::unique_ptr<Event> sinks_updated_event(new Event( |
| 92 events::DISPLAY_SOURCE_ON_SINKS_UPDATED, | 92 events::DISPLAY_SOURCE_ON_SINKS_UPDATED, |
| 93 api::display_source::OnSinksUpdated::kEventName, std::move(args))); | 93 api::display_source::OnSinksUpdated::kEventName, std::move(args))); |
| 94 event_router->BroadcastEvent(std::move(sinks_updated_event)); | 94 event_router->BroadcastEvent(std::move(sinks_updated_event)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 DisplaySourceEventRouter* DisplaySourceEventRouter::Create( | 97 DisplaySourceEventRouter* DisplaySourceEventRouter::Create( |
| 98 content::BrowserContext* browser_context) { | 98 content::BrowserContext* browser_context) { |
| 99 return new DisplaySourceEventRouter(browser_context); | 99 return new DisplaySourceEventRouter(browser_context); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace extensions | 102 } // namespace extensions |
| OLD | NEW |