Chromium Code Reviews| Index: chrome/browser/sync/sessions2/notification_service_sessions_router.h |
| diff --git a/chrome/browser/sync/sessions2/notification_service_sessions_router.h b/chrome/browser/sync/sessions2/notification_service_sessions_router.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d45ff0ea4db700473554e35307fcca51097c35d4 |
| --- /dev/null |
| +++ b/chrome/browser/sync/sessions2/notification_service_sessions_router.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_SYNC_SESSIONS2_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_ |
| +#define CHROME_BROWSER_SYNC_SESSIONS2_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "chrome/browser/sync/sessions2/sessions_sync_manager.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| + |
| +class Profile; |
| + |
| +namespace content { |
| +class WebContents; |
| +} |
| + |
| +namespace browser_sync { |
| + |
| +// A SessionsSyncManager::LocalEventRouter that drives session sync via |
| +// the NotificationService. |
| +class NotificationServiceSessionsRouter |
| + : public SessionsSyncManager::LocalEventRouter, |
| + public content::NotificationObserver { |
| + public: |
| + explicit NotificationServiceSessionsRouter(Profile* profile); |
| + virtual ~NotificationServiceSessionsRouter(); |
| + |
| + // content::NotificationObserver implementation. |
| + // BrowserSessionProvider -> sync API model change application. |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| + |
| + // SessionsSyncManager::LocalEventRouter implementation. |
| + virtual void StartRoutingTo(LocalSessionEventHandler* handler) OVERRIDE; |
| + virtual void Stop() OVERRIDE; |
| + |
| + void set_flare( |
| + const syncer::SyncableService::StartSyncFlare& flare); |
|
Nicolas Zea
2013/11/21 02:34:52
nit: looks like this can fit on one line? also, ne
tim (not reviewing)
2013/11/21 21:38:59
Done.
|
| + private: |
| + void OnNavigationBlocked(content::WebContents* web_contents); |
|
Nicolas Zea
2013/11/21 02:34:52
nit: newline after. Also, comment what this functi
tim (not reviewing)
2013/11/21 21:38:59
Done.
|
| + LocalSessionEventHandler* handler_; |
| + content::NotificationRegistrar registrar_; |
| + Profile* const profile_; |
| + syncer::SyncableService::StartSyncFlare flare_; |
| + base::WeakPtrFactory<NotificationServiceSessionsRouter> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NotificationServiceSessionsRouter); |
| +}; |
| + |
| +} // namespace browser_sync |
| + |
| +#endif // CHROME_BROWSER_SYNC_SESSIONS2_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_ |