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

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

Issue 1413853005: Track all extension frames in ProcessManager, inspect extensionoptions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/msg/message/ Created 5 years, 1 month 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
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 "extensions/browser/guest_view/extension_options/extension_options_gues t.h" 5 #include "extensions/browser/guest_view/extension_options/extension_options_gues t.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "components/crx_file/id_util.h" 8 #include "components/crx_file/id_util.h"
9 #include "components/guest_view/browser/guest_view_event.h" 9 #include "components/guest_view/browser/guest_view_event.h"
10 #include "components/guest_view/browser/guest_view_manager.h" 10 #include "components/guest_view/browser/guest_view_manager.h"
11 #include "content/public/browser/navigation_details.h" 11 #include "content/public/browser/navigation_details.h"
12 #include "content/public/browser/render_process_host.h" 12 #include "content/public/browser/render_process_host.h"
13 #include "content/public/browser/site_instance.h" 13 #include "content/public/browser/site_instance.h"
14 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "content/public/common/result_codes.h" 15 #include "content/public/common/result_codes.h"
16 #include "extensions/browser/api/extensions_api_client.h" 16 #include "extensions/browser/api/extensions_api_client.h"
17 #include "extensions/browser/bad_message.h" 17 #include "extensions/browser/bad_message.h"
18 #include "extensions/browser/extension_function_dispatcher.h" 18 #include "extensions/browser/extension_function_dispatcher.h"
19 #include "extensions/browser/extension_registry.h" 19 #include "extensions/browser/extension_registry.h"
20 #include "extensions/browser/guest_view/extension_options/extension_options_cons tants.h" 20 #include "extensions/browser/guest_view/extension_options/extension_options_cons tants.h"
21 #include "extensions/browser/guest_view/extension_options/extension_options_gues t_delegate.h" 21 #include "extensions/browser/guest_view/extension_options/extension_options_gues t_delegate.h"
22 #include "extensions/browser/view_type_utils.h"
22 #include "extensions/common/api/extension_options_internal.h" 23 #include "extensions/common/api/extension_options_internal.h"
23 #include "extensions/common/constants.h" 24 #include "extensions/common/constants.h"
24 #include "extensions/common/extension.h" 25 #include "extensions/common/extension.h"
25 #include "extensions/common/extension_messages.h" 26 #include "extensions/common/extension_messages.h"
26 #include "extensions/common/manifest_handlers/options_page_info.h" 27 #include "extensions/common/manifest_handlers/options_page_info.h"
27 #include "extensions/common/permissions/permissions_data.h" 28 #include "extensions/common/permissions/permissions_data.h"
28 #include "extensions/strings/grit/extensions_strings.h" 29 #include "extensions/strings/grit/extensions_strings.h"
29 #include "ipc/ipc_message_macros.h" 30 #include "ipc/ipc_message_macros.h"
30 31
31 using content::WebContents; 32 using content::WebContents;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return; 102 return;
102 } 103 }
103 104
104 // Create a WebContents using the extension URL. The options page's 105 // Create a WebContents using the extension URL. The options page's
105 // WebContents should live in the same process as its parent extension's 106 // WebContents should live in the same process as its parent extension's
106 // WebContents, so we can use |extension_url| for creating the SiteInstance. 107 // WebContents, so we can use |extension_url| for creating the SiteInstance.
107 content::SiteInstance* options_site_instance = 108 content::SiteInstance* options_site_instance =
108 content::SiteInstance::CreateForURL(browser_context(), extension_url); 109 content::SiteInstance::CreateForURL(browser_context(), extension_url);
109 WebContents::CreateParams params(browser_context(), options_site_instance); 110 WebContents::CreateParams params(browser_context(), options_site_instance);
110 params.guest_delegate = this; 111 params.guest_delegate = this;
111 callback.Run(WebContents::Create(params)); 112 WebContents* wc = WebContents::Create(params);
113 SetViewType(wc, VIEW_TYPE_EXTENSION_OPTIONS);
Fady Samuel 2015/11/01 21:53:29 This seems incomplete? What about other GuestView
Fady Samuel 2015/11/01 22:09:55 Nevermind, chrome.extensions.getViews() should not
114 callback.Run(wc);
112 } 115 }
113 116
114 void ExtensionOptionsGuest::DidInitialize( 117 void ExtensionOptionsGuest::DidInitialize(
115 const base::DictionaryValue& create_params) { 118 const base::DictionaryValue& create_params) {
116 ExtensionsAPIClient::Get()->AttachWebContentsHelpers(web_contents()); 119 ExtensionsAPIClient::Get()->AttachWebContentsHelpers(web_contents());
117 web_contents()->GetController().LoadURL(options_page_, 120 web_contents()->GetController().LoadURL(options_page_,
118 content::Referrer(), 121 content::Referrer(),
119 ui::PAGE_TRANSITION_LINK, 122 ui::PAGE_TRANSITION_LINK,
120 std::string()); 123 std::string());
121 } 124 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 SetGuestZoomLevelToMatchEmbedder(); 230 SetGuestZoomLevelToMatchEmbedder();
228 231
229 if (params.url.GetOrigin() != options_page_.GetOrigin()) { 232 if (params.url.GetOrigin() != options_page_.GetOrigin()) {
230 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(), 233 bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(),
231 bad_message::EOG_BAD_ORIGIN); 234 bad_message::EOG_BAD_ORIGIN);
232 } 235 }
233 } 236 }
234 } 237 }
235 238
236 } // namespace extensions 239 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698