1c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// found in the LICENSE file.
4c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
57d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#ifndef CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_FACTORY_H_
67d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#define CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_FACTORY_H_
7c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
8c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "base/memory/singleton.h"
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)namespace content {
1258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)class BrowserContext;
1358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)}
14c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
15eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdochnamespace drive {
16c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
17c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)class DriveNotificationManager;
18c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
19c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)// Singleton that owns all DriveNotificationManager and associates them with
2058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// browser contexts.
2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class DriveNotificationManagerFactory
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)    : public BrowserContextKeyedServiceFactory {
23c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) public:
24e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  // Returns the |DriveNotificationManager| for |context| if one exists or NULL
25e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  // otherwise.
26e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  static DriveNotificationManager* FindForBrowserContext(
27e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch      content::BrowserContext* context);
28e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch
29e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  // Returns the |DriveNotificationManager| for |context|, creating it first if
30e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  // required.
3158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  static DriveNotificationManager* GetForBrowserContext(
3258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)      content::BrowserContext* context);
33c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
34c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  static DriveNotificationManagerFactory* GetInstance();
35c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
36c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) private:
37c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  friend struct DefaultSingletonTraits<DriveNotificationManagerFactory>;
38c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
39c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  DriveNotificationManagerFactory();
40c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual ~DriveNotificationManagerFactory();
41c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
4290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // BrowserContextKeyedServiceFactory implementation.
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual KeyedService* BuildServiceInstanceFor(
4458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)      content::BrowserContext* context) const OVERRIDE;
45c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)};
46c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
47eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch}  // namespace drive
48c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
497d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#endif  // CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_FACTORY_H_
50