| OLD | NEW |
| 1 // Copyright (c) 2009 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> |
| 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 | |
| 27 #include <shdeprecated.h> // for IBrowserService2 | 12 #include <shdeprecated.h> // for IBrowserService2 |
| 28 #include <shlguid.h> | 13 #include <shlguid.h> |
| 29 | 14 |
| 30 #include <set> | 15 #include <set> |
| 31 #include <string> | 16 #include <string> |
| 32 | 17 |
| 33 #include "base/histogram.h" | 18 #include "base/histogram.h" |
| 34 #include "base/scoped_bstr_win.h" | 19 #include "base/scoped_bstr_win.h" |
| 35 #include "base/scoped_comptr_win.h" | 20 #include "base/scoped_comptr_win.h" |
| 36 #include "base/scoped_variant_win.h" | 21 #include "base/scoped_variant_win.h" |
| 37 #include "base/string_util.h" | 22 #include "base/string_util.h" |
| 38 #include "grit/chrome_frame_resources.h" | 23 #include "grit/chrome_frame_resources.h" |
| 39 #include "chrome_frame/chrome_frame_plugin.h" | 24 #include "chrome_frame/chrome_frame_plugin.h" |
| 40 #include "chrome_frame/com_message_event.h" | 25 #include "chrome_frame/com_message_event.h" |
| 41 #include "chrome_frame/com_type_info_holder.h" | 26 #include "chrome_frame/com_type_info_holder.h" |
| 42 #include "chrome_frame/simple_resource_loader.h" | 27 #include "chrome_frame/simple_resource_loader.h" |
| 43 #include "chrome_frame/urlmon_url_request.h" | 28 #include "chrome_frame/urlmon_url_request.h" |
| 29 #include "chrome_frame/utils.h" |
| 44 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 45 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
| 46 #include "net/base/cookie_monster.h" | 32 #include "net/base/cookie_monster.h" |
| 47 | 33 |
| 48 // Include without path to make GYP build see it. | 34 // Include without path to make GYP build see it. |
| 49 #include "chrome_tab.h" // NOLINT | 35 #include "chrome_tab.h" // NOLINT |
| 50 | 36 |
| 37 static const wchar_t kIexploreProfileName[] = L"iexplore"; |
| 38 static const wchar_t kRundllProfileName[] = L"rundll32"; |
| 39 |
| 51 // Connection point class to support firing IChromeFrameEvents (dispinterface). | 40 // Connection point class to support firing IChromeFrameEvents (dispinterface). |
| 52 template<class T> | 41 template<class T> |
| 53 class ATL_NO_VTABLE ProxyDIChromeFrameEvents | 42 class ATL_NO_VTABLE ProxyDIChromeFrameEvents |
| 54 : public IConnectionPointImpl<T, &DIID_DIChromeFrameEvents> { | 43 : public IConnectionPointImpl<T, &DIID_DIChromeFrameEvents> { |
| 55 public: | 44 public: |
| 56 void FireMethodWithParams(ChromeFrameEventDispId dispid, | 45 void FireMethodWithParams(ChromeFrameEventDispId dispid, |
| 57 const VARIANT* params, size_t num_params) { | 46 const VARIANT* params, size_t num_params) { |
| 58 T* me = static_cast<T*>(this); | 47 T* me = static_cast<T*>(this); |
| 59 int connections = m_vec.GetSize(); | 48 int connections = m_vec.GetSize(); |
| 60 | 49 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 bool is_frame_busting_enabled() const { | 341 bool is_frame_busting_enabled() const { |
| 353 return !is_privileged_; | 342 return !is_privileged_; |
| 354 } | 343 } |
| 355 | 344 |
| 356 // Needed to support PostTask. | 345 // Needed to support PostTask. |
| 357 static bool ImplementsThreadSafeReferenceCounting() { | 346 static bool ImplementsThreadSafeReferenceCounting() { |
| 358 return true; | 347 return true; |
| 359 } | 348 } |
| 360 | 349 |
| 361 protected: | 350 protected: |
| 351 virtual void GetProfilePath(const std::wstring& profile_name, |
| 352 FilePath* profile_path) { |
| 353 bool is_IE = (lstrcmpi(profile_name.c_str(), kIexploreProfileName) == 0) || |
| 354 (lstrcmpi(profile_name.c_str(), kRundllProfileName) == 0); |
| 355 // Browsers without IDeleteBrowsingHistory in non-priv mode |
| 356 // have their profiles moved into "Temporary Internet Files". |
| 357 if (is_IE && GetIEVersion() < IE_8 && !is_privileged_) { |
| 358 *profile_path = GetIETemporaryFilesFolder(); |
| 359 *profile_path = profile_path->Append(L"Google Chrome Frame"); |
| 360 } else { |
| 361 ChromeFramePlugin::GetProfilePath(profile_name, profile_path); |
| 362 } |
| 363 DLOG(INFO) << __FUNCTION__ << ": " << profile_path->value(); |
| 364 } |
| 365 |
| 366 |
| 362 void OnLoad(int tab_handle, const GURL& url) { | 367 void OnLoad(int tab_handle, const GURL& url) { |
| 363 if (ready_state_ < READYSTATE_COMPLETE) { | 368 if (ready_state_ < READYSTATE_COMPLETE) { |
| 364 ready_state_ = READYSTATE_COMPLETE; | 369 ready_state_ = READYSTATE_COMPLETE; |
| 365 FireOnChanged(DISPID_READYSTATE); | 370 FireOnChanged(DISPID_READYSTATE); |
| 366 } | 371 } |
| 367 | 372 |
| 368 HRESULT hr = InvokeScriptFunction(onload_handler_, url.spec()); | 373 HRESULT hr = InvokeScriptFunction(onload_handler_, url.spec()); |
| 369 } | 374 } |
| 370 | 375 |
| 371 void OnLoadFailed(int error_code, const std::string& url) { | 376 void OnLoadFailed(int error_code, const std::string& url) { |
| (...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 EventHandlers onreadystatechanged_; | 1170 EventHandlers onreadystatechanged_; |
| 1166 EventHandlers onprivatemessage_; | 1171 EventHandlers onprivatemessage_; |
| 1167 EventHandlers onextensionready_; | 1172 EventHandlers onextensionready_; |
| 1168 | 1173 |
| 1169 // Handle network requests when host network stack is used. Passed to the | 1174 // Handle network requests when host network stack is used. Passed to the |
| 1170 // automation client on initialization. | 1175 // automation client on initialization. |
| 1171 UrlmonUrlRequestManager url_fetcher_; | 1176 UrlmonUrlRequestManager url_fetcher_; |
| 1172 }; | 1177 }; |
| 1173 | 1178 |
| 1174 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ | 1179 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ |
| OLD | NEW |