ceee: Include base/win/scope_comptr.h instead of base/scoped_comptr_win.h (issue6063001)

38 views
Skip to first unread message

tfa...@chromium.org

unread,
Dec 19, 2010, 7:27:18 AM12/19/10
to bre...@chromium.org, chromium...@chromium.org, phajd...@chromium.org, ceee-r...@chromium.org
Reviewers: brettw,

Message:
Please, take a look.

Description:
ceee: Include base/win/scope_comptr.h instead of base/scoped_comptr_win.h

Also add base::win:: to ScopedComPtr where necessary.

BUG=None
TEST=trybots

Please review this at http://codereview.chromium.org/6063001/

SVN Base: svn://svn.chromium.org/chrome/trunk/src/ceee

Affected files:
M ceee/ie/broker/cookie_api_module.cc
M ceee/ie/broker/cookie_api_module_unittest.cc
M ceee/ie/broker/tab_api_module_unittest.cc
M ceee/ie/broker/window_api_module_unittest.cc
M ceee/ie/plugin/bho/http_negotiate.cc
M ceee/ie/plugin/toolband/tool_band.h
M ceee/ie/plugin/toolband/tool_band.cc


Index: ceee/ie/broker/cookie_api_module.cc
diff --git a/ceee/ie/broker/cookie_api_module.cc
b/ceee/ie/broker/cookie_api_module.cc
index
52e74038d1efa426d0f516cac5aecd39eff3c0bd..56b28d4d48a9e0c3fda301c1b5f2a1675b105532
100644
--- a/ceee/ie/broker/cookie_api_module.cc
+++ b/ceee/ie/broker/cookie_api_module.cc
@@ -11,9 +11,9 @@

#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
-#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
#include "base/win/scoped_bstr.h"
+#include "base/win/scoped_comptr.h"
#include "ceee/common/com_utils.h"
#include "ceee/common/process_utils_win.h"
#include "ceee/common/window_utils.h"
@@ -67,7 +67,7 @@ bool CookieApiResult::GetTabListForWindow(HWND window,
DCHECK(tab_list);
ApiDispatcher* dispatcher = GetDispatcher();
DCHECK(dispatcher);
- ScopedComPtr<ICeeeWindowExecutor> executor;
+ base::win::ScopedComPtr<ICeeeWindowExecutor> executor;
dispatcher->GetExecutor(window, IID_ICeeeWindowExecutor,
reinterpret_cast<void**>(executor.Receive()));
if (executor == NULL) {
@@ -134,7 +134,7 @@ bool CookieApiResult::GetTabProtectedMode(HWND
tab_window,
}
ApiDispatcher* dispatcher = GetDispatcher();
DCHECK(dispatcher);
- ScopedComPtr<ICeeeTabExecutor> executor;
+ base::win::ScopedComPtr<ICeeeTabExecutor> executor;
dispatcher->GetExecutor(tab_window, IID_ICeeeTabExecutor,
reinterpret_cast<void**>(executor.Receive()));
if (executor == NULL) {
@@ -164,7 +164,7 @@ HRESULT CookieApiResult::GetCookieInfo(

ApiDispatcher* dispatcher = GetDispatcher();
DCHECK(dispatcher);
- ScopedComPtr<ICeeeCookieExecutor> executor;
+ base::win::ScopedComPtr<ICeeeCookieExecutor> executor;
dispatcher->GetExecutor(tab_window, IID_ICeeeCookieExecutor,
reinterpret_cast<void**>(executor.Receive()));
if (executor == NULL) {
@@ -229,7 +229,7 @@ bool CookieApiResult::CreateCookieStoreValues(DWORD
process_id,
HRESULT CookieApiResult::RegisterCookieStore(HWND window) {
ApiDispatcher* dispatcher = GetDispatcher();
DCHECK(dispatcher);
- ScopedComPtr<ICeeeCookieExecutor> executor;
+ base::win::ScopedComPtr<ICeeeCookieExecutor> executor;
dispatcher->GetExecutor(window, IID_ICeeeCookieExecutor,
reinterpret_cast<void**>(executor.Receive()));
if (executor == NULL) {
@@ -249,7 +249,7 @@ HRESULT CookieApiResult::RegisterCookieStore(HWND
window) {
HRESULT CookieApiResult::CookieStoreIsRegistered(HWND window) {
ApiDispatcher* dispatcher = GetDispatcher();
DCHECK(dispatcher);
- ScopedComPtr<ICeeeCookieExecutor> executor;
+ base::win::ScopedComPtr<ICeeeCookieExecutor> executor;
dispatcher->GetExecutor(window, IID_ICeeeCookieExecutor,
reinterpret_cast<void**>(executor.Receive()));
if (executor == NULL) {
Index: ceee/ie/broker/cookie_api_module_unittest.cc
diff --git a/ceee/ie/broker/cookie_api_module_unittest.cc
b/ceee/ie/broker/cookie_api_module_unittest.cc
index
a66f3e877bd4c7fbf0598ee5d8f3523aed7febdc..8ca0c3b8a1342282e31491ef9f81bb88861bae2e
100644
--- a/ceee/ie/broker/cookie_api_module_unittest.cc
+++ b/ceee/ie/broker/cookie_api_module_unittest.cc
@@ -8,8 +8,8 @@
// incompatibility with atlwin.h.
#include "ceee/testing/utils/mock_win32.h" // NOLINT

-#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
+#include "base/win/scoped_comptr.h"
#include "ceee/common/process_utils_win.h"
#include "ceee/ie/broker/api_dispatcher.h"
#include "ceee/ie/broker/api_module_constants.h"
@@ -364,7 +364,7 @@ TEST_F(CookieApiTests, GetCookieInfo) {
NULL));
// Test executor.
testing::MockCookieExecutor* mock_cookie_executor;
- ScopedComPtr<ICeeeCookieExecutor> mock_cookie_executor_keeper;
+ base::win::ScopedComPtr<ICeeeCookieExecutor> mock_cookie_executor_keeper;
EXPECT_HRESULT_SUCCEEDED(testing::MockCookieExecutor::CreateInitialized(
&mock_cookie_executor, mock_cookie_executor_keeper.Receive()));
EXPECT_CALL(result.mock_api_dispatcher_,
@@ -542,7 +542,7 @@ TEST_F(CookieApiTests, GetTabListForWindow) {

// Test executor.
testing::MockWindowExecutor* mock_window_executor;
- ScopedComPtr<ICeeeWindowExecutor> mock_window_executor_keeper;
+ base::win::ScopedComPtr<ICeeeWindowExecutor> mock_window_executor_keeper;
EXPECT_HRESULT_SUCCEEDED(testing::MockWindowExecutor::CreateInitialized(
&mock_window_executor, mock_window_executor_keeper.Receive()));
EXPECT_CALL(result.mock_api_dispatcher_,
@@ -653,7 +653,7 @@ TEST_F(CookieApiTests, GetTabProtectedMode) {

// Test executor.
testing::MockTabExecutor* mock_tab_executor;
- ScopedComPtr<ICeeeTabExecutor> mock_tab_executor_keeper;
+ base::win::ScopedComPtr<ICeeeTabExecutor> mock_tab_executor_keeper;
EXPECT_HRESULT_SUCCEEDED(testing::MockTabExecutor::CreateInitialized(
&mock_tab_executor, mock_tab_executor_keeper.Receive()));
EXPECT_CALL(result.mock_api_dispatcher_,
Index: ceee/ie/broker/tab_api_module_unittest.cc
diff --git a/ceee/ie/broker/tab_api_module_unittest.cc
b/ceee/ie/broker/tab_api_module_unittest.cc
index
b50bb03b6c01888f6ab997760ea1692addf0ded3..30878eeab60a03b302dbf98c01b343dbb29ecefb
100644
--- a/ceee/ie/broker/tab_api_module_unittest.cc
+++ b/ceee/ie/broker/tab_api_module_unittest.cc
@@ -10,7 +10,7 @@

#include "base/json/json_writer.h"
#include "base/json/json_reader.h"
-#include "base/scoped_comptr_win.h"
+#include "base/win/scoped_comptr.h"
#include "base/win/windows_version.h"
#include "ceee/common/initializing_coclass.h"
#include "ceee/ie/broker/api_dispatcher.h"
@@ -189,8 +189,8 @@ class TabApiTests: public testing::Test {
// one and only singleton to use all the time.
CComObjectStackEx< StrictMock< MockChromePostman > > postman_;
// To control the life span of the tab executor.
- ScopedComPtr<ICeeeTabExecutor> mock_tab_executor_keeper_;
- ScopedComPtr<ICeeeWindowExecutor> mock_window_executor_keeper_;
+ base::win::ScopedComPtr<ICeeeTabExecutor> mock_tab_executor_keeper_;
+ base::win::ScopedComPtr<ICeeeWindowExecutor>
mock_window_executor_keeper_;
};

TEST_F(TabApiTests, CreateTabValueErrorHandling) {
@@ -770,7 +770,7 @@ TEST_F(TabApiTests, GetAllTabsInWindow) {
// Failing Executor.
// The executor classes are already strict from their base class impl.
testing::MockWindowExecutor* mock_window_executor;
- ScopedComPtr<ICeeeWindowExecutor> mock_window_executor_keeper_;
+ base::win::ScopedComPtr<ICeeeWindowExecutor>
mock_window_executor_keeper_;
EXPECT_HRESULT_SUCCEEDED(testing::MockWindowExecutor::CreateInitialized(
&mock_window_executor, mock_window_executor_keeper_.Receive()));
EXPECT_CALL(invocation.mock_api_dispatcher_,
@@ -1121,7 +1121,7 @@ TEST_F(TabApiTests, CreateTabExecute) {
CComObject<StrictMock<testing::MockIWebBrowser2>>::CreateInstance(
&browser);
DCHECK(browser != NULL);
- ScopedComPtr<IWebBrowser2> browser_keeper(browser);
+ base::win::ScopedComPtr<IWebBrowser2> browser_keeper(browser);
if (pre_vista) {
EXPECT_CALL(mock_ie_util, GetWebBrowserForTopLevelIeHwnd(
kGoodFrameWindow, _, NotNull())).WillRepeatedly(DoAll(
Index: ceee/ie/broker/window_api_module_unittest.cc
diff --git a/ceee/ie/broker/window_api_module_unittest.cc
b/ceee/ie/broker/window_api_module_unittest.cc
index
590bf02e47ea8e8e9f04053cb11472740b1fb499..13456e8245073ae616e66a5523ed73e7804f9f99
100644
--- a/ceee/ie/broker/window_api_module_unittest.cc
+++ b/ceee/ie/broker/window_api_module_unittest.cc
@@ -11,8 +11,8 @@
#include <iepmapi.h>
#include <set>

-#include "base/scoped_comptr_win.h"
#include "base/scoped_ptr.h"
+#include "base/win/scoped_comptr.h"
#include "ceee/common/process_utils_win.h"
#include "ceee/ie/broker/chrome_postman.h"
#include "ceee/ie/broker/window_api_module.h"
@@ -275,8 +275,8 @@ class WindowApiTests: public testing::Test {
testing::MockWindowExecutor* mock_window_executor_;
testing::MockTabExecutor* mock_tab_executor_;
// To control the life span of the executors.
- ScopedComPtr<ICeeeWindowExecutor> mock_window_executor_keeper_;
- ScopedComPtr<ICeeeTabExecutor> mock_tab_executor_keeper_;
+ base::win::ScopedComPtr<ICeeeWindowExecutor>
mock_window_executor_keeper_;
+ base::win::ScopedComPtr<ICeeeTabExecutor> mock_tab_executor_keeper_;

// Lifespan controlled by Singleton template.
StrictMock<testing::MockExecutorsManager>* executors_manager_;
@@ -738,7 +738,7 @@ TEST_F(WindowApiTests, CreateWindowErrorHandling) {
CComObject<StrictMock<testing::MockIWebBrowser2>>* browser;

CComObject<StrictMock<testing::MockIWebBrowser2>>::CreateInstance(&browser);
DCHECK(browser != NULL);
- ScopedComPtr<IWebBrowser2> browser_keeper(browser);
+ base::win::ScopedComPtr<IWebBrowser2> browser_keeper(browser);
EXPECT_CALL(mock_ie_create, CoCreateInstance(_, _, _, _, _)).
WillRepeatedly(DoAll(SetArgumentPointee<4>(browser_keeper.get()),
AddRef(browser_keeper.get()), Return(S_OK)));
@@ -803,7 +803,7 @@ TEST_F(WindowApiTests, CreateWindowStraightline) {
CComObject<StrictMock<testing::MockIWebBrowser2>>* browser;

CComObject<StrictMock<testing::MockIWebBrowser2>>::CreateInstance(&browser);
DCHECK(browser != NULL);
- ScopedComPtr<IWebBrowser2> browser_keeper(browser);
+ base::win::ScopedComPtr<IWebBrowser2> browser_keeper(browser);
MockIeWindowCreation mock_ie_create;
// TODO(m...@chromium.org): Test behavior with protected on too.
EXPECT_CALL(mock_ie_create, IEIsProtectedModeURL(_)).
Index: ceee/ie/plugin/bho/http_negotiate.cc
diff --git a/ceee/ie/plugin/bho/http_negotiate.cc
b/ceee/ie/plugin/bho/http_negotiate.cc
index
ac39ba3298e5722d1434ed7a102a78ecaf3fede5..20035382b6688ae9a8fbc3999179bf68c4b4643b
100644
--- a/ceee/ie/plugin/bho/http_negotiate.cc
+++ b/ceee/ie/plugin/bho/http_negotiate.cc
@@ -13,11 +13,10 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/time.h"
-
+#include "base/win/scoped_comptr.h"
#include "ceee/ie/plugin/bho/cookie_accountant.h"
#include "chrome_frame/vtable_patch_manager.h"
#include "chrome_frame/utils.h"
-#include "base/scoped_comptr_win.h"

static const int kHttpNegotiateBeginningTransactionIndex = 3;
static const int kHttpNegotiateOnResponseIndex = 4;
@@ -102,12 +101,12 @@ bool HttpNegotiatePatch::Initialize() {
// Use our SimpleBindStatusCallback class as we need a temporary object
that
// implements IBindStatusCallback.
CComObjectStackEx<SimpleBindStatusCallback> request;
- ScopedComPtr<IBindCtx> bind_ctx;
+ base::win::ScopedComPtr<IBindCtx> bind_ctx;
HRESULT hr = ::CreateAsyncBindCtx(0, &request, NULL, bind_ctx.Receive());

DCHECK(SUCCEEDED(hr)) << "CreateAsyncBindCtx";
if (bind_ctx) {
- ScopedComPtr<IUnknown> bscb_holder;
+ base::win::ScopedComPtr<IUnknown> bscb_holder;
bind_ctx->GetObjectParam(L"_BSCB_Holder_", bscb_holder.Receive());
if (bscb_holder) {
hr = PatchHttpNegotiate(bscb_holder);
@@ -136,7 +135,7 @@ HRESULT
HttpNegotiatePatch::PatchHttpNegotiate(IUnknown* to_patch) {
DCHECK(to_patch);
DCHECK_IS_NOT_PATCHED(IHttpNegotiate);

- ScopedComPtr<IHttpNegotiate> http;
+ base::win::ScopedComPtr<IHttpNegotiate> http;
HRESULT hr = http.QueryFrom(to_patch);
if (FAILED(hr)) {
hr = DoQueryService(IID_IHttpNegotiate, to_patch, http.Receive());
Index: ceee/ie/plugin/toolband/tool_band.cc
diff --git a/ceee/ie/plugin/toolband/tool_band.cc
b/ceee/ie/plugin/toolband/tool_band.cc
index
cb193d5cf2258fe6636694a9c5377a4f7da47e18..cb12732567cba9048add2f248a703a7c26b55740
100644
--- a/ceee/ie/plugin/toolband/tool_band.cc
+++ b/ceee/ie/plugin/toolband/tool_band.cc
@@ -287,7 +287,7 @@ HRESULT ToolBand::Initialize(IUnknown* site) {
}

HRESULT ToolBand::InitializeAndShowWindow(IUnknown* site) {
- ScopedComPtr<IOleWindow> site_window;
+ base::win::ScopedComPtr<IOleWindow> site_window;
HRESULT hr = site_window.QueryFrom(site);
if (FAILED(hr)) {
LOG(ERROR) << "Failed to get site window: " << com::LogHr(hr);
@@ -319,7 +319,7 @@ HRESULT ToolBand::Teardown() {
if (IsWindow()) {
// Teardown the ActiveX host window.
CAxWindow host(m_hWnd);
- ScopedComPtr<IObjectWithSite> host_with_site;
+ base::win::ScopedComPtr<IObjectWithSite> host_with_site;
HRESULT hr = host.QueryHost(host_with_site.Receive());
if (SUCCEEDED(hr))
host_with_site->SetSite(NULL);
@@ -350,7 +350,7 @@ LRESULT ToolBand::OnCreate(LPCREATESTRUCT
lpCreateStruct) {
GetUnknown()->AddRef();

// Create a host window instance.
- ScopedComPtr<IAxWinHostWindow> host;
+ base::win::ScopedComPtr<IAxWinHostWindow> host;
HRESULT hr = CAxHostWindow::CreateInstance(host.Receive());
if (FAILED(hr)) {
LOG(ERROR) << "Failed to create ActiveX host window. " <<
com::LogHr(hr);
@@ -564,7 +564,7 @@ STDMETHODIMP_(void)
ToolBand::OnCfGetEnabledExtensionsComplete(
current_height_ = 0;

// Ask IE to reload all info for this toolband.
- ScopedComPtr<IOleCommandTarget> cmd_target;
+ base::win::ScopedComPtr<IOleCommandTarget> cmd_target;
HRESULT hr = GetSite(IID_IOleCommandTarget,
reinterpret_cast<void**>(cmd_target.Receive()));
if (SUCCEEDED(hr)) {
@@ -684,7 +684,7 @@ HRESULT ToolBand::EnsureBhoIsAvailable() {
if (existing_bho.vt == VT_UNKNOWN && existing_bho.punkVal != NULL) {
// This is a sanity / assumption check regarding what we should
regard
// as a valid BHO.
- ScopedComPtr<IPersist> bho_iid_access;
+ base::win::ScopedComPtr<IPersist> bho_iid_access;
HRESULT hr2 = bho_iid_access.QueryFrom(existing_bho.punkVal);
DCHECK(SUCCEEDED(hr2) && bho_iid_access.get() != NULL);
if (SUCCEEDED(hr2) && bho_iid_access.get() != NULL) {
@@ -704,7 +704,7 @@ HRESULT ToolBand::EnsureBhoIsAvailable() {
return SUCCEEDED(hr) ? S_OK : hr;
}

- ScopedComPtr<IObjectWithSite> bho;
+ base::win::ScopedComPtr<IObjectWithSite> bho;
hr = CreateBhoInstance(bho.Receive());

if (FAILED(hr)) {
@@ -738,7 +738,7 @@ HRESULT ToolBand::CreateBhoInstance(IObjectWithSite**
new_bho_instance) {

HRESULT ToolBand::GetSessionId(int* session_id) {
if (chrome_frame_) {
- ScopedComPtr<IChromeFrameInternal> chrome_frame_internal_;
+ base::win::ScopedComPtr<IChromeFrameInternal> chrome_frame_internal_;
chrome_frame_internal_.QueryFrom(chrome_frame_);
if (chrome_frame_internal_) {
return chrome_frame_internal_->getSessionId(session_id);
@@ -752,7 +752,7 @@ HRESULT ToolBand::SendSessionIdToBho(IUnknown* bho) {
if (already_sent_id_to_bho_)
return S_FALSE;
// Now send the tool band's session ID to the BHO.
- ScopedComPtr<ICeeeBho> ceee_bho;
+ base::win::ScopedComPtr<ICeeeBho> ceee_bho;
HRESULT hr = ceee_bho.QueryFrom(bho);
if (SUCCEEDED(hr)) {
int session_id = 0;
Index: ceee/ie/plugin/toolband/tool_band.h
diff --git a/ceee/ie/plugin/toolband/tool_band.h
b/ceee/ie/plugin/toolband/tool_band.h
index
d011719376aba6bf2bbeb525d1b75a431d3dd522..da183efac04927d3bed6da5b566490c5dd1f4c7b
100644
--- a/ceee/ie/plugin/toolband/tool_band.h
+++ b/ceee/ie/plugin/toolband/tool_band.h
@@ -19,8 +19,8 @@
#include <string>

#include "base/basictypes.h"
-#include "base/scoped_comptr_win.h"
#include "base/scoped_ptr.h"
+#include "base/win/scoped_comptr.h"
#include "base/win/rgs_helper.h"
#include "ceee/ie/plugin/toolband/resource.h"

@@ -225,7 +225,7 @@ class ATL_NO_VTABLE ToolBand : public
CComObjectRootEx<CComSingleThreadModel>,
virtual HRESULT CreateBhoInstance(IObjectWithSite** new_bho_instance);

// The web browser that initialized this toolband.
- ScopedComPtr<IWebBrowser2> web_browser_;
+ base::win::ScopedComPtr<IWebBrowser2> web_browser_;
// Our parent window, yielded by our site's IOleWindow.
CWindow parent_window_;
// Our band id, provided by GetBandInfo.


bre...@chromium.org

unread,
Dec 20, 2010, 12:01:41 PM12/20/10
to tfa...@chromium.org, chromium...@chromium.org, phajd...@chromium.org, ceee-r...@chromium.org, am...@chromium.org
Reply all
Reply to author
Forward
0 new messages