| OLD | NEW |
| 1 // Copyright (c) 2010 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 #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> |
| 11 #include <wininet.h> | 11 #include <wininet.h> |
| 12 |
| 13 // Copied min/max defs from windows headers to appease atlimage.h. |
| 14 // TODO(slightlyoff): Figure out of more recent platform SDK's (> 6.1) |
| 15 // undo the janky "#define NOMINMAX" train wreck. See: |
| 16 // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedback
ID=100703 |
| 17 #ifndef max |
| 18 #define max(a,b) (((a) > (b)) ? (a) : (b)) // NOLINT |
| 19 #endif |
| 20 #ifndef min |
| 21 #define min(a,b) (((a) < (b)) ? (a) : (b)) // NOLINT |
| 22 #endif |
| 23 #include <atlimage.h> |
| 24 #undef max |
| 25 #undef min |
| 26 |
| 12 #include <shdeprecated.h> // for IBrowserService2 | 27 #include <shdeprecated.h> // for IBrowserService2 |
| 13 #include <shlguid.h> | 28 #include <shlguid.h> |
| 14 | 29 |
| 15 #include <set> | 30 #include <set> |
| 16 #include <string> | 31 #include <string> |
| 17 | 32 |
| 18 #include "base/histogram.h" | 33 #include "base/histogram.h" |
| 19 #include "base/scoped_bstr_win.h" | 34 #include "base/scoped_bstr_win.h" |
| 20 #include "base/scoped_comptr_win.h" | 35 #include "base/scoped_comptr_win.h" |
| 21 #include "base/scoped_variant_win.h" | 36 #include "base/scoped_variant_win.h" |
| 22 #include "base/string_util.h" | 37 #include "base/string_util.h" |
| 23 #include "grit/chrome_frame_resources.h" | 38 #include "grit/chrome_frame_resources.h" |
| 24 #include "chrome/common/url_constants.h" | |
| 25 #include "chrome_frame/chrome_frame_plugin.h" | 39 #include "chrome_frame/chrome_frame_plugin.h" |
| 26 #include "chrome_frame/com_message_event.h" | 40 #include "chrome_frame/com_message_event.h" |
| 27 #include "chrome_frame/com_type_info_holder.h" | 41 #include "chrome_frame/com_type_info_holder.h" |
| 28 #include "chrome_frame/simple_resource_loader.h" | 42 #include "chrome_frame/simple_resource_loader.h" |
| 29 #include "chrome_frame/urlmon_url_request.h" | 43 #include "chrome_frame/urlmon_url_request.h" |
| 30 #include "chrome_frame/urlmon_url_request_private.h" | 44 #include "chrome_frame/urlmon_url_request_private.h" |
| 31 #include "chrome_frame/utils.h" | 45 #include "chrome/common/url_constants.h" |
| 32 #include "grit/generated_resources.h" | 46 #include "grit/generated_resources.h" |
| 33 #include "net/base/cookie_monster.h" | 47 #include "net/base/cookie_monster.h" |
| 34 | 48 |
| 35 // Include without path to make GYP build see it. | 49 // Include without path to make GYP build see it. |
| 36 #include "chrome_tab.h" // NOLINT | 50 #include "chrome_tab.h" // NOLINT |
| 37 | 51 |
| 38 static const wchar_t kIexploreProfileName[] = L"iexplore"; | |
| 39 static const wchar_t kRundllProfileName[] = L"rundll32"; | |
| 40 | |
| 41 // Connection point class to support firing IChromeFrameEvents (dispinterface). | 52 // Connection point class to support firing IChromeFrameEvents (dispinterface). |
| 42 template<class T> | 53 template<class T> |
| 43 class ATL_NO_VTABLE ProxyDIChromeFrameEvents | 54 class ATL_NO_VTABLE ProxyDIChromeFrameEvents |
| 44 : public IConnectionPointImpl<T, &DIID_DIChromeFrameEvents> { | 55 : public IConnectionPointImpl<T, &DIID_DIChromeFrameEvents> { |
| 45 public: | 56 public: |
| 46 void FireMethodWithParams(ChromeFrameEventDispId dispid, | 57 void FireMethodWithParams(ChromeFrameEventDispId dispid, |
| 47 const VARIANT* params, size_t num_params) { | 58 const VARIANT* params, size_t num_params) { |
| 48 T* me = static_cast<T*>(this); | 59 T* me = static_cast<T*>(this); |
| 49 int connections = m_vec.GetSize(); | 60 int connections = m_vec.GetSize(); |
| 50 | 61 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 bool is_frame_busting_enabled() const { | 354 bool is_frame_busting_enabled() const { |
| 344 return !is_privileged_; | 355 return !is_privileged_; |
| 345 } | 356 } |
| 346 | 357 |
| 347 // Needed to support PostTask. | 358 // Needed to support PostTask. |
| 348 static bool ImplementsThreadSafeReferenceCounting() { | 359 static bool ImplementsThreadSafeReferenceCounting() { |
| 349 return true; | 360 return true; |
| 350 } | 361 } |
| 351 | 362 |
| 352 protected: | 363 protected: |
| 353 virtual void GetProfilePath(const std::wstring& profile_name, | |
| 354 FilePath* profile_path) { | |
| 355 bool is_IE = (lstrcmpi(profile_name.c_str(), kIexploreProfileName) == 0) || | |
| 356 (lstrcmpi(profile_name.c_str(), kRundllProfileName) == 0); | |
| 357 // Browsers without IDeleteBrowsingHistory in non-priv mode | |
| 358 // have their profiles moved into "Temporary Internet Files". | |
| 359 if (is_IE && GetIEVersion() < IE_8 && !is_privileged_) { | |
| 360 *profile_path = GetIETemporaryFilesFolder(); | |
| 361 *profile_path = profile_path->Append(L"Google Chrome Frame"); | |
| 362 } else { | |
| 363 ChromeFramePlugin::GetProfilePath(profile_name, profile_path); | |
| 364 } | |
| 365 DLOG(INFO) << __FUNCTION__ << ": " << profile_path->value(); | |
| 366 } | |
| 367 | |
| 368 | |
| 369 void OnLoad(int tab_handle, const GURL& url) { | 364 void OnLoad(int tab_handle, const GURL& url) { |
| 370 if (ready_state_ < READYSTATE_COMPLETE) { | 365 if (ready_state_ < READYSTATE_COMPLETE) { |
| 371 ready_state_ = READYSTATE_COMPLETE; | 366 ready_state_ = READYSTATE_COMPLETE; |
| 372 FireOnChanged(DISPID_READYSTATE); | 367 FireOnChanged(DISPID_READYSTATE); |
| 373 } | 368 } |
| 374 | 369 |
| 375 HRESULT hr = InvokeScriptFunction(onload_handler_, url.spec()); | 370 HRESULT hr = InvokeScriptFunction(onload_handler_, url.spec()); |
| 376 } | 371 } |
| 377 | 372 |
| 378 void OnLoadFailed(int error_code, const std::string& url) { | 373 void OnLoadFailed(int error_code, const std::string& url) { |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 EventHandlers onreadystatechanged_; | 1178 EventHandlers onreadystatechanged_; |
| 1184 EventHandlers onprivatemessage_; | 1179 EventHandlers onprivatemessage_; |
| 1185 EventHandlers onextensionready_; | 1180 EventHandlers onextensionready_; |
| 1186 | 1181 |
| 1187 // Handle network requests when host network stack is used. Passed to the | 1182 // Handle network requests when host network stack is used. Passed to the |
| 1188 // automation client on initialization. | 1183 // automation client on initialization. |
| 1189 UrlmonUrlRequestManager url_fetcher_; | 1184 UrlmonUrlRequestManager url_fetcher_; |
| 1190 }; | 1185 }; |
| 1191 | 1186 |
| 1192 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ | 1187 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ |
| OLD | NEW |