1 // Copyright (c) 2011 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_FRAME_BIND_CONTEXT_INFO_H_
6 #define CHROME_FRAME_BIND_CONTEXT_INFO_H_
11 #include "base/win/scoped_comptr.h"
12 #include "chrome_frame/protocol_sink_wrap.h"
14 class __declspec(uuid("71CC3EC7-7E8A-457f-93BC-1090CF31CC18"))
15 IBindContextInfoInternal
: public IUnknown
{
17 STDMETHOD(GetCppObject
)(void** me
) = 0;
20 // This class maintains contextual information used by ChromeFrame.
21 // This information is maintained in the bind context.
22 // Association with GUID_NULL is for convenience.
23 class __declspec(uuid("00000000-0000-0000-0000-000000000000")) BindContextInfo
24 : public CComObjectRootEx
<CComMultiThreadModel
>,
25 public IBindContextInfoInternal
{
30 BEGIN_COM_MAP(BindContextInfo
)
31 COM_INTERFACE_ENTRY(IBindContextInfoInternal
)
32 COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal
, ftm_
)
35 // Returns the BindContextInfo instance associated with the bind
36 // context. Creates it if needed.
37 // The returned info object will be AddRef-ed on return, so use
38 // base::win::ScopedComPtr<>::Receive() to receive this pointer.
39 static HRESULT
FromBindContext(IBindCtx
* bind_context
,
40 BindContextInfo
** info
);
42 void set_chrome_request(bool chrome_request
) {
43 chrome_request_
= chrome_request
;
46 bool chrome_request() const {
47 return chrome_request_
;
50 void set_no_cache(bool no_cache
) {
54 bool no_cache() const {
58 bool is_switching() const {
62 void SetToSwitch(IStream
* cache
);
68 void set_prot_data(ProtData
* data
) {
72 scoped_refptr
<ProtData
> get_prot_data() {
76 bool has_prot_data() const {
77 return prot_data_
.get() != NULL
;
80 void set_protocol(IInternetProtocol
* protocol
) {
84 IInternetProtocol
* protocol() {
85 return protocol_
.get();
88 // Returns the url being navigated to. We retrieve the url from the ProtData
89 // instance which wraps the underlying protocol sink.
90 std::wstring
GetUrl();
93 STDMETHOD(GetCppObject
)(void** me
) {
96 *me
= static_cast<BindContextInfo
*>(this);
100 HRESULT
Initialize(IBindCtx
* bind_ctx
);
103 base::win::ScopedComPtr
<IStream
> cache_
;
105 bool chrome_request_
;
107 base::win::ScopedComPtr
<IUnknown
> ftm_
;
108 scoped_refptr
<ProtData
> prot_data_
;
109 base::win::ScopedComPtr
<IInternetProtocol
> protocol_
;
111 DISALLOW_COPY_AND_ASSIGN(BindContextInfo
);
114 #endif // CHROME_FRAME_BIND_CONTEXT_INFO_H_