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

Side by Side Diff: chrome_frame/chrome_active_document.cc

Issue 6458004: Remove includes of message headers in headers. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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/chrome_active_document.h ('k') | chrome_frame/chrome_frame.gyp » ('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 // 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 16 matching lines...) Expand all
27 #include "base/string_util.h" 27 #include "base/string_util.h"
28 #include "base/threading/thread.h" 28 #include "base/threading/thread.h"
29 #include "base/threading/thread_local.h" 29 #include "base/threading/thread_local.h"
30 #include "base/utf_string_conversions.h" 30 #include "base/utf_string_conversions.h"
31 #include "base/win/scoped_variant.h" 31 #include "base/win/scoped_variant.h"
32 #include "base/win/win_util.h" 32 #include "base/win/win_util.h"
33 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
34 #include "chrome/app/chrome_command_ids.h" 34 #include "chrome/app/chrome_command_ids.h"
35 #include "chrome/app/chrome_dll_resource.h" 35 #include "chrome/app/chrome_dll_resource.h"
36 #include "chrome/browser/tab_contents/tab_contents.h" 36 #include "chrome/browser/tab_contents/tab_contents.h"
37 #include "chrome/common/automation_messages.h"
37 #include "chrome/common/chrome_constants.h" 38 #include "chrome/common/chrome_constants.h"
38 #include "chrome/common/navigation_types.h" 39 #include "chrome/common/navigation_types.h"
39 #include "chrome/common/page_zoom.h" 40 #include "chrome/common/page_zoom.h"
40 #include "chrome/test/automation/browser_proxy.h" 41 #include "chrome/test/automation/browser_proxy.h"
41 #include "chrome/test/automation/tab_proxy.h" 42 #include "chrome/test/automation/tab_proxy.h"
42 #include "chrome_frame/bho.h" 43 #include "chrome_frame/bho.h"
43 #include "chrome_frame/bind_context_info.h" 44 #include "chrome_frame/bind_context_info.h"
44 #include "chrome_frame/buggy_bho_handling.h" 45 #include "chrome_frame/buggy_bho_handling.h"
45 #include "chrome_frame/crash_reporting/crash_metrics.h" 46 #include "chrome_frame/crash_reporting/crash_metrics.h"
46 #include "chrome_frame/utils.h" 47 #include "chrome_frame/utils.h"
47 48
48 DEFINE_GUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 49 DEFINE_GUID(CGID_DocHostCmdPriv, 0x000214D4L, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0,
49 0x46); 50 0x46);
50 51
51 base::ThreadLocalPointer<ChromeActiveDocument> g_active_doc_cache; 52 base::ThreadLocalPointer<ChromeActiveDocument> g_active_doc_cache;
52 53
53 bool g_first_launch_by_process_ = true; 54 bool g_first_launch_by_process_ = true;
54 55
55 const DWORD kIEEncodingIdArray[] = { 56 const DWORD kIEEncodingIdArray[] = {
56 #define DEFINE_ENCODING_ID_ARRAY(encoding_name, id, chrome_name) encoding_name, 57 #define DEFINE_ENCODING_ID_ARRAY(encoding_name, id, chrome_name) encoding_name,
57 INTERNAL_IE_ENCODINGMENU_IDS(DEFINE_ENCODING_ID_ARRAY) 58 INTERNAL_IE_ENCODINGMENU_IDS(DEFINE_ENCODING_ID_ARRAY)
58 #undef DEFINE_ENCODING_ID_ARRAY 59 #undef DEFINE_ENCODING_ID_ARRAY
59 0 // The Last data must be 0 to indicate the end of the encoding id array. 60 0 // The Last data must be 0 to indicate the end of the encoding id array.
60 }; 61 };
61 62
62 ChromeActiveDocument::ChromeActiveDocument() 63 ChromeActiveDocument::ChromeActiveDocument()
63 : first_navigation_(true), 64 : navigation_info_(new NavigationInfo()),
65 first_navigation_(true),
64 is_automation_client_reused_(false), 66 is_automation_client_reused_(false),
65 popup_allowed_(false), 67 popup_allowed_(false),
66 accelerator_table_(NULL) { 68 accelerator_table_(NULL) {
67 TRACE_EVENT_BEGIN("chromeframe.createactivedocument", this, ""); 69 TRACE_EVENT_BEGIN("chromeframe.createactivedocument", this, "");
68 70
69 url_fetcher_->set_frame_busting(false); 71 url_fetcher_->set_frame_busting(false);
70 memset(&navigation_info_, 0, sizeof(navigation_info_)); 72 memset(navigation_info_.get(), 0, sizeof(NavigationInfo));
71 } 73 }
72 74
73 HRESULT ChromeActiveDocument::FinalConstruct() { 75 HRESULT ChromeActiveDocument::FinalConstruct() {
74 // If we have a cached ChromeActiveDocument instance in TLS, then grab 76 // If we have a cached ChromeActiveDocument instance in TLS, then grab
75 // ownership of the cached document's automation client. This is an 77 // ownership of the cached document's automation client. This is an
76 // optimization to get Chrome active documents to load faster. 78 // optimization to get Chrome active documents to load faster.
77 ChromeActiveDocument* cached_document = g_active_doc_cache.Get(); 79 ChromeActiveDocument* cached_document = g_active_doc_cache.Get();
78 if (cached_document && cached_document->IsValid()) { 80 if (cached_document && cached_document->IsValid()) {
79 SetResourceModule(); 81 SetResourceModule();
80 DCHECK(automation_client_.get() == NULL); 82 DCHECK(automation_client_.get() == NULL);
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // Back-Forward navigation to anchors to work correctly when we navigate to a 426 // Back-Forward navigation to anchors to work correctly when we navigate to a
425 // page outside of ChromeFrame and then come back. 427 // page outside of ChromeFrame and then come back.
426 if (!stream) { 428 if (!stream) {
427 NOTREACHED(); 429 NOTREACHED();
428 return E_INVALIDARG; 430 return E_INVALIDARG;
429 } 431 }
430 432
431 LARGE_INTEGER offset = {0}; 433 LARGE_INTEGER offset = {0};
432 ULARGE_INTEGER new_pos = {0}; 434 ULARGE_INTEGER new_pos = {0};
433 DWORD written = 0; 435 DWORD written = 0;
434 std::wstring url = UTF8ToWide(navigation_info_.url.spec()); 436 std::wstring url = UTF8ToWide(navigation_info_->url.spec());
435 return stream->Write(url.c_str(), (url.length() + 1) * sizeof(wchar_t), 437 return stream->Write(url.c_str(), (url.length() + 1) * sizeof(wchar_t),
436 &written); 438 &written);
437 } 439 }
438 440
439 STDMETHODIMP ChromeActiveDocument::SetPositionCookie(DWORD position_cookie) { 441 STDMETHODIMP ChromeActiveDocument::SetPositionCookie(DWORD position_cookie) {
440 if (automation_client_.get()) { 442 if (automation_client_.get()) {
441 int index = static_cast<int>(position_cookie); 443 int index = static_cast<int>(position_cookie);
442 navigation_info_.navigation_index = index; 444 navigation_info_->navigation_index = index;
443 automation_client_->NavigateToIndex(index); 445 automation_client_->NavigateToIndex(index);
444 } else { 446 } else {
445 DLOG(WARNING) << "Invalid automation client instance"; 447 DLOG(WARNING) << "Invalid automation client instance";
446 } 448 }
447 return S_OK; 449 return S_OK;
448 } 450 }
449 451
450 STDMETHODIMP ChromeActiveDocument::GetPositionCookie(DWORD* position_cookie) { 452 STDMETHODIMP ChromeActiveDocument::GetPositionCookie(DWORD* position_cookie) {
451 if (!position_cookie) 453 if (!position_cookie)
452 return E_INVALIDARG; 454 return E_INVALIDARG;
453 455
454 *position_cookie = navigation_info_.navigation_index; 456 *position_cookie = navigation_info_->navigation_index;
455 return S_OK; 457 return S_OK;
456 } 458 }
457 459
458 STDMETHODIMP ChromeActiveDocument::GetUrlForEvents(BSTR* url) { 460 STDMETHODIMP ChromeActiveDocument::GetUrlForEvents(BSTR* url) {
459 if (NULL == url) 461 if (NULL == url)
460 return E_POINTER; 462 return E_POINTER;
461 *url = ::SysAllocString(url_); 463 *url = ::SysAllocString(url_);
462 return S_OK; 464 return S_OK;
463 } 465 }
464 466
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 // Close the container window. 705 // Close the container window.
704 ScopedComPtr<IWebBrowser2> web_browser2; 706 ScopedComPtr<IWebBrowser2> web_browser2;
705 DoQueryService(SID_SWebBrowserApp, m_spClientSite, web_browser2.Receive()); 707 DoQueryService(SID_SWebBrowserApp, m_spClientSite, web_browser2.Receive());
706 if (web_browser2) 708 if (web_browser2)
707 web_browser2->Quit(); 709 web_browser2->Quit();
708 } 710 }
709 711
710 void ChromeActiveDocument::UpdateNavigationState( 712 void ChromeActiveDocument::UpdateNavigationState(
711 const NavigationInfo& new_navigation_info, int flags) { 713 const NavigationInfo& new_navigation_info, int flags) {
712 HRESULT hr = S_OK; 714 HRESULT hr = S_OK;
713 bool is_title_changed = (navigation_info_.title != new_navigation_info.title); 715 bool is_title_changed =
716 (navigation_info_->title != new_navigation_info.title);
714 bool is_ssl_state_changed = 717 bool is_ssl_state_changed =
715 (navigation_info_.security_style != new_navigation_info.security_style) || 718 (navigation_info_->security_style !=
716 (navigation_info_.displayed_insecure_content != 719 new_navigation_info.security_style) ||
720 (navigation_info_->displayed_insecure_content !=
717 new_navigation_info.displayed_insecure_content) || 721 new_navigation_info.displayed_insecure_content) ||
718 (navigation_info_.ran_insecure_content != 722 (navigation_info_->ran_insecure_content !=
719 new_navigation_info.ran_insecure_content); 723 new_navigation_info.ran_insecure_content);
720 724
721 if (is_ssl_state_changed) { 725 if (is_ssl_state_changed) {
722 int lock_status = SECURELOCK_SET_UNSECURE; 726 int lock_status = SECURELOCK_SET_UNSECURE;
723 switch (new_navigation_info.security_style) { 727 switch (new_navigation_info.security_style) {
724 case SECURITY_STYLE_AUTHENTICATED: 728 case SECURITY_STYLE_AUTHENTICATED:
725 lock_status = new_navigation_info.displayed_insecure_content ? 729 lock_status = new_navigation_info.displayed_insecure_content ?
726 SECURELOCK_SET_MIXED : SECURELOCK_SET_SECUREUNKNOWNBIT; 730 SECURELOCK_SET_MIXED : SECURELOCK_SET_SECUREUNKNOWNBIT;
727 break; 731 break;
728 default: 732 default:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 if (is_title_changed) { 831 if (is_title_changed) {
828 base::win::ScopedVariant title(new_navigation_info.title.c_str()); 832 base::win::ScopedVariant title(new_navigation_info.title.c_str());
829 IEExec(NULL, OLECMDID_SETTITLE, OLECMDEXECOPT_DONTPROMPTUSER, 833 IEExec(NULL, OLECMDID_SETTITLE, OLECMDEXECOPT_DONTPROMPTUSER,
830 title.AsInput(), NULL); 834 title.AsInput(), NULL);
831 } 835 }
832 836
833 // It is important that we only update the navigation_info_ after we have 837 // It is important that we only update the navigation_info_ after we have
834 // finalized the travel log. This is because IE will ask for information 838 // finalized the travel log. This is because IE will ask for information
835 // such as navigation index when the travel log is finalized and we need 839 // such as navigation index when the travel log is finalized and we need
836 // supply the old index and not the new one. 840 // supply the old index and not the new one.
837 navigation_info_ = new_navigation_info; 841 *navigation_info_ = new_navigation_info;
838 // Update the IE zone here. Ideally we would like to do it when the active 842 // Update the IE zone here. Ideally we would like to do it when the active
839 // document is activated. However that does not work at times as the frame we 843 // document is activated. However that does not work at times as the frame we
840 // get there is not the actual frame which handles the command. 844 // get there is not the actual frame which handles the command.
841 IEExec(&CGID_Explorer, SBCMDID_MIXEDZONE, 0, NULL, NULL); 845 IEExec(&CGID_Explorer, SBCMDID_MIXEDZONE, 0, NULL, NULL);
842 } 846 }
843 847
844 void ChromeActiveDocument::OnFindInPage() { 848 void ChromeActiveDocument::OnFindInPage() {
845 TabProxy* tab = GetTabProxy(); 849 TabProxy* tab = GetTabProxy();
846 if (tab) { 850 if (tab) {
847 if (!find_dialog_.IsWindow()) 851 if (!find_dialog_.IsWindow())
848 find_dialog_.Create(m_hWnd); 852 find_dialog_.Create(m_hWnd);
849 853
850 find_dialog_.ShowWindow(SW_SHOW); 854 find_dialog_.ShowWindow(SW_SHOW);
851 } 855 }
852 } 856 }
853 857
854 void ChromeActiveDocument::OnViewSource() { 858 void ChromeActiveDocument::OnViewSource() {
855 DCHECK(navigation_info_.url.is_valid()); 859 DCHECK(navigation_info_->url.is_valid());
856 HostNavigate(GURL(chrome::kViewSourceScheme + std::string(":") + 860 HostNavigate(GURL(chrome::kViewSourceScheme + std::string(":") +
857 navigation_info_.url.spec()), GURL(), NEW_WINDOW); 861 navigation_info_->url.spec()), GURL(), NEW_WINDOW);
858 } 862 }
859 863
860 void ChromeActiveDocument::OnDetermineSecurityZone(const GUID* cmd_group_guid, 864 void ChromeActiveDocument::OnDetermineSecurityZone(const GUID* cmd_group_guid,
861 DWORD command_id, 865 DWORD command_id,
862 DWORD cmd_exec_opt, 866 DWORD cmd_exec_opt,
863 VARIANT* in_args, 867 VARIANT* in_args,
864 VARIANT* out_args) { 868 VARIANT* out_args) {
865 // Always return URLZONE_INTERNET since that is the Chrome's behaviour. 869 // Always return URLZONE_INTERNET since that is the Chrome's behaviour.
866 // Correct step is to use MapUrlToZone(). 870 // Correct step is to use MapUrlToZone().
867 if (out_args != NULL) { 871 if (out_args != NULL) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 tab_proxy->ReloadAsync(); 1122 tab_proxy->ReloadAsync();
1119 } else { 1123 } else {
1120 DLOG(ERROR) << "No automation proxy"; 1124 DLOG(ERROR) << "No automation proxy";
1121 DCHECK(automation_client_.get() != NULL) << "how did it get freed?"; 1125 DCHECK(automation_client_.get() != NULL) << "how did it get freed?";
1122 // The current url request manager (url_fetcher_) has been switched to 1126 // The current url request manager (url_fetcher_) has been switched to
1123 // a stopping state so we need to reset it and get a new one for the new 1127 // a stopping state so we need to reset it and get a new one for the new
1124 // automation server. 1128 // automation server.
1125 ResetUrlRequestManager(); 1129 ResetUrlRequestManager();
1126 url_fetcher_->set_frame_busting(false); 1130 url_fetcher_->set_frame_busting(false);
1127 // And now launch the current URL again. This starts a new server process. 1131 // And now launch the current URL again. This starts a new server process.
1128 DCHECK(navigation_info_.url.is_valid()); 1132 DCHECK(navigation_info_->url.is_valid());
1129 ChromeFrameUrl cf_url; 1133 ChromeFrameUrl cf_url;
1130 cf_url.Parse(UTF8ToWide(navigation_info_.url.spec())); 1134 cf_url.Parse(UTF8ToWide(navigation_info_->url.spec()));
1131 LaunchUrl(cf_url, navigation_info_.referrer.spec()); 1135 LaunchUrl(cf_url, navigation_info_->referrer.spec());
1132 } 1136 }
1133 1137
1134 return S_OK; 1138 return S_OK;
1135 } 1139 }
1136 1140
1137 HRESULT ChromeActiveDocument::SetPageFontSize(const GUID* cmd_group_guid, 1141 HRESULT ChromeActiveDocument::SetPageFontSize(const GUID* cmd_group_guid,
1138 DWORD command_id, 1142 DWORD command_id,
1139 DWORD cmd_exec_opt, 1143 DWORD cmd_exec_opt,
1140 VARIANT* in_args, 1144 VARIANT* in_args,
1141 VARIANT* out_args) { 1145 VARIANT* out_args) {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 // navigation was initiated on the current external tab. 1380 // navigation was initiated on the current external tab.
1377 // 3. The navigation type has changed. 1381 // 3. The navigation type has changed.
1378 // 4. The url or the referrer are different. 1382 // 4. The url or the referrer are different.
1379 if (flags == TabContents::INVALIDATE_LOAD) 1383 if (flags == TabContents::INVALIDATE_LOAD)
1380 return false; 1384 return false;
1381 1385
1382 if (new_navigation_info.navigation_index <= 0) 1386 if (new_navigation_info.navigation_index <= 0)
1383 return false; 1387 return false;
1384 1388
1385 if (new_navigation_info.navigation_index == 1389 if (new_navigation_info.navigation_index ==
1386 navigation_info_.navigation_index) 1390 navigation_info_->navigation_index)
1387 return false; 1391 return false;
1388 1392
1389 if (new_navigation_info.navigation_type != navigation_info_.navigation_type) 1393 if (new_navigation_info.navigation_type != navigation_info_->navigation_type)
1390 return true; 1394 return true;
1391 1395
1392 if (new_navigation_info.url != navigation_info_.url) 1396 if (new_navigation_info.url != navigation_info_->url)
1393 return true; 1397 return true;
1394 1398
1395 if (new_navigation_info.referrer != navigation_info_.referrer) 1399 if (new_navigation_info.referrer != navigation_info_->referrer)
1396 return true; 1400 return true;
1397 1401
1398 return false; 1402 return false;
1399 } 1403 }
OLDNEW
« no previous file with comments | « chrome_frame/chrome_active_document.h ('k') | chrome_frame/chrome_frame.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698