Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: chrome/browser/extensions/api/sessions/sessions_api.cc

Issue 1099553002: extensions: windows: list all windows from the current profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/api/DEPS ('k') | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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, WindowController::GetDefaultWindowFilter(),
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/DEPS ('k') | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698