Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/browser/ui/views/notifications/balloon_view_views.cc

Issue 11148007: views: Fix a bunch of dchecks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 163
164 void BalloonViewImpl::OnDisplayChanged() { 164 void BalloonViewImpl::OnDisplayChanged() {
165 collection_->DisplayChanged(); 165 collection_->DisplayChanged();
166 } 166 }
167 167
168 void BalloonViewImpl::OnWorkAreaChanged() { 168 void BalloonViewImpl::OnWorkAreaChanged() {
169 collection_->DisplayChanged(); 169 collection_->DisplayChanged();
170 } 170 }
171 171
172 void BalloonViewImpl::ButtonPressed(views::Button* sender, 172 void BalloonViewImpl::ButtonPressed(views::Button* sender, const ui::Event&) {
173 const ui::Event&) {
174 // The only button currently is the close button. 173 // The only button currently is the close button.
175 DCHECK(sender == close_button_); 174 DCHECK_EQ(close_button_, sender);
176 Close(true); 175 Close(true);
177 } 176 }
178 177
179 void BalloonViewImpl::DelayedClose(bool by_user) { 178 void BalloonViewImpl::DelayedClose(bool by_user) {
180 balloon_->OnClose(by_user); 179 balloon_->OnClose(by_user);
181 } 180 }
182 181
183 gfx::Size BalloonViewImpl::GetPreferredSize() { 182 gfx::Size BalloonViewImpl::GetPreferredSize() {
184 return gfx::Size(1000, 1000); 183 return gfx::Size(1000, 1000);
185 } 184 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 void BalloonViewImpl::Update() { 230 void BalloonViewImpl::Update() {
232 DCHECK(html_contents_.get()) << "BalloonView::Update called before Show"; 231 DCHECK(html_contents_.get()) << "BalloonView::Update called before Show";
233 if (!html_contents_->web_contents()) 232 if (!html_contents_->web_contents())
234 return; 233 return;
235 html_contents_->web_contents()->GetController().LoadURL( 234 html_contents_->web_contents()->GetController().LoadURL(
236 balloon_->notification().content_url(), content::Referrer(), 235 balloon_->notification().content_url(), content::Referrer(),
237 content::PAGE_TRANSITION_LINK, std::string()); 236 content::PAGE_TRANSITION_LINK, std::string());
238 } 237 }
239 238
240 void BalloonViewImpl::AnimationProgressed(const ui::Animation* animation) { 239 void BalloonViewImpl::AnimationProgressed(const ui::Animation* animation) {
241 DCHECK(animation == animation_.get()); 240 DCHECK_EQ(animation_.get(), animation);
242 241
243 // Linear interpolation from start to end position. 242 // Linear interpolation from start to end position.
244 double e = animation->GetCurrentValue(); 243 double e = animation->GetCurrentValue();
245 double s = (1.0 - e); 244 double s = (1.0 - e);
246 245
247 gfx::Rect frame_position( 246 gfx::Rect frame_position(
248 static_cast<int>(s * anim_frame_start_.x() + 247 static_cast<int>(s * anim_frame_start_.x() +
249 e * anim_frame_end_.x()), 248 e * anim_frame_end_.x()),
250 static_cast<int>(s * anim_frame_start_.y() + 249 static_cast<int>(s * anim_frame_start_.y() +
251 e * anim_frame_end_.y()), 250 e * anim_frame_end_.y()),
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 return; 532 return;
534 } 533 }
535 534
536 // If the renderer process attached to this balloon is disconnected 535 // If the renderer process attached to this balloon is disconnected
537 // (e.g., because of a crash), we want to close the balloon. 536 // (e.g., because of a crash), we want to close the balloon.
538 notification_registrar_.Remove( 537 notification_registrar_.Remove(
539 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, 538 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED,
540 content::Source<Balloon>(balloon_)); 539 content::Source<Balloon>(balloon_));
541 Close(false); 540 Close(false);
542 } 541 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698