| 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 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 GetProfile(), host_desktop_type, window, window + 1); | 574 GetProfile(), host_desktop_type, window, window + 1); |
| 575 // Will always create one browser because we only restore one window per call. | 575 // Will always create one browser because we only restore one window per call. |
| 576 DCHECK_EQ(1u, browsers.size()); | 576 DCHECK_EQ(1u, browsers.size()); |
| 577 return SetResultRestoredWindow(ExtensionTabUtil::GetWindowId(browsers[0])); | 577 return SetResultRestoredWindow(ExtensionTabUtil::GetWindowId(browsers[0])); |
| 578 } | 578 } |
| 579 | 579 |
| 580 bool SessionsRestoreFunction::RunSync() { | 580 bool SessionsRestoreFunction::RunSync() { |
| 581 scoped_ptr<Restore::Params> params(Restore::Params::Create(*args_)); | 581 scoped_ptr<Restore::Params> params(Restore::Params::Create(*args_)); |
| 582 EXTENSION_FUNCTION_VALIDATE(params); | 582 EXTENSION_FUNCTION_VALIDATE(params); |
| 583 | 583 |
| 584 Browser* browser = chrome::FindBrowserWithProfile( | 584 Browser* browser = chrome::FindBrowserWithProfile(GetProfile()); |
| 585 GetProfile(), chrome::HOST_DESKTOP_TYPE_NATIVE); | |
| 586 if (!browser) { | 585 if (!browser) { |
| 587 SetError(kNoBrowserToRestoreSession); | 586 SetError(kNoBrowserToRestoreSession); |
| 588 return false; | 587 return false; |
| 589 } | 588 } |
| 590 | 589 |
| 591 if (GetProfile() != GetProfile()->GetOriginalProfile()) { | 590 if (GetProfile() != GetProfile()->GetOriginalProfile()) { |
| 592 SetError(kRestoreInIncognitoError); | 591 SetError(kRestoreInIncognitoError); |
| 593 return false; | 592 return false; |
| 594 } | 593 } |
| 595 | 594 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 return g_factory.Pointer(); | 656 return g_factory.Pointer(); |
| 658 } | 657 } |
| 659 | 658 |
| 660 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { | 659 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 661 sessions_event_router_.reset( | 660 sessions_event_router_.reset( |
| 662 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); | 661 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); |
| 663 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 662 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 664 } | 663 } |
| 665 | 664 |
| 666 } // namespace extensions | 665 } // namespace extensions |
| OLD | NEW |