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

Unified Diff: src/plugin/PluginClass.cpp

Issue 11013110: Cleanup (Closed)
Patch Set: Created July 5, 2013, 3:28 a.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
@@ -9,9 +9,7 @@
#include "PluginMimeFilterClient.h"
#include "PluginClient.h"
#include "PluginClientFactory.h"
-#include "PluginHttpRequest.h"
#include "PluginMutex.h"
-#include "DownloadSource.h"
#include "sddl.h"
#include "PluginUtil.h"
#include "PluginUserSettings.h"
@@ -87,43 +85,9 @@
// Prepare settings
settings->SetMainProcessId();
settings->SetMainUiThreadId();
-
- // Ensure plugin version
- if (!settings->Has(SETTING_PLUGIN_VERSION))
- {
- settings->SetString(SETTING_PLUGIN_VERSION, IEPLUGIN_VERSION);
- settings->SetFirstRunUpdate();
- }
-
- // First run or deleted settings file (dictionary version = 1)
- if (settings->GetString(SETTING_DICTIONARY_VERSION, L"1").Compare(L"1") == 0)
- {
- settings->SetFirstRun();
- }
-
- // Update?
- CString oldVersion = settings->GetString(SETTING_PLUGIN_VERSION);
- if (settings->IsFirstRunUpdate() || settings->GetString(SETTING_PLUGIN_UPDATE_VERSION) == IEPLUGIN_VERSION || oldVersion != IEPLUGIN_VERSION)
- {
- settings->SetString(SETTING_PLUGIN_VERSION, IEPLUGIN_VERSION);
-
- settings->SetFirstRunUpdate();
- }
-
- int info = settings->GetValue(SETTING_PLUGIN_INFO_PANEL, 0);
-
#ifdef ENABLE_DEBUG_RESULT
CPluginDebug::DebugResultClear();
#endif
-
-#ifdef ENABLE_DEBUG_INFO
- if (info == 0 || info > 2)
- {
- CPluginDebug::DebugClear();
- }
-#endif // ENABLE_DEBUG_INFO
-
- settings->Write(false);
}
}
@@ -556,13 +520,12 @@
{
if (!isVisible)
{
- if (!settings->GetBool("statusbarasked", false))
+ if (!settings->GetStatusBarAsked())
Oleksandr 2013/07/05 03:33:55 This is the only case where we might have still ne
Wladimir Palant 2013/07/05 09:26:45 I suggest storing it in prefs.json instead - via t
{
SHANDLE_PTR pBrowserHWnd;
browser->get_HWND((SHANDLE_PTR*)&pBrowserHWnd);
Dictionary* dictionary = Dictionary::GetInstance();
- settings->SetBool("statusbarasked", true);
- settings->Write();
+ settings->SetStatusBarAsked(true);
HKEY pHkey;
HKEY pHkeySub;
@@ -1400,49 +1363,7 @@
s_criticalSectionLocal.Unlock();
}
break;
-#ifndef ENTERPRISE
- case ID_SETTINGS:
- {
- url = CString(UserSettingsFileUrl().c_str());
- }
- break;
-#endif
- case ID_INVITEFRIENDS:
- {
- url = CPluginHttpRequest::GetStandardUrl(USERS_SCRIPT_INVITATION);
- navigationErrorId = PLUGIN_ERROR_NAVIGATION_INVITATION;
- }
- break;
-
- case ID_FAQ:
- {
- url = CPluginHttpRequest::GetStandardUrl(USERS_SCRIPT_FAQ);
- navigationErrorId = PLUGIN_ERROR_NAVIGATION_FAQ;
- }
- break;
-
- case ID_FEEDBACK:
- {
- CPluginHttpRequest httpRequest(USERS_SCRIPT_FEEDBACK);
-
- httpRequest.AddPluginId();
- httpRequest.Add("reason", 0);
- httpRequest.Add(L"url", m_tab->GetDocumentUrl(), false);
-
- url = httpRequest.GetUrl();
- navigationErrorId = PLUGIN_ERROR_NAVIGATION_FEEDBACK;
- }
- break;
-
- case ID_ABOUT:
- {
- url = CPluginHttpRequest::GetStandardUrl(USERS_SCRIPT_ABOUT);
- navigationErrorId = PLUGIN_ERROR_NAVIGATION_ABOUT;
- }
- break;
-
default:
-
break;
}
@@ -1505,11 +1426,6 @@
CPluginSettings* settings = CPluginSettings::GetInstance();
- settings->RefreshTab();
-
- // Update settings
- m_tab->OnUpdateSettings(false);
-
#ifdef SUPPORT_WHITELIST
{
// White list domain
@@ -1529,38 +1445,6 @@
}
#endif // SUPPORT_WHITELIST
- // Invite friends
- ctext = dictionary->Lookup("menu", "invite");
- fmii.fMask = MIIM_STATE | MIIM_STRING;
- fmii.fState = MFS_ENABLED;
- fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
- fmii.cch = ctext.size();
- ::SetMenuItemInfoW(hMenu, ID_INVITEFRIENDS, FALSE, &fmii);
-
- // FAQ
- ctext = dictionary->Lookup("menu", "faq");
- fmii.fMask = MIIM_STATE | MIIM_STRING;
- fmii.fState = MFS_ENABLED;
- fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
- fmii.cch = ctext.size();
- ::SetMenuItemInfoW(hMenu, ID_FAQ, FALSE, &fmii);
-
- // About
- ctext = dictionary->Lookup("menu", "about");
- fmii.fMask = MIIM_STATE | MIIM_STRING;
- fmii.fState = MFS_ENABLED;
- fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
- fmii.cch = ctext.size();
- ::SetMenuItemInfoW(hMenu, ID_ABOUT, FALSE, &fmii);
-
- // Feedback
- ctext = dictionary->Lookup("menu", "feedback");
- fmii.fMask = MIIM_STATE | MIIM_STRING;
- fmii.fState = MFS_ENABLED;
- fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
- fmii.cch = ctext.size();
- ::SetMenuItemInfoW(hMenu, ID_FEEDBACK, FALSE, &fmii);
-
// Plugin enable
if (settings->GetPluginEnabled())
{
@@ -1577,17 +1461,12 @@
::SetMenuItemInfoW(hMenu, ID_PLUGIN_ENABLE, FALSE, &fmii);
// Settings
-#ifndef ENTERPRISE
ctext = dictionary->Lookup("menu", "settings");
fmii.fMask = MIIM_STATE | MIIM_STRING;
fmii.fState = MFS_ENABLED;
fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str());
fmii.cch = ctext.size();
::SetMenuItemInfoW(hMenu, ID_SETTINGS, FALSE, &fmii);
-#else
- RemoveMenu(hMenu, ID_SETTINGS, MF_BYCOMMAND);
- RemoveMenu(hMenu, 5, MF_BYPOSITION);
-#endif
return true;
}
@@ -1952,9 +1831,9 @@
}
break;
-#ifndef ENTERPRISE
- case WM_LAUNCH_INFO:
+ // First run page
+ case WM_LAUNCH_INFO:
{
// Set the status bar visible, if it isn't
// Otherwise the user won't see the icon the first time
@@ -1996,19 +1875,13 @@
CPluginSettings* settings = CPluginSettings::GetInstance();
- CPluginHttpRequest httpRequest(USERS_SCRIPT_WELCOME);
-
- httpRequest.Add("errors", settings->GetErrorList());
-
-
- hr = browser->Navigate(CComBSTR(httpRequest.GetUrl() + "&src=" + DOWNLOAD_SOURCE), NULL, NULL, NULL, NULL);
+ //TODO: Navigate to first run page here
+/* hr = browser->Navigate(CComBSTR("FIRST_RUN_PAGE_URL"), NULL, NULL, NULL, NULL);
if (FAILED(hr))
{
DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME, "Navigation::Welcome page failed")
}
-
- // Update settings server side on next IE start, as they have possibly changed
- settings->ForceConfigurationUpdateOnStart();
+ */
}
}
else
@@ -2017,15 +1890,12 @@
CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser();
if (browser)
{
- CPluginHttpRequest httpRequest(USERS_SCRIPT_INFO);
-
- httpRequest.Add("info", wParam);
-
VARIANT vFlags;
vFlags.vt = VT_I4;
vFlags.intVal = navOpenInNewTab;
- HRESULT hr = browser->Navigate(CComBSTR(httpRequest.GetUrl()), &vFlags, NULL, NULL, NULL);
+ // TODO: Navigate to info page here or remove this clause
+/* HRESULT hr = browser->Navigate(CComBSTR(INFO_PAGE_URL), &vFlags, NULL, NULL, NULL);
if (FAILED(hr))
{
vFlags.intVal = navOpenInNewWindow;
@@ -2036,11 +1906,11 @@
DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_INFO, "Navigation::Info page failed")
}
}
+ */
}
}
}
break;
-#endif
case WM_DESTROY:
break;

Powered by Google App Engine
This is Rietveld