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 #ifndef CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ | 5 #ifndef CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ |
6 #define CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ | 6 #define CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlcom.h> | 9 #include <atlcom.h> |
10 #include <atlctl.h> | 10 #include <atlctl.h> |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 void ResetUrlRequestManager() { | 277 void ResetUrlRequestManager() { |
278 url_fetcher_.reset(new UrlmonUrlRequestManager()); | 278 url_fetcher_.reset(new UrlmonUrlRequestManager()); |
279 } | 279 } |
280 | 280 |
281 static HRESULT WINAPI InterfaceNotSupported(void* pv, REFIID riid, void** ppv, | 281 static HRESULT WINAPI InterfaceNotSupported(void* pv, REFIID riid, void** ppv, |
282 DWORD dw) { | 282 DWORD dw) { |
283 #ifndef NDEBUG | 283 #ifndef NDEBUG |
284 wchar_t buffer[64] = {0}; | 284 wchar_t buffer[64] = {0}; |
285 ::StringFromGUID2(riid, buffer, arraysize(buffer)); | 285 ::StringFromGUID2(riid, buffer, arraysize(buffer)); |
286 DLOG(INFO) << "E_NOINTERFACE: " << buffer; | 286 DVLOG(1) << "E_NOINTERFACE: " << buffer; |
287 #endif | 287 #endif |
288 return E_NOINTERFACE; | 288 return E_NOINTERFACE; |
289 } | 289 } |
290 | 290 |
291 // ISupportsErrorInfo | 291 // ISupportsErrorInfo |
292 STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) { | 292 STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) { |
293 static const IID* interfaces[] = { | 293 static const IID* interfaces[] = { |
294 &IID_IChromeFrame, | 294 &IID_IChromeFrame, |
295 &IID_IDispatch | 295 &IID_IDispatch |
296 }; | 296 }; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 bool is_IE = (lstrcmpi(profile_name.c_str(), kIexploreProfileName) == 0) || | 396 bool is_IE = (lstrcmpi(profile_name.c_str(), kIexploreProfileName) == 0) || |
397 (lstrcmpi(profile_name.c_str(), kRundllProfileName) == 0); | 397 (lstrcmpi(profile_name.c_str(), kRundllProfileName) == 0); |
398 // Browsers without IDeleteBrowsingHistory in non-priv mode | 398 // Browsers without IDeleteBrowsingHistory in non-priv mode |
399 // have their profiles moved into "Temporary Internet Files". | 399 // have their profiles moved into "Temporary Internet Files". |
400 if (is_IE && GetIEVersion() < IE_8 && !is_privileged_) { | 400 if (is_IE && GetIEVersion() < IE_8 && !is_privileged_) { |
401 *profile_path = GetIETemporaryFilesFolder(); | 401 *profile_path = GetIETemporaryFilesFolder(); |
402 *profile_path = profile_path->Append(L"Google Chrome Frame"); | 402 *profile_path = profile_path->Append(L"Google Chrome Frame"); |
403 } else { | 403 } else { |
404 ChromeFramePlugin::GetProfilePath(profile_name, profile_path); | 404 ChromeFramePlugin::GetProfilePath(profile_name, profile_path); |
405 } | 405 } |
406 DLOG(INFO) << __FUNCTION__ << ": " << profile_path->value(); | 406 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); |
407 } | 407 } |
408 | 408 |
409 | 409 |
410 void OnLoad(int tab_handle, const GURL& url) { | 410 void OnLoad(int tab_handle, const GURL& url) { |
411 if (ready_state_ < READYSTATE_COMPLETE) { | 411 if (ready_state_ < READYSTATE_COMPLETE) { |
412 ready_state_ = READYSTATE_COMPLETE; | 412 ready_state_ = READYSTATE_COMPLETE; |
413 FireOnChanged(DISPID_READYSTATE); | 413 FireOnChanged(DISPID_READYSTATE); |
414 } | 414 } |
415 | 415 |
416 HRESULT hr = InvokeScriptFunction(onload_handler_, url.spec()); | 416 HRESULT hr = InvokeScriptFunction(onload_handler_, url.spec()); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 // Only fire the 'interactive' ready state if we aren't there already. | 525 // Only fire the 'interactive' ready state if we aren't there already. |
526 if (ready_state_ < READYSTATE_INTERACTIVE) { | 526 if (ready_state_ < READYSTATE_INTERACTIVE) { |
527 ready_state_ = READYSTATE_INTERACTIVE; | 527 ready_state_ = READYSTATE_INTERACTIVE; |
528 FireOnChanged(DISPID_READYSTATE); | 528 FireOnChanged(DISPID_READYSTATE); |
529 } | 529 } |
530 return 0; | 530 return 0; |
531 } | 531 } |
532 | 532 |
533 LRESULT OnDestroy(UINT message, WPARAM wparam, LPARAM lparam, | 533 LRESULT OnDestroy(UINT message, WPARAM wparam, LPARAM lparam, |
534 BOOL& handled) { // NO_LINT | 534 BOOL& handled) { // NO_LINT |
535 DLOG(INFO) << __FUNCTION__; | 535 DVLOG(1) << __FUNCTION__; |
536 return 0; | 536 return 0; |
537 } | 537 } |
538 | 538 |
539 // ChromeFrameDelegate override | 539 // ChromeFrameDelegate override |
540 virtual void OnAutomationServerReady() { | 540 virtual void OnAutomationServerReady() { |
541 draw_sad_tab_ = false; | 541 draw_sad_tab_ = false; |
542 ChromeFramePlugin<T>::OnAutomationServerReady(); | 542 ChromeFramePlugin<T>::OnAutomationServerReady(); |
543 | 543 |
544 ready_state_ = READYSTATE_COMPLETE; | 544 ready_state_ = READYSTATE_COMPLETE; |
545 FireOnChanged(DISPID_READYSTATE); | 545 FireOnChanged(DISPID_READYSTATE); |
546 } | 546 } |
547 | 547 |
548 // ChromeFrameDelegate override | 548 // ChromeFrameDelegate override |
549 virtual void OnAutomationServerLaunchFailed( | 549 virtual void OnAutomationServerLaunchFailed( |
550 AutomationLaunchResult reason, const std::string& server_version) { | 550 AutomationLaunchResult reason, const std::string& server_version) { |
551 DLOG(INFO) << __FUNCTION__; | 551 DVLOG(1) << __FUNCTION__; |
552 if (reason == AUTOMATION_SERVER_CRASHED) | 552 if (reason == AUTOMATION_SERVER_CRASHED) |
553 draw_sad_tab_ = true; | 553 draw_sad_tab_ = true; |
554 | 554 |
555 ready_state_ = READYSTATE_UNINITIALIZED; | 555 ready_state_ = READYSTATE_UNINITIALIZED; |
556 FireOnChanged(DISPID_READYSTATE); | 556 FireOnChanged(DISPID_READYSTATE); |
557 } | 557 } |
558 | 558 |
559 // Overridden to take advantage of readystate prop changes and send those | 559 // Overridden to take advantage of readystate prop changes and send those |
560 // to potential listeners. | 560 // to potential listeners. |
561 HRESULT FireOnChanged(DISPID dispid) { | 561 HRESULT FireOnChanged(DISPID dispid) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 STDMETHOD(get_onmessage)(VARIANT* onmessage_handler) { | 671 STDMETHOD(get_onmessage)(VARIANT* onmessage_handler) { |
672 if (NULL == onmessage_handler) | 672 if (NULL == onmessage_handler) |
673 return E_INVALIDARG; | 673 return E_INVALIDARG; |
674 | 674 |
675 *onmessage_handler = onmessage_handler_.Copy(); | 675 *onmessage_handler = onmessage_handler_.Copy(); |
676 | 676 |
677 return S_OK; | 677 return S_OK; |
678 } | 678 } |
679 | 679 |
680 STDMETHOD(get_readyState)(long* ready_state) { // NOLINT | 680 STDMETHOD(get_readyState)(long* ready_state) { // NOLINT |
681 DLOG(INFO) << __FUNCTION__; | 681 DVLOG(1) << __FUNCTION__; |
682 DCHECK(ready_state); | 682 DCHECK(ready_state); |
683 | 683 |
684 if (!ready_state) | 684 if (!ready_state) |
685 return E_INVALIDARG; | 685 return E_INVALIDARG; |
686 | 686 |
687 *ready_state = ready_state_; | 687 *ready_state = ready_state_; |
688 | 688 |
689 return S_OK; | 689 return S_OK; |
690 } | 690 } |
691 | 691 |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message) { | 1068 virtual void OnAcceleratorPressed(int tab_handle, const MSG& accel_message) { |
1069 DCHECK(m_spInPlaceSite != NULL); | 1069 DCHECK(m_spInPlaceSite != NULL); |
1070 // Allow our host a chance to handle the accelerator. | 1070 // Allow our host a chance to handle the accelerator. |
1071 // This catches things like Ctrl+F, Ctrl+O etc, but not browser | 1071 // This catches things like Ctrl+F, Ctrl+O etc, but not browser |
1072 // accelerators such as F11, Ctrl+T etc. | 1072 // accelerators such as F11, Ctrl+T etc. |
1073 // (see AllowFrameToTranslateAccelerator for those). | 1073 // (see AllowFrameToTranslateAccelerator for those). |
1074 HRESULT hr = TranslateAccelerator(const_cast<MSG*>(&accel_message)); | 1074 HRESULT hr = TranslateAccelerator(const_cast<MSG*>(&accel_message)); |
1075 if (hr != S_OK) | 1075 if (hr != S_OK) |
1076 hr = AllowFrameToTranslateAccelerator(accel_message); | 1076 hr = AllowFrameToTranslateAccelerator(accel_message); |
1077 | 1077 |
1078 DLOG(INFO) << __FUNCTION__ << " browser response: " | 1078 DVLOG(1) << __FUNCTION__ << " browser response: " |
1079 << base::StringPrintf("0x%08x", hr); | 1079 << base::StringPrintf("0x%08x", hr); |
1080 | 1080 |
1081 if (hr != S_OK) { | 1081 if (hr != S_OK) { |
1082 // The WM_SYSCHAR message is not processed by the IOleControlSite | 1082 // The WM_SYSCHAR message is not processed by the IOleControlSite |
1083 // implementation and the IBrowserService2::v_MayTranslateAccelerator | 1083 // implementation and the IBrowserService2::v_MayTranslateAccelerator |
1084 // implementation. We need to understand this better. That is for | 1084 // implementation. We need to understand this better. That is for |
1085 // another day. For now we just post the WM_SYSCHAR message back to our | 1085 // another day. For now we just post the WM_SYSCHAR message back to our |
1086 // parent which forwards it off to the frame. This should not cause major | 1086 // parent which forwards it off to the frame. This should not cause major |
1087 // grief for Chrome as it does not need to handle WM_SYSCHAR accelerators | 1087 // grief for Chrome as it does not need to handle WM_SYSCHAR accelerators |
1088 // when running in ChromeFrame mode. | 1088 // when running in ChromeFrame mode. |
1089 // TODO(iyengar) | 1089 // TODO(iyengar) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1239 EventHandlers onreadystatechanged_; | 1239 EventHandlers onreadystatechanged_; |
1240 EventHandlers onprivatemessage_; | 1240 EventHandlers onprivatemessage_; |
1241 EventHandlers onextensionready_; | 1241 EventHandlers onextensionready_; |
1242 | 1242 |
1243 // Handle network requests when host network stack is used. Passed to the | 1243 // Handle network requests when host network stack is used. Passed to the |
1244 // automation client on initialization. | 1244 // automation client on initialization. |
1245 scoped_ptr<UrlmonUrlRequestManager> url_fetcher_; | 1245 scoped_ptr<UrlmonUrlRequestManager> url_fetcher_; |
1246 }; | 1246 }; |
1247 | 1247 |
1248 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ | 1248 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ |
OLD | NEW |