OLD | NEW |
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/chrome_frame_automation.h" | 5 #include "chrome_frame/chrome_frame_automation.h" |
6 | 6 |
7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 647 |
648 // Keep object in memory, while the window is alive. | 648 // Keep object in memory, while the window is alive. |
649 // Corresponding Release is in OnFinalMessage(); | 649 // Corresponding Release is in OnFinalMessage(); |
650 AddRef(); | 650 AddRef(); |
651 | 651 |
652 // Mark our state as initializing. We'll reach initialized once | 652 // Mark our state as initializing. We'll reach initialized once |
653 // InitializeComplete is called successfully. | 653 // InitializeComplete is called successfully. |
654 init_state_ = INITIALIZING; | 654 init_state_ = INITIALIZING; |
655 | 655 |
656 HRESULT hr = S_OK; | 656 HRESULT hr = S_OK; |
657 // If chrome crashed and is being restarted, the security_manager_ object | |
658 // might already be valid. | |
659 if (security_manager_.get() == NULL) | |
660 hr = security_manager_.CreateInstance(CLSID_InternetSecurityManager); | |
661 | |
662 if (FAILED(hr)) { | |
663 NOTREACHED() << __FUNCTION__ | |
664 << " Failed to create InternetSecurityManager. Error: 0x%x" | |
665 << hr; | |
666 } | |
667 | 657 |
668 if (chrome_launch_params_->url().is_valid()) | 658 if (chrome_launch_params_->url().is_valid()) |
669 navigate_after_initialization_ = false; | 659 navigate_after_initialization_ = false; |
670 | 660 |
671 proxy_factory_->GetAutomationServer(static_cast<LaunchDelegate*>(this), | 661 proxy_factory_->GetAutomationServer(static_cast<LaunchDelegate*>(this), |
672 chrome_launch_params_, &automation_server_id_); | 662 chrome_launch_params_, &automation_server_id_); |
673 | 663 |
674 return true; | 664 return true; |
675 } | 665 } |
676 | 666 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 if (::IsWindow(m_hWnd)) | 703 if (::IsWindow(m_hWnd)) |
714 DestroyWindow(); | 704 DestroyWindow(); |
715 | 705 |
716 // DCHECK(navigate_after_initialization_ == false); | 706 // DCHECK(navigate_after_initialization_ == false); |
717 handle_top_level_requests_ = false; | 707 handle_top_level_requests_ = false; |
718 ui_thread_id_ = 0; | 708 ui_thread_id_ = 0; |
719 chrome_frame_delegate_ = NULL; | 709 chrome_frame_delegate_ = NULL; |
720 init_state_ = UNINITIALIZED; | 710 init_state_ = UNINITIALIZED; |
721 } | 711 } |
722 | 712 |
723 bool ChromeFrameAutomationClient::InitiateNavigation(const std::string& url, | 713 bool ChromeFrameAutomationClient::InitiateNavigation( |
724 const std::string& referrer, bool is_privileged) { | 714 const std::string& url, |
| 715 const std::string& referrer, |
| 716 NavigationConstraints* navigation_constraints) { |
725 if (url.empty()) | 717 if (url.empty()) |
726 return false; | 718 return false; |
727 | 719 |
728 GURL parsed_url(url); | 720 GURL parsed_url(url); |
729 | 721 |
730 // Catch invalid URLs early. | 722 // Catch invalid URLs early. |
731 // Can we allow this navigation to happen? | 723 // Can we allow this navigation to happen? |
732 if (!CanNavigate(parsed_url, security_manager_, is_privileged)) { | 724 if (!CanNavigate(parsed_url, navigation_constraints)) { |
733 DLOG(ERROR) << __FUNCTION__ << " Not allowing navigation to: " << url; | 725 DLOG(ERROR) << __FUNCTION__ << " Not allowing navigation to: " << url; |
734 return false; | 726 return false; |
735 } | 727 } |
736 | 728 |
737 // If we are not yet initialized ignore attempts to navigate to the same url. | 729 // If we are not yet initialized ignore attempts to navigate to the same url. |
738 // Navigation attempts to the same URL could occur if the automation client | 730 // Navigation attempts to the same URL could occur if the automation client |
739 // was reused for a new active document instance. | 731 // was reused for a new active document instance. |
740 if (!chrome_launch_params_ || is_initialized() || | 732 if (!chrome_launch_params_ || is_initialized() || |
741 parsed_url != chrome_launch_params_->url()) { | 733 parsed_url != chrome_launch_params_->url()) { |
742 // Important: Since we will be using the referrer_ variable from a | 734 // Important: Since we will be using the referrer_ variable from a |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 const URLRequestStatus& status) { | 1461 const URLRequestStatus& status) { |
1470 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), | 1462 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), |
1471 request_id, status)); | 1463 request_id, status)); |
1472 } | 1464 } |
1473 | 1465 |
1474 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, | 1466 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, |
1475 const GURL& url, const std::string& cookie_string, int cookie_id) { | 1467 const GURL& url, const std::string& cookie_string, int cookie_id) { |
1476 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, | 1468 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, |
1477 tab_->handle(), success, url, cookie_string, cookie_id)); | 1469 tab_->handle(), success, url, cookie_string, cookie_id)); |
1478 } | 1470 } |
OLD | NEW |