| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_observer.h" | 5 #include "ios/web/public/web_state/web_state_observer.h" |
| 6 | 6 |
| 7 #include "ios/web/public/load_committed_details.h" | 7 #include "ios/web/public/load_committed_details.h" |
| 8 #import "ios/web/public/web_state/web_state.h" | 8 #import "ios/web/public/web_state/web_state.h" |
| 9 | 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
| 10 namespace web { | 14 namespace web { |
| 11 | 15 |
| 12 WebStateObserver::WebStateObserver(WebState* web_state) : web_state_(nullptr) { | 16 WebStateObserver::WebStateObserver(WebState* web_state) : web_state_(nullptr) { |
| 13 Observe(web_state); | 17 Observe(web_state); |
| 14 } | 18 } |
| 15 | 19 |
| 16 WebStateObserver::WebStateObserver() : web_state_(nullptr) {} | 20 WebStateObserver::WebStateObserver() : web_state_(nullptr) {} |
| 17 | 21 |
| 18 WebStateObserver::~WebStateObserver() { | 22 WebStateObserver::~WebStateObserver() { |
| 19 if (web_state_) | 23 if (web_state_) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 31 if (web_state_) | 35 if (web_state_) |
| 32 web_state_->AddObserver(this); | 36 web_state_->AddObserver(this); |
| 33 } | 37 } |
| 34 | 38 |
| 35 void WebStateObserver::ResetWebState() { | 39 void WebStateObserver::ResetWebState() { |
| 36 web_state_->RemoveObserver(this); | 40 web_state_->RemoveObserver(this); |
| 37 web_state_ = nullptr; | 41 web_state_ = nullptr; |
| 38 } | 42 } |
| 39 | 43 |
| 40 } // namespace web | 44 } // namespace web |
| OLD | NEW |