OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" | 5 #include "chrome/browser/extensions/signin/gaia_auth_extension_loader.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 void GaiaAuthExtensionLoader::LoadIfNeeded() { | 78 void GaiaAuthExtensionLoader::LoadIfNeeded() { |
79 if (load_count_ == 0) | 79 if (load_count_ == 0) |
80 LoadGaiaAuthExtension(browser_context_); | 80 LoadGaiaAuthExtension(browser_context_); |
81 ++load_count_; | 81 ++load_count_; |
82 } | 82 } |
83 | 83 |
84 void GaiaAuthExtensionLoader::UnloadIfNeededAsync() { | 84 void GaiaAuthExtensionLoader::UnloadIfNeededAsync() { |
85 base::ThreadTaskRunnerHandle::Get()->PostTask( | 85 base::ThreadTaskRunnerHandle::Get()->PostTask( |
86 FROM_HERE, | 86 FROM_HERE, base::BindOnce(&GaiaAuthExtensionLoader::UnloadIfNeeded, |
87 base::Bind(&GaiaAuthExtensionLoader::UnloadIfNeeded, | 87 weak_ptr_factory_.GetWeakPtr())); |
88 weak_ptr_factory_.GetWeakPtr())); | |
89 } | 88 } |
90 | 89 |
91 void GaiaAuthExtensionLoader::UnloadIfNeeded() { | 90 void GaiaAuthExtensionLoader::UnloadIfNeeded() { |
92 --load_count_; | 91 --load_count_; |
93 if (load_count_ == 0) { | 92 if (load_count_ == 0) { |
94 UnloadGaiaAuthExtension(browser_context_); | 93 UnloadGaiaAuthExtension(browser_context_); |
95 } | 94 } |
96 } | 95 } |
97 | 96 |
98 void GaiaAuthExtensionLoader::Shutdown() { | 97 void GaiaAuthExtensionLoader::Shutdown() { |
(...skipping 12 matching lines...) Expand all Loading... |
111 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>>::DestructorAtExit | 110 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>>::DestructorAtExit |
112 g_factory = LAZY_INSTANCE_INITIALIZER; | 111 g_factory = LAZY_INSTANCE_INITIALIZER; |
113 | 112 |
114 // static | 113 // static |
115 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* | 114 BrowserContextKeyedAPIFactory<GaiaAuthExtensionLoader>* |
116 GaiaAuthExtensionLoader::GetFactoryInstance() { | 115 GaiaAuthExtensionLoader::GetFactoryInstance() { |
117 return g_factory.Pointer(); | 116 return g_factory.Pointer(); |
118 } | 117 } |
119 | 118 |
120 } // namespace extensions | 119 } // namespace extensions |
OLD | NEW |