OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 gfx::Size BalloonViewImpl::GetSize() const { | 125 gfx::Size BalloonViewImpl::GetSize() const { |
126 // BalloonView has no size if it hasn't been shown yet (which is when | 126 // BalloonView has no size if it hasn't been shown yet (which is when |
127 // balloon_ is set). | 127 // balloon_ is set). |
128 if (!balloon_) | 128 if (!balloon_) |
129 return gfx::Size(0, 0); | 129 return gfx::Size(0, 0); |
130 | 130 |
131 return gfx::Size(GetTotalWidth(), GetTotalHeight()); | 131 return gfx::Size(GetTotalWidth(), GetTotalHeight()); |
132 } | 132 } |
133 | 133 |
| 134 BalloonHost* BalloonViewImpl::GetHost() const { |
| 135 return html_contents_.get(); |
| 136 } |
| 137 |
134 void BalloonViewImpl::RunMenu(views::View* source, const gfx::Point& pt) { | 138 void BalloonViewImpl::RunMenu(views::View* source, const gfx::Point& pt) { |
135 RunOptionsMenu(pt); | 139 RunOptionsMenu(pt); |
136 } | 140 } |
137 | 141 |
138 void BalloonViewImpl::DisplayChanged() { | 142 void BalloonViewImpl::DisplayChanged() { |
139 collection_->DisplayChanged(); | 143 collection_->DisplayChanged(); |
140 } | 144 } |
141 | 145 |
142 void BalloonViewImpl::WorkAreaChanged() { | 146 void BalloonViewImpl::WorkAreaChanged() { |
143 collection_->DisplayChanged(); | 147 collection_->DisplayChanged(); |
(...skipping 15 matching lines...) Expand all Loading... |
159 frame_container_->GetRootView()->RemoveAllChildViews(true); | 163 frame_container_->GetRootView()->RemoveAllChildViews(true); |
160 frame_container_->CloseNow(); | 164 frame_container_->CloseNow(); |
161 balloon_->OnClose(by_user); | 165 balloon_->OnClose(by_user); |
162 } | 166 } |
163 | 167 |
164 void BalloonViewImpl::DidChangeBounds(const gfx::Rect& previous, | 168 void BalloonViewImpl::DidChangeBounds(const gfx::Rect& previous, |
165 const gfx::Rect& current) { | 169 const gfx::Rect& current) { |
166 SizeContentsWindow(); | 170 SizeContentsWindow(); |
167 } | 171 } |
168 | 172 |
| 173 gfx::Size BalloonViewImpl::GetPreferredSize() { |
| 174 return gfx::Size(1000, 1000); |
| 175 } |
| 176 |
169 void BalloonViewImpl::SizeContentsWindow() { | 177 void BalloonViewImpl::SizeContentsWindow() { |
170 if (!html_container_ || !frame_container_) | 178 if (!html_container_ || !frame_container_) |
171 return; | 179 return; |
172 | 180 |
173 gfx::Rect contents_rect = GetContentsRectangle(); | 181 gfx::Rect contents_rect = GetContentsRectangle(); |
174 html_container_->SetBounds(contents_rect); | 182 html_container_->SetBounds(contents_rect); |
175 html_container_->MoveAbove(frame_container_); | 183 html_container_->MoveAbove(frame_container_); |
176 | 184 |
177 gfx::Path path; | 185 gfx::Path path; |
178 GetContentsMask(contents_rect, &path); | 186 GetContentsMask(contents_rect, &path); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 NOTREACHED(); | 502 NOTREACHED(); |
495 return; | 503 return; |
496 } | 504 } |
497 | 505 |
498 // If the renderer process attached to this balloon is disconnected | 506 // If the renderer process attached to this balloon is disconnected |
499 // (e.g., because of a crash), we want to close the balloon. | 507 // (e.g., because of a crash), we want to close the balloon. |
500 notification_registrar_.Remove(this, | 508 notification_registrar_.Remove(this, |
501 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); | 509 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon_)); |
502 Close(false); | 510 Close(false); |
503 } | 511 } |
OLD | NEW |