| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 // empty. | 335 // empty. |
| 336 return !window_model ? scoped_ptr<api::sessions::Session>() | 336 return !window_model ? scoped_ptr<api::sessions::Session>() |
| 337 : CreateSessionModelHelper(window.timestamp.ToTimeT(), | 337 : CreateSessionModelHelper(window.timestamp.ToTimeT(), |
| 338 scoped_ptr<tabs::Tab>(), | 338 scoped_ptr<tabs::Tab>(), |
| 339 window_model.Pass()); | 339 window_model.Pass()); |
| 340 } | 340 } |
| 341 | 341 |
| 342 scoped_ptr<api::sessions::Device> SessionsGetDevicesFunction::CreateDeviceModel( | 342 scoped_ptr<api::sessions::Device> SessionsGetDevicesFunction::CreateDeviceModel( |
| 343 const browser_sync::SyncedSession* session) { | 343 const browser_sync::SyncedSession* session) { |
| 344 int max_results = api::sessions::MAX_SESSION_RESULTS; | 344 int max_results = api::sessions::MAX_SESSION_RESULTS; |
| 345 // Already validated in RunImpl(). | 345 // Already validated in RunAsync(). |
| 346 scoped_ptr<GetDevices::Params> params(GetDevices::Params::Create(*args_)); | 346 scoped_ptr<GetDevices::Params> params(GetDevices::Params::Create(*args_)); |
| 347 if (params->filter && params->filter->max_results) | 347 if (params->filter && params->filter->max_results) |
| 348 max_results = *params->filter->max_results; | 348 max_results = *params->filter->max_results; |
| 349 | 349 |
| 350 scoped_ptr<api::sessions::Device> device_struct(new api::sessions::Device); | 350 scoped_ptr<api::sessions::Device> device_struct(new api::sessions::Device); |
| 351 device_struct->info = session->session_name; | 351 device_struct->info = session->session_name; |
| 352 | 352 |
| 353 for (browser_sync::SyncedSession::SyncedWindowMap::const_iterator it = | 353 for (browser_sync::SyncedSession::SyncedWindowMap::const_iterator it = |
| 354 session->windows.begin(); it != session->windows.end() && | 354 session->windows.begin(); it != session->windows.end() && |
| 355 static_cast<int>(device_struct->sessions.size()) < max_results; ++it) { | 355 static_cast<int>(device_struct->sessions.size()) < max_results; ++it) { |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 return g_factory.Pointer(); | 643 return g_factory.Pointer(); |
| 644 } | 644 } |
| 645 | 645 |
| 646 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { | 646 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 647 sessions_event_router_.reset( | 647 sessions_event_router_.reset( |
| 648 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); | 648 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); |
| 649 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 649 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 650 } | 650 } |
| 651 | 651 |
| 652 } // namespace extensions | 652 } // namespace extensions |
| OLD | NEW |