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

Unified Diff: src/engine/Main.cpp

Issue 29317083: Issue 1490 - Enable pre-configurable properties in Internet Explorer (Closed)
Patch Set: Comments addressed Created June 22, 2015, 8:25 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
« no previous file with comments | « .hgsubstate ('k') | src/plugin/PluginClass.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/engine/Main.cpp
===================================================================
--- a/src/engine/Main.cpp
+++ b/src/engine/Main.cpp
@@ -31,6 +31,7 @@
#include "AdblockPlus.h"
#include "Debug.h"
#include "Updater.h"
+#include "Registry.h"
namespace
{
@@ -428,6 +429,19 @@
updater->Update(params[0]->AsString());
}
+
+ std::wstring PreconfigurationValueFromRegistry(const std::wstring& preconfigName)
+ {
+ try
+ {
+ AdblockPlus::RegistryKey regKey(HKEY_CURRENT_USER, L"Software\\AdblockPlus");
+ return regKey.value_wstring(preconfigName);
+ }
+ catch (const std::runtime_error&)
+ {
+ return L"";
+ }
+ }
}
std::auto_ptr<AdblockPlus::FilterEngine> CreateFilterEngine(const std::wstring& locale)
@@ -453,7 +467,12 @@
std::string dataPath = ToUtf8String(GetAppDataPath());
dynamic_cast<AdblockPlus::DefaultFileSystem*>(jsEngine->GetFileSystem().get())->SetBasePath(dataPath);
- std::auto_ptr<AdblockPlus::FilterEngine> filterEngine(new AdblockPlus::FilterEngine(jsEngine));
+ std::map<std::string, AdblockPlus::JsValuePtr> preconfig;
+ preconfig["disable_auto_updates"] = jsEngine->NewValue(
+ PreconfigurationValueFromRegistry(L"disable_auto_updates") == L"true");
+ preconfig["suppress_first_run_page"] = jsEngine->NewValue(
+ PreconfigurationValueFromRegistry(L"suppress_first_run_page") == L"true");
+ std::auto_ptr<AdblockPlus::FilterEngine> filterEngine(new AdblockPlus::FilterEngine(jsEngine, preconfig));
return filterEngine;
}
« no previous file with comments | « .hgsubstate ('k') | src/plugin/PluginClass.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld