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

Unified Diff: chrome/browser/nacl_host/nacl_browser_delegate_impl.cc

Issue 277463003: Use a proper profile in NaClBrowserDelegateImpl::MapUrlToLocalFilePath (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git cl format Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/nacl_host/nacl_browser_delegate_impl.cc
diff --git a/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc b/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc
index b30a3ae0789a1dfb82969b250b67b19187abd5e8..c4ffd39b654fdaa82ad3a13f5b922a8d0e99ba7c 100644
--- a/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc
+++ b/chrome/browser/nacl_host/nacl_browser_delegate_impl.cc
@@ -12,6 +12,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/nacl_host/nacl_infobar_delegate.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
@@ -104,8 +105,10 @@ void OnKeepalive(
} // namespace
NaClBrowserDelegateImpl::NaClBrowserDelegateImpl(
- extensions::InfoMap* extension_info_map)
- : extension_info_map_(extension_info_map), inverse_debug_patterns_(false) {}
+ ProfileManager* profile_manager)
+ : profile_manager_(profile_manager), inverse_debug_patterns_(false) {
+ DCHECK(profile_manager_);
+}
NaClBrowserDelegateImpl::~NaClBrowserDelegateImpl() {
}
@@ -203,11 +206,22 @@ bool NaClBrowserDelegateImpl::URLMatchesDebugPatterns(
// This function is security sensitive. Be sure to check with a security
// person before you modify it.
bool NaClBrowserDelegateImpl::MapUrlToLocalFilePath(
- const GURL& file_url, bool use_blocking_api, base::FilePath* file_path) {
- DCHECK(extension_info_map_);
+ const GURL& file_url,
+ bool use_blocking_api,
+ const base::FilePath& profile_directory,
+ base::FilePath* file_path) {
+ // Get the profile associated with the renderer.
+ Profile* profile = profile_manager_->GetProfileByPath(profile_directory);
+ if (!profile)
+ return false;
+
+ scoped_refptr<extensions::InfoMap> extension_info_map =
+ extensions::ExtensionSystem::Get(profile)->info_map();
+ DCHECK(extension_info_map);
+
// Check that the URL is recognized by the extension system.
const extensions::Extension* extension =
- extension_info_map_->extensions().GetExtensionOrAppByURL(file_url);
+ extension_info_map->extensions().GetExtensionOrAppByURL(file_url);
if (!extension)
return false;
@@ -234,7 +248,7 @@ bool NaClBrowserDelegateImpl::MapUrlToLocalFilePath(
SharedModuleInfo::ParseImportedPath(path, &new_extension_id,
&new_relative_path);
const extensions::Extension* new_extension =
- extension_info_map_->extensions().GetByID(new_extension_id);
+ extension_info_map->extensions().GetByID(new_extension_id);
if (!new_extension)
return false;
« no previous file with comments | « chrome/browser/nacl_host/nacl_browser_delegate_impl.h ('k') | components/nacl/browser/nacl_browser_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698