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

Unified Diff: chrome/browser/ui/browser.cc

Issue 8892011: Clean up TCW, make it solely a hub for 1:1 observer/helper objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/alternate_error_tab_observer.cc ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 6ce101e64e8d653bb5e14128ae6206c6093eb10f..baaaa8308add7597588db9b4c71477ba0fb72477 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -148,6 +148,7 @@
#include "content/browser/tab_contents/interstitial_page.h"
#include "content/browser/tab_contents/navigation_controller.h"
#include "content/browser/tab_contents/navigation_entry.h"
+#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_view.h"
#include "content/browser/user_metrics.h"
#include "content/public/browser/devtools_manager.h"
@@ -1482,7 +1483,8 @@ bool Browser::IsClosingPermitted() {
}
bool Browser::CanGoBack() const {
- return GetSelectedTabContentsWrapper()->controller().CanGoBack();
+ return GetSelectedTabContentsWrapper()->
+ tab_contents()->controller().CanGoBack();
}
void Browser::GoBack(WindowOpenDisposition disposition) {
@@ -1501,7 +1503,8 @@ void Browser::GoBack(WindowOpenDisposition disposition) {
}
bool Browser::CanGoForward() const {
- return GetSelectedTabContentsWrapper()->controller().CanGoForward();
+ return GetSelectedTabContentsWrapper()->
+ tab_contents()->controller().CanGoForward();
}
void Browser::GoForward(WindowOpenDisposition disposition) {
@@ -1636,7 +1639,7 @@ void Browser::NewTab() {
if (is_type_tabbed()) {
AddBlankTab(true);
- GetSelectedTabContentsWrapper()->view()->RestoreFocus();
+ GetSelectedTabContentsWrapper()->tab_contents()->view()->RestoreFocus();
} else {
Browser* b = GetOrCreateTabbedBrowser(profile_);
b->AddBlankTab(true);
@@ -1644,7 +1647,7 @@ void Browser::NewTab() {
// The call to AddBlankTab above did not set the focus to the tab as its
// window was not active, so we have to do it explicitly.
// See http://crbug.com/6380.
- b->GetSelectedTabContentsWrapper()->view()->RestoreFocus();
+ b->GetSelectedTabContentsWrapper()->tab_contents()->view()->RestoreFocus();
}
}
@@ -1926,7 +1929,8 @@ void Browser::Zoom(content::PageZoom zoom) {
if (is_devtools())
return;
- RenderViewHost* host = GetSelectedTabContentsWrapper()->render_view_host();
+ RenderViewHost* host =
+ GetSelectedTabContentsWrapper()->tab_contents()->render_view_host();
if (zoom == content::PAGE_ZOOM_RESET) {
host->SetZoomLevel(0);
UserMetrics::RecordAction(UserMetricsAction("ZoomNormal"));
@@ -2040,7 +2044,8 @@ void Browser::OpenCreateShortcutsDialog() {
web_app::IsValidUrl(current_tab->tab_contents()->GetURL())) <<
"Menu item should be disabled.";
- NavigationEntry* entry = current_tab->controller().GetLastCommittedEntry();
+ NavigationEntry* entry =
+ current_tab->tab_contents()->controller().GetLastCommittedEntry();
if (!entry)
return;
@@ -2063,7 +2068,8 @@ void Browser::ToggleDevToolsWindow(DevToolsToggleAction action) {
UserMetrics::RecordAction(UserMetricsAction("DevTools_ToggleWindow"));
DevToolsWindow::ToggleDevToolsWindow(
- GetSelectedTabContentsWrapper()->render_view_host(), action);
+ GetSelectedTabContentsWrapper()->tab_contents()->render_view_host(),
+ action);
}
void Browser::OpenTaskManager(bool highlight_background_resources) {
@@ -3072,7 +3078,8 @@ TabContentsWrapper* Browser::CreateTabContentsForURL(
if (!defer_load) {
// Load the initial URL before adding the new tab contents to the tab strip
// so that the tab contents has navigation state.
- contents->controller().LoadURL(url, referrer, transition, std::string());
+ contents->tab_contents()->controller().LoadURL(
+ url, referrer, transition, std::string());
}
return contents;
@@ -3158,7 +3165,7 @@ void Browser::CreateHistoricalTab(TabContentsWrapper* contents) {
// We only create historical tab entries for tabbed browser windows.
if (service && CanSupportWindowFeature(FEATURE_TABSTRIP)) {
- service->CreateHistoricalTab(&contents->controller(),
+ service->CreateHistoricalTab(&contents->tab_contents()->controller(),
tab_handler_->GetTabStripModel()->GetIndexOfTabContents(contents));
}
}
@@ -3246,7 +3253,8 @@ void Browser::TabClosingAt(TabStripModel* tab_strip_model,
fullscreen_controller_->OnTabClosing(contents->tab_contents());
content::NotificationService::current()->Notify(
content::NOTIFICATION_TAB_CLOSING,
- content::Source<NavigationController>(&contents->controller()),
+ content::Source<NavigationController>(
+ &contents->tab_contents()->controller()),
content::NotificationService::NoDetails());
// Sever the TabContents' connection back to us.
@@ -3344,11 +3352,12 @@ void Browser::TabReplacedAt(TabStripModel* tab_strip_model,
TabInsertedAt(new_contents, index,
(index == tab_handler_->GetTabStripModel()->active_index()));
- int entry_count = new_contents->controller().entry_count();
+ int entry_count = new_contents->tab_contents()->controller().entry_count();
if (entry_count > 0) {
// Send out notification so that observers are updated appropriately.
- new_contents->controller().NotifyEntryChanged(
- new_contents->controller().GetEntryAtIndex(entry_count - 1),
+ new_contents->tab_contents()->controller().NotifyEntryChanged(
+ new_contents->tab_contents()->controller().GetEntryAtIndex(
+ entry_count - 1),
entry_count - 1);
}
@@ -3962,7 +3971,8 @@ void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source,
if (GetSelectedTabContentsWrapper() != source)
return;
- NavigationEntry* entry = source->controller().GetLastCommittedEntry();
+ NavigationEntry* entry =
+ source->tab_contents()->controller().GetLastCommittedEntry();
if (!entry || (entry->page_id() != page_id))
return;
@@ -5140,7 +5150,7 @@ bool Browser::OpenInstant(WindowOpenDisposition disposition) {
// HideInstant is invoked after release so that InstantController is not
// active when HideInstant asks it for its state.
HideInstant();
- preview_contents->controller().PruneAllButActive();
+ preview_contents->tab_contents()->controller().PruneAllButActive();
tab_handler_->GetTabStripModel()->AddTabContents(
preview_contents,
-1,
@@ -5171,7 +5181,8 @@ void Browser::CreateInstantIfNecessary() {
void Browser::ViewSource(TabContentsWrapper* contents) {
DCHECK(contents);
- NavigationEntry* active_entry = contents->controller().GetActiveEntry();
+ NavigationEntry* active_entry =
+ contents->tab_contents()->controller().GetActiveEntry();
if (!active_entry)
return;
@@ -5185,9 +5196,9 @@ void Browser::ViewSource(TabContentsWrapper* contents,
DCHECK(contents);
TabContentsWrapper* view_source_contents = contents->Clone();
- view_source_contents->controller().PruneAllButActive();
+ view_source_contents->tab_contents()->controller().PruneAllButActive();
NavigationEntry* active_entry =
- view_source_contents->controller().GetActiveEntry();
+ view_source_contents->tab_contents()->controller().GetActiveEntry();
if (!active_entry)
return;
@@ -5295,7 +5306,8 @@ void Browser::ShowSyncSetup() {
}
void Browser::ToggleSpeechInput() {
- GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput();
+ GetSelectedTabContentsWrapper()->tab_contents()->render_view_host()->
+ ToggleSpeechInput();
}
void Browser::OnWindowDidShow() {
« no previous file with comments | « chrome/browser/ui/alternate_error_tab_observer.cc ('k') | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698