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

Side by Side Diff: chrome/browser/ui/views/passwords/manage_passwords_icon_view.cc

Issue 440903002: Password "key" icon in the omnibox should be focusable. If the bubble is open then it automatically… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h" 5 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/command_updater.h" 8 #include "chrome/browser/command_updater.h"
9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 9 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
10 #include "chrome/browser/ui/view_ids.h" 10 #include "chrome/browser/ui/view_ids.h"
11 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" 11 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
12 #include "components/password_manager/core/common/password_manager_ui.h" 12 #include "components/password_manager/core/common/password_manager_ui.h"
13 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
14 #include "grit/theme_resources.h" 14 #include "grit/theme_resources.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
17 17
18 ManagePasswordsIconView::ManagePasswordsIconView(CommandUpdater* updater) 18 ManagePasswordsIconView::ManagePasswordsIconView(CommandUpdater* updater)
19 : BubbleIconView(updater, IDC_MANAGE_PASSWORDS_FOR_PAGE), 19 : BubbleIconView(updater, IDC_MANAGE_PASSWORDS_FOR_PAGE),
20 icon_id_(0), 20 icon_id_(0),
21 tooltip_text_id_(0) { 21 tooltip_text_id_(0) {
22 set_id(VIEW_ID_MANAGE_PASSWORDS_ICON_BUTTON); 22 set_id(VIEW_ID_MANAGE_PASSWORDS_ICON_BUTTON);
23 SetAccessibilityFocusable(true); 23 SetFocusable(true);
Mike West 2014/08/05 16:42:24 What's the difference?
vasilii 2014/08/06 09:14:01 AccessibilityFocusable means focusable for accessi
24 UpdateVisibleUI(); 24 UpdateVisibleUI();
25 } 25 }
26 26
27 ManagePasswordsIconView::~ManagePasswordsIconView() {} 27 ManagePasswordsIconView::~ManagePasswordsIconView() {}
28 28
29 void ManagePasswordsIconView::UpdateVisibleUI() { 29 void ManagePasswordsIconView::UpdateVisibleUI() {
30 // If the icon is inactive: clear out it's image and tooltip, hide the icon, 30 // If the icon is inactive: clear out it's image and tooltip, hide the icon,
31 // close any active bubble, and exit early. 31 // close any active bubble, and exit early.
32 if (state() == password_manager::ui::INACTIVE_STATE) { 32 if (state() == password_manager::ui::INACTIVE_STATE) {
33 icon_id_ = 0; 33 icon_id_ = 0;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void ManagePasswordsIconView::OnExecuting( 68 void ManagePasswordsIconView::OnExecuting(
69 BubbleIconView::ExecuteSource source) { 69 BubbleIconView::ExecuteSource source) {
70 } 70 }
71 71
72 bool ManagePasswordsIconView::OnMousePressed(const ui::MouseEvent& event) { 72 bool ManagePasswordsIconView::OnMousePressed(const ui::MouseEvent& event) {
73 bool result = BubbleIconView::OnMousePressed(event); 73 bool result = BubbleIconView::OnMousePressed(event);
74 if (IsBubbleShowing()) 74 if (IsBubbleShowing())
75 ManagePasswordsBubbleView::CloseBubble(); 75 ManagePasswordsBubbleView::CloseBubble();
76 return result; 76 return result;
77 } 77 }
78
79 bool ManagePasswordsIconView::OnKeyPressed(const ui::KeyEvent& event) {
80 // Space is always ignored because otherwise the bubble appears with the
81 // default button down. Releasing the space is equivalent to clicking this
82 // button.
83 if (event.key_code() == ui::VKEY_SPACE)
84 return true;
85 if (event.key_code() == ui::VKEY_RETURN && active()) {
86 // If the icon is active, it should transfer its focus to the bubble.
87 // If it still somehow got this key event, the bubble shouldn't be reopened.
88 return true;
89 }
90 return BubbleIconView::OnKeyPressed(event);
91 }
92
93 void ManagePasswordsIconView::AboutToRequestFocusFromTabTraversal(
94 bool reverse) {
95 if (active())
Mike West 2014/08/05 16:41:55 You need to check reverse here. Otherwise shift-ta
vasilii 2014/08/06 09:14:01 Shift-Tab is fine. The focus goes to the bubble to
Mike West 2014/08/06 09:17:46 If I shift-tab out of the bubble, what happens? Pe
96 ManagePasswordsBubbleView::ActivateBubble();
97 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698