| 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/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/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 } | 552 } |
| 553 | 553 |
| 554 StatusBubbleViews::~StatusBubbleViews() { | 554 StatusBubbleViews::~StatusBubbleViews() { |
| 555 CancelExpandTimer(); | 555 CancelExpandTimer(); |
| 556 if (popup_.get()) | 556 if (popup_.get()) |
| 557 popup_->CloseNow(); | 557 popup_->CloseNow(); |
| 558 } | 558 } |
| 559 | 559 |
| 560 void StatusBubbleViews::Init() { | 560 void StatusBubbleViews::Init() { |
| 561 if (!popup_.get()) { | 561 if (!popup_.get()) { |
| 562 Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP); | 562 popup_.reset(Widget::CreateWidget()); |
| 563 params.transparent = true; | |
| 564 params.accept_events = false; | |
| 565 params.delete_on_destroy = false; | |
| 566 popup_.reset(Widget::CreateWidget(params)); | |
| 567 views::Widget* frame = base_view_->GetWidget(); | 563 views::Widget* frame = base_view_->GetWidget(); |
| 568 if (!view_) | 564 if (!view_) |
| 569 view_ = new StatusView(this, popup_.get(), frame->GetThemeProvider()); | 565 view_ = new StatusView(this, popup_.get(), frame->GetThemeProvider()); |
| 570 if (!expand_view_.get()) | 566 if (!expand_view_.get()) |
| 571 expand_view_.reset(new StatusViewExpander(this, view_)); | 567 expand_view_.reset(new StatusViewExpander(this, view_)); |
| 572 popup_->SetOpacity(0x00); | 568 popup_->SetOpacity(0x00); |
| 573 popup_->Init(frame->GetNativeView(), gfx::Rect()); | 569 Widget::CreateParams params(Widget::CreateParams::TYPE_POPUP); |
| 570 params.transparent = true; |
| 571 params.accept_events = false; |
| 572 params.delete_on_destroy = false; |
| 573 params.parent = frame->GetNativeView(); |
| 574 popup_->Init(params); |
| 574 popup_->SetContentsView(view_); | 575 popup_->SetContentsView(view_); |
| 575 Reposition(); | 576 Reposition(); |
| 576 popup_->Show(); | 577 popup_->Show(); |
| 577 } | 578 } |
| 578 } | 579 } |
| 579 | 580 |
| 580 void StatusBubbleViews::Reposition() { | 581 void StatusBubbleViews::Reposition() { |
| 581 if (popup_.get()) { | 582 if (popup_.get()) { |
| 582 gfx::Point top_left; | 583 gfx::Point top_left; |
| 583 views::View::ConvertPointToScreen(base_view_, &top_left); | 584 views::View::ConvertPointToScreen(base_view_, &top_left); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 void StatusBubbleViews::SetBubbleWidth(int width) { | 829 void StatusBubbleViews::SetBubbleWidth(int width) { |
| 829 size_.set_width(width); | 830 size_.set_width(width); |
| 830 SetBounds(original_position_.x(), original_position_.y(), | 831 SetBounds(original_position_.x(), original_position_.y(), |
| 831 size_.width(), size_.height()); | 832 size_.width(), size_.height()); |
| 832 } | 833 } |
| 833 | 834 |
| 834 void StatusBubbleViews::CancelExpandTimer() { | 835 void StatusBubbleViews::CancelExpandTimer() { |
| 835 if (!expand_timer_factory_.empty()) | 836 if (!expand_timer_factory_.empty()) |
| 836 expand_timer_factory_.RevokeAll(); | 837 expand_timer_factory_.RevokeAll(); |
| 837 } | 838 } |
| OLD | NEW |