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

Side by Side Diff: chrome/browser/sync/sessions2/notification_service_sessions_router.h

Issue 79973002: sync: Route local sessions events to SessionsSyncManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Richard's review Created 7 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_SESSIONS2_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_
6 #define CHROME_BROWSER_SYNC_SESSIONS2_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/sync/sessions2/sessions_sync_manager.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
12
13 class Profile;
14
15 namespace content {
16 class WebContents;
17 }
18
19 namespace browser_sync {
20
21 // A SessionsSyncManager::LocalEventRouter that drives session sync via
22 // the NotificationService.
23 class NotificationServiceSessionsRouter
24 : public LocalSessionEventRouter,
25 public content::NotificationObserver {
26 public:
27 NotificationServiceSessionsRouter(
28 Profile* profile,
29 const syncer::SyncableService::StartSyncFlare& flare);
30 virtual ~NotificationServiceSessionsRouter();
31
32 // content::NotificationObserver implementation.
33 // BrowserSessionProvider -> sync API model change application.
34 virtual void Observe(int type,
35 const content::NotificationSource& source,
36 const content::NotificationDetails& details) OVERRIDE;
37
38 // SessionsSyncManager::LocalEventRouter implementation.
39 virtual void StartRoutingTo(LocalSessionEventHandler* handler) OVERRIDE;
40 virtual void Stop() OVERRIDE;
41
42 private:
43 // Called when the URL visited in |web_contents| was blocked by the
44 // ManagedUserService. We forward this on to our handler_ via the
45 // normal OnLocalTabModified, but pass through here via a WeakPtr
46 // callback from ManagedUserService and to extract the tab delegate
47 // from WebContents.
48 void OnNavigationBlocked(content::WebContents* web_contents);
49
50 LocalSessionEventHandler* handler_;
51 content::NotificationRegistrar registrar_;
52 Profile* const profile_;
53 syncer::SyncableService::StartSyncFlare flare_;
54 base::WeakPtrFactory<NotificationServiceSessionsRouter> weak_ptr_factory_;
55
56 DISALLOW_COPY_AND_ASSIGN(NotificationServiceSessionsRouter);
57 };
58
59 } // namespace browser_sync
60
61 #endif // CHROME_BROWSER_SYNC_SESSIONS2_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698