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 static PinModuleCallbackFn g_pin_module_callback = NULL; |
| 1503 |
| 1504 void SetPinModuleCallback(PinModuleCallbackFn callback) { |
| 1505 g_pin_module_callback = callback; |
| 1506 } |
| 1507 |
1502 void PinModule() { | 1508 void PinModule() { |
1503 static bool s_pinned = false; | 1509 static bool s_pinned = false; |
1504 if (!s_pinned && !IsUnpinnedMode()) { | 1510 if (!s_pinned && !IsUnpinnedMode()) { |
1505 wchar_t system_buffer[MAX_PATH]; | 1511 wchar_t system_buffer[MAX_PATH]; |
1506 HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase); | 1512 HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase); |
1507 system_buffer[0] = 0; | 1513 system_buffer[0] = 0; |
1508 if (GetModuleFileName(this_module, system_buffer, | 1514 if (GetModuleFileName(this_module, system_buffer, |
1509 arraysize(system_buffer)) != 0) { | 1515 arraysize(system_buffer)) != 0) { |
1510 HMODULE unused; | 1516 HMODULE unused; |
1511 if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN, system_buffer, | 1517 if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN, system_buffer, |
1512 &unused)) { | 1518 &unused)) { |
1513 DPLOG(FATAL) << "Failed to pin module " << system_buffer; | 1519 DPLOG(FATAL) << "Failed to pin module " << system_buffer; |
1514 } else { | 1520 } else { |
1515 s_pinned = true; | 1521 s_pinned = true; |
| 1522 if (g_pin_module_callback) |
| 1523 g_pin_module_callback(); |
1516 } | 1524 } |
1517 } else { | 1525 } else { |
1518 DPLOG(FATAL) << "Could not get module path."; | 1526 DPLOG(FATAL) << "Could not get module path."; |
1519 } | 1527 } |
1520 } | 1528 } |
1521 } | 1529 } |
1522 | 1530 |
1523 void WaitWithMessageLoop(HANDLE* handles, int count, DWORD timeout) { | 1531 void WaitWithMessageLoop(HANDLE* handles, int count, DWORD timeout) { |
1524 base::Time now = base::Time::Now(); | 1532 base::Time now = base::Time::Now(); |
1525 base::Time wait_until = now + base::TimeDelta::FromMilliseconds(timeout); | 1533 base::Time wait_until = now + base::TimeDelta::FromMilliseconds(timeout); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 wininet_connection_count_updated = true; | 1680 wininet_connection_count_updated = true; |
1673 return true; | 1681 return true; |
1674 } | 1682 } |
1675 | 1683 |
1676 void GetChromeFrameProfilePath(const string16& profile_name, | 1684 void GetChromeFrameProfilePath(const string16& profile_name, |
1677 base::FilePath* profile_path) { | 1685 base::FilePath* profile_path) { |
1678 chrome::GetChromeFrameUserDataDirectory(profile_path); | 1686 chrome::GetChromeFrameUserDataDirectory(profile_path); |
1679 *profile_path = profile_path->Append(profile_name); | 1687 *profile_path = profile_path->Append(profile_name); |
1680 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); | 1688 DVLOG(1) << __FUNCTION__ << ": " << profile_path->value(); |
1681 } | 1689 } |
OLD | NEW |