summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/shell_window_registry.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/shell_window_registry.cc')
-rw-r--r--chrome/browser/extensions/shell_window_registry.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/chrome/browser/extensions/shell_window_registry.cc b/chrome/browser/extensions/shell_window_registry.cc
new file mode 100644
index 0000000..375fb9c
--- /dev/null
+++ b/chrome/browser/extensions/shell_window_registry.cc
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/shell_window_registry.h"
+#include "chrome/browser/profiles/profile_dependency_manager.h"
+
+ShellWindowRegistry::ShellWindowRegistry() {}
+
+ShellWindowRegistry::~ShellWindowRegistry() {}
+
+// static
+ShellWindowRegistry* ShellWindowRegistry::Get(Profile* profile) {
+ return Factory::GetForProfile(profile);
+}
+
+void ShellWindowRegistry::AddShellWindow(ShellWindow* shell_window) {
+ shell_windows_.insert(shell_window);
+}
+
+void ShellWindowRegistry::RemoveShellWindow(ShellWindow* shell_window) {
+ shell_windows_.erase(shell_window);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// Factory boilerplate
+
+// static
+ShellWindowRegistry* ShellWindowRegistry::Factory::GetForProfile(
+ Profile* profile) {
+ return static_cast<ShellWindowRegistry*>(
+ GetInstance()->GetServiceForProfile(profile, true));
+}
+
+ShellWindowRegistry::Factory* ShellWindowRegistry::Factory::GetInstance() {
+ return Singleton<ShellWindowRegistry::Factory>::get();
+}
+
+ShellWindowRegistry::Factory::Factory()
+ : ProfileKeyedServiceFactory("ShellWindowRegistry",
+ ProfileDependencyManager::GetInstance()) {
+}
+
+ShellWindowRegistry::Factory::~Factory() {
+}
+
+ProfileKeyedService* ShellWindowRegistry::Factory::BuildServiceInstanceFor(
+ Profile* profile) const {
+ return new ShellWindowRegistry();
+}
+
+bool ShellWindowRegistry::Factory::ServiceIsCreatedWithProfile() {
+ return true;
+}
+
+bool ShellWindowRegistry::Factory::ServiceIsNULLWhileTesting() {
+ return false;
+}