forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_hints_factory.cc
52 lines (42 loc) · 1.81 KB
/
client_hints_factory.cc
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
// Copyright 2020 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 "weblayer/browser/client_hints_factory.h"
#include "components/client_hints/browser/client_hints.h"
#include "components/embedder_support/user_agent_utils.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "weblayer/browser/browser_process.h"
#include "weblayer/browser/cookie_settings_factory.h"
#include "weblayer/browser/host_content_settings_map_factory.h"
namespace weblayer {
// static
client_hints::ClientHints* ClientHintsFactory::GetForBrowserContext(
content::BrowserContext* browser_context) {
return static_cast<client_hints::ClientHints*>(
GetInstance()->GetServiceForBrowserContext(browser_context, true));
}
// static
ClientHintsFactory* ClientHintsFactory::GetInstance() {
static base::NoDestructor<ClientHintsFactory> factory;
return factory.get();
}
ClientHintsFactory::ClientHintsFactory()
: BrowserContextKeyedServiceFactory(
"ClientHints",
BrowserContextDependencyManager::GetInstance()) {
DependsOn(HostContentSettingsMapFactory::GetInstance());
}
ClientHintsFactory::~ClientHintsFactory() = default;
KeyedService* ClientHintsFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
return new client_hints::ClientHints(
context, BrowserProcess::GetInstance()->GetNetworkQualityTracker(),
HostContentSettingsMapFactory::GetForBrowserContext(context),
CookieSettingsFactory::GetForBrowserContext(context),
embedder_support::GetUserAgentMetadata());
}
content::BrowserContext* ClientHintsFactory::GetBrowserContextToUse(
content::BrowserContext* context) const {
return context;
}
} // namespace weblayer