OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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 "views/controls/native/native_view_host_views.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "ui/gfx/canvas.h" | |
9 #include "ui/views/focus/focus_manager.h" | |
10 #include "views/controls/native/native_view_host.h" | |
11 #include "views/widget/root_view.h" | |
12 #include "views/widget/widget.h" | |
13 | |
14 namespace views { | |
15 | |
16 //////////////////////////////////////////////////////////////////////////////// | |
17 // NativeViewHostViews, public: | |
18 | |
19 NativeViewHostViews::NativeViewHostViews(NativeViewHost* host) | |
20 : host_(host), | |
21 installed_clip_(false) { | |
22 } | |
23 | |
24 NativeViewHostViews::~NativeViewHostViews() { | |
25 NOTIMPLEMENTED(); | |
26 } | |
27 | |
28 //////////////////////////////////////////////////////////////////////////////// | |
29 // NativeViewHostViews, NativeViewHostWrapper implementation: | |
30 void NativeViewHostViews::NativeViewAttached() { | |
31 host_->AddChildView(host_->views_view()); | |
32 host_->Layout(); | |
33 } | |
34 | |
35 void NativeViewHostViews::NativeViewDetaching(bool destroyed) { | |
36 host_->RemoveChildView(host_->views_view()); | |
37 } | |
38 | |
39 void NativeViewHostViews::AddedToWidget() { | |
40 // nothing to do | |
41 } | |
42 | |
43 void NativeViewHostViews::RemovedFromWidget() { | |
44 // nothing to do | |
45 } | |
46 | |
47 void NativeViewHostViews::InstallClip(int x, int y, int w, int h) { | |
48 NOTIMPLEMENTED(); | |
49 } | |
50 | |
51 bool NativeViewHostViews::HasInstalledClip() { | |
52 return installed_clip_; | |
53 } | |
54 | |
55 void NativeViewHostViews::UninstallClip() { | |
56 installed_clip_ = false; | |
57 } | |
58 | |
59 void NativeViewHostViews::ShowWidget(int x, int y, int w, int h) { | |
60 // x, y are in the coordinate system of the root view, but we're | |
61 // already properly positioned by virtue of being an actual views | |
62 // child of the NativeHostView, so disregard the origin. | |
63 // It is important to update the visibility first, so that when the bounds is | |
64 // set, the contents get notified of the resize (because resizing a hidden | |
65 // views may not actually resize the contents). | |
66 host_->views_view()->SetVisible(true); | |
67 host_->views_view()->SetBounds(0, 0, w, h); | |
68 } | |
69 | |
70 void NativeViewHostViews::HideWidget() { | |
71 host_->views_view()->SetVisible(false); | |
72 } | |
73 | |
74 void NativeViewHostViews::SetFocus() { | |
75 host_->views_view()->RequestFocus(); | |
76 } | |
77 | |
78 gfx::NativeViewAccessible NativeViewHostViews::GetNativeViewAccessible() { | |
79 return NULL; | |
80 } | |
81 | |
82 } // namespace views | |
OLD | NEW |