| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sessions/sessions_api.h" | 5 #include "chrome/browser/extensions/api/sessions/sessions_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 api::sessions::Device device_struct; | 330 api::sessions::Device device_struct; |
| 331 device_struct.info = session->session_name; | 331 device_struct.info = session->session_name; |
| 332 device_struct.device_name = session->session_name; | 332 device_struct.device_name = session->session_name; |
| 333 | 333 |
| 334 for (auto it = session->windows.begin(); | 334 for (auto it = session->windows.begin(); |
| 335 it != session->windows.end() && | 335 it != session->windows.end() && |
| 336 static_cast<int>(device_struct.sessions.size()) < max_results; | 336 static_cast<int>(device_struct.sessions.size()) < max_results; |
| 337 ++it) { | 337 ++it) { |
| 338 std::unique_ptr<api::sessions::Session> session_model( | 338 std::unique_ptr<api::sessions::Session> session_model( |
| 339 CreateSessionModel(*it->second, session->session_tag)); | 339 CreateSessionModel(it->second->wrapped_window, session->session_tag)); |
| 340 if (session_model) | 340 if (session_model) |
| 341 device_struct.sessions.push_back(std::move(*session_model)); | 341 device_struct.sessions.push_back(std::move(*session_model)); |
| 342 } | 342 } |
| 343 return device_struct; | 343 return device_struct; |
| 344 } | 344 } |
| 345 | 345 |
| 346 ExtensionFunction::ResponseAction SessionsGetDevicesFunction::Run() { | 346 ExtensionFunction::ResponseAction SessionsGetDevicesFunction::Run() { |
| 347 browser_sync::ProfileSyncService* service = | 347 browser_sync::ProfileSyncService* service = |
| 348 ProfileSyncServiceFactory::GetInstance()->GetForProfile( | 348 ProfileSyncServiceFactory::GetInstance()->GetForProfile( |
| 349 Profile::FromBrowserContext(browser_context())); | 349 Profile::FromBrowserContext(browser_context())); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 return g_factory.Pointer(); | 602 return g_factory.Pointer(); |
| 603 } | 603 } |
| 604 | 604 |
| 605 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { | 605 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 606 sessions_event_router_.reset( | 606 sessions_event_router_.reset( |
| 607 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); | 607 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); |
| 608 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 608 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 609 } | 609 } |
| 610 | 610 |
| 611 } // namespace extensions | 611 } // namespace extensions |
| OLD | NEW |