| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/tab_contents/web_contents.h" | 5 #include "chrome/browser/tab_contents/web_contents.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 363 } |
| 364 | 364 |
| 365 bool WebContents::ShouldDisplayURL() { | 365 bool WebContents::ShouldDisplayURL() { |
| 366 DOMUI* dom_ui = GetDOMUIForCurrentState(); | 366 DOMUI* dom_ui = GetDOMUIForCurrentState(); |
| 367 if (dom_ui) | 367 if (dom_ui) |
| 368 return !dom_ui->should_hide_url(); | 368 return !dom_ui->should_hide_url(); |
| 369 return true; | 369 return true; |
| 370 } | 370 } |
| 371 | 371 |
| 372 bool WebContents::ShouldDisplayFavIcon() { | 372 bool WebContents::ShouldDisplayFavIcon() { |
| 373 // Always display a throbber during pending loads. |
| 374 if (controller()->GetLastCommittedEntry() && controller()->GetPendingEntry()) |
| 375 return true; |
| 376 |
| 373 DOMUI* dom_ui = GetDOMUIForCurrentState(); | 377 DOMUI* dom_ui = GetDOMUIForCurrentState(); |
| 374 if (dom_ui) | 378 if (dom_ui) |
| 375 return !dom_ui->hide_favicon(); | 379 return !dom_ui->hide_favicon(); |
| 376 return true; | 380 return true; |
| 377 } | 381 } |
| 378 | 382 |
| 379 std::wstring WebContents::GetStatusText() const { | 383 std::wstring WebContents::GetStatusText() const { |
| 380 if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE) | 384 if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE) |
| 381 return std::wstring(); | 385 return std::wstring(); |
| 382 | 386 |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 HungRendererWarning::HideForWebContents(this); | 1501 HungRendererWarning::HideForWebContents(this); |
| 1498 } | 1502 } |
| 1499 | 1503 |
| 1500 void WebContents::LoadStateChanged(const GURL& url, | 1504 void WebContents::LoadStateChanged(const GURL& url, |
| 1501 net::LoadState load_state) { | 1505 net::LoadState load_state) { |
| 1502 load_state_ = load_state; | 1506 load_state_ = load_state; |
| 1503 load_state_host_ = UTF8ToWide(url.host()); | 1507 load_state_host_ = UTF8ToWide(url.host()); |
| 1504 if (load_state_ == net::LOAD_STATE_READING_RESPONSE) | 1508 if (load_state_ == net::LOAD_STATE_READING_RESPONSE) |
| 1505 SetNotWaitingForResponse(); | 1509 SetNotWaitingForResponse(); |
| 1506 if (is_loading()) | 1510 if (is_loading()) |
| 1507 NotifyNavigationStateChanged(INVALIDATE_LOAD); | 1511 NotifyNavigationStateChanged(INVALIDATE_LOAD | INVALIDATE_FAVICON); |
| 1508 } | 1512 } |
| 1509 | 1513 |
| 1510 void WebContents::OnDidGetApplicationInfo( | 1514 void WebContents::OnDidGetApplicationInfo( |
| 1511 int32 page_id, | 1515 int32 page_id, |
| 1512 const webkit_glue::WebApplicationInfo& info) { | 1516 const webkit_glue::WebApplicationInfo& info) { |
| 1513 if (pending_install_.page_id != page_id) | 1517 if (pending_install_.page_id != page_id) |
| 1514 return; // The user clicked create on a separate page. Ignore this. | 1518 return; // The user clicked create on a separate page. Ignore this. |
| 1515 | 1519 |
| 1516 pending_install_.callback_functor = | 1520 pending_install_.callback_functor = |
| 1517 new GearsCreateShortcutCallbackFunctor(this); | 1521 new GearsCreateShortcutCallbackFunctor(this); |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 // - For subsequent new tabs, they'll get a new SiteInstance which will then | 2018 // - For subsequent new tabs, they'll get a new SiteInstance which will then |
| 2015 // get switched to the one previously associated with the new tab pages. | 2019 // get switched to the one previously associated with the new tab pages. |
| 2016 // This switching will cause the manager to commit the RVH/DOMUI. So we'll | 2020 // This switching will cause the manager to commit the RVH/DOMUI. So we'll |
| 2017 // have a committed DOM UI in this case. | 2021 // have a committed DOM UI in this case. |
| 2018 // | 2022 // |
| 2019 // This condition handles all of these cases: | 2023 // This condition handles all of these cases: |
| 2020 // | 2024 // |
| 2021 // - First load in first tab: no committed nav entry + pending nav entry + | 2025 // - First load in first tab: no committed nav entry + pending nav entry + |
| 2022 // pending dom ui: | 2026 // pending dom ui: |
| 2023 // -> Use pending DOM UI if any. | 2027 // -> Use pending DOM UI if any. |
| 2024 // | 2028 // |
| 2025 // - First load in second tab: no committed nav entry + pending nav entry + | 2029 // - First load in second tab: no committed nav entry + pending nav entry + |
| 2026 // no pending DOM UI: | 2030 // no pending DOM UI: |
| 2027 // -> Use the committed DOM UI if any. | 2031 // -> Use the committed DOM UI if any. |
| 2028 // | 2032 // |
| 2029 // - Second navigation in any tab: committed nav entry + pending nav entry: | 2033 // - Second navigation in any tab: committed nav entry + pending nav entry: |
| 2030 // -> Use pending DOM UI if any. | 2034 // -> Use pending DOM UI if any. |
| 2031 // | 2035 // |
| 2032 // - Normal state with no load: committed nav entry + no pending nav entry: | 2036 // - Normal state with no load: committed nav entry + no pending nav entry: |
| 2033 // -> Use committed DOM UI. | 2037 // -> Use committed DOM UI. |
| 2034 if (controller()->GetPendingEntry() && | 2038 if (controller()->GetPendingEntry() && |
| 2035 (controller()->GetLastCommittedEntry() || | 2039 (controller()->GetLastCommittedEntry() || |
| 2036 render_manager_.pending_dom_ui())) | 2040 render_manager_.pending_dom_ui())) |
| 2037 return render_manager_.pending_dom_ui(); | 2041 return render_manager_.pending_dom_ui(); |
| 2038 return render_manager_.dom_ui(); | 2042 return render_manager_.dom_ui(); |
| 2039 } | 2043 } |
| OLD | NEW |