1 // Copyright 2013 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.
5 #ifndef CHROME_RENDERER_MEDIA_CAST_SESSION_H_
6 #define CHROME_RENDERER_MEDIA_CAST_SESSION_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
13 class MessageLoopProxy;
16 class CastSessionDelegate;
18 // This class represents a Cast session and allows the session to be
19 // configured on the main thread. Actual work is forwarded to
20 // CastSessionDelegate on the IO thread.
21 class CastSession : public base::RefCounted<CastSession> {
26 friend class base::RefCounted<CastSession>;
27 virtual ~CastSession();
29 // This member should never be dereferenced on the main thread.
30 // CastSessionDelegate lives only on the IO thread. It is always
31 // safe to post task on the IO thread to access CastSessionDelegate
32 // because it is owned by this object.
33 scoped_ptr<CastSessionDelegate> delegate_;
35 // Proxy to the IO message loop.
36 const scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
38 DISALLOW_COPY_AND_ASSIGN(CastSession);
41 #endif // CHROME_RENDERER_MEDIA_CAST_SESSION_H_