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

Unified Diff: src/plugin/PluginClass.cpp

Issue 5140323101573120: Issue #276 - introduce classes BSTR_ParamArgument and BSTR_ParamResult (Closed)
Patch Set: Created Aug. 4, 2014, 2:41 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
« no previous file with comments | « src/plugin/COM_Value.cpp ('k') | src/plugin/PluginDomTraverserBase.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginClass.cpp
===================================================================
--- a/src/plugin/PluginClass.cpp
+++ b/src/plugin/PluginClass.cpp
@@ -1,6 +1,7 @@
#include "PluginStdAfx.h"
#include "PluginClass.h"
+#include "COM_Value.h"
#include "PluginSettings.h"
#include "PluginSystem.h"
#ifdef SUPPORT_FILTER
@@ -218,11 +219,10 @@
CComQIPtr<IWebBrowser2> browser = GetBrowser();
if (browser)
{
- CComBSTR bstrURL;
-
- if (SUCCEEDED(browser->get_LocationURL(&bstrURL)))
+ AdblockPlus::COM::BSTR_ParamResult result;
+ if (SUCCEEDED(browser->get_LocationURL(&result)))
{
- url = bstrURL;
+ url = to_CString(result);
CPluginClient::UnescapeUrl(url);
}
}
@@ -507,14 +507,16 @@
vFlags.vt = VT_I4;
vFlags.intVal = navOpenInNewTab;
- CComBSTR curLoc;
+ AdblockPlus::COM::BSTR_ParamResult curLoc;
browser->get_LocationURL(&curLoc);
- HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL);
+ std::wstring location = curLoc;
+ AdblockPlus::COM::BSTR_ParamArgument targetLocation(location);
+ HRESULT hr = browser->Navigate(targetLocation, &vFlags, NULL, NULL, NULL);
if (FAILED(hr))
{
vFlags.intVal = navOpenInNewWindow;
- hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL);
+ hr = browser->Navigate(targetLocation, &vFlags, NULL, NULL, NULL);
if (FAILED(hr))
{
DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION, "Navigation::Failed")
@@ -733,10 +735,10 @@
if (pBrowser)
{
CString url;
- CComBSTR bstrUrl;
- if (SUCCEEDED(pBrowser->get_LocationURL(&bstrUrl)) && ::SysStringLen(bstrUrl) > 0)
+ AdblockPlus::COM::BSTR_ParamResult result;
+ if (SUCCEEDED(pBrowser->get_LocationURL(&result)) && !result.operator std::wstring().empty())
{
- url = bstrUrl;
+ url = to_CString(result);
CPluginClient::UnescapeUrl(url);
@@ -1042,8 +1044,7 @@
vFlags.vt = VT_I4;
vFlags.intVal = navOpenInNewTab;
- CComBSTR navigatePath = CComBSTR(FirstRunPageFileUrl().c_str());
-
+ AdblockPlus::COM::BSTR_ParamArgument navigatePath(FirstRunPageFileUrl());
HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL);
if (FAILED(hr))
{
« no previous file with comments | « src/plugin/COM_Value.cpp ('k') | src/plugin/PluginDomTraverserBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld