| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/browser_bubble.h" | 5 #include "chrome/browser/views/browser_bubble.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_win.h" | 7 #include "app/l10n_util_win.h" |
| 8 #include "chrome/browser/views/frame/browser_view.h" | 8 #include "chrome/browser/views/frame/browser_view.h" |
| 9 #include "views/widget/root_view.h" | 9 #include "views/widget/root_view.h" |
| 10 #include "views/widget/widget_win.h" | 10 #include "views/widget/widget_win.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 if (IsActive()) { | 39 if (IsActive()) { |
| 40 BrowserBubble::Delegate* delegate = bubble_->delegate(); | 40 BrowserBubble::Delegate* delegate = bubble_->delegate(); |
| 41 if (delegate) | 41 if (delegate) |
| 42 delegate->BubbleLostFocus(bubble_); | 42 delegate->BubbleLostFocus(bubble_); |
| 43 } | 43 } |
| 44 views::WidgetWin::Hide(); | 44 views::WidgetWin::Hide(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void OnActivate(UINT action, BOOL minimized, HWND window) { | 47 void OnActivate(UINT action, BOOL minimized, HWND window) { |
| 48 BrowserBubble::Delegate* delegate = bubble_->delegate(); | 48 BrowserBubble::Delegate* delegate = bubble_->delegate(); |
| 49 if (!delegate) | 49 if (!delegate) { |
| 50 if (action == WA_INACTIVE && !closed_) { |
| 51 bubble_->DetachFromBrowser(); |
| 52 delete bubble_; |
| 53 } |
| 50 return; | 54 return; |
| 55 } |
| 51 | 56 |
| 52 if (action == WA_INACTIVE && !closed_) { | 57 if (action == WA_INACTIVE && !closed_) { |
| 53 delegate->BubbleLostFocus(bubble_); | 58 delegate->BubbleLostFocus(bubble_); |
| 54 } else if (action == WA_ACTIVE) { | 59 } else if (action == WA_ACTIVE) { |
| 55 delegate->BubbleGotFocus(bubble_); | 60 delegate->BubbleGotFocus(bubble_); |
| 56 } | 61 } |
| 57 } | 62 } |
| 58 | 63 |
| 59 private: | 64 private: |
| 60 bool closed_; | 65 bool closed_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 87 visible_ = true; | 92 visible_ = true; |
| 88 } | 93 } |
| 89 | 94 |
| 90 void BrowserBubble::Hide() { | 95 void BrowserBubble::Hide() { |
| 91 if (!visible_) | 96 if (!visible_) |
| 92 return; | 97 return; |
| 93 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); | 98 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); |
| 94 pop->Hide(); | 99 pop->Hide(); |
| 95 visible_ = false; | 100 visible_ = false; |
| 96 } | 101 } |
| OLD | NEW |