diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 17:36:44 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 17:36:44 +0000 |
commit | 7be81ff2ac3306784dc9d24973b9ac02fb68e011 (patch) | |
tree | c89f1b500c3311243da37a32c2f71465ddbc9181 /ui/views/view_model.h | |
parent | fde2649e8c7a4e2d74cca52c4d43922f81e9f2fa (diff) | |
download | chromium_src-7be81ff2ac3306784dc9d24973b9ac02fb68e011.zip chromium_src-7be81ff2ac3306784dc9d24973b9ac02fb68e011.tar.gz chromium_src-7be81ff2ac3306784dc9d24973b9ac02fb68e011.tar.bz2 |
Attempt 3 at a better touch tabstrip. There is still a bunch to do,
but this gets things in a better state.
BUG=123274
TEST=covered by unit tests.
R=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10213011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133930 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/view_model.h')
-rw-r--r-- | ui/views/view_model.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ui/views/view_model.h b/ui/views/view_model.h index 6a68fb1..2493878 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); |