| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/bubble/tray_bubble_view.h" | 5 #include "ui/views/bubble/tray_bubble_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 delegate_(delegate), | 325 delegate_(delegate), |
| 326 preferred_width_(init_params.min_width), | 326 preferred_width_(init_params.min_width), |
| 327 bubble_border_(new TrayBubbleBorder(this, GetAnchorView(), init_params)), | 327 bubble_border_(new TrayBubbleBorder(this, GetAnchorView(), init_params)), |
| 328 owned_bubble_border_(bubble_border_), | 328 owned_bubble_border_(bubble_border_), |
| 329 is_gesture_dragging_(false), | 329 is_gesture_dragging_(false), |
| 330 mouse_actively_entered_(false) { | 330 mouse_actively_entered_(false) { |
| 331 set_parent_window(parent_window); | 331 set_parent_window(parent_window); |
| 332 set_notify_enter_exit_on_child(true); | 332 set_notify_enter_exit_on_child(true); |
| 333 set_close_on_deactivate(init_params.close_on_deactivate); | 333 set_close_on_deactivate(init_params.close_on_deactivate); |
| 334 set_margins(gfx::Insets()); | 334 set_margins(gfx::Insets()); |
| 335 SetPaintToLayer(true); | 335 // JAMES: This and other statements below that turn on layers cause the tray |
| 336 | 336 // bubble not to paint. |
| 337 bubble_content_mask_.reset( | 337 // SetPaintToLayer(true); |
| 338 new TrayBubbleContentMask(bubble_border_->GetBorderCornerRadius())); | 338 // |
| 339 // bubble_content_mask_.reset( |
| 340 // new TrayBubbleContentMask(bubble_border_->GetBorderCornerRadius())); |
| 339 } | 341 } |
| 340 | 342 |
| 341 TrayBubbleView::~TrayBubbleView() { | 343 TrayBubbleView::~TrayBubbleView() { |
| 342 mouse_watcher_.reset(); | 344 mouse_watcher_.reset(); |
| 343 // Inform host items (models) that their views are being destroyed. | 345 // Inform host items (models) that their views are being destroyed. |
| 344 if (delegate_) | 346 if (delegate_) |
| 345 delegate_->BubbleViewDestroyed(); | 347 delegate_->BubbleViewDestroyed(); |
| 346 } | 348 } |
| 347 | 349 |
| 348 void TrayBubbleView::InitializeAndShowBubble() { | 350 void TrayBubbleView::InitializeAndShowBubble() { |
| 349 // Must occur after call to BubbleDelegateView::CreateBubble(). | 351 // Must occur after call to BubbleDelegateView::CreateBubble(). |
| 350 SetAlignment(params_.arrow_alignment); | 352 SetAlignment(params_.arrow_alignment); |
| 351 bubble_border_->UpdateArrowOffset(); | 353 bubble_border_->UpdateArrowOffset(); |
| 352 | 354 |
| 353 layer()->parent()->SetMaskLayer(bubble_content_mask_->layer()); | 355 //JAMES |
| 356 //layer()->parent()->SetMaskLayer(bubble_content_mask_->layer()); |
| 354 | 357 |
| 355 GetWidget()->Show(); | 358 GetWidget()->Show(); |
| 356 GetWidget()->GetNativeWindow()->SetEventTargeter( | 359 GetWidget()->GetNativeWindow()->SetEventTargeter( |
| 357 scoped_ptr<ui::EventTargeter>(new BubbleWindowTargeter(this))); | 360 scoped_ptr<ui::EventTargeter>(new BubbleWindowTargeter(this))); |
| 358 UpdateBubble(); | 361 UpdateBubble(); |
| 359 } | 362 } |
| 360 | 363 |
| 361 void TrayBubbleView::UpdateBubble() { | 364 void TrayBubbleView::UpdateBubble() { |
| 362 if (GetWidget()) { | 365 if (GetWidget()) { |
| 363 SizeToContents(); | 366 SizeToContents(); |
| 364 bubble_content_mask_->layer()->SetBounds(layer()->bounds()); | 367 //JAMES |
| 368 //bubble_content_mask_->layer()->SetBounds(layer()->bounds()); |
| 365 GetWidget()->GetRootView()->SchedulePaint(); | 369 GetWidget()->GetRootView()->SchedulePaint(); |
| 366 } | 370 } |
| 367 } | 371 } |
| 368 | 372 |
| 369 void TrayBubbleView::SetMaxHeight(int height) { | 373 void TrayBubbleView::SetMaxHeight(int height) { |
| 370 params_.max_height = height; | 374 params_.max_height = height; |
| 371 if (GetWidget()) | 375 if (GetWidget()) |
| 372 SizeToContents(); | 376 SizeToContents(); |
| 373 } | 377 } |
| 374 | 378 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 mouse_actively_entered_ = true; | 501 mouse_actively_entered_ = true; |
| 498 mouse_watcher_->Stop(); | 502 mouse_watcher_->Stop(); |
| 499 } | 503 } |
| 500 | 504 |
| 501 void TrayBubbleView::ChildPreferredSizeChanged(View* child) { | 505 void TrayBubbleView::ChildPreferredSizeChanged(View* child) { |
| 502 SizeToContents(); | 506 SizeToContents(); |
| 503 } | 507 } |
| 504 | 508 |
| 505 void TrayBubbleView::ViewHierarchyChanged( | 509 void TrayBubbleView::ViewHierarchyChanged( |
| 506 const ViewHierarchyChangedDetails& details) { | 510 const ViewHierarchyChangedDetails& details) { |
| 507 if (details.is_add && details.child == this) { | 511 //JAMES |
| 508 details.parent->SetPaintToLayer(true); | 512 // if (details.is_add && details.child == this) { |
| 509 details.parent->layer()->SetMasksToBounds(true); | 513 // details.parent->SetPaintToLayer(true); |
| 510 } | 514 // details.parent->layer()->SetMasksToBounds(true); |
| 515 // } |
| 511 } | 516 } |
| 512 | 517 |
| 513 } // namespace views | 518 } // namespace views |
| OLD | NEW |