OLD | NEW |
---|---|
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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
423 // Internal helpers | 423 // Internal helpers |
424 | 424 |
425 void TabContentsWrapper::OnJSOutOfMemory() { | 425 void TabContentsWrapper::OnJSOutOfMemory() { |
426 AddInfoBar(new SimpleAlertInfoBarDelegate(tab_contents(), | 426 AddInfoBar(new SimpleAlertInfoBarDelegate(tab_contents(), |
427 NULL, l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), true)); | 427 NULL, l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT), true)); |
428 } | 428 } |
429 | 429 |
430 void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol, | 430 void TabContentsWrapper::OnRegisterProtocolHandler(const std::string& protocol, |
431 const GURL& url, | 431 const GURL& url, |
432 const string16& title) { | 432 const string16& title) { |
433 ChildProcessSecurityPolicy* policy = | |
434 ChildProcessSecurityPolicy::GetInstance(); | |
tony
2011/05/25 17:42:59
Nit: 4 space indent when wrapping
koz (OOO until 15th September)
2011/05/25 21:40:12
Done.
| |
435 if (policy->IsPseudoScheme(protocol) || policy->IsDisabledScheme(protocol)) | |
436 return; | |
437 | |
433 ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry(); | 438 ProtocolHandlerRegistry* registry = profile()->GetProtocolHandlerRegistry(); |
434 if (!registry->enabled()) { | 439 if (!registry->enabled()) |
435 return; | 440 return; |
436 } | 441 |
437 ProtocolHandler handler = | 442 ProtocolHandler handler = |
438 ProtocolHandler::CreateProtocolHandler(protocol, url, title); | 443 ProtocolHandler::CreateProtocolHandler(protocol, url, title); |
439 if (!handler.IsEmpty() && | 444 if (!handler.IsEmpty() && |
440 registry->CanSchemeBeOverridden(handler.protocol())) { | 445 registry->CanSchemeBeOverridden(handler.protocol())) { |
441 AddInfoBar(registry->IsRegistered(handler) ? | 446 AddInfoBar(registry->IsRegistered(handler) ? |
442 static_cast<InfoBarDelegate*>(new SimpleAlertInfoBarDelegate( | 447 static_cast<InfoBarDelegate*>(new SimpleAlertInfoBarDelegate( |
443 tab_contents(), NULL, l10n_util::GetStringFUTF16( | 448 tab_contents(), NULL, l10n_util::GetStringFUTF16( |
444 IDS_REGISTER_PROTOCOL_HANDLER_ALREADY_REGISTERED, | 449 IDS_REGISTER_PROTOCOL_HANDLER_ALREADY_REGISTERED, |
445 handler.title(), UTF8ToUTF16(handler.protocol())), true)) : | 450 handler.title(), UTF8ToUTF16(handler.protocol())), true)) : |
446 new RegisterProtocolHandlerInfoBarDelegate(tab_contents(), registry, | 451 new RegisterProtocolHandlerInfoBarDelegate(tab_contents(), registry, |
447 handler)); | 452 handler)); |
448 } | 453 } |
449 } | 454 } |
450 | 455 |
451 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { | 456 void TabContentsWrapper::OnSnapshot(const SkBitmap& bitmap) { |
452 NotificationService::current()->Notify( | 457 NotificationService::current()->Notify( |
453 NotificationType::TAB_SNAPSHOT_TAKEN, | 458 NotificationType::TAB_SNAPSHOT_TAKEN, |
454 Source<TabContentsWrapper>(this), | 459 Source<TabContentsWrapper>(this), |
455 Details<const SkBitmap>(&bitmap)); | 460 Details<const SkBitmap>(&bitmap)); |
456 } | 461 } |
457 | 462 |
458 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { | 463 void TabContentsWrapper::OnPDFHasUnsupportedFeature() { |
459 PDFHasUnsupportedFeature(this); | 464 PDFHasUnsupportedFeature(this); |
460 } | 465 } |
OLD | NEW |