| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/views/toast_contents_view.h" | 5 #include "ui/message_center/views/toast_contents_view.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 const std::string& notification_id, | 354 const std::string& notification_id, |
| 355 int button_index) { | 355 int button_index) { |
| 356 if (collection_) | 356 if (collection_) |
| 357 collection_->ClickOnNotificationButton(notification_id, button_index); | 357 collection_->ClickOnNotificationButton(notification_id, button_index); |
| 358 } | 358 } |
| 359 | 359 |
| 360 void ToastContentsView::CreateWidget( | 360 void ToastContentsView::CreateWidget( |
| 361 PopupAlignmentDelegate* alignment_delegate) { | 361 PopupAlignmentDelegate* alignment_delegate) { |
| 362 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 362 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 363 params.keep_on_top = true; | 363 params.keep_on_top = true; |
| 364 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 365 params.opacity = views::Widget::InitParams::OPAQUE_WINDOW; |
| 366 #else |
| 364 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 367 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 368 #endif |
| 365 params.delegate = this; | 369 params.delegate = this; |
| 366 views::Widget* widget = new views::Widget(); | 370 views::Widget* widget = new views::Widget(); |
| 367 alignment_delegate->ConfigureWidgetInitParamsForContainer(widget, ¶ms); | 371 alignment_delegate->ConfigureWidgetInitParamsForContainer(widget, ¶ms); |
| 368 widget->set_focus_on_creation(false); | 372 widget->set_focus_on_creation(false); |
| 369 | 373 |
| 370 #if defined(OS_WIN) | 374 #if defined(OS_WIN) |
| 371 // We want to ensure that this toast always goes to the native desktop, | 375 // We want to ensure that this toast always goes to the native desktop, |
| 372 // not the Ash desktop (since there is already another toast contents view | 376 // not the Ash desktop (since there is already another toast contents view |
| 373 // there. | 377 // there. |
| 374 if (!params.parent) | 378 if (!params.parent) |
| 375 params.native_widget = new views::DesktopNativeWidgetAura(widget); | 379 params.native_widget = new views::DesktopNativeWidgetAura(widget); |
| 376 #endif | 380 #endif |
| 377 | 381 |
| 378 widget->Init(params); | 382 widget->Init(params); |
| 379 } | 383 } |
| 380 | 384 |
| 381 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { | 385 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { |
| 382 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, | 386 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, |
| 383 bounds.y(), | 387 bounds.y(), |
| 384 kClosedToastWidth, | 388 kClosedToastWidth, |
| 385 bounds.height()); | 389 bounds.height()); |
| 386 } | 390 } |
| 387 | 391 |
| 388 } // namespace message_center | 392 } // namespace message_center |
| OLD | NEW |