| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 return true; | 386 return true; |
| 387 } | 387 } |
| 388 | 388 |
| 389 void SessionsRestoreFunction::SetInvalidIdError(const std::string& invalid_id) { | 389 void SessionsRestoreFunction::SetInvalidIdError(const std::string& invalid_id) { |
| 390 SetError(ErrorUtils::FormatErrorMessage(kInvalidSessionIdError, invalid_id)); | 390 SetError(ErrorUtils::FormatErrorMessage(kInvalidSessionIdError, invalid_id)); |
| 391 } | 391 } |
| 392 | 392 |
| 393 | 393 |
| 394 void SessionsRestoreFunction::SetResultRestoredTab( | 394 void SessionsRestoreFunction::SetResultRestoredTab( |
| 395 const content::WebContents* contents) { | 395 const content::WebContents* contents) { |
| 396 scoped_ptr<tabs::Tab> tab(tabs::Tab::FromValue( | 396 scoped_ptr<DictionaryValue> tab_value( |
| 397 *ExtensionTabUtil::CreateTabValue(contents, GetExtension()))); | 397 ExtensionTabUtil::CreateTabValue(contents, GetExtension())); |
| 398 scoped_ptr<tabs::Tab> tab(tabs::Tab::FromValue(*tab_value)); |
| 398 scoped_ptr<api::sessions::Session> restored_session(CreateSessionModelHelper( | 399 scoped_ptr<api::sessions::Session> restored_session(CreateSessionModelHelper( |
| 399 base::Time::Now().ToTimeT(), | 400 base::Time::Now().ToTimeT(), |
| 400 tab.Pass(), | 401 tab.Pass(), |
| 401 scoped_ptr<windows::Window>())); | 402 scoped_ptr<windows::Window>())); |
| 402 results_ = Restore::Results::Create(*restored_session); | 403 results_ = Restore::Results::Create(*restored_session); |
| 403 } | 404 } |
| 404 | 405 |
| 405 bool SessionsRestoreFunction::SetResultRestoredWindow(int window_id) { | 406 bool SessionsRestoreFunction::SetResultRestoredWindow(int window_id) { |
| 406 WindowController* controller = NULL; | 407 WindowController* controller = NULL; |
| 407 if (!windows_util::GetWindowFromWindowID(this, window_id, &controller)) { | 408 if (!windows_util::GetWindowFromWindowID(this, window_id, &controller)) { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 static base::LazyInstance<ProfileKeyedAPIFactory<SessionsAPI> > | 583 static base::LazyInstance<ProfileKeyedAPIFactory<SessionsAPI> > |
| 583 g_factory = LAZY_INSTANCE_INITIALIZER; | 584 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 584 | 585 |
| 585 // static | 586 // static |
| 586 ProfileKeyedAPIFactory<SessionsAPI>* | 587 ProfileKeyedAPIFactory<SessionsAPI>* |
| 587 SessionsAPI::GetFactoryInstance() { | 588 SessionsAPI::GetFactoryInstance() { |
| 588 return &g_factory.Get(); | 589 return &g_factory.Get(); |
| 589 } | 590 } |
| 590 | 591 |
| 591 } // namespace extensions | 592 } // namespace extensions |
| OLD | NEW |