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

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: Merge to trunk 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
« no previous file with comments | « ash/launcher/launcher.h ('k') | ash/launcher/launcher_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher.cc
diff --git a/ash/launcher/launcher.cc b/ash/launcher/launcher.cc
index 8bcb15d17a248494226b8d138eb17735b53a8695..f0fe2539c82ddbe83db82686c167ada484dae2eb 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;
« no previous file with comments | « ash/launcher/launcher.h ('k') | ash/launcher/launcher_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698