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" |
| 24 #include "chrome/common/url_constants.h" |
39 #include "chrome_frame/chrome_frame_plugin.h" | 25 #include "chrome_frame/chrome_frame_plugin.h" |
40 #include "chrome_frame/com_message_event.h" | 26 #include "chrome_frame/com_message_event.h" |
41 #include "chrome_frame/com_type_info_holder.h" | 27 #include "chrome_frame/com_type_info_holder.h" |
42 #include "chrome_frame/simple_resource_loader.h" | 28 #include "chrome_frame/simple_resource_loader.h" |
43 #include "chrome_frame/urlmon_url_request.h" | 29 #include "chrome_frame/urlmon_url_request.h" |
44 #include "chrome_frame/urlmon_url_request_private.h" | 30 #include "chrome_frame/urlmon_url_request_private.h" |
45 #include "chrome/common/url_constants.h" | 31 #include "chrome_frame/utils.h" |
46 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
47 #include "net/base/cookie_monster.h" | 33 #include "net/base/cookie_monster.h" |
48 | 34 |
49 // Include without path to make GYP build see it. | 35 // Include without path to make GYP build see it. |
50 #include "chrome_tab.h" // NOLINT | 36 #include "chrome_tab.h" // NOLINT |
51 | 37 |
| 38 static const wchar_t kIexploreProfileName[] = L"iexplore"; |
| 39 static const wchar_t kRundllProfileName[] = L"rundll32"; |
| 40 |
52 // Connection point class to support firing IChromeFrameEvents (dispinterface). | 41 // Connection point class to support firing IChromeFrameEvents (dispinterface). |
53 template<class T> | 42 template<class T> |
54 class ATL_NO_VTABLE ProxyDIChromeFrameEvents | 43 class ATL_NO_VTABLE ProxyDIChromeFrameEvents |
55 : public IConnectionPointImpl<T, &DIID_DIChromeFrameEvents> { | 44 : public IConnectionPointImpl<T, &DIID_DIChromeFrameEvents> { |
56 public: | 45 public: |
57 void FireMethodWithParams(ChromeFrameEventDispId dispid, | 46 void FireMethodWithParams(ChromeFrameEventDispId dispid, |
58 const VARIANT* params, size_t num_params) { | 47 const VARIANT* params, size_t num_params) { |
59 T* me = static_cast<T*>(this); | 48 T* me = static_cast<T*>(this); |
60 int connections = m_vec.GetSize(); | 49 int connections = m_vec.GetSize(); |
61 | 50 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 bool is_frame_busting_enabled() const { | 343 bool is_frame_busting_enabled() const { |
355 return !is_privileged_; | 344 return !is_privileged_; |
356 } | 345 } |
357 | 346 |
358 // Needed to support PostTask. | 347 // Needed to support PostTask. |
359 static bool ImplementsThreadSafeReferenceCounting() { | 348 static bool ImplementsThreadSafeReferenceCounting() { |
360 return true; | 349 return true; |
361 } | 350 } |
362 | 351 |
363 protected: | 352 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 |
364 void OnLoad(int tab_handle, const GURL& url) { | 369 void OnLoad(int tab_handle, const GURL& url) { |
365 if (ready_state_ < READYSTATE_COMPLETE) { | 370 if (ready_state_ < READYSTATE_COMPLETE) { |
366 ready_state_ = READYSTATE_COMPLETE; | 371 ready_state_ = READYSTATE_COMPLETE; |
367 FireOnChanged(DISPID_READYSTATE); | 372 FireOnChanged(DISPID_READYSTATE); |
368 } | 373 } |
369 | 374 |
370 HRESULT hr = InvokeScriptFunction(onload_handler_, url.spec()); | 375 HRESULT hr = InvokeScriptFunction(onload_handler_, url.spec()); |
371 } | 376 } |
372 | 377 |
373 void OnLoadFailed(int error_code, const std::string& url) { | 378 void OnLoadFailed(int error_code, const std::string& url) { |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 EventHandlers onreadystatechanged_; | 1183 EventHandlers onreadystatechanged_; |
1179 EventHandlers onprivatemessage_; | 1184 EventHandlers onprivatemessage_; |
1180 EventHandlers onextensionready_; | 1185 EventHandlers onextensionready_; |
1181 | 1186 |
1182 // Handle network requests when host network stack is used. Passed to the | 1187 // Handle network requests when host network stack is used. Passed to the |
1183 // automation client on initialization. | 1188 // automation client on initialization. |
1184 UrlmonUrlRequestManager url_fetcher_; | 1189 UrlmonUrlRequestManager url_fetcher_; |
1185 }; | 1190 }; |
1186 | 1191 |
1187 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ | 1192 #endif // CHROME_FRAME_CHROME_FRAME_ACTIVEX_BASE_H_ |
OLD | NEW |