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/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" | |
7 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" | 8 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h" |
8 #include "grit/generated_resources.h" | 9 #include "grit/generated_resources.h" |
9 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 11 #include "ui/base/accessibility/accessible_view_state.h" |
11 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
12 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
13 | 14 |
14 ManagePasswordsIconView::ManagePasswordsIconView( | 15 ManagePasswordsIconView::ManagePasswordsIconView( |
15 LocationBarView::Delegate* location_bar_delegate) | 16 LocationBarView::Delegate* location_bar_delegate) |
16 : location_bar_delegate_(location_bar_delegate) { | 17 : location_bar_delegate_(location_bar_delegate) { |
17 set_accessibility_focusable(true); | 18 set_accessibility_focusable(true); |
18 Update(NULL); | 19 Update(NULL); |
19 LocationBarView::InitTouchableLocationBarChildView(this); | 20 LocationBarView::InitTouchableLocationBarChildView(this); |
20 } | 21 } |
21 | 22 |
22 ManagePasswordsIconView::~ManagePasswordsIconView() {} | 23 ManagePasswordsIconView::~ManagePasswordsIconView() {} |
23 | 24 |
24 void ManagePasswordsIconView::Update( | 25 void ManagePasswordsIconView::Update( |
25 ManagePasswordsIconController* manage_passwords_icon_controller) { | 26 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller) { |
26 SetVisible( | 27 SetVisible(manage_passwords_bubble_ui_controller && |
27 manage_passwords_icon_controller && | 28 manage_passwords_bubble_ui_controller->manage_passwords_icon_to_be_shown() |
28 manage_passwords_icon_controller->manage_passwords_icon_to_be_shown() && | 29 && !location_bar_delegate_->GetToolbarModel()->input_in_progress()); |
Garrett Casto
2013/12/02 22:28:49
You should be consistent about how you break lines
npentrel
2013/12/03 10:00:25
Done.
| |
29 !location_bar_delegate_->GetToolbarModel()->input_in_progress()); | |
30 if (!visible()) { | 30 if (!visible()) { |
31 ManagePasswordsBubbleView::CloseBubble(); | 31 ManagePasswordsBubbleView::CloseBubble(); |
32 return; | 32 return; |
33 } | 33 } |
34 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 34 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
35 IDR_SAVE_PASSWORD)); | 35 IDR_SAVE_PASSWORD)); |
36 SetTooltip(manage_passwords_icon_controller->password_to_be_saved()); | 36 SetTooltip(manage_passwords_bubble_ui_controller->password_to_be_saved()); |
37 } | 37 } |
38 | 38 |
39 void ManagePasswordsIconView::ShowBubbleIfNeeded( | 39 void ManagePasswordsIconView::ShowBubbleIfNeeded( |
40 ManagePasswordsIconController* manage_passwords_icon_controller) { | 40 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller) { |
41 if (manage_passwords_icon_controller-> | 41 if (manage_passwords_bubble_ui_controller-> |
42 manage_passwords_bubble_needs_showing() && | 42 manage_passwords_bubble_needs_showing() && visible() && |
43 visible() && !ManagePasswordsBubbleView::IsShowing()) { | 43 !ManagePasswordsBubbleView::IsShowing()) { |
Garrett Casto
2013/12/02 22:28:49
Break after "&&" here as well. So
manage_passwor
npentrel
2013/12/03 10:00:25
Done.
| |
44 ManagePasswordsBubbleView::ShowBubble( | 44 ManagePasswordsBubbleView::ShowBubble( |
45 location_bar_delegate_->GetWebContents(), this); | 45 location_bar_delegate_->GetWebContents(), this); |
46 manage_passwords_icon_controller->OnBubbleShown(); | 46 manage_passwords_bubble_ui_controller->OnBubbleShown(); |
47 } | 47 } |
48 } | 48 } |
49 | 49 |
50 void ManagePasswordsIconView::SetTooltip(bool password_to_be_saved) { | 50 void ManagePasswordsIconView::SetTooltip(bool password_to_be_saved) { |
51 SetTooltipText(l10n_util::GetStringUTF16( | 51 SetTooltipText(l10n_util::GetStringUTF16( |
52 (password_to_be_saved ? | 52 (password_to_be_saved ? |
53 IDS_PASSWORD_MANAGER_TOOLTIP_SAVE : | 53 IDS_PASSWORD_MANAGER_TOOLTIP_SAVE : |
54 IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE))); | 54 IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE))); |
55 } | 55 } |
56 | 56 |
(...skipping 15 matching lines...) Expand all Loading... | |
72 bool ManagePasswordsIconView::OnMousePressed(const ui::MouseEvent& event) { | 72 bool ManagePasswordsIconView::OnMousePressed(const ui::MouseEvent& event) { |
73 // Do nothing until the mouse button is released. | 73 // Do nothing until the mouse button is released. |
74 return true; | 74 return true; |
75 } | 75 } |
76 | 76 |
77 void ManagePasswordsIconView::OnMouseReleased(const ui::MouseEvent& event) { | 77 void ManagePasswordsIconView::OnMouseReleased(const ui::MouseEvent& event) { |
78 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) | 78 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) |
79 ManagePasswordsBubbleView::ShowBubble( | 79 ManagePasswordsBubbleView::ShowBubble( |
80 location_bar_delegate_->GetWebContents(), this); | 80 location_bar_delegate_->GetWebContents(), this); |
81 } | 81 } |
OLD | NEW |