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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome_frame/bind_context_info.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/bind_context_info.h
===================================================================
--- chrome_frame/bind_context_info.h (revision 47036)
+++ chrome_frame/bind_context_info.h (working copy)
@@ -11,15 +11,24 @@
#include "base/scoped_bstr_win.h"
#include "base/scoped_comptr_win.h"
+class __declspec(uuid("71CC3EC7-7E8A-457f-93BC-1090CF31CC18"))
+IBindContextInfoInternal : public IUnknown {
+ public:
+ STDMETHOD(GetCppObject)(void** me) = 0;
+};
+
// This class maintains contextual information used by ChromeFrame.
// This information is maintained in the bind context.
-class BindContextInfo : public IUnknown, public CComObjectRoot {
+class BindContextInfo
+ : public IBindContextInfoInternal,
+ public CComObjectRoot {
public:
BindContextInfo();
- virtual ~BindContextInfo() {}
+ ~BindContextInfo();
BEGIN_COM_MAP(BindContextInfo)
- COM_INTERFACE_ENTRY(IUnknown)
+ COM_INTERFACE_ENTRY(IBindContextInfoInternal)
+ COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, ftm_)
END_COM_MAP()
// Returns the BindContextInfo instance associated with the bind
@@ -52,20 +61,35 @@
return cache_;
}
- void set_url(const std::wstring& url) {
- url_ = url;
+ // Accept a const wchar_t* to ensure that we don't have a reference
+ // to someone else's buffer.
+ void set_url(const wchar_t* url) {
+ DCHECK(url);
+ if (url) {
+ url_ = url;
+ } else {
+ url_.clear();
+ }
}
- const std::wstring url() const {
+ const std::wstring& url() const {
return url_;
}
private:
+ STDMETHOD(GetCppObject)(void** me) {
+ DCHECK(me);
+ *me = static_cast<BindContextInfo*>(this);
+ return S_OK;
+ }
+
+ private:
ScopedComPtr<IStream> cache_;
bool no_cache_;
bool chrome_request_;
bool is_switching_;
std::wstring url_;
+ ScopedComPtr<IUnknown> ftm_;
DISALLOW_COPY_AND_ASSIGN(BindContextInfo);
};
« 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