| 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/tabs/windows_event_router.h" | 5 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 base::MakeUnique<base::ListValue>()); | 257 base::MakeUnique<base::ListValue>()); |
| 258 event->will_dispatch_callback = | 258 event->will_dispatch_callback = |
| 259 base::Bind(&WillDispatchWindowFocusedEvent, window_controller); | 259 base::Bind(&WillDispatchWindowFocusedEvent, window_controller); |
| 260 EventRouter::Get(profile_)->BroadcastEvent(std::move(event)); | 260 EventRouter::Get(profile_)->BroadcastEvent(std::move(event)); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void WindowsEventRouter::DispatchEvent(events::HistogramValue histogram_value, | 263 void WindowsEventRouter::DispatchEvent(events::HistogramValue histogram_value, |
| 264 const std::string& event_name, | 264 const std::string& event_name, |
| 265 WindowController* window_controller, | 265 WindowController* window_controller, |
| 266 std::unique_ptr<base::ListValue> args) { | 266 std::unique_ptr<base::ListValue> args) { |
| 267 std::unique_ptr<Event> event = | 267 auto event = |
| 268 base::MakeUnique<Event>(histogram_value, event_name, std::move(args)); | 268 base::MakeUnique<Event>(histogram_value, event_name, std::move(args), |
| 269 event->restrict_to_browser_context = window_controller->profile(); | 269 window_controller->profile()); |
| 270 event->will_dispatch_callback = | 270 event->will_dispatch_callback = |
| 271 base::Bind(&WillDispatchWindowEvent, window_controller); | 271 base::Bind(&WillDispatchWindowEvent, window_controller); |
| 272 EventRouter::Get(profile_)->BroadcastEvent(std::move(event)); | 272 EventRouter::Get(profile_)->BroadcastEvent(std::move(event)); |
| 273 } | 273 } |
| 274 | 274 |
| 275 bool WindowsEventRouter::HasEventListener(const std::string& event_name) { | 275 bool WindowsEventRouter::HasEventListener(const std::string& event_name) { |
| 276 return EventRouter::Get(profile_)->HasEventListener(event_name); | 276 return EventRouter::Get(profile_)->HasEventListener(event_name); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void WindowsEventRouter::AddAppWindow(extensions::AppWindow* app_window) { | 279 void WindowsEventRouter::AddAppWindow(extensions::AppWindow* app_window) { |
| 280 std::unique_ptr<AppWindowController> controller(new AppWindowController( | 280 std::unique_ptr<AppWindowController> controller(new AppWindowController( |
| 281 app_window, base::MakeUnique<AppBaseWindow>(app_window), profile_)); | 281 app_window, base::MakeUnique<AppBaseWindow>(app_window), profile_)); |
| 282 app_windows_[app_window->session_id().id()] = std::move(controller); | 282 app_windows_[app_window->session_id().id()] = std::move(controller); |
| 283 } | 283 } |
| 284 | 284 |
| 285 } // namespace extensions | 285 } // namespace extensions |
| OLD | NEW |