| Index: ash/launcher/launcher.cc
|
| diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc
|
| index f38b5675e6e571d0fe64de33fbee610c3dc85072..c32eed21b06bb9f178a3b9cacfd304971cdf7799 100644
|
| --- a/ash/launcher/launcher.cc
|
| +++ b/ash/launcher/launcher.cc
|
| @@ -19,6 +19,7 @@
|
| #include "ash/wm/shelf_layout_manager.h"
|
| #include "ash/wm/window_properties.h"
|
| #include "grit/ash_resources.h"
|
| +#include "ui/aura/client/activation_client.h"
|
| #include "ui/aura/root_window.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/aura/window_observer.h"
|
| @@ -68,9 +69,16 @@ class Launcher::DelegateView : public views::WidgetDelegate,
|
| return View::GetWidget();
|
| }
|
| 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();
|
| + // Allow to activate as fallback.
|
| + if (launcher_->activating_as_fallback_ &&
|
| + Shell::GetInstance()->delegate()->IsSpokenFeedbackEnabled()) {
|
| + return true;
|
| + }
|
| + // Allow to activate from the focus cycler.
|
| + if (focus_cycler_ && focus_cycler_->widget_activating() == GetWidget())
|
| + return true;
|
| + // Disallow activating in other cases, especially when using mouse.
|
| + return false;
|
| }
|
|
|
| // BackgroundAnimatorDelegate overrides:
|
| @@ -204,7 +212,8 @@ Launcher::Launcher(aura::Window* window_container,
|
| delegate_view_(new DelegateView(this)),
|
| launcher_view_(NULL),
|
| alignment_(SHELF_ALIGNMENT_BOTTOM),
|
| - background_animator_(delegate_view_, 0, kLauncherBackgroundAlpha) {
|
| + background_animator_(delegate_view_, 0, kLauncherBackgroundAlpha),
|
| + activating_as_fallback_(false) {
|
| model_.reset(new LauncherModel);
|
| delegate_.reset(
|
| Shell::GetInstance()->delegate()->CreateLauncherDelegate(model_.get()));
|
| @@ -234,9 +243,12 @@ Launcher::Launcher(aura::Window* window_container,
|
| gfx::Size pref =
|
| static_cast<views::View*>(launcher_view_)->GetPreferredSize();
|
| widget_->SetBounds(gfx::Rect(pref));
|
| +
|
| + widget_->AddObserver(this);
|
| }
|
|
|
| Launcher::~Launcher() {
|
| + widget_->RemoveObserver(this);
|
| }
|
|
|
| // static
|
| @@ -375,6 +387,15 @@ void Launcher::SetWidgetBounds(const gfx::Rect bounds) {
|
| dimmer_->SetBounds(bounds);
|
| }
|
|
|
| +void Launcher::OnWidgetActivationChanged(views::Widget* widget, bool active) {
|
| + activating_as_fallback_ = false;
|
| + if (active) {
|
| + delegate_view_->SetPaneFocusAndFocusDefault();
|
| + } else {
|
| + delegate_view_->GetFocusManager()->ClearFocus();
|
| + }
|
| +}
|
| +
|
| internal::LauncherView* Launcher::GetLauncherViewForTest() {
|
| return launcher_view_;
|
| }
|
|
|