Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: chrome_frame/bind_context_info.h

Issue 2011016: Use an interface to get to the C++ object pointer instead of casting directly... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome_frame/bind_context_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_FRAME_BIND_CONTEXT_INFO_ 5 #ifndef CHROME_FRAME_BIND_CONTEXT_INFO_
6 #define CHROME_FRAME_BIND_CONTEXT_INFO_ 6 #define CHROME_FRAME_BIND_CONTEXT_INFO_
7 7
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <atlcom.h> 9 #include <atlcom.h>
10 10
11 #include "base/scoped_bstr_win.h" 11 #include "base/scoped_bstr_win.h"
12 #include "base/scoped_comptr_win.h" 12 #include "base/scoped_comptr_win.h"
13 13
14 class __declspec(uuid("71CC3EC7-7E8A-457f-93BC-1090CF31CC18"))
15 IBindContextInfoInternal : public IUnknown {
16 public:
17 STDMETHOD(GetCppObject)(void** me) = 0;
18 };
19
14 // This class maintains contextual information used by ChromeFrame. 20 // This class maintains contextual information used by ChromeFrame.
15 // This information is maintained in the bind context. 21 // This information is maintained in the bind context.
16 class BindContextInfo : public IUnknown, public CComObjectRoot { 22 class BindContextInfo
23 : public IBindContextInfoInternal,
24 public CComObjectRoot {
17 public: 25 public:
18 BindContextInfo(); 26 BindContextInfo();
19 virtual ~BindContextInfo() {} 27 ~BindContextInfo();
20 28
21 BEGIN_COM_MAP(BindContextInfo) 29 BEGIN_COM_MAP(BindContextInfo)
22 COM_INTERFACE_ENTRY(IUnknown) 30 COM_INTERFACE_ENTRY(IBindContextInfoInternal)
31 COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, ftm_)
23 END_COM_MAP() 32 END_COM_MAP()
24 33
25 // Returns the BindContextInfo instance associated with the bind 34 // Returns the BindContextInfo instance associated with the bind
26 // context. Creates it if needed. 35 // context. Creates it if needed.
27 static BindContextInfo* FromBindContext(IBindCtx* bind_context); 36 static BindContextInfo* FromBindContext(IBindCtx* bind_context);
28 37
29 void set_chrome_request(bool chrome_request) { 38 void set_chrome_request(bool chrome_request) {
30 chrome_request_ = chrome_request; 39 chrome_request_ = chrome_request;
31 } 40 }
32 41
(...skipping 12 matching lines...) Expand all
45 bool is_switching() const { 54 bool is_switching() const {
46 return is_switching_; 55 return is_switching_;
47 } 56 }
48 57
49 void SetToSwitch(IStream* cache); 58 void SetToSwitch(IStream* cache);
50 59
51 IStream* cache() { 60 IStream* cache() {
52 return cache_; 61 return cache_;
53 } 62 }
54 63
55 void set_url(const std::wstring& url) { 64 // Accept a const wchar_t* to ensure that we don't have a reference
56 url_ = url; 65 // to someone else's buffer.
66 void set_url(const wchar_t* url) {
67 DCHECK(url);
68 if (url) {
69 url_ = url;
70 } else {
71 url_.clear();
72 }
57 } 73 }
58 74
59 const std::wstring url() const { 75 const std::wstring& url() const {
60 return url_; 76 return url_;
61 } 77 }
62 78
63 private: 79 private:
80 STDMETHOD(GetCppObject)(void** me) {
81 DCHECK(me);
82 *me = static_cast<BindContextInfo*>(this);
83 return S_OK;
84 }
85
86 private:
64 ScopedComPtr<IStream> cache_; 87 ScopedComPtr<IStream> cache_;
65 bool no_cache_; 88 bool no_cache_;
66 bool chrome_request_; 89 bool chrome_request_;
67 bool is_switching_; 90 bool is_switching_;
68 std::wstring url_; 91 std::wstring url_;
92 ScopedComPtr<IUnknown> ftm_;
69 93
70 DISALLOW_COPY_AND_ASSIGN(BindContextInfo); 94 DISALLOW_COPY_AND_ASSIGN(BindContextInfo);
71 }; 95 };
72 96
73 #endif // CHROME_FRAME_BIND_CONTEXT_INFO_ 97 #endif // CHROME_FRAME_BIND_CONTEXT_INFO_
74 98
OLDNEW
« no previous file with comments | « no previous file | chrome_frame/bind_context_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698