OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/ozone/platform/dri/native_window_manager.h" | |
6 | |
7 namespace ui { | |
8 | |
9 NativeWindowManager::NativeWindowManager() : allocated_widgets_(0) { | |
10 } | |
11 | |
12 NativeWindowManager::~NativeWindowManager() { | |
13 } | |
14 | |
15 gfx::AcceleratedWidget NativeWindowManager::AllocateAcceleratedWidget() { | |
16 // We're not using 0 since other code assumes that a 0 AcceleratedWidget is an | |
17 // invalid widget. | |
18 return ++allocated_widgets_; | |
19 } | |
20 | |
21 void NativeWindowManager::AddNativeWindowDelegate( | |
22 gfx::AcceleratedWidget widget, | |
23 NativeWindowDelegate* delegate) { | |
24 DCHECK(delegate_map_.find(widget) == delegate_map_.end()) | |
25 << "Surface delegate already added."; | |
spang
2014/08/18 19:31:30
surface delegate?
| |
26 delegate_map_.insert(std::make_pair(widget, delegate)); | |
27 } | |
28 | |
29 void NativeWindowManager::RemoveNativeWindowDelegate( | |
30 gfx::AcceleratedWidget widget) { | |
31 WidgetToDelegateMap::iterator it = delegate_map_.find(widget); | |
32 DCHECK(it != delegate_map_.end()) | |
33 << "Attempting to remove non-existing delegate."; | |
34 | |
35 delegate_map_.erase(it); | |
36 } | |
37 | |
38 NativeWindowDelegate* NativeWindowManager::GetNativeWindowDelegate( | |
39 gfx::AcceleratedWidget widget) { | |
40 WidgetToDelegateMap::iterator it = delegate_map_.find(widget); | |
41 if (it != delegate_map_.end()) | |
42 return it->second; | |
43 | |
44 NOTREACHED(); | |
45 return NULL; | |
46 } | |
47 | |
48 bool NativeWindowManager::HasNativeWindowDelegate( | |
49 gfx::AcceleratedWidget widget) { | |
50 return delegate_map_.find(widget) != delegate_map_.end(); | |
51 } | |
52 | |
53 } // namespace ui | |
OLD | NEW |