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 "content/browser/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 1779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 transition_type, | 1790 transition_type, |
1791 source_frame_id)); | 1791 source_frame_id)); |
1792 } | 1792 } |
1793 } | 1793 } |
1794 | 1794 |
1795 void TabContents::RunJavaScriptMessage( | 1795 void TabContents::RunJavaScriptMessage( |
1796 const RenderViewHost* rvh, | 1796 const RenderViewHost* rvh, |
1797 const string16& message, | 1797 const string16& message, |
1798 const string16& default_prompt, | 1798 const string16& default_prompt, |
1799 const GURL& frame_url, | 1799 const GURL& frame_url, |
1800 const int flags, | 1800 ui::JavascriptMessageType javascript_message_type, |
1801 IPC::Message* reply_msg, | 1801 IPC::Message* reply_msg, |
1802 bool* did_suppress_message) { | 1802 bool* did_suppress_message) { |
1803 // Suppress JavaScript dialogs when requested. Also suppress messages when | 1803 // Suppress JavaScript dialogs when requested. Also suppress messages when |
1804 // showing an interstitial as it's shown over the previous page and we don't | 1804 // showing an interstitial as it's shown over the previous page and we don't |
1805 // want the hidden page's dialogs to interfere with the interstitial. | 1805 // want the hidden page's dialogs to interfere with the interstitial. |
1806 bool suppress_this_message = | 1806 bool suppress_this_message = |
1807 rvh->is_swapped_out() || | 1807 rvh->is_swapped_out() || |
1808 showing_interstitial_page() || | 1808 showing_interstitial_page() || |
1809 !delegate_ || | 1809 !delegate_ || |
1810 delegate_->ShouldSuppressDialogs(); | 1810 delegate_->ShouldSuppressDialogs(); |
1811 | 1811 |
1812 if (!suppress_this_message) { | 1812 if (!suppress_this_message) { |
1813 content::JavaScriptDialogCreator::TitleType title_type; | 1813 content::JavaScriptDialogCreator::TitleType title_type; |
1814 string16 title; | 1814 string16 title; |
1815 | 1815 |
1816 if (!frame_url.has_host()) { | 1816 if (!frame_url.has_host()) { |
1817 title_type = content::JavaScriptDialogCreator::DIALOG_TITLE_NONE; | 1817 title_type = content::JavaScriptDialogCreator::DIALOG_TITLE_NONE; |
1818 } else { | 1818 } else { |
1819 title_type = content::JavaScriptDialogCreator::DIALOG_TITLE_FORMATTED_URL; | 1819 title_type = content::JavaScriptDialogCreator::DIALOG_TITLE_FORMATTED_URL; |
1820 title = net::FormatUrl( | 1820 title = net::FormatUrl( |
1821 frame_url.GetOrigin(), | 1821 frame_url.GetOrigin(), |
1822 content::GetContentClient()->browser()->GetAcceptLangs( | 1822 content::GetContentClient()->browser()->GetAcceptLangs( |
1823 this->browser_context())); | 1823 this->browser_context())); |
1824 } | 1824 } |
1825 | 1825 |
1826 dialog_creator_ = delegate_->GetJavaScriptDialogCreator(); | 1826 dialog_creator_ = delegate_->GetJavaScriptDialogCreator(); |
1827 dialog_creator_->RunJavaScriptDialog(this, | 1827 dialog_creator_->RunJavaScriptDialog(this, |
1828 title_type, | 1828 title_type, |
1829 title, | 1829 title, |
1830 flags, | 1830 javascript_message_type, |
1831 message, | 1831 message, |
1832 default_prompt, | 1832 default_prompt, |
1833 reply_msg, | 1833 reply_msg, |
1834 &suppress_this_message); | 1834 &suppress_this_message); |
1835 } | 1835 } |
1836 | 1836 |
1837 if (suppress_this_message) { | 1837 if (suppress_this_message) { |
1838 // If we are suppressing messages, just reply as if the user immediately | 1838 // If we are suppressing messages, just reply as if the user immediately |
1839 // pressed "Cancel". | 1839 // pressed "Cancel". |
1840 OnDialogClosed(reply_msg, false, string16()); | 1840 OnDialogClosed(reply_msg, false, string16()); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2069 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2070 // Can be NULL during tests. | 2070 // Can be NULL during tests. |
2071 if (rwh_view) | 2071 if (rwh_view) |
2072 rwh_view->SetSize(view()->GetContainerSize()); | 2072 rwh_view->SetSize(view()->GetContainerSize()); |
2073 } | 2073 } |
2074 | 2074 |
2075 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { | 2075 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { |
2076 return render_view_host() ? | 2076 return render_view_host() ? |
2077 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; | 2077 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; |
2078 } | 2078 } |
OLD | NEW |