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

Unified Diff: ui/views/view_model.h

Issue 10213011: Attempt 3 at a better touch tabstrip. There is still a bunch to do, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove Tab::GetTouchModeMinimumSize Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | ui/views/view_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view_model.h
diff --git a/ui/views/view_model.h b/ui/views/view_model.h
index 6a68fb10f84ee18f51fec327b0a7cb2e128f7726..2493878b1df8b06114f957e81c4e6a81e3644e8c 100644
--- a/ui/views/view_model.h
+++ b/ui/views/view_model.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/logging.h"
#include "ui/gfx/rect.h"
#include "ui/views/views_export.h"
@@ -46,14 +47,17 @@ class VIEWS_EXPORT ViewModel {
// Returns the view at the specified index.
View* view_at(int index) const {
+ check_index(index);
return entries_[index].view;
}
void set_ideal_bounds(int index, const gfx::Rect& bounds) {
+ check_index(index);
entries_[index].ideal_bounds = bounds;
}
const gfx::Rect& ideal_bounds(int index) const {
+ check_index(index);
return entries_[index].ideal_bounds;
}
@@ -70,6 +74,15 @@ class VIEWS_EXPORT ViewModel {
};
typedef std::vector<Entry> Entries;
+#if !defined(NDEBUG)
+ void check_index(int index) const {
+ DCHECK_LT(index, static_cast<int>(entries_.size()));
+ DCHECK_GE(index, 0);
+ }
+#else
+ void check_index(int index) const {}
+#endif
+
Entries entries_;
DISALLOW_COPY_AND_ASSIGN(ViewModel);
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | ui/views/view_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698