OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.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 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 | 1228 |
1229 void TabContents::DidNavigateAnyFramePostCommit( | 1229 void TabContents::DidNavigateAnyFramePostCommit( |
1230 RenderViewHost* render_view_host, | 1230 RenderViewHost* render_view_host, |
1231 const NavigationController::LoadCommittedDetails& details, | 1231 const NavigationController::LoadCommittedDetails& details, |
1232 const ViewHostMsg_FrameNavigate_Params& params) { | 1232 const ViewHostMsg_FrameNavigate_Params& params) { |
1233 // If we navigate, start showing messages again. This does nothing to prevent | 1233 // If we navigate, start showing messages again. This does nothing to prevent |
1234 // a malicious script from spamming messages, since the script could just | 1234 // a malicious script from spamming messages, since the script could just |
1235 // reload the page to stop blocking. | 1235 // reload the page to stop blocking. |
1236 suppress_javascript_messages_ = false; | 1236 suppress_javascript_messages_ = false; |
1237 | 1237 |
1238 // Update history. Note that this needs to happen after the entry is complete, | |
1239 // which WillNavigate[Main,Sub]Frame will do before this function is called. | |
1240 if (params.should_update_history) { | |
1241 // Most of the time, the displayURL matches the loaded URL, but for about: | |
1242 // URLs, we use a data: URL as the real value. We actually want to save | |
1243 // the about: URL to the history db and keep the data: URL hidden. This is | |
1244 // what the TabContents' URL getter does. | |
1245 UpdateHistoryForNavigation(GetURL(), details, params); | |
1246 } | |
1247 | |
1248 // Notify the password manager of the navigation or form submit. | 1238 // Notify the password manager of the navigation or form submit. |
1249 // TODO(brettw) bug 1343111: Password manager stuff in here needs to be | 1239 // TODO(brettw) bug 1343111: Password manager stuff in here needs to be |
1250 // cleaned up and covered by tests. | 1240 // cleaned up and covered by tests. |
1251 if (params.password_form.origin.is_valid()) | 1241 if (params.password_form.origin.is_valid()) |
1252 GetPasswordManager()->ProvisionallySavePassword(params.password_form); | 1242 GetPasswordManager()->ProvisionallySavePassword(params.password_form); |
1253 } | 1243 } |
1254 | 1244 |
1255 void TabContents::MaybeCloseChildWindows(const GURL& previous_url, | 1245 void TabContents::MaybeCloseChildWindows(const GURL& previous_url, |
1256 const GURL& current_url) { | 1246 const GURL& current_url) { |
1257 if (net::RegistryControlledDomainService::SameDomainOrHost( | 1247 if (net::RegistryControlledDomainService::SameDomainOrHost( |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1568 // determine whether or not to enable the encoding menu. | 1558 // determine whether or not to enable the encoding menu. |
1569 // It's updated only for the main frame. For a subframe, | 1559 // It's updated only for the main frame. For a subframe, |
1570 // RenderView::UpdateURL does not set params.contents_mime_type. | 1560 // RenderView::UpdateURL does not set params.contents_mime_type. |
1571 // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) | 1561 // (see http://code.google.com/p/chromium/issues/detail?id=2929 ) |
1572 // TODO(jungshik): Add a test for the encoding menu to avoid | 1562 // TODO(jungshik): Add a test for the encoding menu to avoid |
1573 // regressing it again. | 1563 // regressing it again. |
1574 if (PageTransition::IsMainFrame(params.transition)) | 1564 if (PageTransition::IsMainFrame(params.transition)) |
1575 contents_mime_type_ = params.contents_mime_type; | 1565 contents_mime_type_ = params.contents_mime_type; |
1576 | 1566 |
1577 NavigationController::LoadCommittedDetails details; | 1567 NavigationController::LoadCommittedDetails details; |
1578 if (!controller_.RendererDidNavigate(params, &details)) | 1568 bool did_navigate = controller_.RendererDidNavigate(params, &details); |
1579 return; // No navigation happened. | 1569 |
| 1570 // Update history. Note that this needs to happen after the entry is complete, |
| 1571 // which WillNavigate[Main,Sub]Frame will do before this function is called. |
| 1572 if (params.should_update_history) { |
| 1573 // Most of the time, the displayURL matches the loaded URL, but for about: |
| 1574 // URLs, we use a data: URL as the real value. We actually want to save |
| 1575 // the about: URL to the history db and keep the data: URL hidden. This is |
| 1576 // what the TabContents' URL getter does. |
| 1577 UpdateHistoryForNavigation(GetURL(), details, params); |
| 1578 } |
| 1579 |
| 1580 if (!did_navigate) |
| 1581 return; // No navigation happened. |
1580 | 1582 |
1581 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen | 1583 // DO NOT ADD MORE STUFF TO THIS FUNCTION! Your component should either listen |
1582 // for the appropriate notification (best) or you can add it to | 1584 // for the appropriate notification (best) or you can add it to |
1583 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if | 1585 // DidNavigateMainFramePostCommit / DidNavigateAnyFramePostCommit (only if |
1584 // necessary, please). | 1586 // necessary, please). |
1585 | 1587 |
1586 // Run post-commit tasks. | 1588 // Run post-commit tasks. |
1587 if (details.is_main_frame) | 1589 if (details.is_main_frame) |
1588 DidNavigateMainFramePostCommit(details, params); | 1590 DidNavigateMainFramePostCommit(details, params); |
1589 DidNavigateAnyFramePostCommit(rvh, details, params); | 1591 DidNavigateAnyFramePostCommit(rvh, details, params); |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2330 NavigationController::LoadCommittedDetails& committed_details = | 2332 NavigationController::LoadCommittedDetails& committed_details = |
2331 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); | 2333 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); |
2332 ExpireInfoBars(committed_details); | 2334 ExpireInfoBars(committed_details); |
2333 break; | 2335 break; |
2334 } | 2336 } |
2335 | 2337 |
2336 default: | 2338 default: |
2337 NOTREACHED(); | 2339 NOTREACHED(); |
2338 } | 2340 } |
2339 } | 2341 } |
OLD | NEW |