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

Unified Diff: src/plugin/PluginClass.cpp

Issue 11043057: First run page triggering (Closed)
Patch Set: Comments addressed Created July 20, 2013, 8:11 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/plugin/PluginClass.cpp
===================================================================
--- a/src/plugin/PluginClass.cpp
+++ b/src/plugin/PluginClass.cpp
@@ -822,6 +822,11 @@
}
}
+ if (CPluginClient::GetInstance()->IsFirstRun())
+ {
+ CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CPluginClass::FirstRunThread, NULL, NULL, NULL);
+ }
+
CPluginSettings* settings = CPluginSettings::GetInstance();
return true;
}
@@ -999,51 +1004,28 @@
SendMessage(m_hStatusBarWnd, WM_PAINT, (WPARAM)hdc, 0);
ReleaseDC(m_hStatusBarWnd, hdc);
- if (CPluginClient::GetInstance()->GetIsFirstRun())
- {
- CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CPluginClass::FirstRunThread, NULL, NULL, NULL);
- }
-
return true;
}
void CPluginClass::FirstRunThread()
{
- // IE may still be not ready to navigate. Try until it is.
- VARIANT_BOOL isBusy = VARIANT_FALSE;
- while (GetAsyncBrowser()->get_Busy(&isBusy) == S_OK && isBusy != VARIANT_FALSE)
- {
- Sleep(100);
- }
VARIANT vFlags;
vFlags.vt = VT_I4;
vFlags.intVal = navOpenInNewTab;
- READYSTATE readyState;
- HRESULT hr;
- while ((hr = GetAsyncBrowser()->get_ReadyState(&readyState) == S_OK) && (readyState <= READYSTATE_LOADED))
- {
- Sleep(100);
- }
CComBSTR bTest = CComBSTR(UserSettingsFirstRunPageUrl().c_str());
//Try 10 times, or until successful
int numberOfAttempts = 0;
- while ((hr != S_OK) && (numberOfAttempts < 10))
+ HRESULT hr = S_FALSE;
+ hr = GetAsyncBrowser()->Navigate(bTest, &vFlags, NULL, NULL, NULL);
+ if (FAILED(hr))
{
- hr = GetAsyncBrowser()->Navigate(bTest, &vFlags, NULL, NULL, NULL);
- if (FAILED(hr))
- {
- vFlags.intVal = navOpenInNewWindow;
+ vFlags.intVal = navOpenInNewWindow;
+ hr = GetAsyncBrowser()->Navigate(bTest, &vFlags, NULL, NULL, NULL);
Wladimir Palant 2013/07/21 11:53:45 Wrong indentation here?
+ }
- hr = GetAsyncBrowser()->Navigate(bTest, &vFlags, NULL, NULL, NULL);
- if (FAILED(hr))
- {
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_SETTINGS, "Navigation::Failed")
- }
- }
- Sleep(100);
- }
+
if (FAILED(hr))
{
DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME, "Navigation::Welcome page failed")

Powered by Google App Engine
This is Rietveld