| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 std::unique_ptr<tabs::Tab> tab( | 394 std::unique_ptr<tabs::Tab> tab( |
| 395 ExtensionTabUtil::CreateTabObject(contents, extension())); | 395 ExtensionTabUtil::CreateTabObject(contents, extension())); |
| 396 std::unique_ptr<api::sessions::Session> restored_session( | 396 std::unique_ptr<api::sessions::Session> restored_session( |
| 397 CreateSessionModelHelper(base::Time::Now().ToTimeT(), std::move(tab), | 397 CreateSessionModelHelper(base::Time::Now().ToTimeT(), std::move(tab), |
| 398 std::unique_ptr<windows::Window>())); | 398 std::unique_ptr<windows::Window>())); |
| 399 results_ = Restore::Results::Create(*restored_session); | 399 results_ = Restore::Results::Create(*restored_session); |
| 400 } | 400 } |
| 401 | 401 |
| 402 bool SessionsRestoreFunction::SetResultRestoredWindow(int window_id) { | 402 bool SessionsRestoreFunction::SetResultRestoredWindow(int window_id) { |
| 403 WindowController* controller = NULL; | 403 WindowController* controller = NULL; |
| 404 if (!windows_util::GetWindowFromWindowID(this, window_id, 0, &controller)) { | 404 if (!windows_util::GetWindowFromWindowID(this, window_id, 0, &controller, |
| 405 // error_ is set by GetWindowFromWindowId function call. | 405 &error_)) { |
| 406 return false; | 406 return false; |
| 407 } | 407 } |
| 408 std::unique_ptr<base::DictionaryValue> window_value( | 408 std::unique_ptr<base::DictionaryValue> window_value( |
| 409 controller->CreateWindowValueWithTabs(extension())); | 409 controller->CreateWindowValueWithTabs(extension())); |
| 410 std::unique_ptr<windows::Window> window( | 410 std::unique_ptr<windows::Window> window( |
| 411 windows::Window::FromValue(*window_value)); | 411 windows::Window::FromValue(*window_value)); |
| 412 results_ = Restore::Results::Create(*CreateSessionModelHelper( | 412 results_ = Restore::Results::Create(*CreateSessionModelHelper( |
| 413 base::Time::Now().ToTimeT(), std::unique_ptr<tabs::Tab>(), | 413 base::Time::Now().ToTimeT(), std::unique_ptr<tabs::Tab>(), |
| 414 std::move(window))); | 414 std::move(window))); |
| 415 return true; | 415 return true; |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 return g_factory.Pointer(); | 627 return g_factory.Pointer(); |
| 628 } | 628 } |
| 629 | 629 |
| 630 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { | 630 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 631 sessions_event_router_.reset( | 631 sessions_event_router_.reset( |
| 632 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); | 632 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); |
| 633 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 633 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 634 } | 634 } |
| 635 | 635 |
| 636 } // namespace extensions | 636 } // namespace extensions |
| OLD | NEW |