OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/widget/widget.h" | 5 #include "views/widget/widget.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "ui/gfx/compositor.h" | 9 #include "ui/gfx/compositor.h" |
10 #include "views/focus/view_storage.h" | 10 #include "views/focus/view_storage.h" |
| 11 #include "views/ime/input_method.h" |
11 #include "views/widget/default_theme_provider.h" | 12 #include "views/widget/default_theme_provider.h" |
12 #include "views/widget/root_view.h" | 13 #include "views/widget/root_view.h" |
13 #include "views/widget/native_widget.h" | 14 #include "views/widget/native_widget.h" |
14 | 15 |
15 namespace views { | 16 namespace views { |
16 | 17 |
17 //////////////////////////////////////////////////////////////////////////////// | 18 //////////////////////////////////////////////////////////////////////////////// |
18 // Widget, public: | 19 // Widget, public: |
19 | 20 |
20 Widget::Widget() | 21 Widget::Widget() |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 } | 178 } |
178 | 179 |
179 FocusManager* Widget::GetFocusManager() { | 180 FocusManager* Widget::GetFocusManager() { |
180 Widget* toplevel_widget = GetTopLevelWidget(); | 181 Widget* toplevel_widget = GetTopLevelWidget(); |
181 if (toplevel_widget && toplevel_widget != this) | 182 if (toplevel_widget && toplevel_widget != this) |
182 return toplevel_widget->focus_manager_.get(); | 183 return toplevel_widget->focus_manager_.get(); |
183 | 184 |
184 return focus_manager_.get(); | 185 return focus_manager_.get(); |
185 } | 186 } |
186 | 187 |
| 188 InputMethod* Widget::GetInputMethod() const { |
| 189 const Widget* toplevel_widget = GetTopLevelWidget(); |
| 190 return toplevel_widget ? |
| 191 toplevel_widget->native_widget()->GetInputMethodNative() : NULL; |
| 192 } |
| 193 |
187 bool Widget::ContainsNativeView(gfx::NativeView native_view) { | 194 bool Widget::ContainsNativeView(gfx::NativeView native_view) { |
188 if (native_widget_->ContainsNativeView(native_view)) | 195 if (native_widget_->ContainsNativeView(native_view)) |
189 return true; | 196 return true; |
190 | 197 |
191 // A views::NativeViewHost may contain the given native view, without it being | 198 // A views::NativeViewHost may contain the given native view, without it being |
192 // an ancestor of hwnd(), so traverse the views::View hierarchy looking for | 199 // an ancestor of hwnd(), so traverse the views::View hierarchy looking for |
193 // such views. | 200 // such views. |
194 return GetRootView()->ContainsNativeView(native_view); | 201 return GetRootView()->ContainsNativeView(native_view); |
195 } | 202 } |
196 | 203 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // TODO(sad): If there is a parent Widget, then use the same compositor | 343 // TODO(sad): If there is a parent Widget, then use the same compositor |
337 // instead of creating a new one here. | 344 // instead of creating a new one here. |
338 gfx::AcceleratedWidget widget = native_widget_->GetAcceleratedWidget(); | 345 gfx::AcceleratedWidget widget = native_widget_->GetAcceleratedWidget(); |
339 if (widget != gfx::kNullAcceleratedWidget) | 346 if (widget != gfx::kNullAcceleratedWidget) |
340 compositor_ = ui::Compositor::Create(widget); | 347 compositor_ = ui::Compositor::Create(widget); |
341 | 348 |
342 return compositor_.get() != NULL; | 349 return compositor_.get() != NULL; |
343 } | 350 } |
344 | 351 |
345 } // namespace views | 352 } // namespace views |
OLD | NEW |