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