Chromium Code Reviews| Index: blimp/client/core/contents/blimp_contents_manager.h |
| diff --git a/blimp/client/core/contents/blimp_contents_manager.h b/blimp/client/core/contents/blimp_contents_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..81ade613cadd222b5a23217172e2ec58f875a74b |
| --- /dev/null |
| +++ b/blimp/client/core/contents/blimp_contents_manager.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ |
| +#define BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ |
| + |
| +#include "blimp/client/core/contents/blimp_contents_impl.h" |
| +#include "blimp/client/public/contents/blimp_contents_observer.h" |
| + |
| +namespace blimp { |
| +namespace client { |
| + |
| +class BlimpContentsManager { |
| + public: |
| + BlimpContentsManager(); |
| + ~BlimpContentsManager(); |
| + |
| + std::unique_ptr<BlimpContentsImpl> CreateBlimpContents(); |
| + BlimpContentsImpl* GetBlimpContents(int id); |
| + |
| + private: |
| + class BlimpContentsDeletionObserver : public BlimpContentsObserver { |
|
David Trainor- moved to gerrit
2016/08/04 16:21:18
Leave this in the cc file and surround it with ano
Menglin
2016/08/05 02:08:24
BlimpContentsDeletionObserver doesn't work with an
David Trainor- moved to gerrit
2016/08/05 16:10:23
Sorry I suggested that before I wrote my other com
Menglin
2016/08/05 16:39:01
Done.
|
| + public: |
| + BlimpContentsDeletionObserver(BlimpContentsManager* blimp_contents_manager, |
| + BlimpContentsImpl* blimp_contents); |
| + ~BlimpContentsDeletionObserver() override; |
| + |
| + void OnContentsDestroyed() override; |
| + |
| + BlimpContentsImpl* blimp_contents() { return contents_; } |
| + |
| + private: |
| + // The BlimpContentsManager containing this BlimpContentsDeletionObserver |
| + BlimpContentsManager* blimp_contents_manager_; |
| + |
| + // The BlimpContents being tracked by this BlimpContentsDeletionObserver. |
| + BlimpContentsImpl* contents_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BlimpContentsDeletionObserver); |
| + }; |
| + |
| + int CreateBlimpContentsId(); |
| + void EraseObserverFromMap(int id); |
| + |
| + std::map<int, std::unique_ptr<BlimpContentsDeletionObserver>> observer_map_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BlimpContentsManager); |
| +}; |
| + |
| +} // namespace client |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_MANAGER_H_ |