| OLD | NEW |
| 1 // Copyright (c) 2010 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 #include "chrome_frame/chrome_frame_automation.h" | 5 #include "chrome_frame/chrome_frame_automation.h" |
| 6 | 6 |
| 7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 int kDefaultSendUMADataInterval = 20000; // in milliseconds. | 39 int kDefaultSendUMADataInterval = 20000; // in milliseconds. |
| 40 | 40 |
| 41 static const wchar_t kUmaSendIntervalValue[] = L"UmaSendInterval"; | 41 static const wchar_t kUmaSendIntervalValue[] = L"UmaSendInterval"; |
| 42 | 42 |
| 43 // This lock ensures that histograms created by ChromeFrame are thread safe. | 43 // This lock ensures that histograms created by ChromeFrame are thread safe. |
| 44 // The histograms created in ChromeFrame can be initialized on multiple | 44 // The histograms created in ChromeFrame can be initialized on multiple |
| 45 // threads. | 45 // threads. |
| 46 Lock g_ChromeFrameHistogramLock; | 46 Lock g_ChromeFrameHistogramLock; |
| 47 | 47 |
| 48 namespace { |
| 49 std::wstring GetCurrentModuleVersion() { |
| 50 scoped_ptr<FileVersionInfo> module_version_info( |
| 51 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); |
| 52 DCHECK(module_version_info.get() != NULL); |
| 53 return module_version_info->file_version(); |
| 54 } |
| 55 } |
| 56 |
| 48 class ChromeFrameAutomationProxyImpl::TabProxyNotificationMessageFilter | 57 class ChromeFrameAutomationProxyImpl::TabProxyNotificationMessageFilter |
| 49 : public IPC::ChannelProxy::MessageFilter { | 58 : public IPC::ChannelProxy::MessageFilter { |
| 50 public: | 59 public: |
| 51 explicit TabProxyNotificationMessageFilter(AutomationHandleTracker* tracker) | 60 explicit TabProxyNotificationMessageFilter(AutomationHandleTracker* tracker) |
| 52 : tracker_(tracker) { | 61 : tracker_(tracker) { |
| 53 } | 62 } |
| 54 | 63 |
| 55 void AddTabProxy(AutomationHandle tab_proxy) { | 64 void AddTabProxy(AutomationHandle tab_proxy) { |
| 56 AutoLock lock(lock_); | 65 AutoLock lock(lock_); |
| 57 tabs_list_.push_back(tab_proxy); | 66 tabs_list_.push_back(tab_proxy); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 307 |
| 299 // In accessible mode automation tests expect renderer accessibility to be | 308 // In accessible mode automation tests expect renderer accessibility to be |
| 300 // enabled in chrome. | 309 // enabled in chrome. |
| 301 if (IsAccessibleMode()) | 310 if (IsAccessibleMode()) |
| 302 command_line->AppendSwitch(switches::kForceRendererAccessibility); | 311 command_line->AppendSwitch(switches::kForceRendererAccessibility); |
| 303 | 312 |
| 304 DVLOG(1) << "Profile path: " << params->profile_path().value(); | 313 DVLOG(1) << "Profile path: " << params->profile_path().value(); |
| 305 command_line->AppendSwitchPath(switches::kUserDataDir, | 314 command_line->AppendSwitchPath(switches::kUserDataDir, |
| 306 params->profile_path()); | 315 params->profile_path()); |
| 307 | 316 |
| 317 // Ensure that Chrome is running the specified version of chrome.dll. |
| 318 command_line->AppendSwitchNative(switches::kChromeVersion, |
| 319 GetCurrentModuleVersion()); |
| 320 |
| 308 if (!params->language().empty()) | 321 if (!params->language().empty()) |
| 309 command_line->AppendSwitchNative(switches::kLang, params->language()); | 322 command_line->AppendSwitchNative(switches::kLang, params->language()); |
| 310 | 323 |
| 311 std::wstring command_line_string(command_line->command_line_string()); | 324 std::wstring command_line_string(command_line->command_line_string()); |
| 312 // If there are any extra arguments, append them to the command line. | 325 // If there are any extra arguments, append them to the command line. |
| 313 if (!params->extra_arguments().empty()) { | 326 if (!params->extra_arguments().empty()) { |
| 314 command_line_string += L' ' + params->extra_arguments(); | 327 command_line_string += L' ' + params->extra_arguments(); |
| 315 } | 328 } |
| 316 | 329 |
| 317 automation_server_launch_start_time_ = base::TimeTicks::Now(); | 330 automation_server_launch_start_time_ = base::TimeTicks::Now(); |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 } | 1307 } |
| 1295 } | 1308 } |
| 1296 | 1309 |
| 1297 void ChromeFrameAutomationClient::SendContextMenuCommandToChromeFrame( | 1310 void ChromeFrameAutomationClient::SendContextMenuCommandToChromeFrame( |
| 1298 int selected_command) { | 1311 int selected_command) { |
| 1299 DCHECK(tab_ != NULL); | 1312 DCHECK(tab_ != NULL); |
| 1300 tab_->SendContextMenuCommand(selected_command); | 1313 tab_->SendContextMenuCommand(selected_command); |
| 1301 } | 1314 } |
| 1302 | 1315 |
| 1303 std::wstring ChromeFrameAutomationClient::GetVersion() const { | 1316 std::wstring ChromeFrameAutomationClient::GetVersion() const { |
| 1304 static FileVersionInfo* version_info = | 1317 return GetCurrentModuleVersion(); |
| 1305 FileVersionInfo::CreateFileVersionInfoForCurrentModule(); | |
| 1306 | |
| 1307 std::wstring version; | |
| 1308 if (version_info) | |
| 1309 version = version_info->product_version(); | |
| 1310 | |
| 1311 return version; | |
| 1312 } | 1318 } |
| 1313 | 1319 |
| 1314 void ChromeFrameAutomationClient::Print(HDC print_dc, | 1320 void ChromeFrameAutomationClient::Print(HDC print_dc, |
| 1315 const RECT& print_bounds) { | 1321 const RECT& print_bounds) { |
| 1316 if (!tab_window_) { | 1322 if (!tab_window_) { |
| 1317 NOTREACHED(); | 1323 NOTREACHED(); |
| 1318 return; | 1324 return; |
| 1319 } | 1325 } |
| 1320 | 1326 |
| 1321 HDC window_dc = ::GetDC(tab_window_); | 1327 HDC window_dc = ::GetDC(tab_window_); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 const URLRequestStatus& status) { | 1463 const URLRequestStatus& status) { |
| 1458 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), | 1464 automation_server_->Send(new AutomationMsg_RequestEnd(0, tab_->handle(), |
| 1459 request_id, status)); | 1465 request_id, status)); |
| 1460 } | 1466 } |
| 1461 | 1467 |
| 1462 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, | 1468 void ChromeFrameAutomationClient::OnCookiesRetrieved(bool success, |
| 1463 const GURL& url, const std::string& cookie_string, int cookie_id) { | 1469 const GURL& url, const std::string& cookie_string, int cookie_id) { |
| 1464 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, | 1470 automation_server_->Send(new AutomationMsg_GetCookiesHostResponse(0, |
| 1465 tab_->handle(), success, url, cookie_string, cookie_id)); | 1471 tab_->handle(), success, url, cookie_string, cookie_id)); |
| 1466 } | 1472 } |
| OLD | NEW |