OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "views/controls/native/native_view_host.h" | 5 #include "views/controls/native/native_view_host.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "app/gfx/canvas.h" | 8 #include "app/gfx/canvas.h" |
9 #include "views/controls/native/native_view_host_wrapper.h" | 9 #include "views/controls/native/native_view_host_wrapper.h" |
10 #include "views/widget/widget.h" | 10 #include "views/widget/widget.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // to other views changed as it'll effect our position relative to the root. | 26 // to other views changed as it'll effect our position relative to the root. |
27 SetNotifyWhenVisibleBoundsInRootChanges(true); | 27 SetNotifyWhenVisibleBoundsInRootChanges(true); |
28 } | 28 } |
29 | 29 |
30 NativeViewHost::~NativeViewHost() { | 30 NativeViewHost::~NativeViewHost() { |
31 } | 31 } |
32 | 32 |
33 void NativeViewHost::Attach(gfx::NativeView native_view) { | 33 void NativeViewHost::Attach(gfx::NativeView native_view) { |
34 DCHECK(!native_view_); | 34 DCHECK(!native_view_); |
35 native_view_ = native_view; | 35 native_view_ = native_view; |
| 36 // If set_focus_view() has not been invoked, this view is the one that should |
| 37 // be seen as focused when the native view receives focus. |
| 38 if (!focus_view_) |
| 39 focus_view_ = this; |
36 native_wrapper_->NativeViewAttached(); | 40 native_wrapper_->NativeViewAttached(); |
37 } | 41 } |
38 | 42 |
39 void NativeViewHost::Detach() { | 43 void NativeViewHost::Detach() { |
40 DCHECK(native_view_); | 44 DCHECK(native_view_); |
41 native_wrapper_->NativeViewDetaching(); | 45 native_wrapper_->NativeViewDetaching(); |
42 native_view_ = NULL; | 46 native_view_ = NULL; |
43 } | 47 } |
44 | 48 |
45 void NativeViewHost::SetPreferredSize(const gfx::Size& size) { | 49 void NativeViewHost::SetPreferredSize(const gfx::Size& size) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 131 |
128 std::string NativeViewHost::GetClassName() const { | 132 std::string NativeViewHost::GetClassName() const { |
129 return kViewClassName; | 133 return kViewClassName; |
130 } | 134 } |
131 | 135 |
132 void NativeViewHost::Focus() { | 136 void NativeViewHost::Focus() { |
133 native_wrapper_->SetFocus(); | 137 native_wrapper_->SetFocus(); |
134 } | 138 } |
135 | 139 |
136 } // namespace views | 140 } // namespace views |
OLD | NEW |