OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome_frame/urlmon_url_request.h" | 5 #include "chrome_frame/urlmon_url_request.h" |
6 | 6 |
7 #include <urlmon.h> | 7 #include <urlmon.h> |
8 #include <wininet.h> | 8 #include <wininet.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
16 #include "base/stringprintf.h" | 16 #include "base/stringprintf.h" |
17 #include "base/threading/platform_thread.h" | 17 #include "base/threading/platform_thread.h" |
18 #include "base/threading/thread.h" | |
18 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
19 #include "chrome/common/automation_messages.h" | 20 #include "chrome/common/automation_messages.h" |
20 #include "chrome_frame/bind_context_info.h" | 21 #include "chrome_frame/bind_context_info.h" |
21 #include "chrome_frame/chrome_frame_activex_base.h" | 22 #include "chrome_frame/chrome_frame_activex_base.h" |
22 #include "chrome_frame/extra_system_apis.h" | 23 #include "chrome_frame/extra_system_apis.h" |
23 #include "chrome_frame/html_utils.h" | 24 #include "chrome_frame/html_utils.h" |
24 #include "chrome_frame/urlmon_upload_data_stream.h" | 25 #include "chrome_frame/urlmon_upload_data_stream.h" |
25 #include "chrome_frame/urlmon_url_request_private.h" | 26 #include "chrome_frame/urlmon_url_request_private.h" |
26 #include "chrome_frame/utils.h" | 27 #include "chrome_frame/utils.h" |
27 #include "net/base/load_flags.h" | 28 #include "net/base/load_flags.h" |
(...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1394 if (request_map->end() != it) | 1395 if (request_map->end() != it) |
1395 return it->second; | 1396 return it->second; |
1396 return NULL; | 1397 return NULL; |
1397 } | 1398 } |
1398 | 1399 |
1399 UrlmonUrlRequestManager::UrlmonUrlRequestManager() | 1400 UrlmonUrlRequestManager::UrlmonUrlRequestManager() |
1400 : stopping_(false), notification_window_(NULL), | 1401 : stopping_(false), notification_window_(NULL), |
1401 privileged_mode_(false), | 1402 privileged_mode_(false), |
1402 container_(NULL), | 1403 container_(NULL), |
1403 background_worker_thread_enabled_(true) { | 1404 background_worker_thread_enabled_(true) { |
1404 background_thread_.reset(new ResourceFetcherThread( | 1405 background_thread_.reset(new base::Thread("cf_iexplore_background_thread")); |
1405 "cf_iexplore_background_thread")); | 1406 #if defined(OS_WIN) |
ananta
2012/10/16 01:26:43
We don't need the OS_WIN check here? as CF is wind
Peter Kasting
2012/10/16 01:42:10
Good point.
| |
1407 background_thread_->init_com_with_mta(false); | |
1408 #endif | |
1406 background_worker_thread_enabled_ = | 1409 background_worker_thread_enabled_ = |
1407 GetConfigBool(true, kUseBackgroundThreadForSubResources); | 1410 GetConfigBool(true, kUseBackgroundThreadForSubResources); |
1408 if (background_worker_thread_enabled_) { | 1411 if (background_worker_thread_enabled_) { |
1409 base::Thread::Options options; | 1412 base::Thread::Options options; |
1410 options.message_loop_type = MessageLoop::TYPE_UI; | 1413 options.message_loop_type = MessageLoop::TYPE_UI; |
1411 background_thread_->StartWithOptions(options); | 1414 background_thread_->StartWithOptions(options); |
1412 } | 1415 } |
1413 } | 1416 } |
1414 | 1417 |
1415 UrlmonUrlRequestManager::~UrlmonUrlRequestManager() { | 1418 UrlmonUrlRequestManager::~UrlmonUrlRequestManager() { |
(...skipping 22 matching lines...) Expand all Loading... | |
1438 privacy_info_.privacy_records[UTF8ToWide(url)]; | 1441 privacy_info_.privacy_records[UTF8ToWide(url)]; |
1439 | 1442 |
1440 privacy_entry.flags |= flags; | 1443 privacy_entry.flags |= flags; |
1441 privacy_entry.policy_ref = UTF8ToWide(policy_ref); | 1444 privacy_entry.policy_ref = UTF8ToWide(policy_ref); |
1442 | 1445 |
1443 if (fire_privacy_event && IsWindow(notification_window_)) { | 1446 if (fire_privacy_event && IsWindow(notification_window_)) { |
1444 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, | 1447 PostMessage(notification_window_, WM_FIRE_PRIVACY_CHANGE_NOTIFICATION, 1, |
1445 0); | 1448 0); |
1446 } | 1449 } |
1447 } | 1450 } |
1448 | |
1449 UrlmonUrlRequestManager::ResourceFetcherThread::ResourceFetcherThread( | |
1450 const char* name) : base::Thread(name) { | |
1451 } | |
1452 | |
1453 UrlmonUrlRequestManager::ResourceFetcherThread::~ResourceFetcherThread() { | |
1454 Stop(); | |
1455 } | |
1456 | |
1457 void UrlmonUrlRequestManager::ResourceFetcherThread::Init() { | |
1458 com_initializer_.reset(new base::win::ScopedCOMInitializer()); | |
1459 } | |
1460 | |
1461 void UrlmonUrlRequestManager::ResourceFetcherThread::CleanUp() { | |
1462 com_initializer_.reset(); | |
1463 } | |
OLD | NEW |