summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-11 09:03:34 +0000
committermkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-11 09:03:34 +0000
commit39043bcd80d418b4ecd63de46e882f8605286e1b (patch)
tree263b02dc42b934eb621a4a406557c3a00f452444 /chrome
parent600eaf4e37add2a5b8448c0fd9c569b354d39f90 (diff)
downloadchromium_src-39043bcd80d418b4ecd63de46e882f8605286e1b.zip
chromium_src-39043bcd80d418b4ecd63de46e882f8605286e1b.tar.gz
chromium_src-39043bcd80d418b4ecd63de46e882f8605286e1b.tar.bz2
Password bubble: Add an "active" icon state, and a new disabled icon.
------------------------------------------------------------------------ This is a re-land of r276284, which was reverted due to test breakage. The original review is https://codereview.chromium.org/324853004/ ------------------------------------------------------------------------ BUG=261628 TBR=oshima@chromium.org, vabr@chromium.org Review URL: https://codereview.chromium.org/322253006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276311 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/theme/default_100_percent/common/blocked_save_passwords.pngbin398 -> 0 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/save_password.pngbin169 -> 0 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/save_password_active.pngbin0 -> 222 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/save_password_disabled_active.pngbin0 -> 1168 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/save_password_disabled_inactive.pngbin0 -> 1168 bytes
-rw-r--r--chrome/app/theme/default_100_percent/common/save_password_inactive.pngbin0 -> 222 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/blocked_save_passwords.pngbin920 -> 0 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/save_password.pngbin410 -> 0 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/save_password_active.pngbin0 -> 312 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/save_password_disabled_active.pngbin0 -> 1306 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/save_password_disabled_inactive.pngbin0 -> 1319 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/save_password_inactive.pngbin0 -> 312 bytes
-rw-r--r--chrome/app/theme/theme_resources.grd6
-rw-r--r--chrome/browser/ui/passwords/manage_passwords_icon.cc10
-rw-r--r--chrome/browser/ui/passwords/manage_passwords_icon.h4
-rw-r--r--chrome/browser/ui/passwords/manage_passwords_ui_controller.cc4
-rw-r--r--chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc19
-rw-r--r--chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h4
-rw-r--r--chrome/browser/ui/views/passwords/manage_passwords_icon_view.cc5
-rw-r--r--chrome/browser/ui/views/passwords/manage_passwords_icon_view_browsertest.cc21
20 files changed, 55 insertions, 18 deletions
diff --git a/chrome/app/theme/default_100_percent/common/blocked_save_passwords.png b/chrome/app/theme/default_100_percent/common/blocked_save_passwords.png
deleted file mode 100644
index 8e5ce21..0000000
--- a/chrome/app/theme/default_100_percent/common/blocked_save_passwords.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/save_password.png b/chrome/app/theme/default_100_percent/common/save_password.png
deleted file mode 100644
index 63829ef..0000000
--- a/chrome/app/theme/default_100_percent/common/save_password.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/save_password_active.png b/chrome/app/theme/default_100_percent/common/save_password_active.png
new file mode 100644
index 0000000..a297a93
--- /dev/null
+++ b/chrome/app/theme/default_100_percent/common/save_password_active.png
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/save_password_disabled_active.png b/chrome/app/theme/default_100_percent/common/save_password_disabled_active.png
new file mode 100644
index 0000000..a19061a
--- /dev/null
+++ b/chrome/app/theme/default_100_percent/common/save_password_disabled_active.png
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/save_password_disabled_inactive.png b/chrome/app/theme/default_100_percent/common/save_password_disabled_inactive.png
new file mode 100644
index 0000000..223a80d
--- /dev/null
+++ b/chrome/app/theme/default_100_percent/common/save_password_disabled_inactive.png
Binary files differ
diff --git a/chrome/app/theme/default_100_percent/common/save_password_inactive.png b/chrome/app/theme/default_100_percent/common/save_password_inactive.png
new file mode 100644
index 0000000..a2392af
--- /dev/null
+++ b/chrome/app/theme/default_100_percent/common/save_password_inactive.png
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/blocked_save_passwords.png b/chrome/app/theme/default_200_percent/common/blocked_save_passwords.png
deleted file mode 100644
index 30a5328..0000000
--- a/chrome/app/theme/default_200_percent/common/blocked_save_passwords.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/save_password.png b/chrome/app/theme/default_200_percent/common/save_password.png
deleted file mode 100644
index 9e192fe..0000000
--- a/chrome/app/theme/default_200_percent/common/save_password.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/save_password_active.png b/chrome/app/theme/default_200_percent/common/save_password_active.png
new file mode 100644
index 0000000..c911c2e
--- /dev/null
+++ b/chrome/app/theme/default_200_percent/common/save_password_active.png
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/save_password_disabled_active.png b/chrome/app/theme/default_200_percent/common/save_password_disabled_active.png
new file mode 100644
index 0000000..f98563c
--- /dev/null
+++ b/chrome/app/theme/default_200_percent/common/save_password_disabled_active.png
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/save_password_disabled_inactive.png b/chrome/app/theme/default_200_percent/common/save_password_disabled_inactive.png
new file mode 100644
index 0000000..43ce6f8
--- /dev/null
+++ b/chrome/app/theme/default_200_percent/common/save_password_disabled_inactive.png
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/save_password_inactive.png b/chrome/app/theme/default_200_percent/common/save_password_inactive.png
new file mode 100644
index 0000000..8585993
--- /dev/null
+++ b/chrome/app/theme/default_200_percent/common/save_password_inactive.png
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index 7bb6672..afc3fc2 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -107,8 +107,6 @@
<structure type="chrome_scaled_image" name="IDR_BLOCKED_JAVASCRIPT" file="common/blocked_script.png" />
<structure type="chrome_scaled_image" name="IDR_BLOCKED_LOCATION" file="common/blocked_location.png" />
<structure type="chrome_scaled_image" name="IDR_BLOCKED_MEDIA" file="common/blocked_media.png" />
- <structure type="chrome_scaled_image" name="IDR_SAVE_PASSWORD" file="common/save_password.png" />
- <structure type="chrome_scaled_image" name="IDR_SAVE_PASSWORD_BLACKLISTED" file="common/blocked_save_passwords.png" />
<structure type="chrome_scaled_image" name="IDR_BLOCKED_MIDI_SYSEX" file="common/blocked_midi.png" />
<structure type="chrome_scaled_image" name="IDR_BLOCKED_MOUSE_CURSOR" file="common/blocked_mouse_cursor.png" />
<structure type="chrome_scaled_image" name="IDR_BLOCKED_MIXED_CONTENT" file="common/blocked_mixed_content.png" />
@@ -890,6 +888,10 @@
<structure type="chrome_scaled_image" name="IDR_SAD_FAVICON" file="common/favicon_sad_tab.png" />
<structure type="chrome_scaled_image" name="IDR_SAD_TAB" file="common/sadtab.png" />
<structure type="chrome_scaled_image" name="IDR_SAFEBROWSING_WARNING" file="common/safebrowsing_warning.png" />
+ <structure type="chrome_scaled_image" name="IDR_SAVE_PASSWORD_ACTIVE" file="common/save_password_active.png" />
+ <structure type="chrome_scaled_image" name="IDR_SAVE_PASSWORD_DISABLED_ACTIVE" file="common/save_password_disabled_active.png" />
+ <structure type="chrome_scaled_image" name="IDR_SAVE_PASSWORD_DISABLED_INACTIVE" file="common/save_password_disabled_inactive.png" />
+ <structure type="chrome_scaled_image" name="IDR_SAVE_PASSWORD_INACTIVE" file="common/save_password_inactive.png" />
<structure type="chrome_scaled_image" name="IDR_SCREEN_CAPTURE_NOTIFICATION_GRIP" file="screen_capture_notification_grip.png" />
<structure type="chrome_scaled_image" name="IDR_SCREENSHOT_NOTIFICATION_ICON" file="common/notification_screenshot_icon.png" />
<if expr="chromeos">
diff --git a/chrome/browser/ui/passwords/manage_passwords_icon.cc b/chrome/browser/ui/passwords/manage_passwords_icon.cc
index cba65c1..26f2a01 100644
--- a/chrome/browser/ui/passwords/manage_passwords_icon.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_icon.cc
@@ -5,12 +5,20 @@
#include "chrome/browser/ui/passwords/manage_passwords_icon.h"
ManagePasswordsIcon::ManagePasswordsIcon()
- : state_(password_manager::ui::INACTIVE_STATE) {
+ : state_(password_manager::ui::INACTIVE_STATE),
+ active_(false) {
}
ManagePasswordsIcon::~ManagePasswordsIcon() {
}
+void ManagePasswordsIcon::SetActive(bool active) {
+ if (active_ == active)
+ return;
+ active_ = active;
+ UpdateVisibleUI();
+}
+
void ManagePasswordsIcon::SetState(password_manager::ui::State state) {
if (state_ == state)
return;
diff --git a/chrome/browser/ui/passwords/manage_passwords_icon.h b/chrome/browser/ui/passwords/manage_passwords_icon.h
index 76daed5..74f8d5b 100644
--- a/chrome/browser/ui/passwords/manage_passwords_icon.h
+++ b/chrome/browser/ui/passwords/manage_passwords_icon.h
@@ -17,6 +17,9 @@ class ManagePasswordsIcon {
void SetState(password_manager::ui::State state);
password_manager::ui::State state() const { return state_; }
+ void SetActive(bool active);
+ bool active() const { return active_; }
+
protected:
ManagePasswordsIcon();
~ManagePasswordsIcon();
@@ -27,6 +30,7 @@ class ManagePasswordsIcon {
private:
password_manager::ui::State state_;
+ bool active_;
DISALLOW_COPY_AND_ASSIGN(ManagePasswordsIcon);
};
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
index 3bf1d8c..9cbd290 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -109,10 +109,8 @@ void ManagePasswordsUIController::OnLoginsChanged(
if (it->type() == password_manager::PasswordStoreChange::REMOVE) {
password_form_map_.erase(changed_form.username_value);
- if (changed_form.blacklisted_by_user) {
- DCHECK(state_ == password_manager::ui::BLACKLIST_STATE);
+ if (changed_form.blacklisted_by_user)
state_ = password_manager::ui::MANAGE_STATE;
- }
} else {
new_password_forms_.push_back(new autofill::PasswordForm(changed_form));
password_form_map_[changed_form.username_value] =
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
index 27a9007..19b98dd 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -373,8 +373,10 @@ void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents,
BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
bool is_fullscreen = browser_view->IsFullscreen();
- views::View* anchor_view = is_fullscreen ?
- NULL : browser_view->GetLocationBarView()->manage_passwords_icon_view();
+ ManagePasswordsIconView* anchor_view =
+ is_fullscreen
+ ? NULL
+ : browser_view->GetLocationBarView()->manage_passwords_icon_view();
manage_passwords_bubble_ = new ManagePasswordsBubbleView(
web_contents, anchor_view, reason);
@@ -390,7 +392,6 @@ void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents,
manage_passwords_bubble_->AdjustForFullscreen(
browser_view->GetBoundsInScreen());
}
-
manage_passwords_bubble_->GetWidget()->Show();
manage_passwords_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
}
@@ -410,18 +411,24 @@ bool ManagePasswordsBubbleView::IsShowing() {
ManagePasswordsBubbleView::ManagePasswordsBubbleView(
content::WebContents* web_contents,
- views::View* anchor_view,
+ ManagePasswordsIconView* anchor_view,
DisplayReason reason)
: ManagePasswordsBubble(web_contents, reason),
BubbleDelegateView(anchor_view,
anchor_view ? views::BubbleBorder::TOP_RIGHT
- : views::BubbleBorder::NONE) {
+ : views::BubbleBorder::NONE),
+ anchor_view_(anchor_view) {
// Compensate for built-in vertical padding in the anchor view's image.
set_anchor_view_insets(gfx::Insets(2, 0, 2, 0));
set_notify_enter_exit_on_child(true);
+ if (anchor_view)
+ anchor_view->SetActive(true);
}
-ManagePasswordsBubbleView::~ManagePasswordsBubbleView() {}
+ManagePasswordsBubbleView::~ManagePasswordsBubbleView() {
+ if (anchor_view_)
+ anchor_view_->SetActive(false);
+}
void ManagePasswordsBubbleView::AdjustForFullscreen(
const gfx::Rect& screen_bounds) {
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h
index c79d92a..efb9ec5 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h
@@ -122,7 +122,7 @@ class ManagePasswordsBubbleView : public ManagePasswordsBubble,
private:
ManagePasswordsBubbleView(content::WebContents* web_contents,
- views::View* anchor_view,
+ ManagePasswordsIconView* anchor_view,
DisplayReason reason);
virtual ~ManagePasswordsBubbleView();
@@ -144,6 +144,8 @@ class ManagePasswordsBubbleView : public ManagePasswordsBubble,
// shown twice at the same time.
static ManagePasswordsBubbleView* manage_passwords_bubble_;
+ ManagePasswordsIconView* anchor_view_;
+
DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubbleView);
};
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_icon_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_icon_view.cc
index 72e3002..42457d0 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_icon_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_icon_view.cc
@@ -41,10 +41,11 @@ void ManagePasswordsIconView::UpdateVisibleUI() {
// Otherwise, start with the correct values for MANAGE_STATE, and adjust
// things accordingly if we're either in BLACKLIST_STATE or PENDING_STATE.
- icon_id_ = IDR_SAVE_PASSWORD;
+ icon_id_ = active() ? IDR_SAVE_PASSWORD_ACTIVE : IDR_SAVE_PASSWORD_INACTIVE;
tooltip_text_id_ = IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE;
if (state() == password_manager::ui::BLACKLIST_STATE)
- icon_id_ = IDR_SAVE_PASSWORD_BLACKLISTED;
+ icon_id_ = active() ? IDR_SAVE_PASSWORD_DISABLED_ACTIVE
+ : IDR_SAVE_PASSWORD_DISABLED_INACTIVE;
else if (password_manager::ui::IsPendingState(state()))
tooltip_text_id_ = IDS_PASSWORD_MANAGER_TOOLTIP_SAVE;
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_icon_view_browsertest.cc b/chrome/browser/ui/views/passwords/manage_passwords_icon_view_browsertest.cc
index 9f1331c..4338aaa 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_icon_view_browsertest.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_icon_view_browsertest.cc
@@ -19,28 +19,43 @@ IN_PROC_BROWSER_TEST_F(ManagePasswordsIconViewTest, DefaultStateIsInactive) {
EXPECT_FALSE(view()->visible());
EXPECT_EQ(0, view()->icon_id());
EXPECT_EQ(0, view()->tooltip_text_id());
+ view()->SetActive(true);
+ EXPECT_EQ(0, view()->icon_id());
+ view()->SetActive(false);
+ EXPECT_EQ(0, view()->icon_id());
}
IN_PROC_BROWSER_TEST_F(ManagePasswordsIconViewTest, PendingState) {
SetupPendingPassword();
EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE, view()->state());
EXPECT_TRUE(view()->visible());
- EXPECT_EQ(IDR_SAVE_PASSWORD, view()->icon_id());
+ EXPECT_TRUE(view()->active());
+ EXPECT_EQ(IDR_SAVE_PASSWORD_ACTIVE, view()->icon_id());
EXPECT_EQ(IDS_PASSWORD_MANAGER_TOOLTIP_SAVE, view()->tooltip_text_id());
+ view()->SetActive(false);
+ EXPECT_EQ(IDR_SAVE_PASSWORD_INACTIVE, view()->icon_id());
}
IN_PROC_BROWSER_TEST_F(ManagePasswordsIconViewTest, ManageState) {
SetupManagingPasswords();
EXPECT_EQ(password_manager::ui::MANAGE_STATE, view()->state());
EXPECT_TRUE(view()->visible());
- EXPECT_EQ(IDR_SAVE_PASSWORD, view()->icon_id());
+ EXPECT_EQ(IDR_SAVE_PASSWORD_INACTIVE, view()->icon_id());
EXPECT_EQ(IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE, view()->tooltip_text_id());
+ view()->SetActive(true);
+ EXPECT_EQ(IDR_SAVE_PASSWORD_ACTIVE, view()->icon_id());
+ view()->SetActive(false);
+ EXPECT_EQ(IDR_SAVE_PASSWORD_INACTIVE, view()->icon_id());
}
IN_PROC_BROWSER_TEST_F(ManagePasswordsIconViewTest, BlacklistedState) {
SetupBlackistedPassword();
EXPECT_EQ(password_manager::ui::BLACKLIST_STATE, view()->state());
EXPECT_TRUE(view()->visible());
- EXPECT_EQ(IDR_SAVE_PASSWORD_BLACKLISTED, view()->icon_id());
+ EXPECT_EQ(IDR_SAVE_PASSWORD_DISABLED_INACTIVE, view()->icon_id());
EXPECT_EQ(IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE, view()->tooltip_text_id());
+ view()->SetActive(true);
+ EXPECT_EQ(IDR_SAVE_PASSWORD_DISABLED_ACTIVE, view()->icon_id());
+ view()->SetActive(false);
+ EXPECT_EQ(IDR_SAVE_PASSWORD_DISABLED_INACTIVE, view()->icon_id());
}