OLD | NEW |
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/renderer/render_thread.h" | 5 #include "chrome/renderer/render_thread.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 WebKit::initialize(webkit_client_.get()); | 857 WebKit::initialize(webkit_client_.get()); |
858 | 858 |
859 WebScriptController::enableV8SingleThreadMode(); | 859 WebScriptController::enableV8SingleThreadMode(); |
860 | 860 |
861 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 861 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
862 | 862 |
863 // chrome: pages should not be accessible by normal content, and should | 863 // chrome: pages should not be accessible by normal content, and should |
864 // also be unable to script anything but themselves (to help limit the damage | 864 // also be unable to script anything but themselves (to help limit the damage |
865 // that a corrupt chrome: page could cause). | 865 // that a corrupt chrome: page could cause). |
866 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); | 866 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); |
867 if (command_line.HasSwitch(switches::kNewChromeUISecurityModel)) { | 867 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); |
868 WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(chrome_ui_scheme); | |
869 } else { | |
870 WebSecurityPolicy::registerURLSchemeAsLocal(chrome_ui_scheme); | |
871 WebSecurityPolicy::registerURLSchemeAsNoAccess(chrome_ui_scheme); | |
872 } | |
873 | 868 |
874 // chrome-extension: resources shouldn't trigger insecure content warnings. | 869 // chrome-extension: resources shouldn't trigger insecure content warnings. |
875 WebString extension_scheme(ASCIIToUTF16(chrome::kExtensionScheme)); | 870 WebString extension_scheme(ASCIIToUTF16(chrome::kExtensionScheme)); |
876 WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme); | 871 WebSecurityPolicy::registerURLSchemeAsSecure(extension_scheme); |
877 | 872 |
878 #if defined(OS_WIN) | 873 #if defined(OS_WIN) |
879 // We don't yet support Gears on non-Windows, so don't tell pages that we do. | 874 // We don't yet support Gears on non-Windows, so don't tell pages that we do. |
880 RegisterExtension(extensions_v8::GearsExtension::Get(), false); | 875 RegisterExtension(extensions_v8::GearsExtension::Get(), false); |
881 #endif | 876 #endif |
882 RegisterExtension(extensions_v8::LoadTimesExtension::Get(), false); | 877 RegisterExtension(extensions_v8::LoadTimesExtension::Get(), false); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 } | 1132 } |
1138 | 1133 |
1139 return false; | 1134 return false; |
1140 } | 1135 } |
1141 | 1136 |
1142 void RenderThread::RegisterExtension(v8::Extension* extension, | 1137 void RenderThread::RegisterExtension(v8::Extension* extension, |
1143 bool restrict_to_extensions) { | 1138 bool restrict_to_extensions) { |
1144 WebScriptController::registerExtension(extension); | 1139 WebScriptController::registerExtension(extension); |
1145 v8_extensions_[extension->name()] = restrict_to_extensions; | 1140 v8_extensions_[extension->name()] = restrict_to_extensions; |
1146 } | 1141 } |
OLD | NEW |