diff options
Diffstat (limited to 'ash/launcher')
-rw-r--r-- | ash/launcher/app_launcher_button.cc | 2 | ||||
-rw-r--r-- | ash/launcher/launcher.cc | 20 | ||||
-rw-r--r-- | ash/launcher/launcher.h | 7 | ||||
-rw-r--r-- | ash/launcher/launcher_view.cc | 2 | ||||
-rw-r--r-- | ash/launcher/launcher_view.h | 4 | ||||
-rw-r--r-- | ash/launcher/tabbed_launcher_button.cc | 2 |
6 files changed, 31 insertions, 6 deletions
diff --git a/ash/launcher/app_launcher_button.cc b/ash/launcher/app_launcher_button.cc index cc73255..8bcac90 100644 --- a/ash/launcher/app_launcher_button.cc +++ b/ash/launcher/app_launcher_button.cc @@ -22,7 +22,7 @@ AppLauncherButton::AppLauncherButton(views::ButtonListener* listener, host_(host) { SetImageAlignment(views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); - set_focusable(true); + set_accessibility_focusable(true); } AppLauncherButton::~AppLauncherButton() { diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc index 8bcb15d..f0fe253 100644 --- a/ash/launcher/launcher.cc +++ b/ash/launcher/launcher.cc @@ -4,6 +4,7 @@ #include "ash/launcher/launcher.h" +#include "ash/focus_cycler.h" #include "ash/launcher/launcher_delegate.h" #include "ash/launcher/launcher_model.h" #include "ash/launcher/launcher_view.h" @@ -19,6 +20,7 @@ #include "ui/views/accessible_pane_view.h" #include "ui/views/painter.h" #include "ui/views/widget/widget.h" +#include "ui/views/widget/widget_delegate.h" namespace ash { @@ -56,6 +58,10 @@ class Launcher::DelegateView : public views::WidgetDelegate, void SetStatusWidth(int width); int status_width() const { return status_width_; } + void set_focus_cycler(const internal::FocusCycler* focus_cycler) { + focus_cycler_ = focus_cycler; + } + // views::View overrides virtual gfx::Size GetPreferredSize() OVERRIDE; virtual void Layout() OVERRIDE; @@ -68,15 +74,23 @@ class Launcher::DelegateView : public views::WidgetDelegate, return View::GetWidget(); } + // views::WidgetDelegateView overrides: + virtual bool CanActivate() const OVERRIDE { + // We don't want mouse clicks to activate us, but we need to allow + // activation when the user is using the keyboard (FocusCycler). + return focus_cycler_ && focus_cycler_->widget_activating() == GetWidget(); + } private: int status_width_; + const internal::FocusCycler* focus_cycler_; DISALLOW_COPY_AND_ASSIGN(DelegateView); }; Launcher::DelegateView::DelegateView() - : status_width_(0) { + : status_width_(0), + focus_cycler_(NULL) { set_background( views::Background::CreateBackgroundPainter(true, new ShelfPainter())); } @@ -84,6 +98,10 @@ Launcher::DelegateView::DelegateView() Launcher::DelegateView::~DelegateView() { } +void Launcher::SetFocusCycler(const internal::FocusCycler* focus_cycler) { + delegate_view_->set_focus_cycler(focus_cycler); +} + void Launcher::DelegateView::SetStatusWidth(int width) { if (status_width_ == width) return; diff --git a/ash/launcher/launcher.h b/ash/launcher/launcher.h index f910367..9404d2b 100644 --- a/ash/launcher/launcher.h +++ b/ash/launcher/launcher.h @@ -20,6 +20,10 @@ class Widget; namespace ash { +namespace internal { +class FocusCycler; +} + class LauncherDelegate; class LauncherModel; @@ -28,6 +32,9 @@ class ASH_EXPORT Launcher { explicit Launcher(aura::Window* window_container); ~Launcher(); + // Sets the focus cycler. + void SetFocusCycler(const internal::FocusCycler* focus_cycler); + // Sets the width of the status area. void SetStatusWidth(int width); int GetStatusWidth(); diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index b95fcd8..061a560 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -214,7 +214,7 @@ void LauncherView::Init() { } overflow_button_ = new views::ImageButton(this); - overflow_button_->set_focusable(true); + overflow_button_->set_accessibility_focusable(true); overflow_button_->SetImage( views::CustomButton::BS_NORMAL, rb.GetImageNamed(IDR_AURA_LAUNCHER_OVERFLOW).ToSkBitmap()); diff --git a/ash/launcher/launcher_view.h b/ash/launcher/launcher_view.h index f4173b5..d505d0e 100644 --- a/ash/launcher/launcher_view.h +++ b/ash/launcher/launcher_view.h @@ -11,7 +11,7 @@ #include "ash/launcher/launcher_button_host.h" #include "ash/launcher/launcher_model_observer.h" #include "ui/views/controls/button/button.h" -#include "ui/views/widget/widget_delegate.h" +#include "ui/views/view.h" namespace views { class BoundsAnimator; @@ -29,7 +29,7 @@ class ViewModel; namespace internal { -class LauncherView : public views::WidgetDelegateView, +class LauncherView : public views::View, public LauncherModelObserver, public views::ButtonListener, public LauncherButtonHost { diff --git a/ash/launcher/tabbed_launcher_button.cc b/ash/launcher/tabbed_launcher_button.cc index 84d061e..c947144 100644 --- a/ash/launcher/tabbed_launcher_button.cc +++ b/ash/launcher/tabbed_launcher_button.cc @@ -65,7 +65,7 @@ TabbedLauncherButton::TabbedLauncherButton(views::ButtonListener* listener, } SetImageAlignment(views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); - set_focusable(true); + set_accessibility_focusable(true); } TabbedLauncherButton::~TabbedLauncherButton() { |