| 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/bubble/bubble.h" | 5 #include "chrome/browser/ui/views/bubble/bubble.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/views/bubble/border_contents.h" | 9 #include "chrome/browser/ui/views/bubble/border_contents.h" |
| 10 #include "content/common/notification_service.h" | 10 #include "content/common/notification_service.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // During FadeIn we need to turn on the layered window style to deal with | 182 // During FadeIn we need to turn on the layered window style to deal with |
| 183 // transparency. This flag needs to be reset after fading in is complete. | 183 // transparency. This flag needs to be reset after fading in is complete. |
| 184 bool fade_in = delegate_ && delegate_->FadeInOnShow(); | 184 bool fade_in = delegate_ && delegate_->FadeInOnShow(); |
| 185 if (fade_in) | 185 if (fade_in) |
| 186 extended_style |= WS_EX_LAYERED; | 186 extended_style |= WS_EX_LAYERED; |
| 187 set_window_ex_style(extended_style); | 187 set_window_ex_style(extended_style); |
| 188 | 188 |
| 189 DCHECK(!border_); | 189 DCHECK(!border_); |
| 190 border_ = new BorderWidgetWin(); | 190 border_ = new BorderWidgetWin(); |
| 191 | 191 |
| 192 if (fade_in) { | |
| 193 border_->SetOpacity(0); | |
| 194 GetWidget()->SetOpacity(0); | |
| 195 } | |
| 196 | |
| 197 border_->InitBorderWidgetWin(CreateBorderContents(), parent->GetNativeView()); | 192 border_->InitBorderWidgetWin(CreateBorderContents(), parent->GetNativeView()); |
| 198 border_->border_contents()->SetBackgroundColor(kBackgroundColor); | 193 border_->border_contents()->SetBackgroundColor(kBackgroundColor); |
| 199 | 194 |
| 200 // We make the BorderWidgetWin the owner of the Bubble HWND, so that the | 195 // We make the BorderWidgetWin the owner of the Bubble HWND, so that the |
| 201 // latter is displayed on top of the former. | 196 // latter is displayed on top of the former. |
| 202 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 197 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 203 params.parent = border_->GetNativeView(); | 198 params.parent = border_->GetNativeView(); |
| 204 params.native_widget = this; | 199 params.native_widget = this; |
| 205 GetWidget()->Init(params); | 200 GetWidget()->Init(params); |
| 206 | 201 |
| 202 if (fade_in) { |
| 203 border_->SetOpacity(0); |
| 204 GetWidget()->SetOpacity(0); |
| 205 } |
| 207 SetWindowText(GetNativeView(), delegate_->accessible_name().c_str()); | 206 SetWindowText(GetNativeView(), delegate_->accessible_name().c_str()); |
| 208 #elif defined(TOOLKIT_USES_GTK) | 207 #elif defined(TOOLKIT_USES_GTK) |
| 209 views::Widget::InitParams params(type_); | 208 views::Widget::InitParams params(type_); |
| 210 params.transparent = true; | 209 params.transparent = true; |
| 211 params.parent_widget = parent; | 210 params.parent_widget = parent; |
| 212 params.native_widget = this; | 211 params.native_widget = this; |
| 213 GetWidget()->Init(params); | 212 GetWidget()->Init(params); |
| 214 #if defined(OS_CHROMEOS) | 213 #if defined(OS_CHROMEOS) |
| 215 { | 214 { |
| 216 vector<int> params; | 215 vector<int> params; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 animation_->Hide(); | 381 animation_->Hide(); |
| 383 } | 382 } |
| 384 | 383 |
| 385 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) { | 384 bool Bubble::AcceleratorPressed(const views::Accelerator& accelerator) { |
| 386 if (!delegate_ || delegate_->CloseOnEscape()) { | 385 if (!delegate_ || delegate_->CloseOnEscape()) { |
| 387 DoClose(true); | 386 DoClose(true); |
| 388 return true; | 387 return true; |
| 389 } | 388 } |
| 390 return false; | 389 return false; |
| 391 } | 390 } |
| OLD | NEW |