| OLD | NEW |
| 1 // Copyright (c) 2009 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 #include "chrome_frame/chrome_frame_automation.h" | 5 #include "chrome_frame/chrome_frame_automation.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 | 138 |
| 139 ProxyFactory::ProxyCacheEntry::ProxyCacheEntry(const std::wstring& profile) | 139 ProxyFactory::ProxyCacheEntry::ProxyCacheEntry(const std::wstring& profile) |
| 140 : proxy(NULL), profile_name(profile), ref_count(1), | 140 : proxy(NULL), profile_name(profile), ref_count(1), |
| 141 launch_result(AutomationLaunchResult(-1)) { | 141 launch_result(AutomationLaunchResult(-1)) { |
| 142 thread.reset(new base::Thread(WideToASCII(profile_name).c_str())); | 142 thread.reset(new base::Thread(WideToASCII(profile_name).c_str())); |
| 143 thread->Start(); | 143 thread->Start(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 template <> struct RunnableMethodTraits<ProxyFactory> { | 146 template <> struct RunnableMethodTraits<ProxyFactory> { |
| 147 static void RetainCallee(ProxyFactory* obj) {} | 147 void RetainCallee(ProxyFactory* obj) {} |
| 148 static void ReleaseCallee(ProxyFactory* obj) {} | 148 void ReleaseCallee(ProxyFactory* obj) {} |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 ProxyFactory::ProxyFactory() | 151 ProxyFactory::ProxyFactory() |
| 152 : uma_send_interval_(0) { | 152 : uma_send_interval_(0) { |
| 153 uma_send_interval_ = GetConfigInt(kDefaultSendUMADataInterval, | 153 uma_send_interval_ = GetConfigInt(kDefaultSendUMADataInterval, |
| 154 kUmaSendIntervalValue); | 154 kUmaSendIntervalValue); |
| 155 } | 155 } |
| 156 | 156 |
| 157 ProxyFactory::~ProxyFactory() { | 157 ProxyFactory::~ProxyFactory() { |
| 158 DCHECK_EQ(proxies_.container().size(), 0); | 158 DCHECK_EQ(proxies_.container().size(), 0); |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 incognito_, | 593 incognito_, |
| 594 !use_chrome_network_, | 594 !use_chrome_network_, |
| 595 handle_top_level_requests_, | 595 handle_top_level_requests_, |
| 596 GURL(url_) | 596 GURL(url_) |
| 597 }; | 597 }; |
| 598 | 598 |
| 599 UMA_HISTOGRAM_CUSTOM_COUNTS( | 599 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 600 "ChromeFrame.HostNetworking", !use_chrome_network_, 0, 1, 2); | 600 "ChromeFrame.HostNetworking", !use_chrome_network_, 0, 1, 2); |
| 601 | 601 |
| 602 UMA_HISTOGRAM_CUSTOM_COUNTS( | 602 UMA_HISTOGRAM_CUSTOM_COUNTS( |
| 603 "ChromeFrame.HandleTopLevelRequests", handle_top_level_requests_, 0, 1, | 603 "ChromeFrame.HandleTopLevelRequests", handle_top_level_requests_, 0, 1, |
| 604 2); | 604 2); |
| 605 | 605 |
| 606 IPC::SyncMessage* message = | 606 IPC::SyncMessage* message = |
| 607 new AutomationMsg_CreateExternalTab(0, settings, NULL, NULL, NULL); | 607 new AutomationMsg_CreateExternalTab(0, settings, NULL, NULL, NULL); |
| 608 automation_server_->SendAsAsync(message, NewCallback(this, | 608 automation_server_->SendAsAsync(message, NewCallback(this, |
| 609 &ChromeFrameAutomationClient::CreateExternalTabComplete), this); | 609 &ChromeFrameAutomationClient::CreateExternalTabComplete), this); |
| 610 } | 610 } |
| 611 | 611 |
| 612 void ChromeFrameAutomationClient::CreateExternalTabComplete(HWND chrome_window, | 612 void ChromeFrameAutomationClient::CreateExternalTabComplete(HWND chrome_window, |
| 613 HWND tab_window, int tab_handle) { | 613 HWND tab_window, int tab_handle) { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 int height = parent_client_rect.bottom - parent_client_rect.top; | 772 int height = parent_client_rect.bottom - parent_client_rect.top; |
| 773 | 773 |
| 774 Resize(width, height, SWP_SHOWWINDOW | SWP_NOZORDER); | 774 Resize(width, height, SWP_SHOWWINDOW | SWP_NOZORDER); |
| 775 } | 775 } |
| 776 } | 776 } |
| 777 } | 777 } |
| 778 | 778 |
| 779 void ChromeFrameAutomationClient::ReleaseAutomationServer() { | 779 void ChromeFrameAutomationClient::ReleaseAutomationServer() { |
| 780 DLOG(INFO) << __FUNCTION__; | 780 DLOG(INFO) << __FUNCTION__; |
| 781 if (automation_server_id_) { | 781 if (automation_server_id_) { |
| 782 // Cache the server id and clear the automation_server_id_ before | 782 // Cache the server id and clear the automation_server_id_ before |
| 783 // calling ReleaseAutomationServer. The reason we do this is that | 783 // calling ReleaseAutomationServer. The reason we do this is that |
| 784 // we must cancel pending messages before we release the automation server. | 784 // we must cancel pending messages before we release the automation server. |
| 785 // Furthermore, while ReleaseAutomationServer is running, we could get | 785 // Furthermore, while ReleaseAutomationServer is running, we could get |
| 786 // a callback to LaunchComplete which is where we normally get our pointer | 786 // a callback to LaunchComplete which is where we normally get our pointer |
| 787 // to the automation server and there we check the server id for NULLness | 787 // to the automation server and there we check the server id for NULLness |
| 788 // and do nothing if it is NULL. | 788 // and do nothing if it is NULL. |
| 789 void* server_id = automation_server_id_; | 789 void* server_id = automation_server_id_; |
| 790 automation_server_id_ = NULL; | 790 automation_server_id_ = NULL; |
| 791 | 791 |
| 792 if (automation_server_) { | 792 if (automation_server_) { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 return true; | 966 return true; |
| 967 } | 967 } |
| 968 | 968 |
| 969 void ChromeFrameAutomationClient::AttachExternalTab( | 969 void ChromeFrameAutomationClient::AttachExternalTab( |
| 970 intptr_t external_tab_cookie) { | 970 intptr_t external_tab_cookie) { |
| 971 DCHECK(tab_.get() == NULL); | 971 DCHECK(tab_.get() == NULL); |
| 972 DCHECK(tab_handle_ == -1); | 972 DCHECK(tab_handle_ == -1); |
| 973 | 973 |
| 974 external_tab_cookie_ = external_tab_cookie; | 974 external_tab_cookie_ = external_tab_cookie; |
| 975 } | 975 } |
| OLD | NEW |