Fire an error if a pref used in the UI is missing once all prefs are fetched.
[chromium-blink-merge.git] / chrome / browser / guest_view / extension_options / chrome_extension_options_guest_delegate.cc
blob4fc170bd06bc6761ac6c6053d83bd2ed070f8484
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/extensions/chrome_extension_web_contents_observer.h"
8 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_finder.h"
11 #include "components/renderer_context_menu/context_menu_delegate.h"
12 #include "extensions/browser/guest_view/extension_options/extension_options_guest.h"
14 namespace extensions {
16 ChromeExtensionOptionsGuestDelegate::ChromeExtensionOptionsGuestDelegate(
17 ExtensionOptionsGuest* guest)
18 : ExtensionOptionsGuestDelegate(guest) {
21 ChromeExtensionOptionsGuestDelegate::~ChromeExtensionOptionsGuestDelegate() {
24 void ChromeExtensionOptionsGuestDelegate::DidInitialize() {
25 ChromeExtensionWebContentsObserver::CreateForWebContents(
26 extension_options_guest()->web_contents());
29 bool ChromeExtensionOptionsGuestDelegate::HandleContextMenu(
30 const content::ContextMenuParams& params) {
31 ContextMenuDelegate* menu_delegate = ContextMenuDelegate::FromWebContents(
32 extension_options_guest()->web_contents());
33 DCHECK(menu_delegate);
35 scoped_ptr<RenderViewContextMenuBase> menu = menu_delegate->BuildMenu(
36 extension_options_guest()->web_contents(), params);
37 menu_delegate->ShowMenu(menu.Pass());
38 return true;
41 content::WebContents* ChromeExtensionOptionsGuestDelegate::OpenURLInNewTab(
42 const content::OpenURLParams& params) {
43 Browser* browser = chrome::FindBrowserWithWebContents(
44 extension_options_guest()->embedder_web_contents());
45 return browser->OpenURL(params);
48 } // namespace extensions