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/utils.h" | 5 #include "chrome_frame/utils.h" |
6 | 6 |
7 #include <atlsafe.h> | 7 #include <atlsafe.h> |
8 #include <atlsecurity.h> | 8 #include <atlsecurity.h> |
9 #include <htiframe.h> | 9 #include <htiframe.h> |
10 #include <mshtml.h> | 10 #include <mshtml.h> |
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 } | 1492 } |
1493 | 1493 |
1494 if (!navigation_constraints->IsZoneAllowed(url)) { | 1494 if (!navigation_constraints->IsZoneAllowed(url)) { |
1495 DLOG(WARNING) << __FUNCTION__ | 1495 DLOG(WARNING) << __FUNCTION__ |
1496 << " Disallowing navigation to restricted url: " << url; | 1496 << " Disallowing navigation to restricted url: " << url; |
1497 return false; | 1497 return false; |
1498 } | 1498 } |
1499 return true; | 1499 return true; |
1500 } | 1500 } |
1501 | 1501 |
1502 void PinModule() { | |
1503 static bool s_pinned = false; | |
1504 if (!s_pinned && !IsUnpinnedMode()) { | |
1505 wchar_t system_buffer[MAX_PATH]; | |
1506 HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase); | |
1507 system_buffer[0] = 0; | |
1508 if (GetModuleFileName(this_module, system_buffer, | |
1509 arraysize(system_buffer)) != 0) { | |
1510 HMODULE unused; | |
1511 if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN, system_buffer, | |
1512 &unused)) { | |
1513 DPLOG(FATAL) << "Failed to pin module " << system_buffer; | |
1514 } else { | |
1515 s_pinned = true; | |
1516 } | |
1517 } else { | |
1518 DPLOG(FATAL) << "Could not get module path."; | |
1519 } | |
1520 } | |
1521 } | |
1522 | |
1523 void WaitWithMessageLoop(HANDLE* handles, int count, DWORD timeout) { | 1502 void WaitWithMessageLoop(HANDLE* handles, int count, DWORD timeout) { |
1524 base::Time now = base::Time::Now(); | 1503 base::Time now = base::Time::Now(); |
1525 base::Time wait_until = now + base::TimeDelta::FromMilliseconds(timeout); | 1504 base::Time wait_until = now + base::TimeDelta::FromMilliseconds(timeout); |
1526 | 1505 |
1527 while (wait_until >= now) { | 1506 while (wait_until >= now) { |
1528 base::TimeDelta wait_time = wait_until - now; | 1507 base::TimeDelta wait_time = wait_until - now; |
1529 DWORD wait = MsgWaitForMultipleObjects( | 1508 DWORD wait = MsgWaitForMultipleObjects( |
1530 count, handles, FALSE, static_cast<DWORD>(wait_time.InMilliseconds()), | 1509 count, handles, FALSE, static_cast<DWORD>(wait_time.InMilliseconds()), |
1531 QS_ALLINPUT); | 1510 QS_ALLINPUT); |
1532 switch (wait) { | 1511 switch (wait) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 wininet_connection_count_updated = true; | 1651 wininet_connection_count_updated = true; |
1673 return true; | 1652 return true; |
1674 } | 1653 } |
1675 | 1654 |
1676 void GetChromeFrameProfilePath(const string16& profile_name, | 1655 void GetChromeFrameProfilePath(const string16& profile_name, |
1677 base::FilePath* profile_path) { | 1656 base::FilePath* profile_path) { |
1678 chrome::GetChromeFrameUserDataDirectory(profile_path); | 1657 chrome::GetChromeFrameUserDataDirectory(profile_path); |
1679 *profile_path = profile_path->Append(profile_name); | 1658 *profile_path = profile_path->Append(profile_name); |
1680 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); | 1659 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); |
1681 } | 1660 } |
OLD | NEW |