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

Side by Side Diff: chrome_frame/chrome_active_document.cc

Issue 1763011: Fix a chrome frame crasher reported on the crash server. It occurs while proc... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | « no previous file | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // Implementation of ChromeActiveDocument 5 // Implementation of ChromeActiveDocument
6 #include "chrome_frame/chrome_active_document.h" 6 #include "chrome_frame/chrome_active_document.h"
7 7
8 #include <hlink.h> 8 #include <hlink.h>
9 #include <htiface.h> 9 #include <htiface.h>
10 #include <initguid.h> 10 #include <initguid.h>
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 390
391 LARGE_INTEGER offset = {0}; 391 LARGE_INTEGER offset = {0};
392 ULARGE_INTEGER new_pos = {0}; 392 ULARGE_INTEGER new_pos = {0};
393 DWORD written = 0; 393 DWORD written = 0;
394 std::wstring url = UTF8ToWide(navigation_info_.url.spec()); 394 std::wstring url = UTF8ToWide(navigation_info_.url.spec());
395 return stream->Write(url.c_str(), (url.length() + 1) * sizeof(wchar_t), 395 return stream->Write(url.c_str(), (url.length() + 1) * sizeof(wchar_t),
396 &written); 396 &written);
397 } 397 }
398 398
399 STDMETHODIMP ChromeActiveDocument::SetPositionCookie(DWORD position_cookie) { 399 STDMETHODIMP ChromeActiveDocument::SetPositionCookie(DWORD position_cookie) {
400 int index = static_cast<int>(position_cookie); 400 if (automation_client_.get()) {
401 navigation_info_.navigation_index = index; 401 int index = static_cast<int>(position_cookie);
402 automation_client_->NavigateToIndex(index); 402 navigation_info_.navigation_index = index;
403 automation_client_->NavigateToIndex(index);
404 } else {
405 DLOG(WARNING) << "Invalid automation client instance";
406 }
403 return S_OK; 407 return S_OK;
404 } 408 }
405 409
406 STDMETHODIMP ChromeActiveDocument::GetPositionCookie(DWORD* position_cookie) { 410 STDMETHODIMP ChromeActiveDocument::GetPositionCookie(DWORD* position_cookie) {
407 if (!position_cookie) 411 if (!position_cookie)
408 return E_INVALIDARG; 412 return E_INVALIDARG;
409 413
410 *position_cookie = navigation_info_.navigation_index; 414 *position_cookie = navigation_info_.navigation_index;
411 return S_OK; 415 return S_OK;
412 } 416 }
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 // Grab a reference to ensure that the document remains valid. 807 // Grab a reference to ensure that the document remains valid.
804 AddRef(); 808 AddRef();
805 g_active_doc_cache.Set(this); 809 g_active_doc_cache.Set(this);
806 } 810 }
807 811
808 BaseActiveX::OnOpenURL(tab_handle, url_to_open, referrer, open_disposition); 812 BaseActiveX::OnOpenURL(tab_handle, url_to_open, referrer, open_disposition);
809 } 813 }
810 814
811 void ChromeActiveDocument::OnAttachExternalTab(int tab_handle, 815 void ChromeActiveDocument::OnAttachExternalTab(int tab_handle,
812 const IPC::AttachExternalTabParams& params) { 816 const IPC::AttachExternalTabParams& params) {
817 if (!automation_client_.get()) {
818 DLOG(WARNING) << "Invalid automation client instance";
819 return;
820 }
813 DWORD flags = 0; 821 DWORD flags = 0;
814 if (params.user_gesture) 822 if (params.user_gesture)
815 flags = NWMF_USERREQUESTED; 823 flags = NWMF_USERREQUESTED;
816 else if (popup_allowed_) 824 else if (popup_allowed_)
817 flags = NWMF_USERALLOWED; 825 flags = NWMF_USERALLOWED;
818 826
819 HRESULT hr = S_OK; 827 HRESULT hr = S_OK;
820 if (popup_manager_) { 828 if (popup_manager_) {
821 LPCWSTR popup_wnd_url = UTF8ToWide(params.url.spec()).c_str(); 829 LPCWSTR popup_wnd_url = UTF8ToWide(params.url.spec()).c_str();
822 hr = popup_manager_->EvaluateNewWindow(popup_wnd_url, NULL, url_, 830 hr = popup_manager_->EvaluateNewWindow(popup_wnd_url, NULL, url_,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 if (!allow_gcf_protocol) 982 if (!allow_gcf_protocol)
975 return false; 983 return false;
976 } 984 }
977 985
978 *parsed_url = initial_url; 986 *parsed_url = initial_url;
979 return true; 987 return true;
980 } 988 }
981 989
982 bool ChromeActiveDocument::LaunchUrl(const std::wstring& url, 990 bool ChromeActiveDocument::LaunchUrl(const std::wstring& url,
983 bool is_new_navigation) { 991 bool is_new_navigation) {
992 DCHECK(automation_client_.get() != NULL);
993
984 url_.Allocate(url.c_str()); 994 url_.Allocate(url.c_str());
985 995
986 if (!is_new_navigation) { 996 if (!is_new_navigation) {
987 WStringTokenizer tokenizer(url, L"&"); 997 WStringTokenizer tokenizer(url, L"&");
988 // Skip over kChromeAttachExternalTabPrefix 998 // Skip over kChromeAttachExternalTabPrefix
989 tokenizer.GetNext(); 999 tokenizer.GetNext();
990 1000
991 uint64 external_tab_cookie = 0; 1001 uint64 external_tab_cookie = 0;
992 if (tokenizer.GetNext()) { 1002 if (tokenizer.GetNext()) {
993 wchar_t* end_ptr = 0; 1003 wchar_t* end_ptr = 0;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 return S_OK; 1068 return S_OK;
1059 } 1069 }
1060 1070
1061 1071
1062 HRESULT ChromeActiveDocument::SetPageFontSize(const GUID* cmd_group_guid, 1072 HRESULT ChromeActiveDocument::SetPageFontSize(const GUID* cmd_group_guid,
1063 DWORD command_id, 1073 DWORD command_id,
1064 DWORD cmd_exec_opt, 1074 DWORD cmd_exec_opt,
1065 VARIANT* in_args, 1075 VARIANT* in_args,
1066 VARIANT* out_args) { 1076 VARIANT* out_args) {
1067 if (!automation_client_.get()) { 1077 if (!automation_client_.get()) {
1068 NOTREACHED() << "Invalid automtion client"; 1078 NOTREACHED() << "Invalid automation client";
1069 return E_FAIL; 1079 return E_FAIL;
1070 } 1080 }
1071 1081
1072 switch (command_id) { 1082 switch (command_id) {
1073 case IDM_BASELINEFONT1: 1083 case IDM_BASELINEFONT1:
1074 automation_client_->SetPageFontSize(SMALLEST_FONT); 1084 automation_client_->SetPageFontSize(SMALLEST_FONT);
1075 break; 1085 break;
1076 1086
1077 case IDM_BASELINEFONT2: 1087 case IDM_BASELINEFONT2:
1078 automation_client_->SetPageFontSize(SMALL_FONT); 1088 automation_client_->SetPageFontSize(SMALL_FONT);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 ScopedComPtr<ITridentService2> trident_services; 1250 ScopedComPtr<ITridentService2> trident_services;
1241 trident_services.QueryFrom(shell_browser); 1251 trident_services.QueryFrom(shell_browser);
1242 if (trident_services) { 1252 if (trident_services) {
1243 trident_services->FirePrivacyImpactedStateChange(wparam); 1253 trident_services->FirePrivacyImpactedStateChange(wparam);
1244 } else { 1254 } else {
1245 NOTREACHED() << "Failed to retrieve IWebBrowser2 interface."; 1255 NOTREACHED() << "Failed to retrieve IWebBrowser2 interface.";
1246 } 1256 }
1247 return 0; 1257 return 0;
1248 } 1258 }
1249 1259
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698