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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 } | 612 } |
613 | 613 |
614 SessionsEventRouter::~SessionsEventRouter() { | 614 SessionsEventRouter::~SessionsEventRouter() { |
615 if (tab_restore_service_) | 615 if (tab_restore_service_) |
616 tab_restore_service_->RemoveObserver(this); | 616 tab_restore_service_->RemoveObserver(this); |
617 } | 617 } |
618 | 618 |
619 void SessionsEventRouter::TabRestoreServiceChanged( | 619 void SessionsEventRouter::TabRestoreServiceChanged( |
620 TabRestoreService* service) { | 620 TabRestoreService* service) { |
621 scoped_ptr<base::ListValue> args(new base::ListValue()); | 621 scoped_ptr<base::ListValue> args(new base::ListValue()); |
622 EventRouter::Get(profile_)->BroadcastEvent(make_scoped_ptr( | 622 EventRouter::Get(profile_)->BroadcastEvent(make_scoped_ptr(new Event( |
623 new Event(api::sessions::OnChanged::kEventName, args.Pass()))); | 623 events::UNKNOWN, api::sessions::OnChanged::kEventName, args.Pass()))); |
624 } | 624 } |
625 | 625 |
626 void SessionsEventRouter::TabRestoreServiceDestroyed( | 626 void SessionsEventRouter::TabRestoreServiceDestroyed( |
627 TabRestoreService* service) { | 627 TabRestoreService* service) { |
628 tab_restore_service_ = NULL; | 628 tab_restore_service_ = NULL; |
629 } | 629 } |
630 | 630 |
631 SessionsAPI::SessionsAPI(content::BrowserContext* context) | 631 SessionsAPI::SessionsAPI(content::BrowserContext* context) |
632 : browser_context_(context) { | 632 : browser_context_(context) { |
633 EventRouter::Get(browser_context_)->RegisterObserver(this, | 633 EventRouter::Get(browser_context_)->RegisterObserver(this, |
(...skipping 15 matching lines...) Expand all Loading... |
649 return g_factory.Pointer(); | 649 return g_factory.Pointer(); |
650 } | 650 } |
651 | 651 |
652 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { | 652 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { |
653 sessions_event_router_.reset( | 653 sessions_event_router_.reset( |
654 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); | 654 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); |
655 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 655 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
656 } | 656 } |
657 | 657 |
658 } // namespace extensions | 658 } // namespace extensions |
OLD | NEW |