| 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/chrome_frame_activex.h" | 5 #include "chrome_frame/chrome_frame_activex.h" |
| 6 | 6 |
| 7 #include <wininet.h> | 7 #include <wininet.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 15 #include "base/file_util.h" | |
| 16 #include "base/logging.h" | 15 #include "base/logging.h" |
| 17 #include "base/memory/singleton.h" | 16 #include "base/memory/singleton.h" |
| 18 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 19 #include "base/process_util.h" | 18 #include "base/process_util.h" |
| 20 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 21 #include "base/stringprintf.h" | 20 #include "base/stringprintf.h" |
| 22 #include "base/strings/string_split.h" | 21 #include "base/strings/string_split.h" |
| 23 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
| 24 #include "base/win/scoped_bstr.h" | 23 #include "base/win/scoped_bstr.h" |
| 25 #include "base/win/scoped_variant.h" | 24 #include "base/win/scoped_variant.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 68 |
| 70 CComAutoCriticalSection top_window_map_lock_; | 69 CComAutoCriticalSection top_window_map_lock_; |
| 71 | 70 |
| 72 DISALLOW_COPY_AND_ASSIGN(TopLevelWindowMapping); | 71 DISALLOW_COPY_AND_ASSIGN(TopLevelWindowMapping); |
| 73 }; | 72 }; |
| 74 | 73 |
| 75 // Message pump hook function that monitors for WM_MOVE and WM_MOVING | 74 // Message pump hook function that monitors for WM_MOVE and WM_MOVING |
| 76 // messages on a top-level window, and passes notification to the appropriate | 75 // messages on a top-level window, and passes notification to the appropriate |
| 77 // Chrome-Frame instances. | 76 // Chrome-Frame instances. |
| 78 LRESULT CALLBACK TopWindowProc(int code, WPARAM wparam, LPARAM lparam) { | 77 LRESULT CALLBACK TopWindowProc(int code, WPARAM wparam, LPARAM lparam) { |
| 79 CWPSTRUCT *info = reinterpret_cast<CWPSTRUCT*>(lparam); | 78 CWPSTRUCT* info = reinterpret_cast<CWPSTRUCT*>(lparam); |
| 80 const UINT &message = info->message; | 79 const UINT &message = info->message; |
| 81 const HWND &message_hwnd = info->hwnd; | 80 const HWND &message_hwnd = info->hwnd; |
| 82 | 81 |
| 83 switch (message) { | 82 switch (message) { |
| 84 case WM_MOVE: | 83 case WM_MOVE: |
| 85 case WM_MOVING: { | 84 case WM_MOVING: { |
| 86 TopLevelWindowMapping::WindowList cf_instances = | 85 TopLevelWindowMapping::WindowList cf_instances = |
| 87 TopLevelWindowMapping::GetInstance()->GetInstances(message_hwnd); | 86 TopLevelWindowMapping::GetInstance()->GetInstances(message_hwnd); |
| 88 TopLevelWindowMapping::WindowList::iterator | 87 TopLevelWindowMapping::WindowList::iterator |
| 89 iter(cf_instances.begin()), end(cf_instances.end()); | 88 iter(cf_instances.begin()), end(cf_instances.end()); |
| 90 for (;iter != end; ++iter) { | 89 for (; iter != end; ++iter) { |
| 91 PostMessage(*iter, WM_HOST_MOVED_NOTIFICATION, NULL, NULL); | 90 PostMessage(*iter, WM_HOST_MOVED_NOTIFICATION, NULL, NULL); |
| 92 } | 91 } |
| 93 break; | 92 break; |
| 94 } | 93 } |
| 95 default: | 94 default: |
| 96 break; | 95 break; |
| 97 } | 96 } |
| 98 | 97 |
| 99 return CallNextHookEx(0, code, wparam, lparam); | 98 return CallNextHookEx(0, code, wparam, lparam); |
| 100 } | 99 } |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 if (FAILED(hr)) { | 694 if (FAILED(hr)) { |
| 696 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" | 695 NOTREACHED() << "ChromeFrame BHO SetSite failed. Error:" |
| 697 << base::StringPrintf(" 0x%08X", hr); | 696 << base::StringPrintf(" 0x%08X", hr); |
| 698 return hr; | 697 return hr; |
| 699 } | 698 } |
| 700 | 699 |
| 701 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), | 700 web_browser2->PutProperty(base::win::ScopedBstr(bho_class_id_as_string), |
| 702 base::win::ScopedVariant(bho)); | 701 base::win::ScopedVariant(bho)); |
| 703 return S_OK; | 702 return S_OK; |
| 704 } | 703 } |
| OLD | NEW |