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
3 // found in the LICENSE file.
5 #include "chrome/browser/guest_view/extension_options/chrome_extension_options_guest_delegate.h"
7 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_finder.h"
10 #include "components/renderer_context_menu/context_menu_delegate.h"
11 #include "extensions/browser/guest_view/extension_options/extension_options_guest.h"
13 namespace extensions
{
15 ChromeExtensionOptionsGuestDelegate::ChromeExtensionOptionsGuestDelegate(
16 ExtensionOptionsGuest
* guest
)
17 : ExtensionOptionsGuestDelegate(guest
) {
20 ChromeExtensionOptionsGuestDelegate::~ChromeExtensionOptionsGuestDelegate() {
23 bool ChromeExtensionOptionsGuestDelegate::HandleContextMenu(
24 const content::ContextMenuParams
& params
) {
25 ContextMenuDelegate
* menu_delegate
= ContextMenuDelegate::FromWebContents(
26 extension_options_guest()->web_contents());
27 DCHECK(menu_delegate
);
29 scoped_ptr
<RenderViewContextMenuBase
> menu
= menu_delegate
->BuildMenu(
30 extension_options_guest()->web_contents(), params
);
31 menu_delegate
->ShowMenu(menu
.Pass());
35 content::WebContents
* ChromeExtensionOptionsGuestDelegate::OpenURLInNewTab(
36 const content::OpenURLParams
& params
) {
37 Browser
* browser
= chrome::FindBrowserWithWebContents(
38 extension_options_guest()->embedder_web_contents());
39 return browser
->OpenURL(params
);
42 } // namespace extensions