Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: chrome/browser/guest_view/extension_options/extension_options_guest.cc

Issue 378783002: Initial implementation of the <extensionoptions> GuestView tag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "chrome/browser/guest_view/extension_options/extension_options_guest.h"
6
7 #include "chrome/common/extensions/manifest_url_handler.h"
8 #include "content/public/browser/render_process_host.h"
9 #include "content/public/browser/site_instance.h"
10 #include "content/public/browser/web_contents.h"
11 #include "extensions/browser/extension_registry.h"
12 #include "extensions/common/extension.h"
13
14 using content::WebContents;
15
16 // static
17 const char ExtensionOptionsGuest::Type[] = "extensionoptions";
18
19 ExtensionOptionsGuest::ExtensionOptionsGuest(
20 content::BrowserContext* browser_context,
21 int guest_instance_id)
22 : GuestView<ExtensionOptionsGuest>(browser_context, guest_instance_id) {}
23
24 ExtensionOptionsGuest::~ExtensionOptionsGuest() {}
25
26 void ExtensionOptionsGuest::CreateWebContents(
27 const std::string& embedder_extension_id,
28 int embedder_render_process_id,
29 const base::DictionaryValue& create_params,
30 const WebContentsCreatedCallback& callback) {
31 content::RenderProcessHost* embedder_render_process_host =
32 content::RenderProcessHost::FromID(embedder_render_process_id);
33 content::BrowserContext* browser_context =
34 embedder_render_process_host->GetBrowserContext();
35
36 // Get the extension id from create_params
37 std::string extension_id;
38 create_params.GetString("extensionId", &extension_id);
Fady Samuel 2014/07/08 14:23:40 Make extensionId a constant.
ericzeng 2014/07/08 18:10:48 A constant just in this class or in some constants
Fady Samuel 2014/07/08 18:13:30 A constants file. See web_view_constants as an exa
ericzeng 2014/07/08 18:34:51 Done.
39 DCHECK(!extension_id.empty());
40
41 extensions::ExtensionRegistry* registry =
42 extensions::ExtensionRegistry::Get(browser_context);
43
44 // Get the extension and its options page
45 const extensions::Extension* extension =
46 registry->GetExtensionById(extension_id,
47 extensions::ExtensionRegistry::ENABLED);
48 GURL options_page = extensions::ManifestURL::GetOptionsPage(extension);
49 content::SiteInstance* options_site_instance =
50 content::SiteInstance::CreateForURL(browser_context, options_page);
Fady Samuel 2014/07/08 14:23:40 Does this end up in the same process as the app?
ericzeng 2014/07/08 18:10:48 I'm not exactly certain how this works and what pr
Fady Samuel 2014/07/08 18:13:30 Use the task manager built into Chrome. Does the o
51
52 // Create a webcontents containing the options page
53 WebContents::CreateParams params(browser_context,
54 options_site_instance);
55 params.guest_delegate = this;
56 callback.Run(WebContents::Create(params));
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698