| // Copyright 2013 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 CHROME_RENDERER_MEDIA_CAST_SESSION_H_ |
| #define CHROME_RENDERER_MEDIA_CAST_SESSION_H_ |
| |
| #include "base/basictypes.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| |
| namespace base { |
| class MessageLoopProxy; |
| } // namespace base |
| |
| class CastSessionDelegate; |
| |
| // This class represents a Cast session and allows the session to be |
| // configured on the main thread. Actual work is forwarded to |
| // CastSessionDelegate on the IO thread. |
| class CastSession : public base::RefCounted<CastSession> { |
| public: |
| CastSession(); |
| |
| private: |
| friend class base::RefCounted<CastSession>; |
| virtual ~CastSession(); |
| |
| // This member should never be dereferenced on the main thread. |
| // CastSessionDelegate lives only on the IO thread. It is always |
| // safe to post task on the IO thread to access CastSessionDelegate |
| // because it is owned by this object. |
| scoped_ptr<CastSessionDelegate> delegate_; |
| |
| // Proxy to the IO message loop. |
| const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
| |
| DISALLOW_COPY_AND_ASSIGN(CastSession); |
| }; |
| |
| #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_ |