1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/passwords/manage_passwords_icon.h"
7 #include "chrome/grit/generated_resources.h"
8 #include "grit/theme_resources.h"
10 ManagePasswordsIcon::ManagePasswordsIcon()
13 state_(password_manager::ui::INACTIVE_STATE
),
17 ManagePasswordsIcon::~ManagePasswordsIcon() {
20 void ManagePasswordsIcon::SetActive(bool active
) {
21 if (active_
== active
)
28 void ManagePasswordsIcon::SetState(password_manager::ui::State state
) {
37 void ManagePasswordsIcon::UpdateIDs() {
38 // If the icon is inactive: clear out its image and tooltip and exit early.
39 if (state() == password_manager::ui::INACTIVE_STATE
) {
45 // Otherwise, start with the correct values for MANAGE_STATE, and adjust
46 // things accordingly if we're in PENDING_STATE.
47 // TODO(dconnelly): Figure out how to share the resources with Android.
48 #if !defined(OS_ANDROID)
49 icon_id_
= active() ? IDR_SAVE_PASSWORD_ACTIVE
: IDR_SAVE_PASSWORD_INACTIVE
;
50 tooltip_text_id_
= IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE
;
51 if (state() == password_manager::ui::PENDING_PASSWORD_STATE
)
52 tooltip_text_id_
= IDS_PASSWORD_MANAGER_TOOLTIP_SAVE
;