Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "blimp/client/public/contents/blimp_contents.h" | |
| 6 #include "blimp/client/public/contents/blimp_contents_observer.h" | |
| 7 | |
| 8 namespace blimp { | |
| 9 namespace client { | |
| 10 | |
| 11 BlimpContentsObserver::BlimpContentsObserver(BlimpContents* blimp_contents) | |
| 12 : contents_(blimp_contents) { | |
| 13 blimp_contents->AddObserver(this); | |
| 14 } | |
| 15 | |
| 16 BlimpContentsObserver::~BlimpContentsObserver() { | |
|
David Trainor- moved to gerrit
2016/08/06 04:32:58
Can we have two unit tests for this?
1. When this
Menglin
2016/08/09 00:31:18
Done.
| |
| 17 if (contents_) | |
| 18 contents_->RemoveObserver(this); | |
| 19 } | |
| 20 | |
| 21 void BlimpContentsObserver::OnContentsDestroyed() { | |
| 22 DCHECK(contents_); | |
| 23 ClearBlimpContents(); | |
| 24 } | |
| 25 | |
| 26 void BlimpContentsObserver::ClearBlimpContents() { | |
| 27 contents_ = nullptr; | |
| 28 } | |
| 29 | |
| 30 } // namespace client | |
| 31 } // namespace blimp | |
| OLD | NEW |