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

Unified Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 580403004: Passworde bubble should close without fading out. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
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 c9bdc4b96aca17ed18129b93fc0d7a9366081dd3..cb45c1c2be4b89ba5352a5d4a6000afe5987480c 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -19,8 +19,6 @@
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
-#include "ui/compositor/layer_animation_observer.h"
-#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/views/controls/button/blue_button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/combobox/combobox.h"
@@ -38,9 +36,6 @@
namespace {
-// The number of seconds the bubble needs to fade out.
-const int kBubbleFadeDelay = 2;
-
const int kDesiredBubbleWidth = 370;
enum ColumnSetType {
@@ -681,13 +676,13 @@ void ManagePasswordsBubbleView::WebContentMouseHandler::OnKeyEvent(
content::RenderViewHost* rvh = web_contents->GetRenderViewHost();
if (rvh->IsFocusedElementEditable() &&
event->type() == ui::ET_KEY_PRESSED)
- bubble_->StartFadingOut();
+ bubble_->Close();
}
void ManagePasswordsBubbleView::WebContentMouseHandler::OnMouseEvent(
ui::MouseEvent* event) {
if (event->type() == ui::ET_MOUSE_PRESSED)
- bubble_->StartFadingOut();
+ bubble_->Close();
}
aura::Window*
@@ -696,26 +691,6 @@ ManagePasswordsBubbleView::WebContentMouseHandler::GetWebContentsWindow() {
return web_contents ? web_contents->GetNativeView() : NULL;
}
-// ManagePasswordsBubbleView::FadeOutObserver ---------------------------------
-
-// The class notifies the bubble when it faded out completely.
-class ManagePasswordsBubbleView::FadeOutObserver
- : public ui::ImplicitAnimationObserver {
- public:
- explicit FadeOutObserver(ManagePasswordsBubbleView* bubble)
- : bubble_(bubble) {
- }
-
- virtual void OnImplicitAnimationsCompleted() OVERRIDE {
- bubble_->OnBubbleDisappeared();
- }
-
- private:
- ManagePasswordsBubbleView* bubble_;
-
- DISALLOW_COPY_AND_ASSIGN(FadeOutObserver);
-};
-
// ManagePasswordsBubbleView --------------------------------------------------
// static
@@ -797,7 +772,6 @@ ManagePasswordsBubbleView::ManagePasswordsBubbleView(
initially_focused_view_(NULL) {
// Compensate for built-in vertical padding in the anchor view's image.
set_anchor_view_insets(gfx::Insets(5, 0, 5, 0));
- set_notify_enter_exit_on_child(true);
if (anchor_view)
anchor_view->SetActive(true);
mouse_handler_.reset(new WebContentMouseHandler(this));
@@ -823,7 +797,6 @@ void ManagePasswordsBubbleView::AdjustForFullscreen(
}
void ManagePasswordsBubbleView::Close() {
- fadeout_observer_.reset();
mouse_handler_.reset();
GetWidget()->Close();
}
@@ -844,7 +817,6 @@ void ManagePasswordsBubbleView::Refresh() {
AddChildView(new ManageView(this));
}
GetLayoutManager()->Layout(this);
- CancelFadingOut();
}
void ManagePasswordsBubbleView::NotifyNeverForThisSiteClicked() {
@@ -881,41 +853,6 @@ void ManagePasswordsBubbleView::WindowClosing() {
manage_passwords_bubble_ = NULL;
}
-void ManagePasswordsBubbleView::OnWidgetActivationChanged(views::Widget* widget,
- bool active) {
- if (active && widget == GetWidget())
- CancelFadingOut();
- BubbleDelegateView::OnWidgetActivationChanged(widget, active);
-}
-
views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() {
return initially_focused_view_;
}
-
-void ManagePasswordsBubbleView::OnMouseEntered(const ui::MouseEvent& event) {
- CancelFadingOut();
-}
-
-void ManagePasswordsBubbleView::StartFadingOut() {
- if (fadeout_observer_)
- return;
- aura::Window* window = GetWidget()->GetNativeView();
- ui::ScopedLayerAnimationSettings animator(window->layer()->GetAnimator());
- fadeout_observer_.reset(new FadeOutObserver(this));
- animator.AddObserver(fadeout_observer_.get());
- animator.SetTransitionDuration(
- base::TimeDelta::FromSeconds(kBubbleFadeDelay));
- window->layer()->SetOpacity(0);
-}
-
-void ManagePasswordsBubbleView::CancelFadingOut() {
- if (!fadeout_observer_)
- return;
- fadeout_observer_.reset();
- aura::Window* window = GetWidget()->GetNativeView();
- window->layer()->SetOpacity(1);
-}
-
-void ManagePasswordsBubbleView::OnBubbleDisappeared() {
- Close();
-}

Powered by Google App Engine
This is Rietveld 408576698