OLD | NEW |
---|---|
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 "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 | 15 |
16 ManagePasswordsIconView::ManagePasswordsIconView(CommandUpdater* updater) | 16 ManagePasswordsIconView::ManagePasswordsIconView(CommandUpdater* updater) |
17 : BubbleIconView(updater, IDC_MANAGE_PASSWORDS_FOR_PAGE) { | 17 : BubbleIconView(updater, IDC_MANAGE_PASSWORDS_FOR_PAGE) { |
18 set_id(VIEW_ID_MANAGE_PASSWORDS_ICON_BUTTON); | 18 set_id(VIEW_ID_MANAGE_PASSWORDS_ICON_BUTTON); |
19 SetFocusable(true); | 19 SetFocusable(true); |
20 UpdateVisibleUI(); | |
Mike West
2014/09/12 11:03:50
Did this call cause problems?
vasilii
2014/09/12 12:29:58
No, but it doesn't belong here. Setting visibility
| |
21 } | 20 } |
22 | 21 |
23 ManagePasswordsIconView::~ManagePasswordsIconView() {} | 22 ManagePasswordsIconView::~ManagePasswordsIconView() {} |
24 | 23 |
25 void ManagePasswordsIconView::UpdateVisibleUI() { | 24 void ManagePasswordsIconView::UpdateVisibleUI() { |
26 if (state() == password_manager::ui::INACTIVE_STATE) { | 25 if (state() == password_manager::ui::INACTIVE_STATE) { |
27 SetVisible(false); | 26 SetVisible(false); |
28 if (ManagePasswordsBubbleView::IsShowing()) | 27 if (ManagePasswordsBubbleView::IsShowing()) |
29 ManagePasswordsBubbleView::CloseBubble(); | 28 ManagePasswordsBubbleView::CloseBubble(); |
30 return; | 29 return; |
31 } | 30 } |
32 | 31 |
32 ManagePasswordsBubbleView::CloseBubbleForInactiveTab(); | |
Mike West
2014/09/12 11:03:50
This seems a bit roundabout, and platform-specific
dconnelly
2014/09/12 11:15:26
This bug doesn't appear on Mac (https://code.googl
vasilii
2014/09/12 12:29:58
Mike, to make it cross platform we need cross plat
dconnelly
2014/09/12 12:31:41
This would be pretty straightforward to add to the
| |
33 SetVisible(true); | 33 SetVisible(true); |
34 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(icon_id_)); | 34 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(icon_id_)); |
35 SetTooltipText(l10n_util::GetStringUTF16(tooltip_text_id_)); | 35 SetTooltipText(l10n_util::GetStringUTF16(tooltip_text_id_)); |
36 | 36 |
37 // We may be about to automatically pop up a ManagePasswordsBubbleView. | 37 // We may be about to automatically pop up a ManagePasswordsBubbleView. |
38 // Force layout of the icon's parent now; the bubble will be incorrectly | 38 // Force layout of the icon's parent now; the bubble will be incorrectly |
39 // positioned otherwise, as the icon won't have been drawn into position. | 39 // positioned otherwise, as the icon won't have been drawn into position. |
40 parent()->Layout(); | 40 parent()->Layout(); |
41 } | 41 } |
42 | 42 |
(...skipping 26 matching lines...) Expand all Loading... | |
69 return true; | 69 return true; |
70 } | 70 } |
71 return BubbleIconView::OnKeyPressed(event); | 71 return BubbleIconView::OnKeyPressed(event); |
72 } | 72 } |
73 | 73 |
74 void ManagePasswordsIconView::AboutToRequestFocusFromTabTraversal( | 74 void ManagePasswordsIconView::AboutToRequestFocusFromTabTraversal( |
75 bool reverse) { | 75 bool reverse) { |
76 if (active()) | 76 if (active()) |
77 ManagePasswordsBubbleView::ActivateBubble(); | 77 ManagePasswordsBubbleView::ActivateBubble(); |
78 } | 78 } |
OLD | NEW |