OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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_BHO_H_ | 5 #ifndef CHROME_FRAME_BHO_H_ |
6 #define CHROME_FRAME_BHO_H_ | 6 #define CHROME_FRAME_BHO_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlcom.h> | 9 #include <atlcom.h> |
10 #include <deletebrowsinghistory.h> | |
11 #include <exdisp.h> | 10 #include <exdisp.h> |
12 #include <exdispid.h> | 11 #include <exdispid.h> |
13 #include <mshtml.h> | 12 #include <mshtml.h> |
14 #include <shdeprecated.h> | 13 #include <shdeprecated.h> |
15 | 14 |
16 #include <string> | 15 #include <string> |
17 | 16 |
18 #include "base/scoped_comptr_win.h" | 17 #include "base/scoped_comptr_win.h" |
19 #include "chrome_tab.h" // NOLINT | 18 #include "chrome_tab.h" // NOLINT |
20 #include "chrome_frame/delete_chrome_history.h" | |
21 #include "chrome_frame/resource.h" | 19 #include "chrome_frame/resource.h" |
22 #include "chrome_frame/urlmon_moniker.h" | 20 #include "chrome_frame/urlmon_moniker.h" |
23 #include "chrome_frame/urlmon_url_request.h" | 21 #include "chrome_frame/urlmon_url_request.h" |
24 #include "grit/chrome_frame_resources.h" | 22 #include "grit/chrome_frame_resources.h" |
25 | 23 |
26 class DeleteChromeHistory; | |
27 | |
28 class PatchHelper { | 24 class PatchHelper { |
29 public: | 25 public: |
30 enum State { UNKNOWN, PATCH_IBROWSER, PATCH_PROTOCOL }; | 26 enum State { UNKNOWN, PATCH_IBROWSER, PATCH_PROTOCOL }; |
31 PatchHelper() : state_(UNKNOWN) { | 27 PatchHelper() : state_(UNKNOWN) { |
32 } | 28 } |
33 | 29 |
34 State state() const { | 30 State state() const { |
35 return state_; | 31 return state_; |
36 } | 32 } |
37 | 33 |
(...skipping 14 matching lines...) Expand all Loading... |
52 : public CComObjectRootEx<CComSingleThreadModel>, | 48 : public CComObjectRootEx<CComSingleThreadModel>, |
53 public CComCoClass<Bho, &CLSID_ChromeFrameBHO>, | 49 public CComCoClass<Bho, &CLSID_ChromeFrameBHO>, |
54 public IObjectWithSiteImpl<Bho>, | 50 public IObjectWithSiteImpl<Bho>, |
55 public IDispEventSimpleImpl<0, Bho, &DIID_DWebBrowserEvents2>, | 51 public IDispEventSimpleImpl<0, Bho, &DIID_DWebBrowserEvents2>, |
56 public NavigationManager { | 52 public NavigationManager { |
57 public: | 53 public: |
58 typedef HRESULT (STDMETHODCALLTYPE* IBrowserService_OnHttpEquiv_Fn)( | 54 typedef HRESULT (STDMETHODCALLTYPE* IBrowserService_OnHttpEquiv_Fn)( |
59 IBrowserService* browser, IShellView* shell_view, BOOL done, | 55 IBrowserService* browser, IShellView* shell_view, BOOL done, |
60 VARIANT* in_arg, VARIANT* out_arg); | 56 VARIANT* in_arg, VARIANT* out_arg); |
61 | 57 |
62 DECLARE_GET_CONTROLLING_UNKNOWN() | |
63 DECLARE_REGISTRY_RESOURCEID(IDR_BHO) | 58 DECLARE_REGISTRY_RESOURCEID(IDR_BHO) |
64 DECLARE_NOT_AGGREGATABLE(Bho) | 59 DECLARE_NOT_AGGREGATABLE(Bho) |
65 DECLARE_PROTECT_FINAL_CONSTRUCT() | 60 DECLARE_PROTECT_FINAL_CONSTRUCT() |
66 | 61 |
67 BEGIN_COM_MAP(Bho) | 62 BEGIN_COM_MAP(Bho) |
68 COM_INTERFACE_ENTRY(IObjectWithSite) | 63 COM_INTERFACE_ENTRY(IObjectWithSite) |
69 // When calling DeleteChromeHistory, ensure that only one instance | |
70 // is created to avoid mulitple message loops. | |
71 COM_INTERFACE_ENTRY_CACHED_TEAR_OFF(IID_IDeleteBrowsingHistory, | |
72 DeleteChromeHistory, | |
73 delete_chrome_history_.p) | |
74 END_COM_MAP() | 64 END_COM_MAP() |
75 | 65 |
76 BEGIN_SINK_MAP(Bho) | 66 BEGIN_SINK_MAP(Bho) |
77 SINK_ENTRY_INFO(0, DIID_DWebBrowserEvents2, DISPID_BEFORENAVIGATE2, | 67 SINK_ENTRY_INFO(0, DIID_DWebBrowserEvents2, DISPID_BEFORENAVIGATE2, |
78 BeforeNavigate2, &kBeforeNavigate2Info) | 68 BeforeNavigate2, &kBeforeNavigate2Info) |
79 SINK_ENTRY_INFO(0, DIID_DWebBrowserEvents2, DISPID_NAVIGATECOMPLETE2, | 69 SINK_ENTRY_INFO(0, DIID_DWebBrowserEvents2, DISPID_NAVIGATECOMPLETE2, |
80 NavigateComplete2, &kNavigateComplete2Info) | 70 NavigateComplete2, &kNavigateComplete2Info) |
81 END_SINK_MAP() | 71 END_SINK_MAP() |
82 | 72 |
83 Bho(); | 73 Bho(); |
(...skipping 15 matching lines...) Expand all Loading... |
99 // us to sniff the META tag by simply patching it. The renderer | 89 // us to sniff the META tag by simply patching it. The renderer |
100 // switching can be achieved by canceling original navigation | 90 // switching can be achieved by canceling original navigation |
101 // and issuing a new one using IWebBrowser2->Navigate2. | 91 // and issuing a new one using IWebBrowser2->Navigate2. |
102 static HRESULT STDMETHODCALLTYPE OnHttpEquiv( | 92 static HRESULT STDMETHODCALLTYPE OnHttpEquiv( |
103 IBrowserService_OnHttpEquiv_Fn original_httpequiv, | 93 IBrowserService_OnHttpEquiv_Fn original_httpequiv, |
104 IBrowserService* browser, IShellView* shell_view, BOOL done, | 94 IBrowserService* browser, IShellView* shell_view, BOOL done, |
105 VARIANT* in_arg, VARIANT* out_arg); | 95 VARIANT* in_arg, VARIANT* out_arg); |
106 | 96 |
107 static void ProcessOptInUrls(IWebBrowser2* browser, BSTR url); | 97 static void ProcessOptInUrls(IWebBrowser2* browser, BSTR url); |
108 | 98 |
109 // COM_INTERFACE_ENTRY_CACHED_TEAR_OFF manages the raw pointer from CComPtr | |
110 // which ScopedComPtr doesn't expose. | |
111 CComPtr<IUnknown> delete_chrome_history_; | |
112 | |
113 protected: | 99 protected: |
114 bool PatchProtocolHandler(const CLSID& handler_clsid); | 100 bool PatchProtocolHandler(const CLSID& handler_clsid); |
115 | 101 |
116 static _ATL_FUNC_INFO kBeforeNavigate2Info; | 102 static _ATL_FUNC_INFO kBeforeNavigate2Info; |
117 static _ATL_FUNC_INFO kNavigateComplete2Info; | 103 static _ATL_FUNC_INFO kNavigateComplete2Info; |
118 }; | 104 }; |
119 | 105 |
120 #endif // CHROME_FRAME_BHO_H_ | 106 #endif // CHROME_FRAME_BHO_H_ |
121 | 107 |
OLD | NEW |