Chromium Code Reviews| Index: ui/aura/window.cc |
| =================================================================== |
| --- ui/aura/window.cc (revision 169793) |
| +++ ui/aura/window.cc (working copy) |
| @@ -525,18 +525,20 @@ |
| } |
| void Window::Focus() { |
| - DCHECK(GetFocusManager()); |
| - GetFocusManager()->SetFocusedWindow(this, NULL); |
| + client::FocusClient* client = client::GetFocusClient(this); |
| + DCHECK(client); |
| + client->FocusWindow(this, NULL); |
| } |
| void Window::Blur() { |
| - DCHECK(GetFocusManager()); |
| - GetFocusManager()->SetFocusedWindow(NULL, NULL); |
| + client::FocusClient* client = client::GetFocusClient(this); |
| + DCHECK(client); |
| + client->FocusWindow(NULL, NULL); |
| } |
| bool Window::HasFocus() const { |
| - const FocusManager* focus_manager = GetFocusManager(); |
| - return focus_manager ? focus_manager->IsFocusedWindow(this) : false; |
| + client::FocusClient* client = client::GetFocusClient(this); |
| + return client ? client->GetFocusedWindow() == this : false; |
|
sky
2012/11/28 00:20:13
nit: return client && client->Getfocusedwindow() =
|
| } |
| bool Window::CanFocus() const { |
| @@ -565,15 +567,6 @@ |
| return parent_ && IsVisible() && parent_->CanReceiveEvents(); |
| } |
| -FocusManager* Window::GetFocusManager() { |
| - return const_cast<FocusManager*>( |
| - static_cast<const Window*>(this)->GetFocusManager()); |
| -} |
| - |
| -const FocusManager* Window::GetFocusManager() const { |
| - return parent_ ? parent_->GetFocusManager() : NULL; |
| -} |
| - |
| void Window::SetCapture() { |
| if (!IsVisible()) |
| return; |