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

Side by Side Diff: chrome_frame/chrome_frame_activex.h

Issue 218019: Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | « chrome_frame/chrome_frame.gyp ('k') | chrome_frame/chrome_frame_activex.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 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.
4
5 #ifndef CHROME_FRAME_CHROME_FRAME_ACTIVEX_H_
6 #define CHROME_FRAME_CHROME_FRAME_ACTIVEX_H_
7
8 #include <atlbase.h>
9 #include <atlcom.h>
10 #include <atlctl.h>
11
12 #include <set>
13 #include <string>
14
15 #include "base/scoped_bstr_win.h"
16 #include "base/scoped_comptr_win.h"
17 #include "base/scoped_variant_win.h"
18 #include "chrome_frame/chrome_frame_activex_base.h"
19 #include "chrome_frame/com_type_info_holder.h"
20 #include "grit/chrome_frame_resources.h"
21
22 // Include without path to make GYP build see it.
23 #include "chrome_tab.h" // NOLINT
24
25 // ChromeFrameActivex: Implementation of the ActiveX control that is
26 // responsible for hosting a chrome frame, i.e. an iframe like widget which
27 // hosts the the chrome window. This object delegates to Chrome.exe
28 // (via the Chrome IPC-based automation mechanism) for the actual rendering.
29 class ATL_NO_VTABLE ChromeFrameActivex
30 : public ChromeFrameActivexBase<ChromeFrameActivex, CLSID_ChromeFrame>,
31 public IObjectSafetyImpl<ChromeFrameActivex,
32 INTERFACESAFE_FOR_UNTRUSTED_CALLER |
33 INTERFACESAFE_FOR_UNTRUSTED_DATA>,
34 public IPersistPropertyBag {
35 public:
36 typedef ChromeFrameActivexBase<ChromeFrameActivex, CLSID_ChromeFrame> Base;
37 ChromeFrameActivex();
38 ~ChromeFrameActivex();
39
40 DECLARE_REGISTRY_RESOURCEID(IDR_CHROMEFRAME)
41
42 BEGIN_COM_MAP(ChromeFrameActivex)
43 COM_INTERFACE_ENTRY(IObjectSafety)
44 COM_INTERFACE_ENTRY(IPersistPropertyBag)
45 COM_INTERFACE_ENTRY(IConnectionPointContainer)
46 COM_INTERFACE_ENTRY_CHAIN(Base)
47 END_COM_MAP()
48
49 BEGIN_MSG_MAP(ChromeFrameActivex)
50 MESSAGE_HANDLER(WM_CREATE, OnCreate)
51 CHAIN_MSG_MAP(Base)
52 END_MSG_MAP()
53
54 HRESULT FinalConstruct();
55
56 virtual HRESULT OnDraw(ATL_DRAWINFO& draw_info);
57
58 // IPersistPropertyBag implementation
59 STDMETHOD(GetClassID)(CLSID* class_id) {
60 if (class_id != NULL)
61 *class_id = GetObjectCLSID();
62 return S_OK;
63 }
64
65 STDMETHOD(InitNew)() {
66 return S_OK;
67 }
68
69 STDMETHOD(Load)(IPropertyBag* bag, IErrorLog* error_log);
70
71 STDMETHOD(Save)(IPropertyBag* bag, BOOL clear_dirty, BOOL save_all) {
72 return E_NOTIMPL;
73 }
74
75 // Used to setup the document_url_ member needed for completing navigation.
76 // Create external tab (possibly in incognito mode).
77 HRESULT IOleObject_SetClientSite(IOleClientSite *pClientSite);
78
79 // Overridden to perform security checks.
80 STDMETHOD(put_src)(BSTR src);
81
82 protected:
83 virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message);
84 virtual void OnLoad(int tab_handle, const GURL& url);
85 virtual void OnMessageFromChromeFrame(int tab_handle,
86 const std::string& message,
87 const std::string& origin,
88 const std::string& target);
89
90 private:
91
92 LRESULT OnCreate(UINT message, WPARAM wparam, LPARAM lparam,
93 BOOL& handled); // NO_LINT
94
95 // ChromeFrameDelegate overrides
96 virtual void ChromeFrameActivex::OnAutomationServerLaunchFailed(
97 AutomationLaunchResult reason, const std::string& server_version);
98 virtual void OnLoadFailed(int error_code, const std::string& url);
99
100 // Helper function to execute a function on a script IDispatch interface.
101 HRESULT InvokeScriptFunction(const VARIANT& script, const std::string& param);
102 HRESULT InvokeScriptFunction(const VARIANT& script, VARIANT* param);
103 HRESULT GetContainingDocument(IHTMLDocument2** doc);
104 HRESULT GetDocumentWindow(IHTMLWindow2** window);
105
106 // Gets the value of the 'id' attribute of the object element.
107 HRESULT GetObjectScriptId(IHTMLObjectElement* object_elem, BSTR* id);
108
109 // Returns the object element in the HTML page.
110 // Note that if we're not being hosted inside an HTML
111 // document, then this call will fail.
112 HRESULT GetObjectElement(IHTMLObjectElement** element);
113
114 HRESULT CreateScriptBlockForEvent(IHTMLElement2* insert_after,
115 BSTR instance_id, BSTR script,
116 BSTR event_name);
117
118 // Creates a new event object that supports the |data| property.
119 // Note: you should supply an empty string for |origin| unless you're
120 // creating a "message" event.
121 HRESULT CreateDomEvent(const std::string& event_type, const std::string& data,
122 const std::string& origin, IDispatch** event);
123
124 // Utility function that checks the size of the vector and if > 0 creates
125 // a variant for the string argument and forwards the call to the other
126 // FireEvent method.
127 void FireEvent(const EventHandlers& handlers, const std::string& arg);
128
129 // Invokes all registered handlers in a vector of event handlers.
130 void FireEvent(const EventHandlers& handlers, IDispatch* event);
131
132 // This variant is used for the privatemessage handler only.
133 void FireEvent(const EventHandlers& handlers, IDispatch* event,
134 BSTR target);
135
136 };
137
138 OBJECT_ENTRY_AUTO(__uuidof(ChromeFrame), ChromeFrameActivex)
139
140 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_H_
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame.gyp ('k') | chrome_frame/chrome_frame_activex.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698