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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 139943005: Convert extensions::ProcessMap to BrowserContextKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase process_map Created 6 years, 11 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 return false; 2242 return false;
2243 2243
2244 // No BackgroundContents allowed if BackgroundContentsService doesn't exist. 2244 // No BackgroundContents allowed if BackgroundContentsService doesn't exist.
2245 BackgroundContentsService* service = 2245 BackgroundContentsService* service =
2246 BackgroundContentsServiceFactory::GetForProfile(profile_); 2246 BackgroundContentsServiceFactory::GetForProfile(profile_);
2247 if (!service) 2247 if (!service)
2248 return false; 2248 return false;
2249 2249
2250 // Ensure that we're trying to open this from the extension's process. 2250 // Ensure that we're trying to open this from the extension's process.
2251 SiteInstance* opener_site_instance = opener_web_contents->GetSiteInstance(); 2251 SiteInstance* opener_site_instance = opener_web_contents->GetSiteInstance();
2252 extensions::ProcessMap* process_map = extensions_service->process_map(); 2252 extensions::ProcessMap* process_map = extensions::ProcessMap::Get(profile_);
2253 if (!opener_site_instance->GetProcess() || 2253 if (!opener_site_instance->GetProcess() ||
2254 !process_map->Contains( 2254 !process_map->Contains(
2255 extension->id(), opener_site_instance->GetProcess()->GetID())) { 2255 extension->id(), opener_site_instance->GetProcess()->GetID())) {
2256 return false; 2256 return false;
2257 } 2257 }
2258 2258
2259 // Only allow a single background contents per app. 2259 // Only allow a single background contents per app.
2260 bool allow_js_access = extensions::BackgroundInfo::AllowJSAccess(extension); 2260 bool allow_js_access = extensions::BackgroundInfo::AllowJSAccess(extension);
2261 BackgroundContents* existing = 2261 BackgroundContents* existing =
2262 service->GetAppBackgroundContents(base::ASCIIToUTF16(extension->id())); 2262 service->GetAppBackgroundContents(base::ASCIIToUTF16(extension->id()));
(...skipping 29 matching lines...) Expand all
2292 if (contents && !allow_js_access) { 2292 if (contents && !allow_js_access) {
2293 contents->web_contents()->GetController().LoadURL( 2293 contents->web_contents()->GetController().LoadURL(
2294 target_url, 2294 target_url,
2295 content::Referrer(), 2295 content::Referrer(),
2296 content::PAGE_TRANSITION_LINK, 2296 content::PAGE_TRANSITION_LINK,
2297 std::string()); // No extra headers. 2297 std::string()); // No extra headers.
2298 } 2298 }
2299 2299
2300 return contents != NULL; 2300 return contents != NULL;
2301 } 2301 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/tab_contents_resource_provider.cc ('k') | extensions/browser/event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698