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

Side by Side Diff: chrome/browser/nacl_host/nacl_browser_delegate_impl.cc

Issue 437503004: Add NaCl support to app_shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (nacl-init) cleanup Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/nacl_host/nacl_browser_delegate_impl.h" 5 #include "chrome/browser/nacl_host/nacl_browser_delegate_impl.h"
6 6
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h" 11 #include "chrome/browser/component_updater/pnacl/pnacl_component_installer.h"
12 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/nacl_host/nacl_infobar_delegate.h" 13 #include "chrome/browser/nacl_host/nacl_infobar_delegate.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory .h" 16 #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory .h"
17 #include "chrome/common/chrome_paths.h" 17 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/chrome_paths_internal.h" 18 #include "chrome/common/chrome_paths_internal.h"
19 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
20 #include "chrome/common/logging_chrome.h" 20 #include "chrome/common/logging_chrome.h"
21 #include "chrome/common/pepper_permission_util.h" 21 #include "chrome/common/pepper_permission_util.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/render_frame_host.h"
24 #include "content/public/browser/site_instance.h"
25 #include "extensions/browser/extension_system.h" 23 #include "extensions/browser/extension_system.h"
26 #include "extensions/browser/info_map.h" 24 #include "extensions/browser/info_map.h"
27 #include "extensions/browser/process_manager.h" 25 #include "extensions/browser/process_manager.h"
28 #include "extensions/common/constants.h" 26 #include "extensions/common/constants.h"
29 #include "extensions/common/extension.h" 27 #include "extensions/common/extension.h"
30 #include "extensions/common/manifest_handlers/shared_module_info.h" 28 #include "extensions/common/manifest_handlers/shared_module_info.h"
31 #include "extensions/common/url_pattern.h" 29 #include "extensions/common/url_pattern.h"
32 #include "ppapi/c/private/ppb_nacl_private.h" 30 #include "ppapi/c/private/ppb_nacl_private.h"
31 #include "url/gurl.h"
33 32
34 using extensions::SharedModuleInfo; 33 using extensions::SharedModuleInfo;
35 34
36 namespace { 35 namespace {
37 36
38 // These are temporarily needed for testing non-sfi mode on ChromeOS without 37 // These are temporarily needed for testing non-sfi mode on ChromeOS without
39 // passing command-line arguments to Chrome. 38 // passing command-line arguments to Chrome.
40 const char* const kAllowedNonSfiOrigins[] = { 39 const char* const kAllowedNonSfiOrigins[] = {
41 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see http://crbug.com/355141 40 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see http://crbug.com/355141
42 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see http://crbug.com/355141 41 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see http://crbug.com/355141
(...skipping 17 matching lines...) Expand all
60 const content::BrowserPpapiHost::OnKeepaliveInstanceData& instance_data, 59 const content::BrowserPpapiHost::OnKeepaliveInstanceData& instance_data,
61 const base::FilePath& profile_data_directory) { 60 const base::FilePath& profile_data_directory) {
62 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 61 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
63 62
64 // Only one instance will exist for NaCl embeds, even when more than one 63 // Only one instance will exist for NaCl embeds, even when more than one
65 // embed of the same plugin exists on the same page. 64 // embed of the same plugin exists on the same page.
66 DCHECK(instance_data.size() == 1); 65 DCHECK(instance_data.size() == 1);
67 if (instance_data.size() < 1) 66 if (instance_data.size() < 1)
68 return; 67 return;
69 68
70 content::RenderFrameHost* render_frame_host = 69 extensions::ProcessManager::OnKeepaliveFromPlugin(
71 content::RenderFrameHost::FromID( 70 instance_data[0].render_process_id,
72 instance_data[0].render_process_id, instance_data[0].render_frame_id); 71 instance_data[0].render_frame_id,
73 if (!render_frame_host) 72 instance_data[0].document_url.host());
74 return;
75
76 content::SiteInstance* site_instance = render_frame_host->GetSiteInstance();
77 if (!site_instance)
78 return;
79
80 extensions::ExtensionSystem* extension_system =
81 extensions::ExtensionSystem::Get(site_instance->GetBrowserContext());
82 if (!extension_system)
83 return;
84
85 const ExtensionService* extension_service =
86 extension_system->extension_service();
87 if (!extension_service)
88 return;
89
90 const extensions::Extension* extension = extension_service->GetExtensionById(
91 instance_data[0].document_url.host(), false);
92 if (!extension)
93 return;
94
95 extensions::ProcessManager* pm = extension_system->process_manager();
96 if (!pm)
97 return;
98
99 pm->KeepaliveImpulse(extension);
100 } 73 }
101 74
102 // Calls OnKeepaliveOnUIThread on UI thread. 75 // Calls OnKeepaliveOnUIThread on UI thread.
103 void OnKeepalive( 76 void OnKeepalive(
104 const content::BrowserPpapiHost::OnKeepaliveInstanceData& instance_data, 77 const content::BrowserPpapiHost::OnKeepaliveInstanceData& instance_data,
105 const base::FilePath& profile_data_directory) { 78 const base::FilePath& profile_data_directory) {
106 DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 79 DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
107 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 80 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
108 base::Bind(&OnKeepaliveOnUIThread, 81 base::Bind(&OnKeepaliveOnUIThread,
109 instance_data, 82 instance_data,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 scoped_refptr<extensions::InfoMap> NaClBrowserDelegateImpl::GetExtensionInfoMap( 269 scoped_refptr<extensions::InfoMap> NaClBrowserDelegateImpl::GetExtensionInfoMap(
297 const base::FilePath& profile_directory) { 270 const base::FilePath& profile_directory) {
298 // Get the profile associated with the renderer. 271 // Get the profile associated with the renderer.
299 Profile* profile = profile_manager_->GetProfileByPath(profile_directory); 272 Profile* profile = profile_manager_->GetProfileByPath(profile_directory);
300 DCHECK(profile); 273 DCHECK(profile);
301 scoped_refptr<extensions::InfoMap> extension_info_map = 274 scoped_refptr<extensions::InfoMap> extension_info_map =
302 extensions::ExtensionSystem::Get(profile)->info_map(); 275 extensions::ExtensionSystem::Get(profile)->info_map();
303 DCHECK(extension_info_map); 276 DCHECK(extension_info_map);
304 return extension_info_map; 277 return extension_info_map;
305 } 278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698