blob: 375fb9c467447f8d94d744fdc03932017e2fd7d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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;
}
|