Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2742)

Unified Diff: ash/launcher/launcher.cc

Issue 9406031: Makes it so the launcher only gets focus when using the keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/launcher/launcher.cc
diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc
index 195fab78e6fe7e5e3ee53609eb49e83f367e84f4..18f16a9ee6fda8d153b0fd4becb833e74666f972 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_model.h"
#include "ash/launcher/launcher_view.h"
#include "ash/shell.h"
@@ -18,6 +19,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 {
@@ -54,6 +56,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;
@@ -66,15 +72,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()));
}
@@ -82,6 +96,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;

Powered by Google App Engine
This is Rietveld 408576698