| 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 namespace web { | 9 namespace web { |
| 10 | 10 |
| 11 WebStateDelegate::WebStateDelegate() {} | 11 WebStateDelegate::WebStateDelegate() {} |
| 12 | 12 |
| 13 WebStateDelegate::~WebStateDelegate() { | 13 WebStateDelegate::~WebStateDelegate() { |
| 14 while (!attached_states_.empty()) { | 14 while (!attached_states_.empty()) { |
| 15 WebState* web_state = *attached_states_.begin(); | 15 WebState* web_state = *attached_states_.begin(); |
| 16 web_state->SetDelegate(nullptr); | 16 web_state->SetDelegate(nullptr); |
| 17 } | 17 } |
| 18 DCHECK(attached_states_.empty()); | 18 DCHECK(attached_states_.empty()); |
| 19 } | 19 } |
| 20 | 20 |
| 21 void WebStateDelegate::LoadProgressChanged(WebState*, double) {} | 21 void WebStateDelegate::LoadProgressChanged(WebState*, double) {} |
| 22 | 22 |
| 23 bool WebStateDelegate::HandleContextMenu(WebState*, const ContextMenuParams&) { | 23 bool WebStateDelegate::HandleContextMenu(WebState*, const ContextMenuParams&) { |
| 24 return false; | 24 return false; |
| 25 } | 25 } |
| 26 | 26 |
| 27 DialogPresenter* WebStateDelegate::GetDialogPresenter(WebState*) { |
| 28 return nullptr; |
| 29 } |
| 30 |
| 27 void WebStateDelegate::Attach(WebState* source) { | 31 void WebStateDelegate::Attach(WebState* source) { |
| 28 DCHECK(attached_states_.find(source) == attached_states_.end()); | 32 DCHECK(attached_states_.find(source) == attached_states_.end()); |
| 29 attached_states_.insert(source); | 33 attached_states_.insert(source); |
| 30 } | 34 } |
| 31 | 35 |
| 32 void WebStateDelegate::Detach(WebState* source) { | 36 void WebStateDelegate::Detach(WebState* source) { |
| 33 DCHECK(attached_states_.find(source) != attached_states_.end()); | 37 DCHECK(attached_states_.find(source) != attached_states_.end()); |
| 34 attached_states_.erase(source); | 38 attached_states_.erase(source); |
| 35 } | 39 } |
| 36 | 40 |
| 37 } // web | 41 } // web |
| OLD | NEW |