| 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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 // When it's the first load, we know either the pending one or the committed | 951 // When it's the first load, we know either the pending one or the committed |
| 952 // one will have the DOM UI in it (see GetDOMUIForCurrentState), and only one | 952 // one will have the DOM UI in it (see GetDOMUIForCurrentState), and only one |
| 953 // of them will be valid, so we can just check both. | 953 // of them will be valid, so we can just check both. |
| 954 if (render_manager_.pending_dom_ui()) | 954 if (render_manager_.pending_dom_ui()) |
| 955 return render_manager_.pending_dom_ui()->force_bookmark_bar_visible(); | 955 return render_manager_.pending_dom_ui()->force_bookmark_bar_visible(); |
| 956 if (render_manager_.dom_ui()) | 956 if (render_manager_.dom_ui()) |
| 957 return render_manager_.dom_ui()->force_bookmark_bar_visible(); | 957 return render_manager_.dom_ui()->force_bookmark_bar_visible(); |
| 958 return false; // Default. | 958 return false; // Default. |
| 959 } | 959 } |
| 960 | 960 |
| 961 bool TabContents::IsExtensionShelfAlwaysVisible() { |
| 962 // See GetDOMUIForCurrentState() comment for more info. This case is very |
| 963 // similar, but for non-first loads, we want to use the committed entry. This |
| 964 // is so the bookmarks bar disappears at the same time the page does. |
| 965 if (controller_.GetLastCommittedEntry()) { |
| 966 // Not the first load, always use the committed DOM UI. |
| 967 if (render_manager_.dom_ui()) |
| 968 return render_manager_.dom_ui()->force_extension_shelf_visible(); |
| 969 return false; // Default. |
| 970 } |
| 971 |
| 972 // When it's the first load, we know either the pending one or the committed |
| 973 // one will have the DOM UI in it (see GetDOMUIForCurrentState), and only one |
| 974 // of them will be valid, so we can just check both. |
| 975 if (render_manager_.pending_dom_ui()) |
| 976 return render_manager_.pending_dom_ui()->force_extension_shelf_visible(); |
| 977 if (render_manager_.dom_ui()) |
| 978 return render_manager_.dom_ui()->force_extension_shelf_visible(); |
| 979 return false; // Default. |
| 980 } |
| 981 |
| 961 void TabContents::ToolbarSizeChanged(bool is_animating) { | 982 void TabContents::ToolbarSizeChanged(bool is_animating) { |
| 962 TabContentsDelegate* d = delegate(); | 983 TabContentsDelegate* d = delegate(); |
| 963 if (d) | 984 if (d) |
| 964 d->ToolbarSizeChanged(this, is_animating); | 985 d->ToolbarSizeChanged(this, is_animating); |
| 965 } | 986 } |
| 966 | 987 |
| 967 void TabContents::OnStartDownload(DownloadItem* download) { | 988 void TabContents::OnStartDownload(DownloadItem* download) { |
| 968 DCHECK(download); | 989 DCHECK(download); |
| 969 | 990 |
| 970 // Download in a constrained popup is shown in the tab that opened it. | 991 // Download in a constrained popup is shown in the tab that opened it. |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2447 NavigationController::LoadCommittedDetails& committed_details = | 2468 NavigationController::LoadCommittedDetails& committed_details = |
| 2448 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); | 2469 *(Details<NavigationController::LoadCommittedDetails>(details).ptr()); |
| 2449 ExpireInfoBars(committed_details); | 2470 ExpireInfoBars(committed_details); |
| 2450 break; | 2471 break; |
| 2451 } | 2472 } |
| 2452 | 2473 |
| 2453 default: | 2474 default: |
| 2454 NOTREACHED(); | 2475 NOTREACHED(); |
| 2455 } | 2476 } |
| 2456 } | 2477 } |
| OLD | NEW |