diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-13 20:15:19 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-13 20:15:19 +0000 |
commit | 42aa1fa0adf702861284679eba4ed236187a4272 (patch) | |
tree | c279f4e63184c78444fa77162ecaab1c2ab09d6e /ui | |
parent | a495859987b081c6cec74102e5b194d48e124d2e (diff) | |
download | chromium_src-42aa1fa0adf702861284679eba4ed236187a4272.zip chromium_src-42aa1fa0adf702861284679eba4ed236187a4272.tar.gz chromium_src-42aa1fa0adf702861284679eba4ed236187a4272.tar.bz2 |
Get more of RenderWidgetHostViewAura running.
This displays content now (software-only) on Windows, and supports Mouse Events. keyboard events are not yet working.
http://crbug.com/99757
TEST=none
Review URL: http://codereview.chromium.org/8234026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/focus_manager.h | 3 | ||||
-rw-r--r-- | ui/aura/root_window.cc | 4 | ||||
-rw-r--r-- | ui/aura/root_window.h | 1 | ||||
-rw-r--r-- | ui/aura/window.cc | 14 | ||||
-rw-r--r-- | ui/aura/window.h | 4 | ||||
-rw-r--r-- | ui/aura_shell/shell.cc | 1 |
6 files changed, 25 insertions, 2 deletions
diff --git a/ui/aura/focus_manager.h b/ui/aura/focus_manager.h index 0cd8e6f..43243c6 100644 --- a/ui/aura/focus_manager.h +++ b/ui/aura/focus_manager.h @@ -27,6 +27,9 @@ class FocusManager { // Returns the currently focused window or NULL if there is none. virtual Window* GetFocusedWindow() = 0; + // Returns true if |window| is the focused window. + virtual bool IsFocusedWindow(const Window* window) const = 0; + protected: virtual ~FocusManager() {} }; diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index 82dc37e..40a763a 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -118,6 +118,10 @@ Window* RootWindow::GetFocusedWindow() { return focused_window_; } +bool RootWindow::IsFocusedWindow(const Window* window) const { + return focused_window_ == window; +} + bool RootWindow::CanFocus() const { return IsVisible(); } diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h index 0edc057..1fea6f3 100644 --- a/ui/aura/root_window.h +++ b/ui/aura/root_window.h @@ -48,6 +48,7 @@ class RootWindow : public Window, // Overridden from FocusManager: virtual void SetFocusedWindow(Window* window) OVERRIDE; virtual Window* GetFocusedWindow() OVERRIDE; + virtual bool IsFocusedWindow(const Window* window) const OVERRIDE; // Overridden from Window: virtual bool CanFocus() const OVERRIDE; diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 07c48e6..2014f25 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -64,8 +64,8 @@ void Window::Init() { if (delegate_) type = ui::Layer::LAYER_HAS_TEXTURE; layer_.reset(new ui::Layer(Desktop::GetInstance()->compositor(), type)); - // Windows (and therefore the layer) should initially be hidden. - // Control window is visible by default. + // Windows (and therefore their layers) should initially be hidden, except for + // controls. layer_->SetVisible(type_ == kWindowType_Control); layer_->set_delegate(this); } @@ -294,6 +294,11 @@ void Window::Blur() { GetFocusManager()->SetFocusedWindow(NULL); } +bool Window::HasFocus() const { + const internal::FocusManager* focus_manager = GetFocusManager(); + return focus_manager ? focus_manager->IsFocusedWindow(this) : false; +} + // For a given window, we determine its focusability by inspecting each sibling // after it (i.e. drawn in front of it in the z-order) to see if it stops // propagation of events that would otherwise be targeted at windows behind it. @@ -314,6 +319,11 @@ bool Window::CanFocus() const { } internal::FocusManager* Window::GetFocusManager() { + return const_cast<internal::FocusManager*>( + const_cast<const Window*>(this)->GetFocusManager()); +} + +const internal::FocusManager* Window::GetFocusManager() const { return parent_ ? parent_->GetFocusManager() : NULL; } diff --git a/ui/aura/window.h b/ui/aura/window.h index 9820b29..2e13521 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -182,12 +182,16 @@ class AURA_EXPORT Window : public ui::LayerDelegate { void Focus(); void Blur(); + // Returns true if the Window is currently the focused window. + bool HasFocus() const; + // Returns true if the Window can be focused. virtual bool CanFocus() const; // Returns the FocusManager for the Window, which may be attached to a parent // Window. Can return NULL if the Window has no FocusManager. virtual internal::FocusManager* GetFocusManager(); + virtual const internal::FocusManager* GetFocusManager() const; // The Window does not own this object. void set_user_data(void* user_data) { user_data_ = user_data; } diff --git a/ui/aura_shell/shell.cc b/ui/aura_shell/shell.cc index cc815c1..afcd051 100644 --- a/ui/aura_shell/shell.cc +++ b/ui/aura_shell/shell.cc @@ -246,6 +246,7 @@ void Shell::AddChildToDefaultParent(aura::Window* window) { aura::Window* parent = NULL; switch (window->type()) { case aura::kWindowType_Toplevel: + case aura::kWindowType_Control: parent = GetContainer(internal::kShellWindowId_DefaultContainer); break; case aura::kWindowType_Menu: |