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

Side by Side Diff: extensions/browser/extension_web_contents_observer.cc

Issue 2211213002: Revert of [Extensions] Ensure ordering of extension [un]loaded, activated messages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 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
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/extension_web_contents_observer.h" 5 #include "extensions/browser/extension_web_contents_observer.h"
6 6
7 #include "content/public/browser/child_process_security_policy.h" 7 #include "content/public/browser/child_process_security_policy.h"
8 #include "content/public/browser/navigation_details.h" 8 #include "content/public/browser/navigation_details.h"
9 #include "content/public/browser/render_frame_host.h" 9 #include "content/public/browser/render_frame_host.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
11 #include "content/public/browser/render_view_host.h" 11 #include "content/public/browser/render_view_host.h"
12 #include "content/public/browser/site_instance.h" 12 #include "content/public/browser/site_instance.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/url_constants.h" 14 #include "content/public/common/url_constants.h"
15 #include "extensions/browser/extension_api_frame_id_map.h" 15 #include "extensions/browser/extension_api_frame_id_map.h"
16 #include "extensions/browser/extension_prefs.h" 16 #include "extensions/browser/extension_prefs.h"
17 #include "extensions/browser/extension_registry.h" 17 #include "extensions/browser/extension_registry.h"
18 #include "extensions/browser/extensions_browser_client.h" 18 #include "extensions/browser/extensions_browser_client.h"
19 #include "extensions/browser/mojo/service_registration.h" 19 #include "extensions/browser/mojo/service_registration.h"
20 #include "extensions/browser/process_manager.h" 20 #include "extensions/browser/process_manager.h"
21 #include "extensions/browser/renderer_startup_helper.h"
22 #include "extensions/browser/view_type_utils.h" 21 #include "extensions/browser/view_type_utils.h"
23 #include "extensions/common/constants.h" 22 #include "extensions/common/constants.h"
24 #include "extensions/common/extension.h" 23 #include "extensions/common/extension.h"
25 #include "extensions/common/extension_messages.h" 24 #include "extensions/common/extension_messages.h"
26 #include "extensions/common/view_type.h" 25 #include "extensions/common/view_type.h"
27 26
28 namespace extensions { 27 namespace extensions {
29 28
30 // static 29 // static
31 ExtensionWebContentsObserver* ExtensionWebContentsObserver::GetForWebContents( 30 ExtensionWebContentsObserver* ExtensionWebContentsObserver::GetForWebContents(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 98 }
100 99
101 // Tells the new view that it's hosted in an extension process. 100 // Tells the new view that it's hosted in an extension process.
102 // 101 //
103 // This will often be a rendant IPC, because activating extensions happens at 102 // This will often be a rendant IPC, because activating extensions happens at
104 // the process level, not at the view level. However, without some mild 103 // the process level, not at the view level. However, without some mild
105 // refactoring this isn't trivial to do, and this way is simpler. 104 // refactoring this isn't trivial to do, and this way is simpler.
106 // 105 //
107 // Plus, we can delete the concept of activating an extension once site 106 // Plus, we can delete the concept of activating an extension once site
108 // isolation is turned on. 107 // isolation is turned on.
109 RendererStartupHelperFactory::GetForBrowserContext(browser_context_) 108 render_view_host->Send(new ExtensionMsg_ActivateExtension(extension->id()));
110 ->ActivateExtensionInProcess(extension->id(),
111 render_view_host->GetProcess());
112 } 109 }
113 110
114 void ExtensionWebContentsObserver::RenderFrameCreated( 111 void ExtensionWebContentsObserver::RenderFrameCreated(
115 content::RenderFrameHost* render_frame_host) { 112 content::RenderFrameHost* render_frame_host) {
116 InitializeRenderFrame(render_frame_host); 113 InitializeRenderFrame(render_frame_host);
117 114
118 // Optimization: Look up the extension API frame ID to force the mapping to be 115 // Optimization: Look up the extension API frame ID to force the mapping to be
119 // cached. This minimizes the number of IO->UI->IO thread hops when the ID is 116 // cached. This minimizes the number of IO->UI->IO thread hops when the ID is
120 // looked up again on the IO thread for the webRequest API. 117 // looked up again on the IO thread for the webRequest API.
121 ExtensionApiFrameIdMap::Get()->CacheFrameData(render_frame_host); 118 ExtensionApiFrameIdMap::Get()->CacheFrameData(render_frame_host);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // Since this is called for all existing RenderFrameHosts during the 280 // Since this is called for all existing RenderFrameHosts during the
284 // ExtensionWebContentsObserver's creation, it's possible that not all hosts 281 // ExtensionWebContentsObserver's creation, it's possible that not all hosts
285 // are ready. 282 // are ready.
286 // We only initialize the frame if the renderer counterpart is live; otherwise 283 // We only initialize the frame if the renderer counterpart is live; otherwise
287 // we wait for the RenderFrameCreated notification. 284 // we wait for the RenderFrameCreated notification.
288 if (render_frame_host->IsRenderFrameLive()) 285 if (render_frame_host->IsRenderFrameLive())
289 InitializeRenderFrame(render_frame_host); 286 InitializeRenderFrame(render_frame_host);
290 } 287 }
291 288
292 } // namespace extensions 289 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/simple_with_file/manifest.json ('k') | extensions/browser/renderer_startup_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698