Home | History | Annotate | Download | only in drive
      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_DRIVE_DRIVE_NOTIFICATION_MANAGER_FACTORY_H_
      6 #define CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_FACTORY_H_
      7 
      8 #include "base/memory/singleton.h"
      9 #include "components/keyed_service/content/browser_context_keyed_service_factory.h"
     10 
     11 namespace content {
     12 class BrowserContext;
     13 }
     14 
     15 namespace drive {
     16 
     17 class DriveNotificationManager;
     18 
     19 // Singleton that owns all DriveNotificationManager and associates them with
     20 // browser contexts.
     21 class DriveNotificationManagerFactory
     22     : public BrowserContextKeyedServiceFactory {
     23  public:
     24   // Returns the |DriveNotificationManager| for |context| if one exists or NULL
     25   // otherwise.
     26   static DriveNotificationManager* FindForBrowserContext(
     27       content::BrowserContext* context);
     28 
     29   // Returns the |DriveNotificationManager| for |context|, creating it first if
     30   // required.
     31   static DriveNotificationManager* GetForBrowserContext(
     32       content::BrowserContext* context);
     33 
     34   static DriveNotificationManagerFactory* GetInstance();
     35 
     36  private:
     37   friend struct DefaultSingletonTraits<DriveNotificationManagerFactory>;
     38 
     39   DriveNotificationManagerFactory();
     40   virtual ~DriveNotificationManagerFactory();
     41 
     42   // BrowserContextKeyedServiceFactory implementation.
     43   virtual KeyedService* BuildServiceInstanceFor(
     44       content::BrowserContext* context) const OVERRIDE;
     45 };
     46 
     47 }  // namespace drive
     48 
     49 #endif  // CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_FACTORY_H_
     50