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

Side by Side Diff: chrome/browser/extensions/extension_protocols.cc

Issue 3210007: Add support for a "split" incognito behavior for extensions. (Closed)
Patch Set: latest Created 10 years, 3 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extensions/extension_protocols.h" 5 #include "chrome/browser/extensions/extension_protocols.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/resource_bundle.h" 9 #include "app/resource_bundle.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 if (context->ExtensionHasWebExtent(request->url().host())) { 92 if (context->ExtensionHasWebExtent(request->url().host())) {
93 LOG(ERROR) << "Denying load of " << request->url().spec() << " from " 93 LOG(ERROR) << "Denying load of " << request->url().spec() << " from "
94 << "hosted app."; 94 << "hosted app.";
95 return false; 95 return false;
96 } 96 }
97 97
98 // Don't allow toplevel navigations to extension resources in incognito mode. 98 // Don't allow toplevel navigations to extension resources in incognito mode.
99 // This is because an extension must run in a single process, and an 99 // This is because an extension must run in a single process, and an
100 // incognito tab prevents that. 100 // incognito tab prevents that.
101 if (context->is_off_the_record() && 101 if (context->is_off_the_record() &&
102 info->resource_type() == ResourceType::MAIN_FRAME) { 102 info->resource_type() == ResourceType::MAIN_FRAME &&
103 !context->ExtensionCanLoadInIncognito(request->url().host())) {
103 LOG(ERROR) << "Denying load of " << request->url().spec() << " from " 104 LOG(ERROR) << "Denying load of " << request->url().spec() << " from "
104 << "incognito tab."; 105 << "incognito tab.";
105 return false; 106 return false;
106 } 107 }
107 108
108 // Otherwise, pages are allowed to load resources from extensions if the 109 // Otherwise, pages are allowed to load resources from extensions if the
109 // extension has host permissions to (and therefore could be running script 110 // extension has host permissions to (and therefore could be running script
110 // in, which might need access to the extension resources). 111 // in, which might need access to the extension resources).
111 // 112 //
112 // Exceptions are: 113 // Exceptions are:
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 201
201 return new URLRequestFileJob(request, resource.GetFilePath()); 202 return new URLRequestFileJob(request, resource.GetFilePath());
202 } 203 }
203 204
204 void RegisterExtensionProtocols() { 205 void RegisterExtensionProtocols() {
205 URLRequest::RegisterProtocolFactory(chrome::kExtensionScheme, 206 URLRequest::RegisterProtocolFactory(chrome::kExtensionScheme,
206 &CreateExtensionURLRequestJob); 207 &CreateExtensionURLRequestJob);
207 URLRequest::RegisterProtocolFactory(chrome::kUserScriptScheme, 208 URLRequest::RegisterProtocolFactory(chrome::kUserScriptScheme,
208 &CreateUserScriptURLRequestJob); 209 &CreateUserScriptURLRequestJob);
209 } 210 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_process_manager_unittest.cc ('k') | chrome/browser/extensions/extension_sidebar_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698