summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/info_bubble.cc
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-15 18:07:06 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-15 18:07:06 +0000
commitc74369a5288264e52355a940121cb09cebc633b5 (patch)
tree231f742ba9ad7c68e6d3c035100157da4d556072 /chrome/browser/views/info_bubble.cc
parent43448f9b2f1bad7df5dc408888322b639129142e (diff)
downloadchromium_src-c74369a5288264e52355a940121cb09cebc633b5.zip
chromium_src-c74369a5288264e52355a940121cb09cebc633b5.tar.gz
chromium_src-c74369a5288264e52355a940121cb09cebc633b5.tar.bz2
Changes the bookmark bubble to have the following logic:
. We only apply edits when the bubble is closed (previously selecting a different folder resulted in an immediate action). . Hitting escape cancels any edits. . When the bubble is shown for newly bookmarked items hitting escape removes the bookmark. . If you click 'Edit...' or select 'Choose another folder...' any edits are applied immediately before the editor is shown. BUG=5015 TEST=thorougly test the bookmark bubble to make sure I haven't broken anything. Review URL: http://codereview.chromium.org/14074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/info_bubble.cc')
-rw-r--r--chrome/browser/views/info_bubble.cc26
1 files changed, 17 insertions, 9 deletions
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc
index c896f33..d034a1d 100644
--- a/chrome/browser/views/info_bubble.cc
+++ b/chrome/browser/views/info_bubble.cc
@@ -71,13 +71,14 @@ InfoBubble* InfoBubble::Show(HWND parent_hwnd,
views::View* content,
InfoBubbleDelegate* delegate) {
InfoBubble* window = new InfoBubble();
+ DLOG(WARNING) << "new bubble=" << window;
window->Init(parent_hwnd, position_relative_to, content);
window->ShowWindow(SW_SHOW);
window->delegate_ = delegate;
return window;
}
-InfoBubble::InfoBubble() : content_view_(NULL) {
+InfoBubble::InfoBubble() : content_view_(NULL), closed_(false) {
}
InfoBubble::~InfoBubble() {
@@ -146,11 +147,7 @@ void InfoBubble::Init(HWND parent_hwnd,
}
void InfoBubble::Close() {
- // We don't fade out because it looks terrible.
- if (delegate_)
- delegate_->InfoBubbleClosing(this);
- parent_->DisableInactiveRendering(false);
- WidgetWin::Close();
+ Close(false);
}
void InfoBubble::AnimationProgressed(const Animation* animation) {
@@ -168,7 +165,7 @@ void InfoBubble::AnimationProgressed(const Animation* animation) {
bool InfoBubble::AcceleratorPressed(const views::Accelerator& accelerator) {
DCHECK(accelerator.GetKeyCode() == VK_ESCAPE);
if (!delegate_ || delegate_->CloseOnEscape()) {
- Close();
+ Close(true);
return true;
}
return false;
@@ -180,7 +177,7 @@ void InfoBubble::OnSize(UINT param, const CSize& size) {
void InfoBubble::OnActivate(UINT action, BOOL minimized, HWND window) {
// The popup should close when it is deactivated.
- if (action == WA_INACTIVE) {
+ if (action == WA_INACTIVE && !closed_) {
Close();
} else if (action == WA_ACTIVE) {
DCHECK(GetRootView()->GetChildViewCount() > 0);
@@ -192,6 +189,18 @@ InfoBubble::ContentView* InfoBubble::CreateContentView(View* content) {
return new ContentView(content, this);
}
+void InfoBubble::Close(bool closed_by_escape) {
+ if (closed_)
+ return;
+
+ // We don't fade out because it looks terrible.
+ if (delegate_)
+ delegate_->InfoBubbleClosing(this, closed_by_escape);
+ parent_->DisableInactiveRendering(false);
+ closed_ = true;
+ WidgetWin::Close();
+}
+
// ContentView ----------------------------------------------------------------
InfoBubble::ContentView::ContentView(views::View* content, InfoBubble* host)
@@ -410,4 +419,3 @@ gfx::Rect InfoBubble::ContentView::CalculateWindowBounds(
}
return gfx::Rect(x, y, pref.width(), pref.height());
}
-