| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 // mode, in which case we always trust our container so we return false. | 354 // mode, in which case we always trust our container so we return false. |
| 355 bool is_frame_busting_enabled() const { | 355 bool is_frame_busting_enabled() const { |
| 356 return !is_privileged_; | 356 return !is_privileged_; |
| 357 } | 357 } |
| 358 | 358 |
| 359 // Needed to support PostTask. | 359 // Needed to support PostTask. |
| 360 static bool ImplementsThreadSafeReferenceCounting() { | 360 static bool ImplementsThreadSafeReferenceCounting() { |
| 361 return true; | 361 return true; |
| 362 } | 362 } |
| 363 | 363 |
| 364 // IOleInPlaceObject overrides. |
| 365 STDMETHOD(InPlaceDeactivate)(void) { |
| 366 static UINT onload_handlers_done_msg = |
| 367 RegisterWindowMessage(L"ChromeFrame_OnloadHandlersDone"); |
| 368 |
| 369 if (m_bInPlaceActive && IsWindow() && IsValid()) { |
| 370 static const int kChromeFrameUnloadEventTimerId = 0xdeadbeef; |
| 371 static const int kChromeFrameUnloadEventTimeout = 1000; |
| 372 |
| 373 // To prevent us from indefinitely waiting for an acknowledgement from |
| 374 // Chrome indicating that unload handlers have been run, we set a 1 |
| 375 // second timer and exit the loop when it fires. |
| 376 ::SetTimer(m_hWnd, kChromeFrameUnloadEventTimerId, |
| 377 kChromeFrameUnloadEventTimeout, NULL); |
| 378 |
| 379 automation_client_->RunUnloadHandlers(m_hWnd, onload_handlers_done_msg); |
| 380 |
| 381 MSG msg = {0}; |
| 382 while (GetMessage(&msg, NULL, 0, 0)) { |
| 383 if (msg.message == onload_handlers_done_msg && |
| 384 msg.hwnd == m_hWnd) { |
| 385 break; |
| 386 } |
| 387 |
| 388 if (msg.message == WM_TIMER && |
| 389 msg.wParam == kChromeFrameUnloadEventTimerId) { |
| 390 break; |
| 391 } |
| 392 TranslateMessage(&msg); |
| 393 DispatchMessage(&msg); |
| 394 } |
| 395 |
| 396 ::KillTimer(m_hWnd, kChromeFrameUnloadEventTimerId); |
| 397 } |
| 398 return IOleInPlaceObjectWindowlessImpl<T>::InPlaceDeactivate(); |
| 399 } |
| 400 |
| 364 protected: | 401 protected: |
| 365 virtual void GetProfilePath(const std::wstring& profile_name, | 402 virtual void GetProfilePath(const std::wstring& profile_name, |
| 366 FilePath* profile_path) { | 403 FilePath* profile_path) { |
| 367 bool is_IE = (lstrcmpi(profile_name.c_str(), kIexploreProfileName) == 0) || | 404 bool is_IE = (lstrcmpi(profile_name.c_str(), kIexploreProfileName) == 0) || |
| 368 (lstrcmpi(profile_name.c_str(), kRundllProfileName) == 0); | 405 (lstrcmpi(profile_name.c_str(), kRundllProfileName) == 0); |
| 369 // Browsers without IDeleteBrowsingHistory in non-priv mode | 406 // Browsers without IDeleteBrowsingHistory in non-priv mode |
| 370 // have their profiles moved into "Temporary Internet Files". | 407 // have their profiles moved into "Temporary Internet Files". |
| 371 if (is_IE && GetIEVersion() < IE_8 && !is_privileged_) { | 408 if (is_IE && GetIEVersion() < IE_8 && !is_privileged_) { |
| 372 *profile_path = GetIETemporaryFilesFolder(); | 409 *profile_path = GetIETemporaryFilesFolder(); |
| 373 *profile_path = profile_path->Append(L"Google Chrome Frame"); | 410 *profile_path = profile_path->Append(L"Google Chrome Frame"); |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 EventHandlers onreadystatechanged_; | 1179 EventHandlers onreadystatechanged_; |
| 1143 EventHandlers onprivatemessage_; | 1180 EventHandlers onprivatemessage_; |
| 1144 EventHandlers onextensionready_; | 1181 EventHandlers onextensionready_; |
| 1145 | 1182 |
| 1146 // Handle network requests when host network stack is used. Passed to the | 1183 // Handle network requests when host network stack is used. Passed to the |
| 1147 // automation client on initialization. | 1184 // automation client on initialization. |
| 1148 UrlmonUrlRequestManager url_fetcher_; | 1185 UrlmonUrlRequestManager url_fetcher_; |
| 1149 }; | 1186 }; |
| 1150 | 1187 |
| 1151 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ | 1188 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ |
| OLD | NEW |