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/aura/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 } | 668 } |
669 return topmost_window_with_delegate; | 669 return topmost_window_with_delegate; |
670 } | 670 } |
671 | 671 |
672 void Window::Focus() { | 672 void Window::Focus() { |
673 client::FocusClient* client = client::GetFocusClient(this); | 673 client::FocusClient* client = client::GetFocusClient(this); |
674 DCHECK(client); | 674 DCHECK(client); |
675 client->FocusWindow(this); | 675 client->FocusWindow(this); |
676 } | 676 } |
677 | 677 |
678 void Window::Blur() { | |
679 client::FocusClient* client = client::GetFocusClient(this); | |
680 DCHECK(client); | |
681 client->FocusWindow(NULL); | |
682 } | |
683 | |
684 bool Window::HasFocus() const { | 678 bool Window::HasFocus() const { |
685 client::FocusClient* client = client::GetFocusClient(this); | 679 client::FocusClient* client = client::GetFocusClient(this); |
686 return client && client->GetFocusedWindow() == this; | 680 return client && client->GetFocusedWindow() == this; |
687 } | 681 } |
688 | 682 |
689 bool Window::CanFocus() const { | 683 bool Window::CanFocus() const { |
690 if (IsRootWindow()) | 684 if (IsRootWindow()) |
691 return IsVisible(); | 685 return IsVisible(); |
692 | 686 |
693 // NOTE: as part of focusing the window the ActivationClient may make the | 687 // NOTE: as part of focusing the window the ActivationClient may make the |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 return window; | 1401 return window; |
1408 if (offset) | 1402 if (offset) |
1409 *offset += window->bounds().OffsetFromOrigin(); | 1403 *offset += window->bounds().OffsetFromOrigin(); |
1410 } | 1404 } |
1411 if (offset) | 1405 if (offset) |
1412 *offset = gfx::Vector2d(); | 1406 *offset = gfx::Vector2d(); |
1413 return NULL; | 1407 return NULL; |
1414 } | 1408 } |
1415 | 1409 |
1416 } // namespace aura | 1410 } // namespace aura |
OLD | NEW |