| 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 #ifndef CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ | 5 #ifndef CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ |
| 6 #define CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ | 6 #define CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 #include "base/win/win_util.h" | 12 #include "base/win/win_util.h" |
| 13 #include "chrome_frame/chrome_frame_automation.h" | 13 #include "chrome_frame/chrome_frame_automation.h" |
| 14 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 15 #include "chrome/common/chrome_paths_internal.h" | 15 #include "chrome/common/chrome_paths_internal.h" |
| 16 #include "chrome_frame/simple_resource_loader.h" | 16 #include "chrome_frame/simple_resource_loader.h" |
| 17 #include "chrome_frame/navigation_constraints.h" | 17 #include "chrome_frame/navigation_constraints.h" |
| 18 #include "chrome_frame/utils.h" | 18 #include "chrome_frame/utils.h" |
| 19 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
| 20 | 20 |
| 21 #define IDC_ABOUT_CHROME_FRAME 40018 | 21 #define IDC_ABOUT_CHROME_FRAME 40018 |
| 22 | 22 |
| 23 // Helper so that this file doesn't include the messages header. |
| 24 void ChromeFramePluginGetParamsCoordinates( |
| 25 const MiniContextMenuParams& params, |
| 26 int* x, |
| 27 int* y); |
| 28 |
| 23 // A class to implement common functionality for all types of | 29 // A class to implement common functionality for all types of |
| 24 // plugins: NPAPI. ActiveX and ActiveDoc | 30 // plugins: NPAPI. ActiveX and ActiveDoc |
| 25 template <typename T> | 31 template <typename T> |
| 26 class ChromeFramePlugin | 32 class ChromeFramePlugin |
| 27 : public ChromeFrameDelegateImpl, | 33 : public ChromeFrameDelegateImpl, |
| 28 public NavigationConstraintsImpl { | 34 public NavigationConstraintsImpl { |
| 29 public: | 35 public: |
| 30 ChromeFramePlugin() : ignore_setfocus_(false){ | 36 ChromeFramePlugin() : ignore_setfocus_(false){ |
| 31 } | 37 } |
| 32 ~ChromeFramePlugin() { | 38 ~ChromeFramePlugin() { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return; | 140 return; |
| 135 | 141 |
| 136 T* self = static_cast<T*>(this); | 142 T* self = static_cast<T*>(this); |
| 137 if (self->PreProcessContextMenu(copy)) { | 143 if (self->PreProcessContextMenu(copy)) { |
| 138 // In order for the context menu to handle keyboard input, give the | 144 // In order for the context menu to handle keyboard input, give the |
| 139 // ActiveX window focus. | 145 // ActiveX window focus. |
| 140 ignore_setfocus_ = true; | 146 ignore_setfocus_ = true; |
| 141 SetFocus(GetWindow()); | 147 SetFocus(GetWindow()); |
| 142 ignore_setfocus_ = false; | 148 ignore_setfocus_ = false; |
| 143 UINT flags = align_flags | TPM_LEFTBUTTON | TPM_RETURNCMD | TPM_RECURSE; | 149 UINT flags = align_flags | TPM_LEFTBUTTON | TPM_RETURNCMD | TPM_RECURSE; |
| 144 UINT selected = TrackPopupMenuEx(copy, flags, params.screen_x, | 150 int x, y; |
| 145 params.screen_y, GetWindow(), NULL); | 151 ChromeFramePluginGetParamsCoordinates(params, &x, &y); |
| 152 UINT selected = TrackPopupMenuEx(copy, flags, x, y, GetWindow(), NULL); |
| 146 // Menu is over now give focus back to chrome | 153 // Menu is over now give focus back to chrome |
| 147 GiveFocusToChrome(false); | 154 GiveFocusToChrome(false); |
| 148 if (IsValid() && selected != 0 && | 155 if (IsValid() && selected != 0 && |
| 149 !self->HandleContextMenuCommand(selected, params)) { | 156 !self->HandleContextMenuCommand(selected, params)) { |
| 150 automation_client_->SendContextMenuCommandToChromeFrame(selected); | 157 automation_client_->SendContextMenuCommandToChromeFrame(selected); |
| 151 } | 158 } |
| 152 } | 159 } |
| 153 | 160 |
| 154 DestroyMenu(copy); | 161 DestroyMenu(copy); |
| 155 } | 162 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 bool ignore_setfocus_; | 269 bool ignore_setfocus_; |
| 263 | 270 |
| 264 // List of functions to enable for automation, or a single entry "*" to | 271 // List of functions to enable for automation, or a single entry "*" to |
| 265 // enable all functions for automation. Ignored unless is_privileged_ is | 272 // enable all functions for automation. Ignored unless is_privileged_ is |
| 266 // true. Defaults to the empty list, meaning automation will not be | 273 // true. Defaults to the empty list, meaning automation will not be |
| 267 // turned on. | 274 // turned on. |
| 268 std::vector<std::string> functions_enabled_; | 275 std::vector<std::string> functions_enabled_; |
| 269 }; | 276 }; |
| 270 | 277 |
| 271 #endif // CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ | 278 #endif // CHROME_FRAME_CHROME_FRAME_PLUGIN_H_ |
| OLD | NEW |