| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/web/public/web_state/web_state_delegate.h" | 5 #import "ios/web/public/web_state/web_state_delegate.h" |
| 6 | 6 |
| 7 #import "ios/web/public/web_state/web_state.h" | 7 #import "ios/web/public/web_state/web_state.h" |
| 8 | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
| 12 |
| 9 namespace web { | 13 namespace web { |
| 10 | 14 |
| 11 WebStateDelegate::WebStateDelegate() {} | 15 WebStateDelegate::WebStateDelegate() {} |
| 12 | 16 |
| 13 WebStateDelegate::~WebStateDelegate() { | 17 WebStateDelegate::~WebStateDelegate() { |
| 14 while (!attached_states_.empty()) { | 18 while (!attached_states_.empty()) { |
| 15 WebState* web_state = *attached_states_.begin(); | 19 WebState* web_state = *attached_states_.begin(); |
| 16 web_state->SetDelegate(nullptr); | 20 web_state->SetDelegate(nullptr); |
| 17 } | 21 } |
| 18 DCHECK(attached_states_.empty()); | 22 DCHECK(attached_states_.empty()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 DCHECK(attached_states_.find(source) == attached_states_.end()); | 63 DCHECK(attached_states_.find(source) == attached_states_.end()); |
| 60 attached_states_.insert(source); | 64 attached_states_.insert(source); |
| 61 } | 65 } |
| 62 | 66 |
| 63 void WebStateDelegate::Detach(WebState* source) { | 67 void WebStateDelegate::Detach(WebState* source) { |
| 64 DCHECK(attached_states_.find(source) != attached_states_.end()); | 68 DCHECK(attached_states_.find(source) != attached_states_.end()); |
| 65 attached_states_.erase(source); | 69 attached_states_.erase(source); |
| 66 } | 70 } |
| 67 | 71 |
| 68 } // web | 72 } // web |
| OLD | NEW |