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 "chrome/browser/ui/views/status_bubble_views.h" | 5 #include "chrome/browser/ui/views/status_bubble_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 } | 574 } |
575 | 575 |
576 void StatusBubbleViews::Init() { | 576 void StatusBubbleViews::Init() { |
577 if (!popup_.get()) { | 577 if (!popup_.get()) { |
578 popup_.reset(new views::Widget); | 578 popup_.reset(new views::Widget); |
579 views::Widget* frame = base_view_->GetWidget(); | 579 views::Widget* frame = base_view_->GetWidget(); |
580 if (!view_) | 580 if (!view_) |
581 view_ = new StatusView(popup_.get(), frame->GetThemeProvider()); | 581 view_ = new StatusView(popup_.get(), frame->GetThemeProvider()); |
582 if (!expand_view_.get()) | 582 if (!expand_view_.get()) |
583 expand_view_.reset(new StatusViewExpander(this, view_)); | 583 expand_view_.reset(new StatusViewExpander(this, view_)); |
584 // On Windows use TYPE_MENU to ensure that this window uses the software | 584 |
585 // compositor which avoids the UI thread blocking issue during command | 585 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
586 // buffer creation. We can revert this change once http://crbug.com/125248 | |
587 // is fixed. | |
588 #if defined(OS_WIN) | 586 #if defined(OS_WIN) |
589 views::Widget::InitParams params(views::Widget::InitParams::TYPE_MENU); | 587 // On Windows use the software compositor to ensure that we don't block |
590 // The menu style assumes a top most window. We don't want that in this | 588 // the UI thread blocking issue during command buffer creation. We can |
591 // case. | 589 // revert this change once http://crbug.com/125248 is fixed. |
592 params.keep_on_top = false; | 590 params.force_software_compositing = true; |
593 #else | |
594 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | |
595 #endif | 591 #endif |
596 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 592 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
597 params.accept_events = false; | 593 params.accept_events = false; |
598 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 594 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
599 params.parent = frame->GetNativeView(); | 595 params.parent = frame->GetNativeView(); |
600 params.context = frame->GetNativeWindow(); | 596 params.context = frame->GetNativeWindow(); |
601 popup_->Init(params); | 597 popup_->Init(params); |
602 // We do our own animation and don't want any from the system. | 598 // We do our own animation and don't want any from the system. |
603 popup_->SetVisibilityChangedAnimationsEnabled(false); | 599 popup_->SetVisibilityChangedAnimationsEnabled(false); |
604 popup_->SetOpacity(0x00); | 600 popup_->SetOpacity(0x00); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 void StatusBubbleViews::SetBubbleWidth(int width) { | 882 void StatusBubbleViews::SetBubbleWidth(int width) { |
887 size_.set_width(width); | 883 size_.set_width(width); |
888 SetBounds(original_position_.x(), original_position_.y(), | 884 SetBounds(original_position_.x(), original_position_.y(), |
889 size_.width(), size_.height()); | 885 size_.width(), size_.height()); |
890 } | 886 } |
891 | 887 |
892 void StatusBubbleViews::CancelExpandTimer() { | 888 void StatusBubbleViews::CancelExpandTimer() { |
893 if (expand_timer_factory_.HasWeakPtrs()) | 889 if (expand_timer_factory_.HasWeakPtrs()) |
894 expand_timer_factory_.InvalidateWeakPtrs(); | 890 expand_timer_factory_.InvalidateWeakPtrs(); |
895 } | 891 } |
OLD | NEW |