Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / sync / sessions / notification_service_sessions_router.h
blob8d0eb32126c42f4ea610ca45ccd3b0db02c63c43
1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_SYNC_SESSIONS_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_
6 #define CHROME_BROWSER_SYNC_SESSIONS_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_
8 #include <set>
10 #include "base/callback_list.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/sync/sessions/sessions_sync_manager.h"
13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h"
16 class GURL;
17 class Profile;
19 namespace content {
20 class WebContents;
23 namespace browser_sync {
25 // A SessionsSyncManager::LocalEventRouter that drives session sync via
26 // the NotificationService.
27 class NotificationServiceSessionsRouter
28 : public LocalSessionEventRouter,
29 public content::NotificationObserver {
30 public:
31 NotificationServiceSessionsRouter(
32 Profile* profile,
33 const syncer::SyncableService::StartSyncFlare& flare);
34 ~NotificationServiceSessionsRouter() override;
36 // content::NotificationObserver implementation.
37 // BrowserSessionProvider -> sync API model change application.
38 void Observe(int type,
39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) override;
42 // SessionsSyncManager::LocalEventRouter implementation.
43 void StartRoutingTo(LocalSessionEventHandler* handler) override;
44 void Stop() override;
46 private:
47 // Called when the URL visited in |web_contents| was blocked by the
48 // SupervisedUserService. We forward this on to our handler_ via the
49 // normal OnLocalTabModified, but pass through here via a WeakPtr
50 // callback from SupervisedUserService and to extract the tab delegate
51 // from WebContents.
52 void OnNavigationBlocked(content::WebContents* web_contents);
54 // Called when the favicons for the given page URLs
55 // (e.g. http://www.google.com) and the given icon URL (e.g.
56 // http://www.google.com/favicon.ico) have changed. It is valid to call
57 // OnFaviconsChanged() with non-empty |page_urls| and an empty |icon_url|
58 // and vice versa.
59 void OnFaviconsChanged(const std::set<GURL>& page_urls,
60 const GURL& icon_url);
62 LocalSessionEventHandler* handler_;
63 content::NotificationRegistrar registrar_;
64 Profile* const profile_;
65 syncer::SyncableService::StartSyncFlare flare_;
67 scoped_ptr<base::CallbackList<void(const std::set<GURL>&,
68 const GURL&)>::Subscription>
69 favicon_changed_subscription_;
71 base::WeakPtrFactory<NotificationServiceSessionsRouter> weak_ptr_factory_;
73 DISALLOW_COPY_AND_ASSIGN(NotificationServiceSessionsRouter);
76 } // namespace browser_sync
78 #endif // CHROME_BROWSER_SYNC_SESSIONS_NOTIFICATION_SERVICE_SESSIONS_ROUTER_H_