Chromium Code Reviews| 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 // An observer API implemented by classes which are interested in various events | 14 // An observer API implemented by classes which are interested in various events |
| 15 // related to BlimpContents. | 15 // related to BlimpContents. |
| 16 class BlimpContentsObserver { | 16 class BlimpContentsObserver { |
| 17 public: | 17 public: |
| 18 virtual ~BlimpContentsObserver() = default; | 18 virtual ~BlimpContentsObserver(); |
| 19 | 19 |
| 20 // Invoked when the navigation state of the BlimpContents has changed. | 20 // Invoked when the navigation state of the BlimpContents has changed. |
| 21 virtual void OnNavigationStateChanged() {} | 21 virtual void OnNavigationStateChanged() {} |
| 22 | 22 |
| 23 // Invoked when the blimp contents is destroyed. | |
| 24 virtual void OnContentsDestroyed(); | |
| 25 | |
| 26 BlimpContents* blimp_contents() { return contents_; } | |
| 27 | |
| 23 protected: | 28 protected: |
| 24 BlimpContentsObserver() {} | 29 explicit BlimpContentsObserver(BlimpContents* blimp_contents); |
| 30 | |
| 31 // Can be used by subclass to clear the contents_ to nullptr. | |
| 32 void ClearBlimpContents(); | |
|
David Trainor- moved to gerrit
2016/08/06 04:32:58
See above, now that I think about it this should h
Menglin
2016/08/09 00:31:18
Done.
| |
| 25 | 33 |
| 26 private: | 34 private: |
| 35 // The BlimpContents being tracked by this BlimpContentsObserver. | |
| 36 BlimpContents* contents_; | |
| 37 | |
| 27 DISALLOW_COPY_AND_ASSIGN(BlimpContentsObserver); | 38 DISALLOW_COPY_AND_ASSIGN(BlimpContentsObserver); |
| 28 }; | 39 }; |
| 29 | 40 |
| 30 } // namespace client | 41 } // namespace client |
| 31 } // namespace blimp | 42 } // namespace blimp |
| 32 | 43 |
| 33 #endif // BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_OBSERVER_H_ | 44 #endif // BLIMP_CLIENT_PUBLIC_CONTENTS_BLIMP_CONTENTS_OBSERVER_H_ |
| OLD | NEW |