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

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: adding controller files 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_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 ManagePasswordsController* manage_passwords_controller) {
26 SetVisible( 27 SetVisible(manage_passwords_controller &&
27 manage_passwords_icon_controller && 28 manage_passwords_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());
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_controller->password_to_be_saved());
37 } 37 }
38 38
39 void ManagePasswordsIconView::ShowBubbleIfNeeded( 39 void ManagePasswordsIconView::ShowBubbleIfNeeded(
40 ManagePasswordsIconController* manage_passwords_icon_controller) { 40 ManagePasswordsController* manage_passwords_controller) {
41 if (manage_passwords_icon_controller-> 41 if (manage_passwords_controller->manage_passwords_bubble_needs_showing() &&
42 manage_passwords_bubble_needs_showing() &&
43 visible() && !ManagePasswordsBubbleView::IsShowing()) { 42 visible() && !ManagePasswordsBubbleView::IsShowing()) {
44 ManagePasswordsBubbleView::ShowBubble( 43 ManagePasswordsBubbleView::ShowBubble(
45 location_bar_delegate_->GetWebContents(), this); 44 location_bar_delegate_->GetWebContents(), this);
46 manage_passwords_icon_controller->OnBubbleShown(); 45 manage_passwords_controller->OnBubbleShown();
47 } 46 }
48 } 47 }
49 48
50 void ManagePasswordsIconView::SetTooltip(bool password_to_be_saved) { 49 void ManagePasswordsIconView::SetTooltip(bool password_to_be_saved) {
51 SetTooltipText(l10n_util::GetStringUTF16( 50 SetTooltipText(l10n_util::GetStringUTF16(
52 (password_to_be_saved ? 51 (password_to_be_saved ?
53 IDS_PASSWORD_MANAGER_TOOLTIP_SAVE : 52 IDS_PASSWORD_MANAGER_TOOLTIP_SAVE :
54 IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE))); 53 IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE)));
55 } 54 }
56 55
(...skipping 15 matching lines...) Expand all
72 bool ManagePasswordsIconView::OnMousePressed(const ui::MouseEvent& event) { 71 bool ManagePasswordsIconView::OnMousePressed(const ui::MouseEvent& event) {
73 // Do nothing until the mouse button is released. 72 // Do nothing until the mouse button is released.
74 return true; 73 return true;
75 } 74 }
76 75
77 void ManagePasswordsIconView::OnMouseReleased(const ui::MouseEvent& event) { 76 void ManagePasswordsIconView::OnMouseReleased(const ui::MouseEvent& event) {
78 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location())) 77 if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location()))
79 ManagePasswordsBubbleView::ShowBubble( 78 ManagePasswordsBubbleView::ShowBubble(
80 location_bar_delegate_->GetWebContents(), this); 79 location_bar_delegate_->GetWebContents(), this);
81 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698