| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 scoped_ptr<tabs::Tab> tab(tabs::Tab::FromValue(*tab_value)); | 417 scoped_ptr<tabs::Tab> tab(tabs::Tab::FromValue(*tab_value)); |
| 418 scoped_ptr<api::sessions::Session> restored_session(CreateSessionModelHelper( | 418 scoped_ptr<api::sessions::Session> restored_session(CreateSessionModelHelper( |
| 419 base::Time::Now().ToTimeT(), | 419 base::Time::Now().ToTimeT(), |
| 420 tab.Pass(), | 420 tab.Pass(), |
| 421 scoped_ptr<windows::Window>())); | 421 scoped_ptr<windows::Window>())); |
| 422 results_ = Restore::Results::Create(*restored_session); | 422 results_ = Restore::Results::Create(*restored_session); |
| 423 } | 423 } |
| 424 | 424 |
| 425 bool SessionsRestoreFunction::SetResultRestoredWindow(int window_id) { | 425 bool SessionsRestoreFunction::SetResultRestoredWindow(int window_id) { |
| 426 WindowController* controller = NULL; | 426 WindowController* controller = NULL; |
| 427 if (!windows_util::GetWindowFromWindowID(this, window_id, &controller)) { | 427 if (!windows_util::GetWindowFromWindowID( |
| 428 this, window_id, windows_util::GetDefaultWindowTypeFilters(), |
| 429 &controller)) { |
| 428 // error_ is set by GetWindowFromWindowId function call. | 430 // error_ is set by GetWindowFromWindowId function call. |
| 429 return false; | 431 return false; |
| 430 } | 432 } |
| 431 scoped_ptr<base::DictionaryValue> window_value( | 433 scoped_ptr<base::DictionaryValue> window_value( |
| 432 controller->CreateWindowValueWithTabs(extension())); | 434 controller->CreateWindowValueWithTabs(extension())); |
| 433 scoped_ptr<windows::Window> window(windows::Window::FromValue( | 435 scoped_ptr<windows::Window> window(windows::Window::FromValue( |
| 434 *window_value)); | 436 *window_value)); |
| 435 results_ = Restore::Results::Create(*CreateSessionModelHelper( | 437 results_ = Restore::Results::Create(*CreateSessionModelHelper( |
| 436 base::Time::Now().ToTimeT(), | 438 base::Time::Now().ToTimeT(), |
| 437 scoped_ptr<tabs::Tab>(), | 439 scoped_ptr<tabs::Tab>(), |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 return g_factory.Pointer(); | 652 return g_factory.Pointer(); |
| 651 } | 653 } |
| 652 | 654 |
| 653 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { | 655 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 654 sessions_event_router_.reset( | 656 sessions_event_router_.reset( |
| 655 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); | 657 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); |
| 656 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 658 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 657 } | 659 } |
| 658 | 660 |
| 659 } // namespace extensions | 661 } // namespace extensions |
| OLD | NEW |