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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // views::WidgetDelegate | 227 // views::WidgetDelegate |
228 views::View* ToastContentsView::GetContentsView() { | 228 views::View* ToastContentsView::GetContentsView() { |
229 return this; | 229 return this; |
230 } | 230 } |
231 | 231 |
232 void ToastContentsView::WindowClosing() { | 232 void ToastContentsView::WindowClosing() { |
233 if (!is_closing_ && collection_.get()) | 233 if (!is_closing_ && collection_.get()) |
234 collection_->ForgetToast(this); | 234 collection_->ForgetToast(this); |
235 } | 235 } |
236 | 236 |
237 bool ToastContentsView::CanActivate() const { | |
238 return false; | |
239 } | |
240 | |
241 void ToastContentsView::OnDisplayChanged() { | 237 void ToastContentsView::OnDisplayChanged() { |
242 views::Widget* widget = GetWidget(); | 238 views::Widget* widget = GetWidget(); |
243 if (!widget) | 239 if (!widget) |
244 return; | 240 return; |
245 | 241 |
246 gfx::NativeView native_view = widget->GetNativeView(); | 242 gfx::NativeView native_view = widget->GetNativeView(); |
247 if (!native_view || !collection_.get()) | 243 if (!native_view || !collection_.get()) |
248 return; | 244 return; |
249 | 245 |
250 collection_->OnDisplayBoundsChanged(gfx::Screen::GetScreenFor( | 246 collection_->OnDisplayBoundsChanged(gfx::Screen::GetScreenFor( |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } | 348 } |
353 | 349 |
354 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { | 350 gfx::Rect ToastContentsView::GetClosedToastBounds(gfx::Rect bounds) { |
355 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, | 351 return gfx::Rect(bounds.x() + bounds.width() - kClosedToastWidth, |
356 bounds.y(), | 352 bounds.y(), |
357 kClosedToastWidth, | 353 kClosedToastWidth, |
358 bounds.height()); | 354 bounds.height()); |
359 } | 355 } |
360 | 356 |
361 } // namespace message_center | 357 } // namespace message_center |
OLD | NEW |