Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginTabBase.cpp

Issue 10825021: Move settings page into the application directory (Closed)
Patch Set: Fixed nit and removed copying of html directory Created June 4, 2013, 9:15 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginSettings.cpp ('k') | src/plugin/PluginUtil.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClient.h" 3 #include "PluginClient.h"
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #include "PluginDictionary.h" 5 #include "PluginDictionary.h"
6 #ifdef SUPPORT_CONFIG 6 #ifdef SUPPORT_CONFIG
7 #include "PluginConfig.h" 7 #include "PluginConfig.h"
8 #endif 8 #endif
9 #include "PluginTab.h" 9 #include "PluginTab.h"
10 #include "PluginDomTraverser.h" 10 #include "PluginDomTraverser.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 CString documentUrl = GetDocumentUrl(); 155 CString documentUrl = GetDocumentUrl();
156 156
157 if (isDocumentBrowser) 157 if (isDocumentBrowser)
158 { 158 {
159 if (url != documentUrl) 159 if (url != documentUrl)
160 { 160 {
161 SetDocumentUrl(url); 161 SetDocumentUrl(url);
162 } 162 }
163 163
164 CString log; 164 CString log;
165 log.Format(L"Current URL: %s, settings URL: %s", url, UserSettingsFileUrl()) ; 165 log.Format(L"Current URL: %s, settings URL: %s", url, UserSettingsFileUrl(). c_str());
166 DEBUG_ERROR_LOG(0, 0, 0, log); 166 DEBUG_ERROR_LOG(0, 0, 0, log);
167 if (0 == url.CompareNoCase(UserSettingsFileUrl())) 167 if (0 == url.CompareNoCase(CString(UserSettingsFileUrl().c_str())))
168 { 168 {
169 CComPtr<IDispatch> pDocDispatch; 169 CComPtr<IDispatch> pDocDispatch;
170 browser->get_Document(&pDocDispatch); 170 browser->get_Document(&pDocDispatch);
171 CComQIPtr<IHTMLDocument2> pDoc2 = pDocDispatch; 171 CComQIPtr<IHTMLDocument2> pDoc2 = pDocDispatch;
172 if (pDoc2) 172 if (pDoc2)
173 { 173 {
174 CComPtr<IHTMLWindow2> pWnd2; 174 CComPtr<IHTMLWindow2> pWnd2;
175 pDoc2->get_parentWindow(&pWnd2); 175 pDoc2->get_parentWindow(&pWnd2);
176 if (pWnd2) 176 if (pWnd2)
177 { 177 {
178 CComQIPtr<IDispatchEx> pWndEx = pWnd2; 178 CComQIPtr<IDispatchEx> pWndEx = pWnd2;
179 if (pWndEx) 179 if (pWndEx)
180 { 180 {
181 // Create "Settings" object in JavaScript. 181 // Create "Settings" object in JavaScript.
182 // A method call of "Settings" in JavaScript, transfered to "Invoke" of m_pluginUserSettings 182 // A method call of "Settings" in JavaScript, transfered to "Invoke" of m_pluginUserSettings
183 DISPID dispid; 183 DISPID dispid;
184 HRESULT hr = pWndEx->GetDispID(L"Settings", fdexNameEnsure, &dispid) ; 184 HRESULT hr = pWndEx->GetDispID(L"Settings", fdexNameEnsure, &dispid) ;
185 if (SUCCEEDED(hr)) 185 if (SUCCEEDED(hr))
186 { 186 {
187 CComVariant var((IDispatch*)&m_pluginUserSettings); 187 CComVariant var((IDispatch*)&m_pluginUserSettings);
188 188
189 DISPPARAMS params; 189 DISPPARAMS params;
190 params.cArgs = 1; 190 params.cArgs = 1;
191 params.cNamedArgs = 0; 191 params.cNamedArgs = 0;
192 params.rgvarg = &var; 192 params.rgvarg = &var;
193 params.rgdispidNamedArgs = 0; 193 params.rgdispidNamedArgs = 0;
194 hr = pWndEx->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATC H_PROPERTYPUT | DISPATCH_PROPERTYPUTREF, &params, 0, 0, 0); 194 hr = pWndEx->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATC H_PROPERTYPUT | DISPATCH_PROPERTYPUTREF, &params, 0, 0, 0);
195 if (FAILED(hr)) 195 if (FAILED(hr))
196 { 196 {
197 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLU GIN_ERROR_CREATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::OnDocumentComplete - Failed to create Settings in JavaScript"); 197 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLU GIN_ERROR_CREATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::OnDocumentComplete - Failed to create Settings in JavaScript");
198 } 198 }
199 } 199 }
200 } 200 }
201 } 201 }
202 } 202 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 // Non-hanging sleep 441 // Non-hanging sleep
442 Sleep(50); 442 Sleep(50);
443 } 443 }
444 444
445 tabLoopIteration++; 445 tabLoopIteration++;
446 } 446 }
447 447
448 return 0; 448 return 0;
449 } 449 }
OLDNEW
« no previous file with comments | « src/plugin/PluginSettings.cpp ('k') | src/plugin/PluginUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld