OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/notifications/balloon_view.h" | 5 #include "chrome/browser/views/notifications/balloon_view.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 // * The contents is an html window which cannot be a | 289 // * The contents is an html window which cannot be a |
290 // layered window (because it may have child windows for instance). | 290 // layered window (because it may have child windows for instance). |
291 // * The frame is a layered window so that we can have nicely rounded | 291 // * The frame is a layered window so that we can have nicely rounded |
292 // corners using alpha blending (and we may do other alpha blending | 292 // corners using alpha blending (and we may do other alpha blending |
293 // effects). | 293 // effects). |
294 // Unfortunately, layered windows cannot have child windows. (Well, they can | 294 // Unfortunately, layered windows cannot have child windows. (Well, they can |
295 // but the child windows don't render). | 295 // but the child windows don't render). |
296 // | 296 // |
297 // We carefully keep these two windows in sync to present the illusion of | 297 // We carefully keep these two windows in sync to present the illusion of |
298 // one window to the user. | 298 // one window to the user. |
299 // | |
300 // We don't let the OS manage the RTL layout of these widgets, because | |
301 // this code is already taking care of correctly reversing the layout. | |
xji
2010/06/10 19:14:21
Is the reason "because HTML content layout is dete
| |
299 gfx::Rect contents_rect = GetContentsRectangle(); | 302 gfx::Rect contents_rect = GetContentsRectangle(); |
300 html_contents_.reset(new BalloonViewHost(balloon)); | 303 html_contents_.reset(new BalloonViewHost(balloon)); |
301 html_contents_->SetPreferredSize(gfx::Size(10000, 10000)); | 304 html_contents_->SetPreferredSize(gfx::Size(10000, 10000)); |
302 | |
303 html_container_ = Widget::CreatePopupWidget(Widget::NotTransparent, | 305 html_container_ = Widget::CreatePopupWidget(Widget::NotTransparent, |
304 Widget::AcceptEvents, | 306 Widget::AcceptEvents, |
305 Widget::DeleteOnDestroy); | 307 Widget::DeleteOnDestroy, |
308 Widget::DontMirrorOriginInRTL); | |
306 html_container_->SetAlwaysOnTop(true); | 309 html_container_->SetAlwaysOnTop(true); |
307 html_container_->Init(NULL, contents_rect); | 310 html_container_->Init(NULL, contents_rect); |
308 html_container_->SetContentsView(html_contents_->view()); | 311 html_container_->SetContentsView(html_contents_->view()); |
309 | 312 |
310 gfx::Rect balloon_rect(x(), y(), GetTotalWidth(), GetTotalHeight()); | 313 gfx::Rect balloon_rect(x(), y(), GetTotalWidth(), GetTotalHeight()); |
311 frame_container_ = Widget::CreatePopupWidget(Widget::Transparent, | 314 frame_container_ = Widget::CreatePopupWidget(Widget::Transparent, |
312 Widget::AcceptEvents, | 315 Widget::AcceptEvents, |
313 Widget::DeleteOnDestroy); | 316 Widget::DeleteOnDestroy, |
317 Widget::DontMirrorOriginInRTL); | |
314 frame_container_->SetWidgetDelegate(this); | 318 frame_container_->SetWidgetDelegate(this); |
315 frame_container_->SetAlwaysOnTop(true); | 319 frame_container_->SetAlwaysOnTop(true); |
316 frame_container_->Init(NULL, balloon_rect); | 320 frame_container_->Init(NULL, balloon_rect); |
317 frame_container_->SetContentsView(this); | 321 frame_container_->SetContentsView(this); |
318 frame_container_->MoveAbove(html_container_); | 322 frame_container_->MoveAbove(html_container_); |
319 | 323 |
320 close_button_->SetImage(views::CustomButton::BS_NORMAL, | 324 close_button_->SetImage(views::CustomButton::BS_NORMAL, |
321 rb.GetBitmapNamed(IDR_BALLOON_CLOSE)); | 325 rb.GetBitmapNamed(IDR_BALLOON_CLOSE)); |
322 close_button_->SetImage(views::CustomButton::BS_HOT, | 326 close_button_->SetImage(views::CustomButton::BS_HOT, |
323 rb.GetBitmapNamed(IDR_BALLOON_CLOSE_HOVER)); | 327 rb.GetBitmapNamed(IDR_BALLOON_CLOSE_HOVER)); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 NOTREACHED(); | 513 NOTREACHED(); |
510 return; | 514 return; |
511 } | 515 } |
512 | 516 |
513 // If the renderer process attached to this balloon is disconnected | 517 // If the renderer process attached to this balloon is disconnected |
514 // (e.g., because of a crash), we want to close the balloon. | 518 // (e.g., because of a crash), we want to close the balloon. |
515 notification_registrar_.Remove(this, | 519 notification_registrar_.Remove(this, |
516 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); | 520 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); |
517 Close(false); | 521 Close(false); |
518 } | 522 } |
OLD | NEW |