find_notification_details.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_FIND_IN_PAGE_FIND_NOTIFICATION_DETAILS_H_
  5. #define COMPONENTS_FIND_IN_PAGE_FIND_NOTIFICATION_DETAILS_H_
  6. #include "ui/gfx/geometry/rect.h"
  7. namespace find_in_page {
  8. class FindNotificationDetails {
  9. public:
  10. FindNotificationDetails(int request_id,
  11. int number_of_matches,
  12. const gfx::Rect& selection_rect,
  13. int active_match_ordinal,
  14. bool final_update)
  15. : request_id_(request_id),
  16. number_of_matches_(number_of_matches),
  17. selection_rect_(selection_rect),
  18. active_match_ordinal_(active_match_ordinal),
  19. final_update_(final_update) {}
  20. FindNotificationDetails()
  21. : request_id_(0),
  22. number_of_matches_(-1),
  23. active_match_ordinal_(-1),
  24. final_update_(false) {}
  25. ~FindNotificationDetails() {}
  26. int request_id() const { return request_id_; }
  27. int number_of_matches() const { return number_of_matches_; }
  28. gfx::Rect selection_rect() const { return selection_rect_; }
  29. int active_match_ordinal() const { return active_match_ordinal_; }
  30. bool final_update() const { return final_update_; }
  31. bool operator==(const FindNotificationDetails& other) const {
  32. return std::tie(request_id_, number_of_matches_, selection_rect_,
  33. active_match_ordinal_, final_update_) ==
  34. std::tie(other.request_id_, other.number_of_matches_,
  35. other.selection_rect_, other.active_match_ordinal_,
  36. other.final_update_);
  37. }
  38. private:
  39. int request_id_; // The find-in-page request whose results we're returning.
  40. int number_of_matches_; // How many matches were found.
  41. gfx::Rect selection_rect_; // Where selection occurred (screen coordinate).
  42. int active_match_ordinal_; // The ordinal of the currently selected match.
  43. bool final_update_; // Whether this is the last Find Result update.
  44. };
  45. } // namespace find_in_page
  46. #endif // COMPONENTS_FIND_IN_PAGE_FIND_NOTIFICATION_DETAILS_H_