Chromium Code Reviews| 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 #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/guest_view/guest_view_base.h" | 7 #include "chrome/browser/guest_view/guest_view_base.h" |
| 8 #include "chrome/browser/guest_view/guest_view_manager.h" | 8 #include "chrome/browser/guest_view/guest_view_manager.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/common/extensions/api/guest_view_internal.h" | 10 #include "chrome/common/extensions/api/guest_view_internal.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 base::DictionaryValue* create_params; | 27 base::DictionaryValue* create_params; |
| 28 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &create_params)); | 28 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &create_params)); |
| 29 | 29 |
| 30 GuestViewManager* guest_view_manager = | 30 GuestViewManager* guest_view_manager = |
| 31 GuestViewManager::FromBrowserContext(browser_context()); | 31 GuestViewManager::FromBrowserContext(browser_context()); |
| 32 | 32 |
| 33 GuestViewManager::WebContentsCreatedCallback callback = | 33 GuestViewManager::WebContentsCreatedCallback callback = |
| 34 base::Bind(&GuestViewInternalCreateGuestFunction::CreateGuestCallback, | 34 base::Bind(&GuestViewInternalCreateGuestFunction::CreateGuestCallback, |
| 35 this); | 35 this); |
| 36 | |
| 37 // If this the guest is an <extensionoptions> to be embedded in a WebUI, then | |
| 38 // there is no extension, and extension() will be null. Use an empty string | |
|
not at google - send to devlin
2014/08/07 23:06:02
this shouldn't be necessary after https://coderevi
ericzeng
2014/08/08 00:23:46
I'm not sure if that's the case. ExtensionFunction
not at google - send to devlin
2014/08/08 14:08:15
ah you're right, my bad sorry.
1 last nit: the la
| |
| 39 // instead. | |
| 40 std::string embedder_extension_id = ""; | |
|
Fady Samuel
2014/08/07 23:09:29
no need for initializer.
ericzeng
2014/08/08 00:23:46
Done.
| |
| 41 if (extension()) { | |
|
Fady Samuel
2014/08/07 23:09:29
No need for braces.
ericzeng
2014/08/08 00:23:46
Done.
| |
| 42 embedder_extension_id = extension_id(); | |
| 43 } | |
| 44 | |
| 36 guest_view_manager->CreateGuest(view_type, | 45 guest_view_manager->CreateGuest(view_type, |
| 37 extension_id(), | 46 embedder_extension_id, |
| 38 render_view_host()->GetProcess()->GetID(), | 47 render_view_host()->GetProcess()->GetID(), |
| 39 *create_params, | 48 *create_params, |
| 40 callback); | 49 callback); |
| 41 | 50 |
| 42 return true; | 51 return true; |
| 43 } | 52 } |
| 44 | 53 |
| 45 void GuestViewInternalCreateGuestFunction::CreateGuestCallback( | 54 void GuestViewInternalCreateGuestFunction::CreateGuestCallback( |
| 46 content::WebContents* guest_web_contents) { | 55 content::WebContents* guest_web_contents) { |
| 47 int guest_instance_id = 0; | 56 int guest_instance_id = 0; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 72 guest->SetAutoSize(params->params.enable_auto_size, | 81 guest->SetAutoSize(params->params.enable_auto_size, |
| 73 gfx::Size(params->params.min.width, | 82 gfx::Size(params->params.min.width, |
| 74 params->params.min.height), | 83 params->params.min.height), |
| 75 gfx::Size(params->params.max.width, | 84 gfx::Size(params->params.max.width, |
| 76 params->params.max.height)); | 85 params->params.max.height)); |
| 77 SendResponse(true); | 86 SendResponse(true); |
| 78 return true; | 87 return true; |
| 79 } | 88 } |
| 80 | 89 |
| 81 } // namespace extensions | 90 } // namespace extensions |
| OLD | NEW |