Consolidates managing of bookmark bar state to browser. Browser now
pushes that state to the BrowserWindow when it changes (except during
tab switches, when it's assumed the browserwindow polls). The problem
with the current code is that as the BookmarkBar queries for state
during painting and layout, it was possible for that state without the
bookmarkbar being layed out. This resulted in the bookmark bar
painting attached even when it was given the detached state.

I'm also plumbing through one case of when the bookmark bar state
changes that wasn't being handled.

BUG=87137
TEST=see bug, but make sure you don't notice any problems with
bookmark bar visibility changes (such as toggling visibility, or
turning off and navigating back/to the new tab page).
[email protected],[email protected],[email protected]
[email protected], [email protected]

Review URL: http://codereview.chromium.org/7237001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90405 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index e00e238c..e350f53 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -553,6 +553,9 @@
                     observers_,
                     NavigateToPendingEntry(entry.url(), reload_type));
 
+  if (delegate_)
+    delegate_->DidNavigateToPendingEntry(this);
+
   return true;
 }
 
@@ -1313,13 +1316,8 @@
 
 void TabContents::DidNavigate(RenderViewHost* rvh,
                               const ViewHostMsg_FrameNavigate_Params& params) {
-  scoped_ptr<TabContentsDelegate::MainFrameCommitDetails> commit_details;
-
-  if (PageTransition::IsMainFrame(params.transition)) {
-    if (delegate())
-      commit_details.reset(delegate()->CreateMainFrameCommitDetails(this));
+  if (PageTransition::IsMainFrame(params.transition))
     render_manager_.DidNavigateMainFrame(rvh);
-  }
 
   // Update the site of the SiteInstance if it doesn't have one yet.
   if (!GetSiteInstance()->has_site())
@@ -1374,8 +1372,8 @@
   // Run post-commit tasks.
   if (details.is_main_frame) {
     DidNavigateMainFramePostCommit(details, params);
-    if (delegate() && commit_details.get())
-      delegate()->DidNavigateMainFramePostCommit(this, *commit_details);
+    if (delegate())
+      delegate()->DidNavigateMainFramePostCommit(this);
   }
   DidNavigateAnyFramePostCommit(rvh, details, params);
 }