Adding instrumentation to locate the source of jankiness
[chromium-blink-merge.git] / chrome / browser / extensions / signin / gaia_auth_extension_loader.h
blob788e70cf055d7b9471048bb7555ba6562b92c912
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_
6 #define CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "extensions/browser/browser_context_keyed_api_factory.h"
11 namespace content {
12 class BrowserContext;
15 namespace extensions {
17 const char kGaiaAuthExtensionId[] = "mfffpogegjflfpflabcdkioaeobkgjik";
18 const char kGaiaAuthExtensionOrigin[] =
19 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik";
21 // Manages and registers the gaia auth extension with the extension system.
22 class GaiaAuthExtensionLoader : public BrowserContextKeyedAPI {
23 public:
24 explicit GaiaAuthExtensionLoader(content::BrowserContext* context);
25 virtual ~GaiaAuthExtensionLoader();
27 // Load the gaia auth extension if the extension is not loaded yet.
28 void LoadIfNeeded();
29 // Unload the gaia auth extension if no pending reference.
30 void UnloadIfNeeded();
32 static GaiaAuthExtensionLoader* Get(content::BrowserContext* context);
34 // BrowserContextKeyedAPI implementation.
35 static BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>*
36 GetFactoryInstance();
38 private:
39 friend class BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>;
41 // KeyedService overrides:
42 virtual void Shutdown() override;
44 // BrowserContextKeyedAPI implementation.
45 static const char* service_name() {
46 return "GaiaAuthExtensionLoader";
48 static const bool kServiceRedirectedInIncognito = true;
50 content::BrowserContext* browser_context_;
51 int load_count_;
53 DISALLOW_COPY_AND_ASSIGN(GaiaAuthExtensionLoader);
56 } // namespace extensions
58 #endif // CHROME_BROWSER_EXTENSIONS_SIGNIN_GAIA_AUTH_EXTENSION_LOADER_H_