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

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

Issue 7069006: Prevent registerProtocolHandler for pseudo-schemes and disabled schemes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing include Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tab_contents/tab_contents_wrapper.h" 5 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "chrome/browser/autocomplete_history_manager.h" 9 #include "chrome/browser/autocomplete_history_manager.h"
10 #include "chrome/browser/autofill/autofill_manager.h" 10 #include "chrome/browser/autofill/autofill_manager.h"
(...skipping 27 matching lines...) Expand all
38 #include "chrome/browser/translate/translate_tab_helper.h" 38 #include "chrome/browser/translate/translate_tab_helper.h"
39 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 39 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
40 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" 40 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
41 #include "chrome/browser/ui/download/download_tab_helper.h" 41 #include "chrome/browser/ui/download/download_tab_helper.h"
42 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 42 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
43 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" 43 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
44 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h" 44 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h"
45 #include "chrome/common/chrome_switches.h" 45 #include "chrome/common/chrome_switches.h"
46 #include "chrome/common/pref_names.h" 46 #include "chrome/common/pref_names.h"
47 #include "chrome/common/render_messages.h" 47 #include "chrome/common/render_messages.h"
48 #include "content/browser/child_process_security_policy.h"
48 #include "content/browser/renderer_host/render_view_host.h" 49 #include "content/browser/renderer_host/render_view_host.h"
49 #include "content/browser/tab_contents/tab_contents.h" 50 #include "content/browser/tab_contents/tab_contents.h"
50 #include "content/common/notification_service.h" 51 #include "content/common/notification_service.h"
51 #include "content/common/view_messages.h" 52 #include "content/common/view_messages.h"
52 #include "grit/generated_resources.h" 53 #include "grit/generated_resources.h"
53 #include "grit/locale_settings.h" 54 #include "grit/locale_settings.h"
54 #include "grit/platform_locale_settings.h" 55 #include "grit/platform_locale_settings.h"
55 #include "ui/base/l10n/l10n_util.h" 56 #include "ui/base/l10n/l10n_util.h"
56 #include "webkit/glue/webpreferences.h" 57 #include "webkit/glue/webpreferences.h"
57 58
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // Internal helpers 497 // Internal helpers
497 498
498 void TabContentsWrapper::OnJSOutOfMemory() { 499 void TabContentsWrapper::OnJSOutOfMemory() {
499 AddInfoBar(new SimpleAlertInfoBarDelegate(tab_contents(), 500 AddInfoBar(new SimpleAlertInfoBarDelegate(tab_contents(),
500 NULL, l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), true)); 501 NULL, l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), true));
501 } 502 }
502 503
503 void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol, 504 void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol,
504 const GURL& url, 505 const GURL& url,
505 const string16& title) { 506 const string16& title) {
507 ChildProcessSecurityPolicy* policy =
508 ChildProcessSecurityPolicy::GetInstance();
509 if (policy->IsPseudoScheme(protocol) || policy->IsDisabledScheme(protocol))
510 return;
511
506 ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry(); 512 ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry();
507 if (!registry->enabled()) { 513 if (!registry->enabled())
508 return; 514 return;
509 } 515
510 ProtocolHandler handler = 516 ProtocolHandler handler =
511 ProtocolHandler::CreateProtocolHandler(protocol, url, title); 517 ProtocolHandler::CreateProtocolHandler(protocol, url, title);
512 if (!handler.IsEmpty() && 518 if (!handler.IsEmpty() &&
513 registry->CanSchemeBeOverridden(handler.protocol())) { 519 registry->CanSchemeBeOverridden(handler.protocol())) {
514 AddInfoBar(registry->IsRegistered(handler) ? 520 AddInfoBar(registry->IsRegistered(handler) ?
515 static_cast<InfoBarDelegate*>(new SimpleAlertInfoBarDelegate( 521 static_cast<InfoBarDelegate*>(new SimpleAlertInfoBarDelegate(
516 tab_contents(), NULL, l10n_util::GetStringFUTF16( 522 tab_contents(), NULL, l10n_util::GetStringFUTF16(
517 IDS_REGISTER_PROTOCOL_HANDLER_ALREADY_REGISTERED, 523 IDS_REGISTER_PROTOCOL_HANDLER_ALREADY_REGISTERED,
518 handler.title(), UTF8ToUTF16(handler.protocol())), true)) : 524 handler.title(), UTF8ToUTF16(handler.protocol())), true)) :
519 new RegisterProtocolHandlerInfoBarDelegate(tab_contents(), registry, 525 new RegisterProtocolHandlerInfoBarDelegate(tab_contents(), registry,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 void TabContentsWrapper::UpdateWebPreferences() { 561 void TabContentsWrapper::UpdateWebPreferences() {
556 RenderViewHostDelegate* rvhd = tab_contents(); 562 RenderViewHostDelegate* rvhd = tab_contents();
557 Send(new ViewMsg_UpdateWebPreferences(routing_id(), rvhd->GetWebkitPrefs())); 563 Send(new ViewMsg_UpdateWebPreferences(routing_id(), rvhd->GetWebkitPrefs()));
558 } 564 }
559 565
560 void TabContentsWrapper::UpdateRendererPreferences() { 566 void TabContentsWrapper::UpdateRendererPreferences() {
561 renderer_preferences_util::UpdateFromSystemSettings( 567 renderer_preferences_util::UpdateFromSystemSettings(
562 tab_contents()->GetMutableRendererPrefs(), profile()); 568 tab_contents()->GetMutableRendererPrefs(), profile());
563 render_view_host()->SyncRendererPrefs(); 569 render_view_host()->SyncRendererPrefs();
564 } 570 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698