| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 delegate->BubbleGotFocus(bubble_); | 55 delegate->BubbleGotFocus(bubble_); |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 bool closed_; | 60 bool closed_; |
| 61 BrowserBubble* bubble_; | 61 BrowserBubble* bubble_; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 void BrowserBubble::InitPopup() { | 64 void BrowserBubble::InitPopup() { |
| 65 gfx::NativeWindow native_window = frame_->GetWindow()->GetNativeWindow(); | |
| 66 | |
| 67 // popup_ is a Widget, but we need to do some WidgetWin stuff first, then | 65 // popup_ is a Widget, but we need to do some WidgetWin stuff first, then |
| 68 // we'll assign it into popup_. | 66 // we'll assign it into popup_. |
| 69 views::WidgetWin* pop = new BubbleWidget(this); | 67 views::WidgetWin* pop = new BubbleWidget(this); |
| 70 pop->set_window_style(WS_POPUP); | 68 pop->set_window_style(WS_POPUP); |
| 71 | |
| 72 #if 0 | |
| 73 // TODO(erikkay) Layered windows don't draw child windows. | |
| 74 // Apparently there's some tricks you can do to handle that. | |
| 75 // Do the research so we can use this. | |
| 76 pop->set_window_ex_style(WS_EX_LAYERED | | |
| 77 l10n_util::GetExtendedTooltipStyles()); | |
| 78 pop->SetOpacity(0xFF); | |
| 79 #endif | |
| 80 | |
| 81 // A focus manager is necessary if you want to be able to handle various | |
| 82 // mouse events properly. | |
| 83 pop->Init(frame_native_view_, bounds_); | 69 pop->Init(frame_native_view_, bounds_); |
| 84 pop->SetContentsView(view_); | 70 pop->SetContentsView(view_); |
| 85 | 71 |
| 86 popup_ = pop; | 72 popup_ = pop; |
| 87 Reposition(); | 73 Reposition(); |
| 88 AttachToBrowser(); | 74 AttachToBrowser(); |
| 89 } | 75 } |
| 90 | 76 |
| 91 void BrowserBubble::MovePopup(int x, int y, int w, int h) { | 77 void BrowserBubble::MovePopup(int x, int y, int w, int h) { |
| 92 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); | 78 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); |
| 93 pop->MoveWindow(x, y, w, h); | 79 pop->MoveWindow(x, y, w, h); |
| 94 } | 80 } |
| 95 | 81 |
| 96 void BrowserBubble::Show(bool activate) { | 82 void BrowserBubble::Show(bool activate) { |
| 97 if (visible_) | 83 if (visible_) |
| 98 return; | 84 return; |
| 99 BubbleWidget* pop = static_cast<BubbleWidget*>(popup_); | 85 BubbleWidget* pop = static_cast<BubbleWidget*>(popup_); |
| 100 pop->Show(activate); | 86 pop->Show(activate); |
| 101 visible_ = true; | 87 visible_ = true; |
| 102 } | 88 } |
| 103 | 89 |
| 104 void BrowserBubble::Hide() { | 90 void BrowserBubble::Hide() { |
| 105 if (!visible_) | 91 if (!visible_) |
| 106 return; | 92 return; |
| 107 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); | 93 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); |
| 108 pop->Hide(); | 94 pop->Hide(); |
| 109 visible_ = false; | 95 visible_ = false; |
| 110 } | 96 } |
| OLD | NEW |