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

Side by Side Diff: ui/message_center/views/notification_view.cc

Issue 265713007: views: Update event-related API to use PointF/RectF instead of Point/Rect. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 "ui/message_center/views/notification_view.h" 5 #include "ui/message_center/views/notification_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 MessageView::OnFocus(); 516 MessageView::OnFocus();
517 ScrollRectToVisible(GetLocalBounds()); 517 ScrollRectToVisible(GetLocalBounds());
518 } 518 }
519 519
520 void NotificationView::ScrollRectToVisible(const gfx::Rect& rect) { 520 void NotificationView::ScrollRectToVisible(const gfx::Rect& rect) {
521 // Notification want to show the whole notification when a part of it (like 521 // Notification want to show the whole notification when a part of it (like
522 // a button) gets focused. 522 // a button) gets focused.
523 views::View::ScrollRectToVisible(GetLocalBounds()); 523 views::View::ScrollRectToVisible(GetLocalBounds());
524 } 524 }
525 525
526 views::View* NotificationView::GetEventHandlerForRect(const gfx::Rect& rect) { 526 views::View* NotificationView::GetEventHandlerForRect(const gfx::RectF& rect) {
527 // TODO(tdanderson): Modify this function to support rect-based event 527 // TODO(tdanderson): Modify this function to support rect-based event
528 // targeting. Using the center point of |rect| preserves this function's 528 // targeting. Using the center point of |rect| preserves this function's
529 // expected behavior for the time being. 529 // expected behavior for the time being.
530 gfx::Point point = rect.CenterPoint(); 530 gfx::Point point = gfx::ToFlooredPoint(rect.CenterPoint());
531 531
532 // Want to return this for underlying views, otherwise GetCursor is not 532 // Want to return this for underlying views, otherwise GetCursor is not
533 // called. But buttons are exceptions, they'll have their own event handlings. 533 // called. But buttons are exceptions, they'll have their own event handlings.
534 std::vector<views::View*> buttons(action_buttons_); 534 std::vector<views::View*> buttons(action_buttons_);
535 buttons.push_back(close_button()); 535 buttons.push_back(close_button());
536 536
537 for (size_t i = 0; i < buttons.size(); ++i) { 537 for (size_t i = 0; i < buttons.size(); ++i) {
538 gfx::Point point_in_child = point; 538 gfx::Point point_in_child = point;
539 ConvertPointToTarget(this, buttons[i], &point_in_child); 539 ConvertPointToTarget(this, buttons[i], &point_in_child);
540 if (buttons[i]->HitTestPoint(point_in_child)) 540 if (buttons[i]->HitTestPoint(point_in_child))
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 DCHECK_GT(message_line_limit, 0); 598 DCHECK_GT(message_line_limit, 0);
599 return message_line_limit; 599 return message_line_limit;
600 } 600 }
601 601
602 int NotificationView::GetMessageHeight(int width, int limit) { 602 int NotificationView::GetMessageHeight(int width, int limit) {
603 return message_view_ ? 603 return message_view_ ?
604 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0; 604 message_view_->GetSizeForWidthAndLines(width, limit).height() : 0;
605 } 605 }
606 606
607 } // namespace message_center 607 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698