summaryrefslogtreecommitdiffstats
path: root/views/controls/native/native_view_host_views.cc
blob: 8d28bb01e2046248bb161dfe8d19cd120a2c71b9 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright (c) 2006-2008 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 "views/controls/native/native_view_host_views.h"

#include "base/logging.h"
#include "ui/gfx/canvas.h"
#include "views/controls/native/native_view_host.h"
#include "views/focus/focus_manager.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"

namespace views {

////////////////////////////////////////////////////////////////////////////////
// NativeViewHostViews, public:

NativeViewHostViews::NativeViewHostViews(NativeViewHost* host)
    : host_(host),
      installed_clip_(false) {
}

NativeViewHostViews::~NativeViewHostViews() {
NOTIMPLEMENTED();
}

////////////////////////////////////////////////////////////////////////////////
// NativeViewHostViews, NativeViewHostWrapper implementation:
void NativeViewHostViews::NativeViewAttached() {
  host_->AddChildView(host_->views_view());
  host_->Layout();
}

void NativeViewHostViews::NativeViewDetaching(bool destroyed) {
  host_->RemoveChildView(host_->views_view());
}

void NativeViewHostViews::AddedToWidget() {
  // nothing to do
}

void NativeViewHostViews::RemovedFromWidget() {
  // nothing to do
}

void NativeViewHostViews::InstallClip(int x, int y, int w, int h) {
  NOTIMPLEMENTED();
}

bool NativeViewHostViews::HasInstalledClip() {
  return installed_clip_;
}

void NativeViewHostViews::UninstallClip() {
  installed_clip_ = false;
}

void NativeViewHostViews::ShowWidget(int x, int y, int w, int h) {
  // x, y are in the coordinate system of the root view, but we're
  // already properly positioned by virtue of being an actual views
  // child of the NativeHostView, so disregard the origin.
  host_->views_view()->SetBounds(0, 0, w, h);
  host_->views_view()->SetVisible(true);
}

void NativeViewHostViews::HideWidget() {
  host_->views_view()->SetVisible(false);
}

void NativeViewHostViews::SetFocus() {
  host_->views_view()->RequestFocus();
}

}  // namespace views