| 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 #ifndef BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_OBSERVER_H_ | 5 #ifndef BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_OBSERVER_H_ |
| 6 #define BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_OBSERVER_H_ | 6 #define BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 10 | 10 |
| 11 namespace blimp { | 11 namespace blimp { |
| 12 namespace client { | 12 namespace client { |
| 13 | 13 |
| 14 class BlimpContents; |
| 15 |
| 14 // An observer API implemented by classes which are interested in various events | 16 // An observer API implemented by classes which are interested in various events |
| 15 // related to BlimpContents. | 17 // related to BlimpContents. |
| 16 class BlimpContentsObserver { | 18 class BlimpContentsObserver { |
| 17 public: | 19 public: |
| 18 virtual ~BlimpContentsObserver() = default; | 20 virtual ~BlimpContentsObserver(); |
| 19 | 21 |
| 20 // Invoked when the navigation state of the BlimpContents has changed. | 22 // Invoked when the navigation state of the BlimpContents has changed. |
| 21 virtual void OnNavigationStateChanged() {} | 23 virtual void OnNavigationStateChanged() {} |
| 22 | 24 |
| 25 // Called by BlimpContentsDying(). |
| 26 virtual void OnContentsDestroyed() {} |
| 27 |
| 28 // Invoke when the destructor of blimp contents is called. This will clear |
| 29 // the contents_ to nullptr. |
| 30 void BlimpContentsDying(); |
| 31 |
| 32 BlimpContents* blimp_contents() { return contents_; } |
| 33 |
| 23 protected: | 34 protected: |
| 24 BlimpContentsObserver() {} | 35 explicit BlimpContentsObserver(BlimpContents* blimp_contents); |
| 25 | 36 |
| 26 private: | 37 private: |
| 38 // The BlimpContents being tracked by this BlimpContentsObserver. |
| 39 BlimpContents* contents_; |
| 40 |
| 27 DISALLOW_COPY_AND_ASSIGN(BlimpContentsObserver); | 41 DISALLOW_COPY_AND_ASSIGN(BlimpContentsObserver); |
| 28 }; | 42 }; |
| 29 | 43 |
| 30 } // namespace client | 44 } // namespace client |
| 31 } // namespace blimp | 45 } // namespace blimp |
| 32 | 46 |
| 33 #endif // BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_OBSERVER_H_ | 47 #endif // BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_OBSERVER_H_ |
| OLD | NEW |