OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "ios/chrome/browser/ui/tabs/target_frame_cache.h" | 5 #include "ios/chrome/browser/ui/tabs/target_frame_cache.h" |
6 | 6 |
| 7 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 8 #error "This file requires ARC support." |
| 9 #endif |
| 10 |
7 TargetFrameCache::TargetFrameCache() {} | 11 TargetFrameCache::TargetFrameCache() {} |
8 | 12 |
9 TargetFrameCache::~TargetFrameCache() {} | 13 TargetFrameCache::~TargetFrameCache() {} |
10 | 14 |
11 void TargetFrameCache::AddFrame(UIView* view, CGRect frame) { | 15 void TargetFrameCache::AddFrame(UIView* view, CGRect frame) { |
12 targetFrames_[view] = frame; | 16 targetFrames_[view] = frame; |
13 } | 17 } |
14 | 18 |
15 void TargetFrameCache::RemoveFrame(UIView* view) { | 19 void TargetFrameCache::RemoveFrame(UIView* view) { |
16 targetFrames_.erase(view); | 20 targetFrames_.erase(view); |
17 } | 21 } |
18 | 22 |
19 CGRect TargetFrameCache::GetFrame(UIView* view) { | 23 CGRect TargetFrameCache::GetFrame(UIView* view) { |
20 std::map<UIView*, CGRect>::iterator it = targetFrames_.find(view); | 24 std::map<UIView*, CGRect>::iterator it = targetFrames_.find(view); |
21 if (it != targetFrames_.end()) | 25 if (it != targetFrames_.end()) |
22 return it->second; | 26 return it->second; |
23 | 27 |
24 return CGRectZero; | 28 return CGRectZero; |
25 } | 29 } |
26 | 30 |
27 bool TargetFrameCache::HasFrame(UIView* view) { | 31 bool TargetFrameCache::HasFrame(UIView* view) { |
28 return targetFrames_.find(view) != targetFrames_.end(); | 32 return targetFrames_.find(view) != targetFrames_.end(); |
29 } | 33 } |
OLD | NEW |