Home | History | Annotate | Download | only in settings
      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_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_H_
      6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_H_
      7 
      8 #include <queue>
      9 #include <string>
     10 
     11 #include "base/basictypes.h"
     12 
     13 namespace chromeos {
     14 
     15 class DeviceOAuth2TokenService;
     16 
     17 class DeviceOAuth2TokenServiceFactory {
     18  public:
     19   // Returns the instance of the DeviceOAuth2TokenService singleton.  May return
     20   // NULL during browser startup and shutdown.  When calling Get(), either make
     21   // sure that your code executes after browser startup and before shutdown or
     22   // be careful to call Get() every time (instead of holding a pointer) and
     23   // check for NULL to handle cases where you might access
     24   // DeviceOAuth2TokenService during startup or shutdown.
     25   static DeviceOAuth2TokenService* Get();
     26 
     27   // Called by ChromeBrowserMainPartsChromeOS in order to bootstrap the
     28   // DeviceOAuth2TokenService instance after the required global data is
     29   // available (local state and request context getter).
     30   static void Initialize();
     31 
     32   // Called by ChromeBrowserMainPartsChromeOS in order to shutdown the
     33   // DeviceOAuth2TokenService instance and cancel all in-flight requests before
     34   // the required global data is destroyed (local state and request context
     35   // getter).
     36   static void Shutdown();
     37 
     38  private:
     39   DeviceOAuth2TokenServiceFactory();
     40   ~DeviceOAuth2TokenServiceFactory();
     41 
     42   DISALLOW_COPY_AND_ASSIGN(DeviceOAuth2TokenServiceFactory);
     43 };
     44 
     45 }  // namespace chromeos
     46 
     47 #endif  // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_OAUTH2_TOKEN_SERVICE_FACTORY_H_
     48