| 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..a6ce6845b422816f7a6a88c991389ece707fff1f
|
| --- /dev/null
|
| +++ b/chrome/browser/sync/sessions2/notification_service_sessions_router.h
|
| @@ -0,0 +1,61 @@
|
| +// 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);
|
| +
|
| + private:
|
| + // Called when the URL visited in |web_contents| was blocked by the
|
| + // ManagedUserService. We forward this on to our handler_ via the
|
| + // normal OnLocalTabModified, but pass through here via a WeakPtr
|
| + // callback from ManagedUserService and to extract the tab delegate
|
| + // from WebContents.
|
| + void OnNavigationBlocked(content::WebContents* web_contents);
|
| +
|
| + 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_
|
|
|