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/notifications/balloon_view_views.h" | 5 #include "chrome/browser/ui/views/notifications/balloon_view_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 content::RenderWidgetHostView* view = | 226 content::RenderWidgetHostView* view = |
227 html_contents_->web_contents()->GetRenderWidgetHostView(); | 227 html_contents_->web_contents()->GetRenderWidgetHostView(); |
228 if (view) | 228 if (view) |
229 view->SetSize(contents_rect.size()); | 229 view->SetSize(contents_rect.size()); |
230 return; | 230 return; |
231 } | 231 } |
232 | 232 |
233 anim_frame_end_ = gfx::Rect( | 233 anim_frame_end_ = gfx::Rect( |
234 balloon_->GetPosition().x(), balloon_->GetPosition().y(), | 234 balloon_->GetPosition().x(), balloon_->GetPosition().y(), |
235 GetTotalWidth(), GetTotalHeight()); | 235 GetTotalWidth(), GetTotalHeight()); |
236 anim_frame_start_ = frame_container_->GetClientAreaScreenBounds(); | 236 anim_frame_start_ = frame_container_->GetClientAreaBoundsInScreen(); |
237 animation_.reset(new ui::SlideAnimation(this)); | 237 animation_.reset(new ui::SlideAnimation(this)); |
238 animation_->Show(); | 238 animation_->Show(); |
239 } | 239 } |
240 | 240 |
241 void BalloonViewImpl::Update() { | 241 void BalloonViewImpl::Update() { |
242 DCHECK(html_contents_.get()) << "BalloonView::Update called before Show"; | 242 DCHECK(html_contents_.get()) << "BalloonView::Update called before Show"; |
243 if (!html_contents_->web_contents()) | 243 if (!html_contents_->web_contents()) |
244 return; | 244 return; |
245 html_contents_->web_contents()->GetController().LoadURL( | 245 html_contents_->web_contents()->GetController().LoadURL( |
246 balloon_->notification().content_url(), content::Referrer(), | 246 balloon_->notification().content_url(), content::Referrer(), |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 + kTopMargin + kBottomMargin + kTopShadowWidth + kBottomShadowWidth | 493 + kTopMargin + kBottomMargin + kTopShadowWidth + kBottomShadowWidth |
494 + GetShelfHeight(); | 494 + GetShelfHeight(); |
495 } | 495 } |
496 | 496 |
497 gfx::Rect BalloonViewImpl::GetContentsRectangle() const { | 497 gfx::Rect BalloonViewImpl::GetContentsRectangle() const { |
498 if (!frame_container_) | 498 if (!frame_container_) |
499 return gfx::Rect(); | 499 return gfx::Rect(); |
500 | 500 |
501 gfx::Size content_size = balloon_->content_size(); | 501 gfx::Size content_size = balloon_->content_size(); |
502 gfx::Point offset = GetContentsOffset(); | 502 gfx::Point offset = GetContentsOffset(); |
503 gfx::Rect frame_rect = frame_container_->GetWindowScreenBounds(); | 503 gfx::Rect frame_rect = frame_container_->GetWindowBoundsInScreen(); |
504 return gfx::Rect(frame_rect.x() + offset.x(), | 504 return gfx::Rect(frame_rect.x() + offset.x(), |
505 frame_rect.y() + GetShelfHeight() + offset.y(), | 505 frame_rect.y() + GetShelfHeight() + offset.y(), |
506 content_size.width(), | 506 content_size.width(), |
507 content_size.height()); | 507 content_size.height()); |
508 } | 508 } |
509 | 509 |
510 void BalloonViewImpl::OnPaint(gfx::Canvas* canvas) { | 510 void BalloonViewImpl::OnPaint(gfx::Canvas* canvas) { |
511 DCHECK(canvas); | 511 DCHECK(canvas); |
512 // Paint the menu bar area white, with proper rounded corners. | 512 // Paint the menu bar area white, with proper rounded corners. |
513 gfx::Path path; | 513 gfx::Path path; |
(...skipping 26 matching lines...) Expand all Loading... |
540 return; | 540 return; |
541 } | 541 } |
542 | 542 |
543 // If the renderer process attached to this balloon is disconnected | 543 // If the renderer process attached to this balloon is disconnected |
544 // (e.g., because of a crash), we want to close the balloon. | 544 // (e.g., because of a crash), we want to close the balloon. |
545 notification_registrar_.Remove( | 545 notification_registrar_.Remove( |
546 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, | 546 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
547 content::Source<Balloon>(balloon_)); | 547 content::Source<Balloon>(balloon_)); |
548 Close(false); | 548 Close(false); |
549 } | 549 } |
OLD | NEW |