| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | 5 |
| 6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" | 6 #include "chrome/browser/guest_view/web_view/chrome_web_view_guest_delegate.h" |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" | 8 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" |
| 9 #include "chrome/browser/favicon/favicon_utils.h" | 9 #include "chrome/browser/favicon/favicon_utils.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 ChromeWebViewGuestDelegate::~ChromeWebViewGuestDelegate() { | 33 ChromeWebViewGuestDelegate::~ChromeWebViewGuestDelegate() { |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool ChromeWebViewGuestDelegate::HandleContextMenu( | 36 bool ChromeWebViewGuestDelegate::HandleContextMenu( |
| 37 const content::ContextMenuParams& params) { | 37 const content::ContextMenuParams& params) { |
| 38 ContextMenuDelegate* menu_delegate = | 38 ContextMenuDelegate* menu_delegate = |
| 39 ContextMenuDelegate::FromWebContents(guest_web_contents()); | 39 ContextMenuDelegate::FromWebContents(guest_web_contents()); |
| 40 DCHECK(menu_delegate); | 40 DCHECK(menu_delegate); |
| 41 | 41 |
| 42 pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), params); | 42 content::ContextMenuParams new_params = params; |
| 43 new_params.x = context_menu_position_.x(); |
| 44 new_params.y = context_menu_position_.y(); |
| 45 |
| 46 pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), new_params); |
| 43 // It's possible for the returned menu to be null, so early out to avoid | 47 // It's possible for the returned menu to be null, so early out to avoid |
| 44 // a crash. TODO(wjmaclean): find out why it's possible for this to happen | 48 // a crash. TODO(wjmaclean): find out why it's possible for this to happen |
| 45 // in the first place, and if it's an error. | 49 // in the first place, and if it's an error. |
| 46 if (!pending_menu_) | 50 if (!pending_menu_) |
| 47 return false; | 51 return false; |
| 48 | 52 |
| 49 // Pass it to embedder. | 53 // Pass it to embedder. |
| 50 int request_id = ++pending_context_menu_request_id_; | 54 int request_id = ++pending_context_menu_request_id_; |
| 51 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 55 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
| 52 scoped_ptr<base::ListValue> items = | 56 scoped_ptr<base::ListValue> items = |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } else if (details.notification_type == | 136 } else if (details.notification_type == |
| 133 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { | 137 chromeos::ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK) { |
| 134 if (details.enabled) | 138 if (details.enabled) |
| 135 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost()); | 139 InjectChromeVoxIfNeeded(guest_web_contents()->GetRenderViewHost()); |
| 136 else | 140 else |
| 137 chromevox_injected_ = false; | 141 chromevox_injected_ = false; |
| 138 } | 142 } |
| 139 } | 143 } |
| 140 #endif | 144 #endif |
| 141 | 145 |
| 146 void ChromeWebViewGuestDelegate::SetContextMenuPosition( |
| 147 const gfx::Point& position) { |
| 148 context_menu_position_ = position; |
| 149 } |
| 150 |
| 142 } // namespace extensions | 151 } // namespace extensions |
| OLD | NEW |