OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "extensions/browser/guest_view/extension_view/extension_view_guest.h" | 5 #include "extensions/browser/guest_view/extension_view/extension_view_guest.h" |
6 | 6 |
7 #include "components/crx_file/id_util.h" | 7 #include "components/crx_file/id_util.h" |
8 #include "components/guest_view/browser/guest_view_event.h" | 8 #include "components/guest_view/browser/guest_view_event.h" |
9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
| 10 #include "content/public/browser/web_contents_source.h" |
10 #include "content/public/common/result_codes.h" | 11 #include "content/public/common/result_codes.h" |
11 #include "extensions/browser/api/extensions_api_client.h" | 12 #include "extensions/browser/api/extensions_api_client.h" |
12 #include "extensions/browser/bad_message.h" | 13 #include "extensions/browser/bad_message.h" |
13 #include "extensions/browser/guest_view/extension_view/extension_view_constants.
h" | 14 #include "extensions/browser/guest_view/extension_view/extension_view_constants.
h" |
14 #include "extensions/common/constants.h" | 15 #include "extensions/common/constants.h" |
15 #include "extensions/common/extension_messages.h" | 16 #include "extensions/common/extension_messages.h" |
16 #include "extensions/strings/grit/extensions_strings.h" | 17 #include "extensions/strings/grit/extensions_strings.h" |
17 | 18 |
18 using content::WebContents; | 19 using content::WebContents; |
19 using guest_view::GuestViewBase; | 20 using guest_view::GuestViewBase; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 callback.Run(nullptr); | 85 callback.Run(nullptr); |
85 return; | 86 return; |
86 } | 87 } |
87 | 88 |
88 content::SiteInstance* view_site_instance = | 89 content::SiteInstance* view_site_instance = |
89 content::SiteInstance::CreateForURL(browser_context(), | 90 content::SiteInstance::CreateForURL(browser_context(), |
90 extension_url_); | 91 extension_url_); |
91 | 92 |
92 WebContents::CreateParams params(browser_context(), view_site_instance); | 93 WebContents::CreateParams params(browser_context(), view_site_instance); |
93 params.guest_delegate = this; | 94 params.guest_delegate = this; |
94 callback.Run(WebContents::Create(params)); | 95 WebContents* web_contents = WebContents::Create(params); |
| 96 WebContentsSource::CreateForWebContentsAndLocation(web_contents, FROM_HERE); |
| 97 callback.Run(web_contents); |
95 } | 98 } |
96 | 99 |
97 void ExtensionViewGuest::DidInitialize( | 100 void ExtensionViewGuest::DidInitialize( |
98 const base::DictionaryValue& create_params) { | 101 const base::DictionaryValue& create_params) { |
99 ExtensionsAPIClient::Get()->AttachWebContentsHelpers(web_contents()); | 102 ExtensionsAPIClient::Get()->AttachWebContentsHelpers(web_contents()); |
100 | 103 |
101 ApplyAttributes(create_params); | 104 ApplyAttributes(create_params); |
102 } | 105 } |
103 | 106 |
104 void ExtensionViewGuest::DidAttachToEmbedder() { | 107 void ExtensionViewGuest::DidAttachToEmbedder() { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 140 } |
138 } | 141 } |
139 | 142 |
140 void ExtensionViewGuest::ApplyAttributes(const base::DictionaryValue& params) { | 143 void ExtensionViewGuest::ApplyAttributes(const base::DictionaryValue& params) { |
141 std::string src; | 144 std::string src; |
142 params.GetString(extensionview::kAttributeSrc, &src); | 145 params.GetString(extensionview::kAttributeSrc, &src); |
143 NavigateGuest(src, false /* force_navigation */); | 146 NavigateGuest(src, false /* force_navigation */); |
144 } | 147 } |
145 | 148 |
146 } // namespace extensions | 149 } // namespace extensions |
OLD | NEW |