| 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" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 tooltip_text_id_ = 0; | 34 tooltip_text_id_ = 0; |
| 35 | 35 |
| 36 SetVisible(false); | 36 SetVisible(false); |
| 37 if (ManagePasswordsBubbleView::IsShowing()) | 37 if (ManagePasswordsBubbleView::IsShowing()) |
| 38 ManagePasswordsBubbleView::CloseBubble(); | 38 ManagePasswordsBubbleView::CloseBubble(); |
| 39 return; | 39 return; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // Otherwise, start with the correct values for MANAGE_STATE, and adjust | 42 // Otherwise, start with the correct values for MANAGE_STATE, and adjust |
| 43 // things accordingly if we're either in BLACKLIST_STATE or PENDING_STATE. | 43 // things accordingly if we're either in BLACKLIST_STATE or PENDING_STATE. |
| 44 icon_id_ = active() ? IDR_SAVE_PASSWORD_ACTIVE : IDR_SAVE_PASSWORD_INACTIVE; | 44 icon_id_ = IDR_SAVE_PASSWORD; |
| 45 tooltip_text_id_ = IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE; | 45 tooltip_text_id_ = IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE; |
| 46 if (state() == password_manager::ui::BLACKLIST_STATE) | 46 if (state() == password_manager::ui::BLACKLIST_STATE) |
| 47 icon_id_ = active() ? IDR_SAVE_PASSWORD_DISABLED_ACTIVE | 47 icon_id_ = IDR_SAVE_PASSWORD_BLACKLISTED; |
| 48 : IDR_SAVE_PASSWORD_DISABLED_INACTIVE; | |
| 49 else if (password_manager::ui::IsPendingState(state())) | 48 else if (password_manager::ui::IsPendingState(state())) |
| 50 tooltip_text_id_ = IDS_PASSWORD_MANAGER_TOOLTIP_SAVE; | 49 tooltip_text_id_ = IDS_PASSWORD_MANAGER_TOOLTIP_SAVE; |
| 51 | 50 |
| 52 SetVisible(true); | 51 SetVisible(true); |
| 53 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(icon_id_)); | 52 SetImage(ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(icon_id_)); |
| 54 SetTooltipText(l10n_util::GetStringUTF16(tooltip_text_id_)); | 53 SetTooltipText(l10n_util::GetStringUTF16(tooltip_text_id_)); |
| 55 | 54 |
| 56 if (password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE) { | 55 if (password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE) { |
| 57 // We're about the automatically pop up a ManagePasswordsBubbleView. | 56 // We're about the automatically pop up a ManagePasswordsBubbleView. |
| 58 // Force layout of the icon's parent now; the bubble will be incorrectly | 57 // Force layout of the icon's parent now; the bubble will be incorrectly |
| 59 // positioned otherwise, as the icon won't have been drawn into position. | 58 // positioned otherwise, as the icon won't have been drawn into position. |
| 60 parent()->Layout(); | 59 parent()->Layout(); |
| 61 } | 60 } |
| 62 } | 61 } |
| 63 | 62 |
| 64 bool ManagePasswordsIconView::IsBubbleShowing() const { | 63 bool ManagePasswordsIconView::IsBubbleShowing() const { |
| 65 return ManagePasswordsBubbleView::IsShowing(); | 64 return ManagePasswordsBubbleView::IsShowing(); |
| 66 } | 65 } |
| 67 | 66 |
| 68 void ManagePasswordsIconView::OnExecuting( | 67 void ManagePasswordsIconView::OnExecuting( |
| 69 BubbleIconView::ExecuteSource source) { | 68 BubbleIconView::ExecuteSource source) { |
| 70 } | 69 } |
| OLD | NEW |