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