forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_image_registry.cc
39 lines (29 loc) · 1.07 KB
/
client_image_registry.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
// Copyright 2018 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 "ash/client_image_registry.h"
namespace ash {
ClientImageRegistry::ClientImageRegistry() = default;
ClientImageRegistry::~ClientImageRegistry() = default;
void ClientImageRegistry::BindRequest(
mojom::ClientImageRegistryRequest request) {
binding_set_.AddBinding(this, std::move(request));
}
const gfx::ImageSkia* ClientImageRegistry::GetImage(
const base::UnguessableToken& token) const {
auto iter = images_.find(token);
if (iter == images_.end()) {
// No DCHECK here as otherwise ash would crash if a bad client supplies a
// random value.
return nullptr;
}
return &iter->second;
}
void ClientImageRegistry::RegisterImage(const base::UnguessableToken& token,
const gfx::ImageSkia& image) {
images_[token] = image;
}
void ClientImageRegistry::ForgetImage(const base::UnguessableToken& token) {
images_.erase(token);
}
} // namespace ash