OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/views/browser_bubble.h" | 5 #include "chrome/browser/ui/views/browser_bubble.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/frame/browser_view.h" | 7 #include "chrome/browser/ui/views/frame/browser_view.h" |
8 #include "views/widget/root_view.h" | 8 #include "views/widget/root_view.h" |
9 #include "views/widget/widget_win.h" | 9 #include "views/widget/widget_win.h" |
10 #include "views/window/window.h" | 10 #include "views/window/window.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 BrowserBubble* bubble_; | 91 BrowserBubble* bubble_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(BubbleWidget); | 93 DISALLOW_COPY_AND_ASSIGN(BubbleWidget); |
94 }; | 94 }; |
95 | 95 |
96 void BrowserBubble::InitPopup() { | 96 void BrowserBubble::InitPopup() { |
97 // popup_ is a Widget, but we need to do some WidgetWin stuff first, then | 97 // popup_ is a Widget, but we need to do some WidgetWin stuff first, then |
98 // we'll assign it into popup_. | 98 // we'll assign it into popup_. |
99 views::WidgetWin* pop = new BubbleWidget(this); | 99 views::WidgetWin* pop = new BubbleWidget(this); |
100 | 100 |
101 // Enable the drop-shadow through the native windows drop-shadow support. | |
102 if (drop_shadow_enabled_) | |
103 pop->set_initial_class_style(CS_DROPSHADOW | pop->initial_class_style()); | |
104 | |
105 pop->Init(frame_->GetNativeView(), bounds_); | 101 pop->Init(frame_->GetNativeView(), bounds_); |
106 pop->SetContentsView(view_); | 102 pop->SetContentsView(view_); |
107 | 103 |
108 popup_ = pop; | 104 popup_ = pop; |
109 Reposition(); | 105 Reposition(); |
110 AttachToBrowser(); | 106 AttachToBrowser(); |
111 } | 107 } |
112 | 108 |
113 void BrowserBubble::MovePopup(int x, int y, int w, int h) { | 109 void BrowserBubble::MovePopup(int x, int y, int w, int h) { |
114 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); | 110 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); |
115 pop->SetBounds(gfx::Rect(x, y, w, h)); | 111 pop->SetBounds(gfx::Rect(x, y, w, h)); |
116 } | 112 } |
117 | 113 |
118 void BrowserBubble::Show(bool activate) { | 114 void BrowserBubble::Show(bool activate) { |
119 if (visible_) | 115 if (visible_) |
120 return; | 116 return; |
121 BubbleWidget* pop = static_cast<BubbleWidget*>(popup_); | 117 BubbleWidget* pop = static_cast<BubbleWidget*>(popup_); |
122 pop->Show(activate); | 118 pop->Show(activate); |
123 visible_ = true; | 119 visible_ = true; |
124 } | 120 } |
125 | 121 |
126 void BrowserBubble::Hide() { | 122 void BrowserBubble::Hide() { |
127 if (!visible_) | 123 if (!visible_) |
128 return; | 124 return; |
129 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); | 125 views::WidgetWin* pop = static_cast<views::WidgetWin*>(popup_); |
130 pop->Hide(); | 126 pop->Hide(); |
131 visible_ = false; | 127 visible_ = false; |
132 } | 128 } |
OLD | NEW |