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/notifications/balloon_view.h" | 5 #include "chrome/browser/ui/views/notifications/balloon_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // but the child windows don't render). | 309 // but the child windows don't render). |
310 // | 310 // |
311 // We carefully keep these two windows in sync to present the illusion of | 311 // We carefully keep these two windows in sync to present the illusion of |
312 // one window to the user. | 312 // one window to the user. |
313 // | 313 // |
314 // We don't let the OS manage the RTL layout of these widgets, because | 314 // We don't let the OS manage the RTL layout of these widgets, because |
315 // this code is already taking care of correctly reversing the layout. | 315 // this code is already taking care of correctly reversing the layout. |
316 gfx::Rect contents_rect = GetContentsRectangle(); | 316 gfx::Rect contents_rect = GetContentsRectangle(); |
317 html_contents_.reset(new BalloonViewHost(balloon)); | 317 html_contents_.reset(new BalloonViewHost(balloon)); |
318 html_contents_->SetPreferredSize(gfx::Size(10000, 10000)); | 318 html_contents_->SetPreferredSize(gfx::Size(10000, 10000)); |
319 html_container_ = Widget::CreateWidget(); | 319 html_container_ = new Widget; |
320 html_container_->SetAlwaysOnTop(true); | |
321 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); | 320 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); |
322 params.bounds = contents_rect; | 321 params.bounds = contents_rect; |
323 html_container_->Init(params); | 322 html_container_->Init(params); |
324 html_container_->SetContentsView(html_contents_->view()); | 323 html_container_->SetContentsView(html_contents_->view()); |
| 324 html_container_->SetAlwaysOnTop(true); |
325 | 325 |
326 gfx::Rect balloon_rect(x(), y(), GetTotalWidth(), GetTotalHeight()); | 326 gfx::Rect balloon_rect(x(), y(), GetTotalWidth(), GetTotalHeight()); |
327 frame_container_ = Widget::CreateWidget(); | 327 frame_container_ = new Widget; |
328 frame_container_->set_widget_delegate(this); | 328 frame_container_->set_widget_delegate(this); |
329 frame_container_->SetAlwaysOnTop(true); | |
330 params.transparent = true; | 329 params.transparent = true; |
331 params.bounds = balloon_rect; | 330 params.bounds = balloon_rect; |
332 frame_container_->Init(params); | 331 frame_container_->Init(params); |
333 frame_container_->SetContentsView(this); | 332 frame_container_->SetContentsView(this); |
| 333 frame_container_->SetAlwaysOnTop(true); |
334 frame_container_->MoveAboveWidget(html_container_); | 334 frame_container_->MoveAboveWidget(html_container_); |
335 | 335 |
336 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 336 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
337 rb.GetBitmapNamed(IDR_TAB_CLOSE)); | 337 rb.GetBitmapNamed(IDR_TAB_CLOSE)); |
338 close_button_->SetImage(views::CustomButton::BS_HOT, | 338 close_button_->SetImage(views::CustomButton::BS_HOT, |
339 rb.GetBitmapNamed(IDR_TAB_CLOSE_H)); | 339 rb.GetBitmapNamed(IDR_TAB_CLOSE_H)); |
340 close_button_->SetImage(views::CustomButton::BS_PUSHED, | 340 close_button_->SetImage(views::CustomButton::BS_PUSHED, |
341 rb.GetBitmapNamed(IDR_TAB_CLOSE_P)); | 341 rb.GetBitmapNamed(IDR_TAB_CLOSE_P)); |
342 close_button_->SetBoundsRect(GetCloseButtonBounds()); | 342 close_button_->SetBoundsRect(GetCloseButtonBounds()); |
343 close_button_->SetBackground(SK_ColorBLACK, | 343 close_button_->SetBackground(SK_ColorBLACK, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 NOTREACHED(); | 498 NOTREACHED(); |
499 return; | 499 return; |
500 } | 500 } |
501 | 501 |
502 // If the renderer process attached to this balloon is disconnected | 502 // If the renderer process attached to this balloon is disconnected |
503 // (e.g., because of a crash), we want to close the balloon. | 503 // (e.g., because of a crash), we want to close the balloon. |
504 notification_registrar_.Remove(this, | 504 notification_registrar_.Remove(this, |
505 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); | 505 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); |
506 Close(false); | 506 Close(false); |
507 } | 507 } |
OLD | NEW |