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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 UnlockResource(res_data); | 536 UnlockResource(res_data); |
537 } | 537 } |
538 FreeResource(res_data); | 538 FreeResource(res_data); |
539 } | 539 } |
540 } | 540 } |
541 | 541 |
542 return ok; | 542 return ok; |
543 } | 543 } |
544 | 544 |
545 HMODULE GetModuleFromAddress(void* address) { | |
546 MEMORY_BASIC_INFORMATION info = {0}; | |
547 ::VirtualQuery(address, &info, sizeof(info)); | |
548 return reinterpret_cast<HMODULE>(info.AllocationBase); | |
549 } | |
550 | |
551 namespace { | 545 namespace { |
552 | 546 |
553 const int kMaxSubmenuDepth = 10; | 547 const int kMaxSubmenuDepth = 10; |
554 | 548 |
555 // Builds a Windows menu from the menu model sent from Chrome. The | 549 // Builds a Windows menu from the menu model sent from Chrome. The |
556 // caller is responsible for closing the returned HMENU. This does | 550 // caller is responsible for closing the returned HMENU. This does |
557 // not currently handle bitmaps (e.g. hbmpChecked, hbmpUnchecked or | 551 // not currently handle bitmaps (e.g. hbmpChecked, hbmpUnchecked or |
558 // hbmpItem), so checkmarks, radio buttons, and custom icons won't work. | 552 // hbmpItem), so checkmarks, radio buttons, and custom icons won't work. |
559 // It also copies over submenus up to a maximum depth of kMaxSubMenuDepth. | 553 // It also copies over submenus up to a maximum depth of kMaxSubMenuDepth. |
560 HMENU BuildContextMenuImpl(const ContextMenuModel* menu_model, int depth) { | 554 HMENU BuildContextMenuImpl(const ContextMenuModel* menu_model, int depth) { |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 | 1632 |
1639 ret = InternetSetOption(NULL, connection_options[option_index], | 1633 ret = InternetSetOption(NULL, connection_options[option_index], |
1640 &connections, connection_value_size); | 1634 &connections, connection_value_size); |
1641 if (!ret) { | 1635 if (!ret) { |
1642 return false; | 1636 return false; |
1643 } | 1637 } |
1644 } | 1638 } |
1645 wininet_connection_count_updated = true; | 1639 wininet_connection_count_updated = true; |
1646 return true; | 1640 return true; |
1647 } | 1641 } |
OLD | NEW |