| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_URLMON_URL_REQUEST_H_ | 5 #ifndef CHROME_FRAME_URLMON_URL_REQUEST_H_ |
| 6 #define CHROME_FRAME_URLMON_URL_REQUEST_H_ | 6 #define CHROME_FRAME_URLMON_URL_REQUEST_H_ |
| 7 | 7 |
| 8 #include <urlmon.h> | 8 #include <urlmon.h> |
| 9 #include <atlbase.h> | 9 #include <atlbase.h> |
| 10 #include <atlcom.h> | 10 #include <atlcom.h> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/threading/thread.h" | |
| 15 #include "chrome_frame/plugin_url_request.h" | 14 #include "chrome_frame/plugin_url_request.h" |
| 16 #include "chrome_frame/urlmon_moniker.h" | 15 #include "chrome_frame/urlmon_moniker.h" |
| 17 #include "chrome_frame/utils.h" | 16 #include "chrome_frame/utils.h" |
| 18 | 17 |
| 19 namespace base { | 18 namespace base { |
| 20 namespace win { | 19 class ComThread; |
| 21 class ScopedCOMInitializer; | |
| 22 } | |
| 23 } | 20 } |
| 24 | 21 |
| 25 class UrlmonUrlRequest; | 22 class UrlmonUrlRequest; |
| 26 | 23 |
| 27 class UrlmonUrlRequestManager | 24 class UrlmonUrlRequestManager |
| 28 : public PluginUrlRequestManager, | 25 : public PluginUrlRequestManager, |
| 29 public PluginUrlRequestDelegate { | 26 public PluginUrlRequestDelegate { |
| 30 public: | 27 public: |
| 31 // Sub resources on the pages in chrome frame are fetched on this thread. | |
| 32 class ResourceFetcherThread : public base::Thread { | |
| 33 public: | |
| 34 explicit ResourceFetcherThread(const char* name); | |
| 35 virtual ~ResourceFetcherThread(); | |
| 36 | |
| 37 virtual void Init(); | |
| 38 virtual void CleanUp(); | |
| 39 | |
| 40 private: | |
| 41 scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; | |
| 42 | |
| 43 DISALLOW_COPY_AND_ASSIGN(ResourceFetcherThread); | |
| 44 }; | |
| 45 | |
| 46 // Contains the privacy information for all requests issued by this instance. | 28 // Contains the privacy information for all requests issued by this instance. |
| 47 struct PrivacyInfo { | 29 struct PrivacyInfo { |
| 48 public: | 30 public: |
| 49 struct PrivacyEntry { | 31 struct PrivacyEntry { |
| 50 PrivacyEntry() : flags(0) {} | 32 PrivacyEntry() : flags(0) {} |
| 51 std::wstring policy_ref; | 33 std::wstring policy_ref; |
| 52 int32 flags; | 34 int32 flags; |
| 53 }; | 35 }; |
| 54 | 36 |
| 55 typedef std::map<std::wstring, PrivacyEntry> PrivacyRecords; | 37 typedef std::map<std::wstring, PrivacyEntry> PrivacyRecords; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // Helper function to stop all requests in the request map. | 126 // Helper function to stop all requests in the request map. |
| 145 void StopAllRequestsHelper(RequestMap* request_map, | 127 void StopAllRequestsHelper(RequestMap* request_map, |
| 146 base::Lock* request_map_lock); | 128 base::Lock* request_map_lock); |
| 147 // Helper function for initiating a new IE request. | 129 // Helper function for initiating a new IE request. |
| 148 void StartRequestHelper(int request_id, | 130 void StartRequestHelper(int request_id, |
| 149 const AutomationURLRequest& request_info, | 131 const AutomationURLRequest& request_info, |
| 150 RequestMap* request_map, | 132 RequestMap* request_map, |
| 151 base::Lock* request_map_lock); | 133 base::Lock* request_map_lock); |
| 152 | 134 |
| 153 scoped_refptr<UrlmonUrlRequest> pending_request_; | 135 scoped_refptr<UrlmonUrlRequest> pending_request_; |
| 154 scoped_ptr<ResourceFetcherThread> background_thread_; | 136 scoped_ptr<base::ComThread> background_thread_; |
| 155 | 137 |
| 156 bool stopping_; | 138 bool stopping_; |
| 157 | 139 |
| 158 // Controls whether we download subresources on the page in a background | 140 // Controls whether we download subresources on the page in a background |
| 159 // worker thread. | 141 // worker thread. |
| 160 bool background_worker_thread_enabled_; | 142 bool background_worker_thread_enabled_; |
| 161 | 143 |
| 162 PrivacyInfo privacy_info_; | 144 PrivacyInfo privacy_info_; |
| 163 // The window to be used to fire notifications on. | 145 // The window to be used to fire notifications on. |
| 164 HWND notification_window_; | 146 HWND notification_window_; |
| 165 // Set to true if the ChromeFrame instance is running in privileged mode. | 147 // Set to true if the ChromeFrame instance is running in privileged mode. |
| 166 bool privileged_mode_; | 148 bool privileged_mode_; |
| 167 // A pointer to the containing object. We maintain a weak reference to avoid | 149 // A pointer to the containing object. We maintain a weak reference to avoid |
| 168 // lifetime issues. | 150 // lifetime issues. |
| 169 IUnknown* container_; | 151 IUnknown* container_; |
| 170 }; | 152 }; |
| 171 | 153 |
| 172 #endif // CHROME_FRAME_URLMON_URL_REQUEST_H_ | 154 #endif // CHROME_FRAME_URLMON_URL_REQUEST_H_ |
| OLD | NEW |