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

Unified Diff: ash/status_area/status_area_view.cc

Issue 9570013: Activate the status area only when it's focused using the keyboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new FocusCycler tests Created 8 years, 9 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/status_area/status_area_view.h ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/status_area/status_area_view.cc
diff --git a/ash/status_area/status_area_view.cc b/ash/status_area/status_area_view.cc
index fc4a8e0856484f0505178f4d58e3e16b04eb4c18..62b327b79a8e7e914e92c4a1e2d4ee01b15fd663 100644
--- a/ash/status_area/status_area_view.cc
+++ b/ash/status_area/status_area_view.cc
@@ -5,6 +5,7 @@
#include "ash/status_area/status_area_view.h"
#include "ash/ash_export.h"
+#include "ash/focus_cycler.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "base/utf_string_conversions.h"
@@ -20,11 +21,16 @@ namespace internal {
StatusAreaView::StatusAreaView()
: status_mock_(*ui::ResourceBundle::GetSharedInstance().GetImageNamed(
- IDR_AURA_STATUS_MOCK).ToSkBitmap()) {
+ IDR_AURA_STATUS_MOCK).ToSkBitmap()),
+ focus_cycler_for_testing_(NULL) {
}
StatusAreaView::~StatusAreaView() {
}
+void StatusAreaView::SetFocusCyclerForTesting(const FocusCycler* focus_cycler) {
+ focus_cycler_for_testing_ = focus_cycler;
+}
+
gfx::Size StatusAreaView::GetPreferredSize() {
return gfx::Size(status_mock_.width(), status_mock_.height());
}
@@ -37,6 +43,14 @@ const views::Widget* StatusAreaView::GetWidget() const {
return View::GetWidget();
}
+bool StatusAreaView::CanActivate() const {
+ // We don't want mouse clicks to activate us, but we need to allow
+ // activation when the user is using the keyboard (FocusCycler).
+ const FocusCycler* focus_cycler = focus_cycler_for_testing_ ?
+ focus_cycler_for_testing_ : Shell::GetInstance()->focus_cycler();
+ return focus_cycler->widget_activating() == GetWidget();
+}
+
void StatusAreaView::OnPaint(gfx::Canvas* canvas) {
canvas->DrawBitmapInt(status_mock_, 0, 0);
}
« no previous file with comments | « ash/status_area/status_area_view.h ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698