| 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 #include "ios/web/public/web_state/web_state_delegate.h" | 5 #include "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 WebState* WebStateDelegate::OpenURLFromWebState( |
| 22 WebState*, |
| 23 const WebState::OpenURLParams&) { |
| 24 return nullptr; |
| 25 } |
| 26 |
| 21 void WebStateDelegate::LoadProgressChanged(WebState*, double) {} | 27 void WebStateDelegate::LoadProgressChanged(WebState*, double) {} |
| 22 | 28 |
| 23 bool WebStateDelegate::HandleContextMenu(WebState*, const ContextMenuParams&) { | 29 bool WebStateDelegate::HandleContextMenu(WebState*, const ContextMenuParams&) { |
| 24 return false; | 30 return false; |
| 25 } | 31 } |
| 26 | 32 |
| 27 JavaScriptDialogPresenter* WebStateDelegate::GetJavaScriptDialogPresenter( | 33 JavaScriptDialogPresenter* WebStateDelegate::GetJavaScriptDialogPresenter( |
| 28 WebState*) { | 34 WebState*) { |
| 29 return nullptr; | 35 return nullptr; |
| 30 } | 36 } |
| 31 | 37 |
| 32 void WebStateDelegate::Attach(WebState* source) { | 38 void WebStateDelegate::Attach(WebState* source) { |
| 33 DCHECK(attached_states_.find(source) == attached_states_.end()); | 39 DCHECK(attached_states_.find(source) == attached_states_.end()); |
| 34 attached_states_.insert(source); | 40 attached_states_.insert(source); |
| 35 } | 41 } |
| 36 | 42 |
| 37 void WebStateDelegate::Detach(WebState* source) { | 43 void WebStateDelegate::Detach(WebState* source) { |
| 38 DCHECK(attached_states_.find(source) != attached_states_.end()); | 44 DCHECK(attached_states_.find(source) != attached_states_.end()); |
| 39 attached_states_.erase(source); | 45 attached_states_.erase(source); |
| 40 } | 46 } |
| 41 | 47 |
| 42 } // web | 48 } // web |
| OLD | NEW |