| 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/renderer/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 631 |
| 632 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { | 632 bool ChromeContentRendererClient::ShouldPumpEventsDuringCookieMessage() { |
| 633 // We only need to pump events for chrome frame processes as the | 633 // We only need to pump events for chrome frame processes as the |
| 634 // cookie policy is controlled by the host browser (IE). If the | 634 // cookie policy is controlled by the host browser (IE). If the |
| 635 // policy is set to prompt then the host would put up UI which | 635 // policy is set to prompt then the host would put up UI which |
| 636 // would require plugins if any to also pump to ensure that we | 636 // would require plugins if any to also pump to ensure that we |
| 637 // don't have a deadlock. | 637 // don't have a deadlock. |
| 638 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame); | 638 return CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeFrame); |
| 639 } | 639 } |
| 640 | 640 |
| 641 void ChromeContentRendererClient::DidCreateScriptContext(WebFrame* frame) { | 641 void ChromeContentRendererClient::DidCreateScriptContext( |
| 642 // This can happen if the frame has JavaScript disabled. The context was | 642 WebFrame* frame, v8::Handle<v8::Context> context, int world_id) { |
| 643 // created but we can't access it through mainWorldScriptContext(). | |
| 644 if (frame->mainWorldScriptContext().IsEmpty()) | |
| 645 return; | |
| 646 | |
| 647 EventBindings::HandleContextCreated(frame, | |
| 648 frame->mainWorldScriptContext(), | |
| 649 extension_dispatcher_.get(), | |
| 650 0); // isolated world ID | |
| 651 } | |
| 652 | |
| 653 void ChromeContentRendererClient::DidDestroyScriptContext(WebFrame* frame) { | |
| 654 EventBindings::HandleContextDestroyed(frame); | |
| 655 } | |
| 656 | |
| 657 void ChromeContentRendererClient::DidCreateIsolatedScriptContext( | |
| 658 WebFrame* frame, int world_id, v8::Handle<v8::Context> context) { | |
| 659 EventBindings::HandleContextCreated(frame, | 643 EventBindings::HandleContextCreated(frame, |
| 660 context, | 644 context, |
| 661 extension_dispatcher_.get(), | 645 extension_dispatcher_.get(), |
| 662 world_id); | 646 world_id); |
| 663 } | 647 } |
| 664 | 648 |
| 649 void ChromeContentRendererClient::WillReleaseScriptContext( |
| 650 WebFrame* frame, v8::Handle<v8::Context> context, int world_id) { |
| 651 EventBindings::HandleContextDestroyed(frame); |
| 652 } |
| 653 |
| 665 unsigned long long ChromeContentRendererClient::VisitedLinkHash( | 654 unsigned long long ChromeContentRendererClient::VisitedLinkHash( |
| 666 const char* canonical_url, size_t length) { | 655 const char* canonical_url, size_t length) { |
| 667 return visited_link_slave_->ComputeURLFingerprint(canonical_url, length); | 656 return visited_link_slave_->ComputeURLFingerprint(canonical_url, length); |
| 668 } | 657 } |
| 669 | 658 |
| 670 bool ChromeContentRendererClient::IsLinkVisited(unsigned long long link_hash) { | 659 bool ChromeContentRendererClient::IsLinkVisited(unsigned long long link_hash) { |
| 671 return visited_link_slave_->IsVisited(link_hash); | 660 return visited_link_slave_->IsVisited(link_hash); |
| 672 } | 661 } |
| 673 | 662 |
| 674 void ChromeContentRendererClient::PrefetchHostName(const char* hostname, | 663 void ChromeContentRendererClient::PrefetchHostName(const char* hostname, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 if (spellcheck_.get()) | 756 if (spellcheck_.get()) |
| 768 thread->RemoveObserver(spellcheck_.get()); | 757 thread->RemoveObserver(spellcheck_.get()); |
| 769 SpellCheck* new_spellcheck = new SpellCheck(); | 758 SpellCheck* new_spellcheck = new SpellCheck(); |
| 770 if (spellcheck_provider_) | 759 if (spellcheck_provider_) |
| 771 spellcheck_provider_->SetSpellCheck(new_spellcheck); | 760 spellcheck_provider_->SetSpellCheck(new_spellcheck); |
| 772 spellcheck_.reset(new_spellcheck); | 761 spellcheck_.reset(new_spellcheck); |
| 773 thread->AddObserver(new_spellcheck); | 762 thread->AddObserver(new_spellcheck); |
| 774 } | 763 } |
| 775 | 764 |
| 776 } // namespace chrome | 765 } // namespace chrome |
| OLD | NEW |