| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 189 } |
| 190 | 190 |
| 191 void WindowsEventRouter::OnWindowControllerAdded( | 191 void WindowsEventRouter::OnWindowControllerAdded( |
| 192 WindowController* window_controller) { | 192 WindowController* window_controller) { |
| 193 if (!HasEventListener(windows::OnCreated::kEventName)) | 193 if (!HasEventListener(windows::OnCreated::kEventName)) |
| 194 return; | 194 return; |
| 195 if (!profile_->IsSameProfile(window_controller->profile())) | 195 if (!profile_->IsSameProfile(window_controller->profile())) |
| 196 return; | 196 return; |
| 197 | 197 |
| 198 std::unique_ptr<base::ListValue> args(new base::ListValue()); | 198 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
| 199 base::DictionaryValue* window_dictionary = | 199 args->Append(window_controller->CreateWindowValue()); |
| 200 window_controller->CreateWindowValue(); | |
| 201 args->Append(window_dictionary); | |
| 202 DispatchEvent(events::WINDOWS_ON_CREATED, windows::OnCreated::kEventName, | 200 DispatchEvent(events::WINDOWS_ON_CREATED, windows::OnCreated::kEventName, |
| 203 window_controller, std::move(args)); | 201 window_controller, std::move(args)); |
| 204 } | 202 } |
| 205 | 203 |
| 206 void WindowsEventRouter::OnWindowControllerRemoved( | 204 void WindowsEventRouter::OnWindowControllerRemoved( |
| 207 WindowController* window_controller) { | 205 WindowController* window_controller) { |
| 208 if (!HasEventListener(windows::OnRemoved::kEventName)) | 206 if (!HasEventListener(windows::OnRemoved::kEventName)) |
| 209 return; | 207 return; |
| 210 if (!profile_->IsSameProfile(window_controller->profile())) | 208 if (!profile_->IsSameProfile(window_controller->profile())) |
| 211 return; | 209 return; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 return EventRouter::Get(profile_)->HasEventListener(event_name); | 279 return EventRouter::Get(profile_)->HasEventListener(event_name); |
| 282 } | 280 } |
| 283 | 281 |
| 284 void WindowsEventRouter::AddAppWindow(extensions::AppWindow* app_window) { | 282 void WindowsEventRouter::AddAppWindow(extensions::AppWindow* app_window) { |
| 285 std::unique_ptr<AppWindowController> controller(new AppWindowController( | 283 std::unique_ptr<AppWindowController> controller(new AppWindowController( |
| 286 app_window, base::WrapUnique(new AppBaseWindow(app_window)), profile_)); | 284 app_window, base::WrapUnique(new AppBaseWindow(app_window)), profile_)); |
| 287 app_windows_[app_window->session_id().id()] = std::move(controller); | 285 app_windows_[app_window->session_id().id()] = std::move(controller); |
| 288 } | 286 } |
| 289 | 287 |
| 290 } // namespace extensions | 288 } // namespace extensions |
| OLD | NEW |