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

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

Issue 87853004: Refactoring Manage Passwords Bubble Code to exclude TabSpecificContentSettings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@movingclasses
Patch Set: Android fix Created 7 years 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
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/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->
28 manage_passwords_icon_controller->manage_passwords_icon_to_be_shown() && 29 manage_passwords_icon_to_be_shown() &&
29 !location_bar_delegate_->GetToolbarModel()->input_in_progress()); 30 !location_bar_delegate_->GetToolbarModel()->input_in_progress());
30 if (!visible()) { 31 if (!visible()) {
31 ManagePasswordsBubbleView::CloseBubble(); 32 ManagePasswordsBubbleView::CloseBubble();
32 return; 33 return;
33 } 34 }
34 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 35 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
35 IDR_SAVE_PASSWORD)); 36 IDR_SAVE_PASSWORD));
36 SetTooltip(manage_passwords_icon_controller->password_to_be_saved()); 37 SetTooltip(manage_passwords_bubble_ui_controller->password_to_be_saved());
37 } 38 }
38 39
39 void ManagePasswordsIconView::ShowBubbleIfNeeded( 40 void ManagePasswordsIconView::ShowBubbleIfNeeded(
40 ManagePasswordsIconController* manage_passwords_icon_controller) { 41 ManagePasswordsBubbleUIController* manage_passwords_bubble_ui_controller) {
41 if (manage_passwords_icon_controller-> 42 if (manage_passwords_bubble_ui_controller->
42 manage_passwords_bubble_needs_showing() && 43 manage_passwords_bubble_needs_showing() &&
43 visible() && !ManagePasswordsBubbleView::IsShowing()) { 44 visible() &&
45 !ManagePasswordsBubbleView::IsShowing()) {
44 ManagePasswordsBubbleView::ShowBubble( 46 ManagePasswordsBubbleView::ShowBubble(
45 location_bar_delegate_->GetWebContents(), this); 47 location_bar_delegate_->GetWebContents(), this);
46 manage_passwords_icon_controller->OnBubbleShown(); 48 manage_passwords_bubble_ui_controller->OnBubbleShown();
47 } 49 }
48 } 50 }
49 51
50 void ManagePasswordsIconView::SetTooltip(bool password_to_be_saved) { 52 void ManagePasswordsIconView::SetTooltip(bool password_to_be_saved) {
51 SetTooltipText(l10n_util::GetStringUTF16( 53 SetTooltipText(l10n_util::GetStringUTF16(
52 (password_to_be_saved ? 54 (password_to_be_saved ?
53 IDS_PASSWORD_MANAGER_TOOLTIP_SAVE : 55 IDS_PASSWORD_MANAGER_TOOLTIP_SAVE :
54 IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE))); 56 IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE)));
55 } 57 }
56 58
(...skipping 15 matching lines...) Expand all
72 bool ManagePasswordsIconView::OnMousePressed(const ui::MouseEvent& event) { 74 bool ManagePasswordsIconView::OnMousePressed(const ui::MouseEvent& event) {
73 // Do nothing until the mouse button is released. 75 // Do nothing until the mouse button is released.
74 return true; 76 return true;
75 } 77 }
76 78
77 void ManagePasswordsIconView::OnMouseReleased(const ui::MouseEvent& event) { 79 void ManagePasswordsIconView::OnMouseReleased(const ui::MouseEvent& event) {
78 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) 80 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location()))
79 ManagePasswordsBubbleView::ShowBubble( 81 ManagePasswordsBubbleView::ShowBubble(
80 location_bar_delegate_->GetWebContents(), this); 82 location_bar_delegate_->GetWebContents(), this);
81 } 83 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/passwords/manage_passwords_icon_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698