Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 6513010: WebUI: Get rid of more references to DOMUI in the rest of the directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/tab_contents/tab_contents.h" 5 #include "chrome/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 } 660 }
661 661
662 bool TabContents::ShouldDisplayURL() { 662 bool TabContents::ShouldDisplayURL() {
663 // Don't hide the url in view source mode and with interstitials. 663 // Don't hide the url in view source mode and with interstitials.
664 NavigationEntry* entry = controller_.GetActiveEntry(); 664 NavigationEntry* entry = controller_.GetActiveEntry();
665 if (entry && (entry->IsViewSourceMode() || 665 if (entry && (entry->IsViewSourceMode() ||
666 entry->page_type() == INTERSTITIAL_PAGE)) { 666 entry->page_type() == INTERSTITIAL_PAGE)) {
667 return true; 667 return true;
668 } 668 }
669 669
670 WebUI* web_ui = GetDOMUIForCurrentState(); 670 WebUI* web_ui = GetWebUIForCurrentState();
671 if (web_ui) 671 if (web_ui)
672 return !web_ui->should_hide_url(); 672 return !web_ui->should_hide_url();
673 return true; 673 return true;
674 } 674 }
675 675
676 SkBitmap TabContents::GetFavIcon() const { 676 SkBitmap TabContents::GetFavIcon() const {
677 // Like GetTitle(), we also want to use the favicon for the last committed 677 // Like GetTitle(), we also want to use the favicon for the last committed
678 // entry rather than a pending navigation entry. 678 // entry rather than a pending navigation entry.
679 NavigationEntry* entry = controller_.GetTransientEntry(); 679 NavigationEntry* entry = controller_.GetTransientEntry();
680 if (entry) 680 if (entry)
(...skipping 15 matching lines...) Expand all
696 return entry->favicon().is_valid(); 696 return entry->favicon().is_valid();
697 697
698 return false; 698 return false;
699 } 699 }
700 700
701 bool TabContents::ShouldDisplayFavIcon() { 701 bool TabContents::ShouldDisplayFavIcon() {
702 // Always display a throbber during pending loads. 702 // Always display a throbber during pending loads.
703 if (controller_.GetLastCommittedEntry() && controller_.pending_entry()) 703 if (controller_.GetLastCommittedEntry() && controller_.pending_entry())
704 return true; 704 return true;
705 705
706 WebUI* web_ui = GetDOMUIForCurrentState(); 706 WebUI* web_ui = GetWebUIForCurrentState();
707 if (web_ui) 707 if (web_ui)
708 return !web_ui->hide_favicon(); 708 return !web_ui->hide_favicon();
709 return true; 709 return true;
710 } 710 }
711 711
712 string16 TabContents::GetStatusText() const { 712 string16 TabContents::GetStatusText() const {
713 if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE) 713 if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE)
714 return string16(); 714 return string16();
715 715
716 switch (load_state_) { 716 switch (load_state_) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 1086
1087 void TabContents::FocusThroughTabTraversal(bool reverse) { 1087 void TabContents::FocusThroughTabTraversal(bool reverse) {
1088 if (showing_interstitial_page()) { 1088 if (showing_interstitial_page()) {
1089 render_manager_.interstitial_page()->FocusThroughTabTraversal(reverse); 1089 render_manager_.interstitial_page()->FocusThroughTabTraversal(reverse);
1090 return; 1090 return;
1091 } 1091 }
1092 render_view_host()->SetInitialFocus(reverse); 1092 render_view_host()->SetInitialFocus(reverse);
1093 } 1093 }
1094 1094
1095 bool TabContents::FocusLocationBarByDefault() { 1095 bool TabContents::FocusLocationBarByDefault() {
1096 WebUI* web_ui = GetDOMUIForCurrentState(); 1096 WebUI* web_ui = GetWebUIForCurrentState();
1097 if (web_ui) 1097 if (web_ui)
1098 return web_ui->focus_location_bar_by_default(); 1098 return web_ui->focus_location_bar_by_default();
1099 NavigationEntry* entry = controller_.GetActiveEntry(); 1099 NavigationEntry* entry = controller_.GetActiveEntry();
1100 if (entry && entry->url() == GURL(chrome::kAboutBlankURL)) 1100 if (entry && entry->url() == GURL(chrome::kAboutBlankURL))
1101 return true; 1101 return true;
1102 return false; 1102 return false;
1103 } 1103 }
1104 1104
1105 void TabContents::SetFocusToLocationBar(bool select_all) { 1105 void TabContents::SetFocusToLocationBar(bool select_all) {
1106 if (delegate()) 1106 if (delegate())
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 } 1191 }
1192 1192
1193 bool TabContents::ShouldShowBookmarkBar() { 1193 bool TabContents::ShouldShowBookmarkBar() {
1194 if (showing_interstitial_page()) 1194 if (showing_interstitial_page())
1195 return false; 1195 return false;
1196 1196
1197 // Do not show bookmarks bar if bookmarks aren't enabled. 1197 // Do not show bookmarks bar if bookmarks aren't enabled.
1198 if (!browser_defaults::bookmarks_enabled) 1198 if (!browser_defaults::bookmarks_enabled)
1199 return false; 1199 return false;
1200 1200
1201 // See GetDOMUIForCurrentState() comment for more info. This case is very 1201 // See GetWebUIForCurrentState() comment for more info. This case is very
1202 // similar, but for non-first loads, we want to use the committed entry. This 1202 // similar, but for non-first loads, we want to use the committed entry. This
1203 // is so the bookmarks bar disappears at the same time the page does. 1203 // is so the bookmarks bar disappears at the same time the page does.
1204 if (controller_.GetLastCommittedEntry()) { 1204 if (controller_.GetLastCommittedEntry()) {
1205 // Not the first load, always use the committed Web UI. 1205 // Not the first load, always use the committed Web UI.
1206 return (render_manager_.web_ui() == NULL) ? 1206 return (render_manager_.web_ui() == NULL) ?
1207 false : render_manager_.web_ui()->force_bookmark_bar_visible(); 1207 false : render_manager_.web_ui()->force_bookmark_bar_visible();
1208 } 1208 }
1209 1209
1210 // When it's the first load, we know either the pending one or the committed 1210 // When it's the first load, we know either the pending one or the committed
1211 // one will have the Web UI in it (see GetDOMUIForCurrentState), and only one 1211 // one will have the Web UI in it (see GetWebUIForCurrentState), and only one
1212 // of them will be valid, so we can just check both. 1212 // of them will be valid, so we can just check both.
1213 if (render_manager_.pending_web_ui()) 1213 if (render_manager_.pending_web_ui())
1214 return render_manager_.pending_web_ui()->force_bookmark_bar_visible(); 1214 return render_manager_.pending_web_ui()->force_bookmark_bar_visible();
1215 return (render_manager_.web_ui() == NULL) ? 1215 return (render_manager_.web_ui() == NULL) ?
1216 false : render_manager_.web_ui()->force_bookmark_bar_visible(); 1216 false : render_manager_.web_ui()->force_bookmark_bar_visible();
1217 } 1217 }
1218 1218
1219 void TabContents::ToolbarSizeChanged(bool is_animating) { 1219 void TabContents::ToolbarSizeChanged(bool is_animating) {
1220 TabContentsDelegate* d = delegate(); 1220 TabContentsDelegate* d = delegate();
1221 if (d) 1221 if (d)
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 // NOTE: It is not safe to change the following code to count upwards or use 1726 // NOTE: It is not safe to change the following code to count upwards or use
1727 // iterators, as the RemoveInfoBar() call synchronously modifies our delegate 1727 // iterators, as the RemoveInfoBar() call synchronously modifies our delegate
1728 // list. 1728 // list.
1729 for (size_t i = infobar_count(); i > 0; --i) { 1729 for (size_t i = infobar_count(); i > 0; --i) {
1730 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i - 1); 1730 InfoBarDelegate* delegate = GetInfoBarDelegateAt(i - 1);
1731 if (delegate->ShouldExpire(details)) 1731 if (delegate->ShouldExpire(details))
1732 RemoveInfoBar(delegate); 1732 RemoveInfoBar(delegate);
1733 } 1733 }
1734 } 1734 }
1735 1735
1736 WebUI* TabContents::GetDOMUIForCurrentState() { 1736 WebUI* TabContents::GetWebUIForCurrentState() {
1737 // When there is a pending navigation entry, we want to use the pending WebUI 1737 // When there is a pending navigation entry, we want to use the pending WebUI
1738 // that goes along with it to control the basic flags. For example, we want to 1738 // that goes along with it to control the basic flags. For example, we want to
1739 // show the pending URL in the URL bar, so we want the display_url flag to 1739 // show the pending URL in the URL bar, so we want the display_url flag to
1740 // be from the pending entry. 1740 // be from the pending entry.
1741 // 1741 //
1742 // The confusion comes because there are multiple possibilities for the 1742 // The confusion comes because there are multiple possibilities for the
1743 // initial load in a tab as a side effect of the way the RenderViewHostManager 1743 // initial load in a tab as a side effect of the way the RenderViewHostManager
1744 // works. 1744 // works.
1745 // 1745 //
1746 // - For the very first tab the load looks "normal". The new tab Web UI is 1746 // - For the very first tab the load looks "normal". The new tab Web UI is
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 const ViewHostMsg_FrameNavigate_Params& params) { 1778 const ViewHostMsg_FrameNavigate_Params& params) {
1779 if (opener_web_ui_type_ != WebUIFactory::kNoWebUI) { 1779 if (opener_web_ui_type_ != WebUIFactory::kNoWebUI) {
1780 // If this is a window.open navigation, use the same WebUI as the renderer 1780 // If this is a window.open navigation, use the same WebUI as the renderer
1781 // that opened the window, as long as both renderers have the same 1781 // that opened the window, as long as both renderers have the same
1782 // privileges. 1782 // privileges.
1783 if (opener_web_ui_type_ == 1783 if (opener_web_ui_type_ ==
1784 WebUIFactory::GetWebUIType(profile(), GetURL())) { 1784 WebUIFactory::GetWebUIType(profile(), GetURL())) {
1785 WebUI* web_ui = WebUIFactory::CreateWebUIForURL(this, GetURL()); 1785 WebUI* web_ui = WebUIFactory::CreateWebUIForURL(this, GetURL());
1786 // web_ui might be NULL if the URL refers to a non-existent extension. 1786 // web_ui might be NULL if the URL refers to a non-existent extension.
1787 if (web_ui) { 1787 if (web_ui) {
1788 render_manager_.SetDOMUIPostCommit(web_ui); 1788 render_manager_.SetWebUIPostCommit(web_ui);
1789 web_ui->RenderViewCreated(render_view_host()); 1789 web_ui->RenderViewCreated(render_view_host());
1790 } 1790 }
1791 } 1791 }
1792 opener_web_ui_type_ = WebUIFactory::kNoWebUI; 1792 opener_web_ui_type_ = WebUIFactory::kNoWebUI;
1793 } 1793 }
1794 1794
1795 if (details.is_user_initiated_main_frame_load()) { 1795 if (details.is_user_initiated_main_frame_load()) {
1796 // Clear the status bubble. This is a workaround for a bug where WebKit 1796 // Clear the status bubble. This is a workaround for a bug where WebKit
1797 // doesn't let us know that the cursor left an element during a 1797 // doesn't let us know that the cursor left an element during a
1798 // transition (this is also why the mouse cursor remains as a hand after 1798 // transition (this is also why the mouse cursor remains as a hand after
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2942 } 2942 }
2943 2943
2944 void TabContents::NotifySwappedFromRenderManager() { 2944 void TabContents::NotifySwappedFromRenderManager() {
2945 NotifySwapped(); 2945 NotifySwapped();
2946 } 2946 }
2947 2947
2948 NavigationController& TabContents::GetControllerForRenderManager() { 2948 NavigationController& TabContents::GetControllerForRenderManager() {
2949 return controller(); 2949 return controller();
2950 } 2950 }
2951 2951
2952 WebUI* TabContents::CreateDOMUIForRenderManager(const GURL& url) { 2952 WebUI* TabContents::CreateWebUIForRenderManager(const GURL& url) {
2953 return WebUIFactory::CreateWebUIForURL(this, url); 2953 return WebUIFactory::CreateWebUIForURL(this, url);
2954 } 2954 }
2955 2955
2956 NavigationEntry* 2956 NavigationEntry*
2957 TabContents::GetLastCommittedNavigationEntryForRenderManager() { 2957 TabContents::GetLastCommittedNavigationEntryForRenderManager() {
2958 return controller_.GetLastCommittedEntry(); 2958 return controller_.GetLastCommittedEntry();
2959 } 2959 }
2960 2960
2961 bool TabContents::CreateRenderViewForRenderManager( 2961 bool TabContents::CreateRenderViewForRenderManager(
2962 RenderViewHost* render_view_host) { 2962 RenderViewHost* render_view_host) {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
3133 } 3133 }
3134 3134
3135 bool TabContents::MaybeUsePreloadedPage(const GURL& url) { 3135 bool TabContents::MaybeUsePreloadedPage(const GURL& url) {
3136 PrerenderManager* pm = profile()->GetPrerenderManager(); 3136 PrerenderManager* pm = profile()->GetPrerenderManager();
3137 if (pm != NULL) { 3137 if (pm != NULL) {
3138 if (pm->MaybeUsePreloadedPage(this, url)) 3138 if (pm->MaybeUsePreloadedPage(this, url))
3139 return true; 3139 return true;
3140 } 3140 }
3141 return false; 3141 return false;
3142 } 3142 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698