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/compositor.h" | 9 #include "ui/gfx/compositor/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, CreateParams: | 19 // Widget, CreateParams: |
19 | 20 |
20 Widget::CreateParams::CreateParams() | 21 Widget::CreateParams::CreateParams() |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 207 } |
207 | 208 |
208 FocusManager* Widget::GetFocusManager() { | 209 FocusManager* Widget::GetFocusManager() { |
209 Widget* toplevel_widget = GetTopLevelWidget(); | 210 Widget* toplevel_widget = GetTopLevelWidget(); |
210 if (toplevel_widget && toplevel_widget != this) | 211 if (toplevel_widget && toplevel_widget != this) |
211 return toplevel_widget->focus_manager_.get(); | 212 return toplevel_widget->focus_manager_.get(); |
212 | 213 |
213 return focus_manager_.get(); | 214 return focus_manager_.get(); |
214 } | 215 } |
215 | 216 |
| 217 InputMethod* Widget::GetInputMethod() { |
| 218 Widget* toplevel_widget = GetTopLevelWidget(); |
| 219 return toplevel_widget ? |
| 220 toplevel_widget->native_widget()->GetInputMethodNative() : NULL; |
| 221 } |
| 222 |
216 bool Widget::ContainsNativeView(gfx::NativeView native_view) { | 223 bool Widget::ContainsNativeView(gfx::NativeView native_view) { |
217 if (native_widget_->ContainsNativeView(native_view)) | 224 if (native_widget_->ContainsNativeView(native_view)) |
218 return true; | 225 return true; |
219 | 226 |
220 // A views::NativeViewHost may contain the given native view, without it being | 227 // A views::NativeViewHost may contain the given native view, without it being |
221 // an ancestor of hwnd(), so traverse the views::View hierarchy looking for | 228 // an ancestor of hwnd(), so traverse the views::View hierarchy looking for |
222 // such views. | 229 // such views. |
223 return GetRootView()->ContainsNativeView(native_view); | 230 return GetRootView()->ContainsNativeView(native_view); |
224 } | 231 } |
225 | 232 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // TODO(sad): If there is a parent Widget, then use the same compositor | 372 // TODO(sad): If there is a parent Widget, then use the same compositor |
366 // instead of creating a new one here. | 373 // instead of creating a new one here. |
367 gfx::AcceleratedWidget widget = native_widget_->GetAcceleratedWidget(); | 374 gfx::AcceleratedWidget widget = native_widget_->GetAcceleratedWidget(); |
368 if (widget != gfx::kNullAcceleratedWidget) | 375 if (widget != gfx::kNullAcceleratedWidget) |
369 compositor_ = ui::Compositor::Create(widget); | 376 compositor_ = ui::Compositor::Create(widget); |
370 | 377 |
371 return compositor_.get() != NULL; | 378 return compositor_.get() != NULL; |
372 } | 379 } |
373 | 380 |
374 } // namespace views | 381 } // namespace views |
OLD | NEW |