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

Side by Side Diff: chrome/browser/extensions/api/guest_view/guest_view_internal_api.cc

Issue 453613002: Implement support for <extensionoptions> embedding in WebUI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add left brace Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webui_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/extensions/api/guest_view/guest_view_internal_api.h" 5 #include "chrome/browser/extensions/api/guest_view/guest_view_internal_api.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/common/extensions/api/guest_view_internal.h" 8 #include "chrome/common/extensions/api/guest_view_internal.h"
9 #include "content/public/browser/render_process_host.h" 9 #include "content/public/browser/render_process_host.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
(...skipping 22 matching lines...) Expand all
33 GuestViewManager::WebContentsCreatedCallback callback = 33 GuestViewManager::WebContentsCreatedCallback callback =
34 base::Bind(&GuestViewInternalCreateGuestFunction::CreateGuestCallback, 34 base::Bind(&GuestViewInternalCreateGuestFunction::CreateGuestCallback,
35 this); 35 this);
36 36
37 content::WebContents* embedder_web_contents = 37 content::WebContents* embedder_web_contents =
38 content::WebContents::FromRenderViewHost(render_view_host()); 38 content::WebContents::FromRenderViewHost(render_view_host());
39 if (!embedder_web_contents) { 39 if (!embedder_web_contents) {
40 error_ = "Guest views can only be embedded in web content"; 40 error_ = "Guest views can only be embedded in web content";
41 return false; 41 return false;
42 } 42 }
43 // If the guest is an <extensionoptions> to be embedded in a WebUI, then
44 // there is no extension, and extension() will be null. Use an empty string
45 // instead.
46 std::string embedder_extension_id;
47 if (extension())
48 embedder_extension_id = extension_id();
43 49
44 guest_view_manager->CreateGuest(view_type, 50 guest_view_manager->CreateGuest(view_type,
45 extension_id(), 51 embedder_extension_id,
46 embedder_web_contents, 52 embedder_web_contents,
47 *create_params, 53 *create_params,
48 callback); 54 callback);
49 return true; 55 return true;
50 } 56 }
51 57
52 void GuestViewInternalCreateGuestFunction::CreateGuestCallback( 58 void GuestViewInternalCreateGuestFunction::CreateGuestCallback(
53 content::WebContents* guest_web_contents) { 59 content::WebContents* guest_web_contents) {
54 int guest_instance_id = 0; 60 int guest_instance_id = 0;
55 if (guest_web_contents) { 61 if (guest_web_contents) {
(...skipping 23 matching lines...) Expand all
79 guest->SetAutoSize(params->params.enable_auto_size, 85 guest->SetAutoSize(params->params.enable_auto_size,
80 gfx::Size(params->params.min.width, 86 gfx::Size(params->params.min.width,
81 params->params.min.height), 87 params->params.min.height),
82 gfx::Size(params->params.max.width, 88 gfx::Size(params->params.max.width,
83 params->params.max.height)); 89 params->params.max.height));
84 SendResponse(true); 90 SendResponse(true);
85 return true; 91 return true;
86 } 92 }
87 93
88 } // namespace extensions 94 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webui_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698