| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/native/native_view_host_win.h" | 5 #include "ui/views/controls/native/native_view_host_win.h" |
| 6 | 6 |
| 7 #include <oleacc.h> | 7 #include <oleacc.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/base/win/hidden_window.h" | 10 #include "ui/base/win/hidden_window.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 Widget::ReparentNativeView(host_->native_view(), | 42 Widget::ReparentNativeView(host_->native_view(), |
| 43 host_->GetWidget()->GetNativeView()); | 43 host_->GetWidget()->GetNativeView()); |
| 44 host_->Layout(); | 44 host_->Layout(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void NativeViewHostWin::NativeViewDetaching(bool destroyed) { | 47 void NativeViewHostWin::NativeViewDetaching(bool destroyed) { |
| 48 if (!destroyed) { | 48 if (!destroyed) { |
| 49 if (installed_clip_) | 49 if (installed_clip_) |
| 50 UninstallClip(); | 50 UninstallClip(); |
| 51 ClearFocus(); | |
| 52 SetParent(host_->native_view(), ui::GetHiddenWindow()); | 51 SetParent(host_->native_view(), ui::GetHiddenWindow()); |
| 53 } | 52 } |
| 54 installed_clip_ = false; | 53 installed_clip_ = false; |
| 55 } | 54 } |
| 56 | 55 |
| 57 void NativeViewHostWin::AddedToWidget() { | 56 void NativeViewHostWin::AddedToWidget() { |
| 58 if (!IsWindow(host_->native_view())) | 57 if (!IsWindow(host_->native_view())) |
| 59 return; | 58 return; |
| 60 HWND parent_hwnd = GetParent(host_->native_view()); | 59 HWND parent_hwnd = GetParent(host_->native_view()); |
| 61 HWND widget_hwnd = host_->GetWidget()->GetNativeView(); | 60 HWND widget_hwnd = host_->GetWidget()->GetNativeView(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 hwnd, OBJID_CLIENT, IID_IAccessible, | 140 hwnd, OBJID_CLIENT, IID_IAccessible, |
| 142 reinterpret_cast<void**>(&accessible)); | 141 reinterpret_cast<void**>(&accessible)); |
| 143 | 142 |
| 144 if (success == S_OK) { | 143 if (success == S_OK) { |
| 145 return accessible; | 144 return accessible; |
| 146 } else { | 145 } else { |
| 147 return NULL; | 146 return NULL; |
| 148 } | 147 } |
| 149 } | 148 } |
| 150 | 149 |
| 151 void NativeViewHostWin::ClearFocus() { | |
| 152 FocusManager* focus_manager = host_->GetFocusManager(); | |
| 153 if (!focus_manager || !focus_manager->GetFocusedView()) | |
| 154 return; | |
| 155 | |
| 156 Widget::Widgets widgets; | |
| 157 Widget::GetAllChildWidgets(host_->native_view(), &widgets); | |
| 158 for (Widget::Widgets::iterator i = widgets.begin(); i != widgets.end(); ++i) { | |
| 159 focus_manager->ViewRemoved((*i)->GetRootView()); | |
| 160 if (!focus_manager->GetFocusedView()) | |
| 161 return; | |
| 162 } | |
| 163 } | |
| 164 | |
| 165 //////////////////////////////////////////////////////////////////////////////// | 150 //////////////////////////////////////////////////////////////////////////////// |
| 166 // NativeViewHostWrapper, public: | 151 // NativeViewHostWrapper, public: |
| 167 | 152 |
| 168 // static | 153 // static |
| 169 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( | 154 NativeViewHostWrapper* NativeViewHostWrapper::CreateWrapper( |
| 170 NativeViewHost* host) { | 155 NativeViewHost* host) { |
| 171 return new NativeViewHostWin(host); | 156 return new NativeViewHostWin(host); |
| 172 } | 157 } |
| 173 | 158 |
| 174 } // namespace views | 159 } // namespace views |
| OLD | NEW |