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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 // We may not have a navigation entry yet | 338 // We may not have a navigation entry yet |
339 NavigationEntry* entry = controller_.GetActiveEntry(); | 339 NavigationEntry* entry = controller_.GetActiveEntry(); |
340 return entry ? entry->virtual_url() : GURL::EmptyGURL(); | 340 return entry ? entry->virtual_url() : GURL::EmptyGURL(); |
341 } | 341 } |
342 | 342 |
343 const string16& TabContents::GetTitle() const { | 343 const string16& TabContents::GetTitle() const { |
344 // Transient entries take precedence. They are used for interstitial pages | 344 // Transient entries take precedence. They are used for interstitial pages |
345 // that are shown on top of existing pages. | 345 // that are shown on top of existing pages. |
346 NavigationEntry* entry = controller_.GetTransientEntry(); | 346 NavigationEntry* entry = controller_.GetTransientEntry(); |
347 std::string accept_languages = | 347 std::string accept_languages = |
348 content::GetContentClient()->browser()->GetAcceptLangs(this); | 348 content::GetContentClient()->browser()->GetAcceptLangs( |
| 349 this->browser_context()); |
349 if (entry) { | 350 if (entry) { |
350 return entry->GetTitleForDisplay(accept_languages); | 351 return entry->GetTitleForDisplay(accept_languages); |
351 } | 352 } |
352 WebUI* our_web_ui = render_manager_.pending_web_ui() ? | 353 WebUI* our_web_ui = render_manager_.pending_web_ui() ? |
353 render_manager_.pending_web_ui() : render_manager_.web_ui(); | 354 render_manager_.pending_web_ui() : render_manager_.web_ui(); |
354 if (our_web_ui) { | 355 if (our_web_ui) { |
355 // Don't override the title in view source mode. | 356 // Don't override the title in view source mode. |
356 entry = controller_.GetActiveEntry(); | 357 entry = controller_.GetActiveEntry(); |
357 if (!(entry && entry->IsViewSourceMode())) { | 358 if (!(entry && entry->IsViewSourceMode())) { |
358 // Give the Web UI the chance to override our title. | 359 // Give the Web UI the chance to override our title. |
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1761 if (!suppress_this_message) { | 1762 if (!suppress_this_message) { |
1762 content::JavaScriptDialogCreator::TitleType title_type; | 1763 content::JavaScriptDialogCreator::TitleType title_type; |
1763 string16 title; | 1764 string16 title; |
1764 | 1765 |
1765 if (!frame_url.has_host()) { | 1766 if (!frame_url.has_host()) { |
1766 title_type = content::JavaScriptDialogCreator::DIALOG_TITLE_NONE; | 1767 title_type = content::JavaScriptDialogCreator::DIALOG_TITLE_NONE; |
1767 } else { | 1768 } else { |
1768 title_type = content::JavaScriptDialogCreator::DIALOG_TITLE_FORMATTED_URL; | 1769 title_type = content::JavaScriptDialogCreator::DIALOG_TITLE_FORMATTED_URL; |
1769 title = net::FormatUrl( | 1770 title = net::FormatUrl( |
1770 frame_url.GetOrigin(), | 1771 frame_url.GetOrigin(), |
1771 content::GetContentClient()->browser()->GetAcceptLangs(this)); | 1772 content::GetContentClient()->browser()->GetAcceptLangs( |
| 1773 this->browser_context())); |
1772 } | 1774 } |
1773 | 1775 |
1774 dialog_creator_ = delegate_->GetJavaScriptDialogCreator(); | 1776 dialog_creator_ = delegate_->GetJavaScriptDialogCreator(); |
1775 dialog_creator_->RunJavaScriptDialog(this, | 1777 dialog_creator_->RunJavaScriptDialog(this, |
1776 title_type, | 1778 title_type, |
1777 title, | 1779 title, |
1778 flags, | 1780 flags, |
1779 message, | 1781 message, |
1780 default_prompt, | 1782 default_prompt, |
1781 reply_msg, | 1783 reply_msg, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 } | 1899 } |
1898 | 1900 |
1899 void TabContents::LoadStateChanged(const GURL& url, | 1901 void TabContents::LoadStateChanged(const GURL& url, |
1900 const net::LoadStateWithParam& load_state, | 1902 const net::LoadStateWithParam& load_state, |
1901 uint64 upload_position, | 1903 uint64 upload_position, |
1902 uint64 upload_size) { | 1904 uint64 upload_size) { |
1903 load_state_ = load_state; | 1905 load_state_ = load_state; |
1904 upload_position_ = upload_position; | 1906 upload_position_ = upload_position; |
1905 upload_size_ = upload_size; | 1907 upload_size_ = upload_size; |
1906 load_state_host_ = net::IDNToUnicode(url.host(), | 1908 load_state_host_ = net::IDNToUnicode(url.host(), |
1907 content::GetContentClient()->browser()->GetAcceptLangs(this)); | 1909 content::GetContentClient()->browser()->GetAcceptLangs( |
| 1910 this->browser_context())); |
1908 if (load_state_.state == net::LOAD_STATE_READING_RESPONSE) | 1911 if (load_state_.state == net::LOAD_STATE_READING_RESPONSE) |
1909 SetNotWaitingForResponse(); | 1912 SetNotWaitingForResponse(); |
1910 if (IsLoading()) | 1913 if (IsLoading()) |
1911 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB); | 1914 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_TAB); |
1912 } | 1915 } |
1913 | 1916 |
1914 void TabContents::WorkerCrashed() { | 1917 void TabContents::WorkerCrashed() { |
1915 if (delegate()) | 1918 if (delegate()) |
1916 delegate()->WorkerCrashed(this); | 1919 delegate()->WorkerCrashed(this); |
1917 } | 1920 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 | 2018 |
2016 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2019 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2017 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 2020 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
2018 rwh_view->SetSize(view()->GetContainerSize()); | 2021 rwh_view->SetSize(view()->GetContainerSize()); |
2019 } | 2022 } |
2020 | 2023 |
2021 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { | 2024 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { |
2022 return render_view_host() ? | 2025 return render_view_host() ? |
2023 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; | 2026 render_view_host()->GotResponseToLockMouseRequest(allowed) : false; |
2024 } | 2027 } |
OLD | NEW |