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

Side by Side Diff: chrome_frame/chrome_frame_activex.cc

Issue 10783007: Add rudimentary support in the ChromeFrame ActiveX to enable it work in a generic client site, i.e. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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_frame_activex.h ('k') | chrome_frame/chrome_tab.idl » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_activex.h" 5 #include "chrome_frame/chrome_frame_activex.h"
6 6
7 #include <wininet.h> 7 #include <wininet.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 GURL* referrer, 140 GURL* referrer,
141 GURL* url) { 141 GURL* url) {
142 *referrer = params.frame_url.is_empty() ? params.page_url : params.frame_url; 142 *referrer = params.frame_url.is_empty() ? params.page_url : params.frame_url;
143 *url = (cmd == IDS_CONTENT_CONTEXT_SAVELINKAS ? 143 *url = (cmd == IDS_CONTENT_CONTEXT_SAVELINKAS ?
144 params.link_url : params.src_url); 144 params.link_url : params.src_url);
145 } 145 }
146 146
147 } // namespace chrome_frame 147 } // namespace chrome_frame
148 148
149 ChromeFrameActivex::ChromeFrameActivex() 149 ChromeFrameActivex::ChromeFrameActivex()
150 : chrome_wndproc_hook_(NULL) { 150 : chrome_wndproc_hook_(NULL),
151 attaching_to_existing_cf_tab_(false) {
151 TRACE_EVENT_BEGIN_ETW("chromeframe.createactivex", this, ""); 152 TRACE_EVENT_BEGIN_ETW("chromeframe.createactivex", this, "");
152 } 153 }
153 154
154 HRESULT ChromeFrameActivex::FinalConstruct() { 155 HRESULT ChromeFrameActivex::FinalConstruct() {
155 HRESULT hr = Base::FinalConstruct(); 156 HRESULT hr = Base::FinalConstruct();
156 if (FAILED(hr)) 157 if (FAILED(hr))
157 return hr; 158 return hr;
158 159
159 // No need to call FireOnChanged at this point since nobody will be listening. 160 // No need to call FireOnChanged at this point since nobody will be listening.
160 ready_state_ = READYSTATE_LOADING; 161 ready_state_ = READYSTATE_LOADING;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 404
404 STDMETHODIMP ChromeFrameActivex::put_src(BSTR src) { 405 STDMETHODIMP ChromeFrameActivex::put_src(BSTR src) {
405 GURL document_url(GetDocumentUrl()); 406 GURL document_url(GetDocumentUrl());
406 if (document_url.SchemeIsSecure()) { 407 if (document_url.SchemeIsSecure()) {
407 GURL source_url(src); 408 GURL source_url(src);
408 if (!source_url.SchemeIsSecure()) { 409 if (!source_url.SchemeIsSecure()) {
409 Base::put_src(base::win::ScopedBstr(g_activex_insecure_content_error)); 410 Base::put_src(base::win::ScopedBstr(g_activex_insecure_content_error));
410 return E_ACCESSDENIED; 411 return E_ACCESSDENIED;
411 } 412 }
412 } 413 }
413 return Base::put_src(src); 414 HRESULT hr = S_OK;
415 // If we are connecting to an existing ExternalTabContainer instance in
416 // Chrome then we should wait for Chrome to initiate the navigation.
417 if (!attaching_to_existing_cf_tab_) {
418 hr = Base::put_src(src);
419 } else {
420 url_.Reset(::SysAllocString(src));
421 attaching_to_existing_cf_tab_ = false;
422 }
423 return S_OK;
414 } 424 }
415 425
416 HRESULT ChromeFrameActivex::IOleObject_SetClientSite( 426 HRESULT ChromeFrameActivex::IOleObject_SetClientSite(
417 IOleClientSite* client_site) { 427 IOleClientSite* client_site) {
418 HRESULT hr = Base::IOleObject_SetClientSite(client_site); 428 HRESULT hr = Base::IOleObject_SetClientSite(client_site);
419 if (FAILED(hr) || !client_site) { 429 if (FAILED(hr) || !client_site) {
420 EventHandlers* handlers[] = { 430 EventHandlers* handlers[] = {
421 &onmessage_, 431 &onmessage_,
422 &onloaderror_, 432 &onloaderror_,
423 &onload_, 433 &onload_,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 profile_name.assign(profile_name_arg, profile_name_arg.Length()); 473 profile_name.assign(profile_name_arg, profile_name_arg.Length());
464 } 474 }
465 475
466 std::string utf8_url; 476 std::string utf8_url;
467 if (url_.Length()) { 477 if (url_.Length()) {
468 WideToUTF8(url_, url_.Length(), &utf8_url); 478 WideToUTF8(url_, url_.Length(), &utf8_url);
469 } 479 }
470 480
471 InitializeAutomationSettings(); 481 InitializeAutomationSettings();
472 482
483 if (service) {
484 base::win::ScopedBstr navigation_url;
485 service->GetNavigationUrl(navigation_url.Receive());
486 if (navigation_url.Length()) {
487 ChromeFrameUrl cf_url;
488 cf_url.Parse(navigation_url.operator BSTR());
489 if (cf_url.attach_to_external_tab()) {
490 automation_client_->AttachExternalTab(cf_url.cookie());
491 attaching_to_existing_cf_tab_ = true;
492 }
493 }
494 }
473 url_fetcher_->set_frame_busting(!is_privileged()); 495 url_fetcher_->set_frame_busting(!is_privileged());
474 automation_client_->SetUrlFetcher(url_fetcher_.get()); 496 automation_client_->SetUrlFetcher(url_fetcher_.get());
475 if (!InitializeAutomation(profile_name, IsIEInPrivate(), true, 497 if (!InitializeAutomation(profile_name, IsIEInPrivate(), true,
476 GURL(utf8_url), GURL(), false)) { 498 GURL(utf8_url), GURL(), false)) {
477 DLOG(ERROR) << "Failed to navigate to url:" << utf8_url; 499 DLOG(ERROR) << "Failed to navigate to url:" << utf8_url;
478 return E_FAIL; 500 return E_FAIL;
479 } 501 }
480 502
481 // Log a metric that Chrome Frame is being used in Widget mode 503 // Log a metric that Chrome Frame is being used in Widget mode
482 UMA_LAUNCH_TYPE_COUNT(RENDERER_TYPE_CHROME_WIDGET); 504 UMA_LAUNCH_TYPE_COUNT(RENDERER_TYPE_CHROME_WIDGET);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 if (FAILED(hr)) { 695 if (FAILED(hr)) {
674 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" 696 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:"
675 << base::StringPrintf(" 0x%08X", hr); 697 << base::StringPrintf(" 0x%08X", hr);
676 return hr; 698 return hr;
677 } 699 }
678 700
679 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), 701 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string),
680 base::win::ScopedVariant(bho)); 702 base::win::ScopedVariant(bho));
681 return S_OK; 703 return S_OK;
682 } 704 }
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame_activex.h ('k') | chrome_frame/chrome_tab.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698