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 | |
Lei Zhang
2014/08/12 20:00:46
"if this the guest is ..." <- did you mean "If the
ericzeng
2014/08/12 22:07:17
Done.
| |
38 // there is no extension, and extension() will be null. Use an empty string | |
39 // instead. | |
40 std::string embedder_extension_id; | |
41 if (extension()) | |
42 embedder_extension_id = extension_id(); | |
43 | |
36 guest_view_manager->CreateGuest(view_type, | 44 guest_view_manager->CreateGuest(view_type, |
37 extension_id(), | 45 embedder_extension_id, |
38 GetAssociatedWebContents(), | 46 GetAssociatedWebContents(), |
39 *create_params, | 47 *create_params, |
40 callback); | 48 callback); |
41 | 49 |
42 return true; | 50 return true; |
43 } | 51 } |
44 | 52 |
45 void GuestViewInternalCreateGuestFunction::CreateGuestCallback( | 53 void GuestViewInternalCreateGuestFunction::CreateGuestCallback( |
46 content::WebContents* guest_web_contents) { | 54 content::WebContents* guest_web_contents) { |
47 int guest_instance_id = 0; | 55 int guest_instance_id = 0; |
(...skipping 24 matching lines...) Expand all Loading... | |
72 guest->SetAutoSize(params->params.enable_auto_size, | 80 guest->SetAutoSize(params->params.enable_auto_size, |
73 gfx::Size(params->params.min.width, | 81 gfx::Size(params->params.min.width, |
74 params->params.min.height), | 82 params->params.min.height), |
75 gfx::Size(params->params.max.width, | 83 gfx::Size(params->params.max.width, |
76 params->params.max.height)); | 84 params->params.max.height)); |
77 SendResponse(true); | 85 SendResponse(true); |
78 return true; | 86 return true; |
79 } | 87 } |
80 | 88 |
81 } // namespace extensions | 89 } // namespace extensions |
OLD | NEW |