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

Side by Side Diff: chrome/renderer/render_thread.cc

Issue 293021: Introduce WebSecurityPolicy for security related methods (Closed)
Patch Set: socket needs weburl import Created 11 years, 2 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
« no previous file with comments | « chrome/renderer/extensions/extension_process_bindings.cc ('k') | webkit/api/public/WebKit.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "chrome/renderer/renderer_webkitclient_impl.h" 45 #include "chrome/renderer/renderer_webkitclient_impl.h"
46 #include "chrome/renderer/user_script_slave.h" 46 #include "chrome/renderer/user_script_slave.h"
47 #include "ipc/ipc_message.h" 47 #include "ipc/ipc_message.h"
48 #include "webkit/api/public/WebCache.h" 48 #include "webkit/api/public/WebCache.h"
49 #include "webkit/api/public/WebColor.h" 49 #include "webkit/api/public/WebColor.h"
50 #include "webkit/api/public/WebCrossOriginPreflightResultCache.h" 50 #include "webkit/api/public/WebCrossOriginPreflightResultCache.h"
51 #include "webkit/api/public/WebFontCache.h" 51 #include "webkit/api/public/WebFontCache.h"
52 #include "webkit/api/public/WebColor.h" 52 #include "webkit/api/public/WebColor.h"
53 #include "webkit/api/public/WebKit.h" 53 #include "webkit/api/public/WebKit.h"
54 #include "webkit/api/public/WebScriptController.h" 54 #include "webkit/api/public/WebScriptController.h"
55 #include "webkit/api/public/WebSecurityPolicy.h"
55 #include "webkit/api/public/WebStorageEventDispatcher.h" 56 #include "webkit/api/public/WebStorageEventDispatcher.h"
56 #include "webkit/api/public/WebString.h" 57 #include "webkit/api/public/WebString.h"
57 #include "webkit/extensions/v8/benchmarking_extension.h" 58 #include "webkit/extensions/v8/benchmarking_extension.h"
58 #include "webkit/extensions/v8/gears_extension.h" 59 #include "webkit/extensions/v8/gears_extension.h"
59 #include "webkit/extensions/v8/interval_extension.h" 60 #include "webkit/extensions/v8/interval_extension.h"
60 #include "webkit/extensions/v8/playback_extension.h" 61 #include "webkit/extensions/v8/playback_extension.h"
61 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h" 62 #include "third_party/tcmalloc/tcmalloc/src/google/malloc_extension.h"
62 63
63 #if defined(OS_WIN) 64 #if defined(OS_WIN)
64 #include <windows.h> 65 #include <windows.h>
65 #include <objbase.h> 66 #include <objbase.h>
66 #endif 67 #endif
67 68
68 using WebKit::WebCache; 69 using WebKit::WebCache;
69 using WebKit::WebCrossOriginPreflightResultCache; 70 using WebKit::WebCrossOriginPreflightResultCache;
70 using WebKit::WebFontCache; 71 using WebKit::WebFontCache;
72 using WebKit::WebSecurityPolicy;
71 using WebKit::WebString; 73 using WebKit::WebString;
72 using WebKit::WebStorageEventDispatcher; 74 using WebKit::WebStorageEventDispatcher;
73 using WebKit::WebView; 75 using WebKit::WebView;
74 76
75 namespace { 77 namespace {
76 static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */; 78 static const unsigned int kCacheStatsDelayMS = 2000 /* milliseconds */;
77 static const double kInitialIdleHandlerDelayS = 1.0 /* seconds */; 79 static const double kInitialIdleHandlerDelayS = 1.0 /* seconds */;
78 80
79 static base::LazyInstance<base::ThreadLocalPointer<RenderThread> > lazy_tls( 81 static base::LazyInstance<base::ThreadLocalPointer<RenderThread> > lazy_tls(
80 base::LINKER_INITIALIZED); 82 base::LINKER_INITIALIZED);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 441
440 webkit_client_.reset(new RendererWebKitClientImpl); 442 webkit_client_.reset(new RendererWebKitClientImpl);
441 WebKit::initialize(webkit_client_.get()); 443 WebKit::initialize(webkit_client_.get());
442 444
443 WebKit::enableV8SingleThreadMode(); 445 WebKit::enableV8SingleThreadMode();
444 446
445 // chrome: pages should not be accessible by normal content, and should 447 // chrome: pages should not be accessible by normal content, and should
446 // also be unable to script anything but themselves (to help limit the damage 448 // also be unable to script anything but themselves (to help limit the damage
447 // that a corrupt chrome: page could cause). 449 // that a corrupt chrome: page could cause).
448 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme)); 450 WebString chrome_ui_scheme(ASCIIToUTF16(chrome::kChromeUIScheme));
449 WebKit::registerURLSchemeAsLocal(chrome_ui_scheme); 451 WebSecurityPolicy::registerURLSchemeAsLocal(chrome_ui_scheme);
450 WebKit::registerURLSchemeAsNoAccess(chrome_ui_scheme); 452 WebSecurityPolicy::registerURLSchemeAsNoAccess(chrome_ui_scheme);
451 453
452 // print: pages should be not accessible by normal context. 454 // print: pages should be not accessible by normal context.
453 WebString print_ui_scheme(ASCIIToUTF16(chrome::kPrintScheme)); 455 WebString print_ui_scheme(ASCIIToUTF16(chrome::kPrintScheme));
454 WebKit::registerURLSchemeAsLocal(print_ui_scheme); 456 WebSecurityPolicy::registerURLSchemeAsLocal(print_ui_scheme);
455 WebKit::registerURLSchemeAsNoAccess(print_ui_scheme); 457 WebSecurityPolicy::registerURLSchemeAsNoAccess(print_ui_scheme);
456 458
457 #if defined(OS_WIN) 459 #if defined(OS_WIN)
458 // We don't yet support Gears on non-Windows, so don't tell pages that we do. 460 // We don't yet support Gears on non-Windows, so don't tell pages that we do.
459 WebKit::registerExtension(extensions_v8::GearsExtension::Get()); 461 WebKit::registerExtension(extensions_v8::GearsExtension::Get());
460 #endif 462 #endif
461 WebKit::registerExtension(extensions_v8::IntervalExtension::Get()); 463 WebKit::registerExtension(extensions_v8::IntervalExtension::Get());
462 WebKit::registerExtension(extensions_v8::LoadTimesExtension::Get()); 464 WebKit::registerExtension(extensions_v8::LoadTimesExtension::Get());
463 WebKit::registerExtension(extensions_v8::ExternalExtension::Get()); 465 WebKit::registerExtension(extensions_v8::ExternalExtension::Get());
464 466
465 const WebKit::WebString kExtensionScheme = 467 const WebKit::WebString kExtensionScheme =
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 void RenderThread::OnPurgePluginListCache(bool reload_pages) { 567 void RenderThread::OnPurgePluginListCache(bool reload_pages) {
566 EnsureWebKitInitialized(); 568 EnsureWebKitInitialized();
567 // The call below will cause a GetPlugins call with refresh=true, but at this 569 // The call below will cause a GetPlugins call with refresh=true, but at this
568 // point we already know that the browser has refreshed its list, so disable 570 // point we already know that the browser has refreshed its list, so disable
569 // refresh temporarily to prevent each renderer process causing the list to be 571 // refresh temporarily to prevent each renderer process causing the list to be
570 // regenerated. 572 // regenerated.
571 plugin_refresh_allowed_ = false; 573 plugin_refresh_allowed_ = false;
572 WebKit::resetPluginCache(reload_pages); 574 WebKit::resetPluginCache(reload_pages);
573 plugin_refresh_allowed_ = true; 575 plugin_refresh_allowed_ = true;
574 } 576 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/extension_process_bindings.cc ('k') | webkit/api/public/WebKit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698