Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: chrome_frame/test/ie_event_sink.cc

Issue 3850002: Convert LOG(INFO) to VLOG(1) - chrome_frame/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/ie_event_sink.h ('k') | chrome_frame/test/mock_ie_event_sink_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome_frame/test/ie_event_sink.h" 5 #include "chrome_frame/test/ie_event_sink.h"
6 6
7 #include "base/scoped_bstr_win.h" 7 #include "base/scoped_bstr_win.h"
8 #include "base/scoped_handle.h" 8 #include "base/scoped_handle.h"
9 #include "base/scoped_variant_win.h" 9 #include "base/scoped_variant_win.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 414 }
415 415
416 STDMETHODIMP_(void) IEEventSink::OnNewWindow2(IDispatch** disp, 416 STDMETHODIMP_(void) IEEventSink::OnNewWindow2(IDispatch** disp,
417 VARIANT_BOOL* s) { 417 VARIANT_BOOL* s) {
418 if (listener_) 418 if (listener_)
419 listener_->OnNewWindow2(disp, s); 419 listener_->OnNewWindow2(disp, s);
420 } 420 }
421 421
422 STDMETHODIMP_(void) IEEventSink::OnNavigateError(IDispatch* dispatch, 422 STDMETHODIMP_(void) IEEventSink::OnNavigateError(IDispatch* dispatch,
423 VARIANT* url, VARIANT* frame_name, VARIANT* status_code, VARIANT* cancel) { 423 VARIANT* url, VARIANT* frame_name, VARIANT* status_code, VARIANT* cancel) {
424 DLOG(INFO) << __FUNCTION__; 424 DVLOG(1) << __FUNCTION__;
425 if (listener_) 425 if (listener_)
426 listener_->OnNavigateError(dispatch, url, frame_name, status_code, cancel); 426 listener_->OnNavigateError(dispatch, url, frame_name, status_code, cancel);
427 } 427 }
428 428
429 STDMETHODIMP IEEventSink::OnBeforeNavigate2( 429 STDMETHODIMP IEEventSink::OnBeforeNavigate2(
430 IDispatch* dispatch, VARIANT* url, VARIANT* flags, 430 IDispatch* dispatch, VARIANT* url, VARIANT* flags,
431 VARIANT* target_frame_name, VARIANT* post_data, VARIANT* headers, 431 VARIANT* target_frame_name, VARIANT* post_data, VARIANT* headers,
432 VARIANT_BOOL* cancel) { 432 VARIANT_BOOL* cancel) {
433 DLOG(INFO) << __FUNCTION__ 433 DVLOG(1) << __FUNCTION__
434 << base::StringPrintf("%ls - 0x%08X", url->bstrVal, this); 434 << base::StringPrintf("%ls - 0x%08X", url->bstrVal, this);
435 // Reset any existing reference to chrome frame since this is a new 435 // Reset any existing reference to chrome frame since this is a new
436 // navigation. 436 // navigation.
437 DisconnectFromChromeFrame(); 437 DisconnectFromChromeFrame();
438 if (listener_) 438 if (listener_)
439 listener_->OnBeforeNavigate2(dispatch, url, flags, target_frame_name, 439 listener_->OnBeforeNavigate2(dispatch, url, flags, target_frame_name,
440 post_data, headers, cancel); 440 post_data, headers, cancel);
441 return S_OK; 441 return S_OK;
442 } 442 }
443 443
444 STDMETHODIMP_(void) IEEventSink::OnNavigateComplete2( 444 STDMETHODIMP_(void) IEEventSink::OnNavigateComplete2(
445 IDispatch* dispatch, VARIANT* url) { 445 IDispatch* dispatch, VARIANT* url) {
446 DLOG(INFO) << __FUNCTION__; 446 DVLOG(1) << __FUNCTION__;
447 ConnectToChromeFrame(); 447 ConnectToChromeFrame();
448 if (listener_) 448 if (listener_)
449 listener_->OnNavigateComplete2(dispatch, url); 449 listener_->OnNavigateComplete2(dispatch, url);
450 } 450 }
451 451
452 STDMETHODIMP_(void) IEEventSink::OnDocumentComplete( 452 STDMETHODIMP_(void) IEEventSink::OnDocumentComplete(
453 IDispatch* dispatch, VARIANT* url) { 453 IDispatch* dispatch, VARIANT* url) {
454 DLOG(INFO) << __FUNCTION__; 454 DVLOG(1) << __FUNCTION__;
455 EXPECT_TRUE(url); 455 EXPECT_TRUE(url);
456 if (!url) 456 if (!url)
457 return; 457 return;
458 if (listener_) 458 if (listener_)
459 listener_->OnDocumentComplete(dispatch, url); 459 listener_->OnDocumentComplete(dispatch, url);
460 } 460 }
461 461
462 STDMETHODIMP_(void) IEEventSink::OnFileDownload( 462 STDMETHODIMP_(void) IEEventSink::OnFileDownload(
463 VARIANT_BOOL active_doc, VARIANT_BOOL* cancel) { 463 VARIANT_BOOL active_doc, VARIANT_BOOL* cancel) {
464 DLOG(INFO) << __FUNCTION__ << base::StringPrintf(" 0x%08X ad=%i", this, 464 DVLOG(1) << __FUNCTION__
465 active_doc); 465 << base::StringPrintf(" 0x%08X ad=%i", this, active_doc);
466 if (listener_) 466 if (listener_)
467 listener_->OnFileDownload(active_doc, cancel); 467 listener_->OnFileDownload(active_doc, cancel);
468 // Always cancel file downloads in tests. 468 // Always cancel file downloads in tests.
469 *cancel = VARIANT_TRUE; 469 *cancel = VARIANT_TRUE;
470 } 470 }
471 471
472 STDMETHODIMP_(void) IEEventSink::OnNewWindow3( 472 STDMETHODIMP_(void) IEEventSink::OnNewWindow3(
473 IDispatch** dispatch, VARIANT_BOOL* cancel, DWORD flags, BSTR url_context, 473 IDispatch** dispatch, VARIANT_BOOL* cancel, DWORD flags, BSTR url_context,
474 BSTR url) { 474 BSTR url) {
475 DLOG(INFO) << __FUNCTION__; 475 DVLOG(1) << __FUNCTION__;
476 EXPECT_TRUE(dispatch); 476 EXPECT_TRUE(dispatch);
477 if (!dispatch) 477 if (!dispatch)
478 return; 478 return;
479 479
480 if (listener_) 480 if (listener_)
481 listener_->OnNewWindow3(dispatch, cancel, flags, url_context, url); 481 listener_->OnNewWindow3(dispatch, cancel, flags, url_context, url);
482 482
483 // Note that |dispatch| is an [in/out] argument. IE is asking listeners if 483 // Note that |dispatch| is an [in/out] argument. IE is asking listeners if
484 // they want to use a IWebBrowser2 of their choice for the new window. 484 // they want to use a IWebBrowser2 of their choice for the new window.
485 // Since we need to listen on events on the new browser, we create one 485 // Since we need to listen on events on the new browser, we create one
486 // if needed. 486 // if needed.
487 if (!*dispatch) { 487 if (!*dispatch) {
488 ScopedComPtr<IDispatch> new_browser; 488 ScopedComPtr<IDispatch> new_browser;
489 HRESULT hr = new_browser.CreateInstance(CLSID_InternetExplorer, NULL, 489 HRESULT hr = new_browser.CreateInstance(CLSID_InternetExplorer, NULL,
490 CLSCTX_LOCAL_SERVER); 490 CLSCTX_LOCAL_SERVER);
491 DCHECK(SUCCEEDED(hr) && new_browser); 491 DCHECK(SUCCEEDED(hr) && new_browser);
492 *dispatch = new_browser.Detach(); 492 *dispatch = new_browser.Detach();
493 } 493 }
494 494
495 if (*dispatch) 495 if (*dispatch)
496 listener_->OnNewBrowserWindow(*dispatch, url); 496 listener_->OnNewBrowserWindow(*dispatch, url);
497 } 497 }
498 498
499 STDMETHODIMP_(void) IEEventSink::OnQuit() { 499 STDMETHODIMP_(void) IEEventSink::OnQuit() {
500 DLOG(INFO) << __FUNCTION__; 500 DVLOG(1) << __FUNCTION__;
501 501
502 did_receive_on_quit_ = true; 502 did_receive_on_quit_ = true;
503 503
504 DispEventUnadvise(web_browser2_); 504 DispEventUnadvise(web_browser2_);
505 CoDisconnectObject(this, 0); 505 CoDisconnectObject(this, 0);
506 506
507 if (listener_) 507 if (listener_)
508 listener_->OnQuit(); 508 listener_->OnQuit();
509 } 509 }
510 510
511 HRESULT IEEventSink::OnLoad(const VARIANT* param) { 511 HRESULT IEEventSink::OnLoad(const VARIANT* param) {
512 DLOG(INFO) << __FUNCTION__ << " " << param->bstrVal; 512 DVLOG(1) << __FUNCTION__ << " " << param->bstrVal;
513 ScopedVariant stack_object(*param); 513 ScopedVariant stack_object(*param);
514 if (chrome_frame_) { 514 if (chrome_frame_) {
515 if (listener_) 515 if (listener_)
516 listener_->OnLoad(param->bstrVal); 516 listener_->OnLoad(param->bstrVal);
517 } else { 517 } else {
518 DLOG(WARNING) << "Invalid chrome frame pointer"; 518 DLOG(WARNING) << "Invalid chrome frame pointer";
519 } 519 }
520 return S_OK; 520 return S_OK;
521 } 521 }
522 522
523 HRESULT IEEventSink::OnLoadError(const VARIANT* param) { 523 HRESULT IEEventSink::OnLoadError(const VARIANT* param) {
524 DLOG(INFO) << __FUNCTION__ << " " << param->bstrVal; 524 DVLOG(1) << __FUNCTION__ << " " << param->bstrVal;
525 if (chrome_frame_) { 525 if (chrome_frame_) {
526 if (listener_) 526 if (listener_)
527 listener_->OnLoadError(param->bstrVal); 527 listener_->OnLoadError(param->bstrVal);
528 } else { 528 } else {
529 DLOG(WARNING) << "Invalid chrome frame pointer"; 529 DLOG(WARNING) << "Invalid chrome frame pointer";
530 } 530 }
531 return S_OK; 531 return S_OK;
532 } 532 }
533 533
534 HRESULT IEEventSink::OnMessage(const VARIANT* param) { 534 HRESULT IEEventSink::OnMessage(const VARIANT* param) {
535 DLOG(INFO) << __FUNCTION__ << " " << param; 535 DVLOG(1) << __FUNCTION__ << " " << param;
536 if (!chrome_frame_.get()) { 536 if (!chrome_frame_.get()) {
537 DLOG(WARNING) << "Invalid chrome frame pointer"; 537 DLOG(WARNING) << "Invalid chrome frame pointer";
538 return S_OK; 538 return S_OK;
539 } 539 }
540 540
541 ScopedVariant data, origin, source; 541 ScopedVariant data, origin, source;
542 if (param && (V_VT(param) == VT_DISPATCH)) { 542 if (param && (V_VT(param) == VT_DISPATCH)) {
543 wchar_t* properties[] = { L"data", L"origin", L"source" }; 543 wchar_t* properties[] = { L"data", L"origin", L"source" };
544 const int prop_count = arraysize(properties); 544 const int prop_count = arraysize(properties);
545 DISPID ids[prop_count] = {0}; 545 DISPID ids[prop_count] = {0};
(...skipping 13 matching lines...) Expand all
559 source.Receive(), NULL, NULL)); 559 source.Receive(), NULL, NULL));
560 } 560 }
561 } 561 }
562 562
563 if (listener_) 563 if (listener_)
564 listener_->OnMessage(V_BSTR(&data), V_BSTR(&origin), V_BSTR(&source)); 564 listener_->OnMessage(V_BSTR(&data), V_BSTR(&origin), V_BSTR(&source));
565 return S_OK; 565 return S_OK;
566 } 566 }
567 567
568 } // namespace chrome_frame_test 568 } // namespace chrome_frame_test
OLDNEW
« no previous file with comments | « chrome_frame/test/ie_event_sink.h ('k') | chrome_frame/test/mock_ie_event_sink_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698