This is only the first part of the refactoring. The old method was preserved
and not all call points were changed.

The second part will deal with factoring out the old OpenURL method.

Overall purpose: speed up calls, make it more flexible to plumb parameters to
the call chain, reduce code repetition.

It is necessary to add one more parameter (namely, override_encoding) to
OpenURL in order to be able to restore the page encoding upon loading the
contents. For solving this issue, it is necessary for the encoding to be
restored from the BookmarkModel.

BUG=2926

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95013 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 19357aa..65ae370 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -514,16 +514,21 @@
       !render_view_host()->SuddenTerminationAllowed();
 }
 
+// TODO(adriansc): Remove this method once refactoring changed all call sites.
 TabContents* TabContents::OpenURL(const GURL& url,
                                   const GURL& referrer,
                                   WindowOpenDisposition disposition,
                                   PageTransition::Type transition) {
+  return OpenURL(OpenURLParams(url, referrer, disposition, transition));
+}
+
+TabContents* TabContents::OpenURL(const OpenURLParams& params) {
   if (delegate_) {
-    TabContents* new_contents =
-        delegate_->OpenURLFromTab(this, url, referrer, disposition, transition);
+    TabContents* new_contents = delegate_->OpenURLFromTab(this, params);
     // Notify observers.
     FOR_EACH_OBSERVER(TabContentsObserver, observers_,
-                      DidOpenURL(url, referrer, disposition, transition));
+                      DidOpenURL(params.url, params.referrer,
+                                 params.disposition, params.transition));
     return new_contents;
   }
   return NULL;