| Index: chrome/browser/history/history_tab_helper.cc
|
| ===================================================================
|
| --- chrome/browser/history/history_tab_helper.cc (revision 158566)
|
| +++ chrome/browser/history/history_tab_helper.cc (working copy)
|
| @@ -9,6 +9,8 @@
|
| #include "chrome/browser/history/history.h"
|
| #include "chrome/browser/history/history_service_factory.h"
|
| #include "chrome/browser/history/top_sites.h"
|
| +#include "chrome/browser/prerender/prerender_manager.h"
|
| +#include "chrome/browser/prerender/prerender_manager_factory.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/common/render_messages.h"
|
| #include "content/public/browser/navigation_details.h"
|
| @@ -20,6 +22,11 @@
|
| #include "content/public/browser/web_contents_delegate.h"
|
| #include "content/public/common/frame_navigate_params.h"
|
|
|
| +#if !defined(OS_ANDROID)
|
| +#include "chrome/browser/ui/browser.h"
|
| +#include "chrome/browser/ui/browser_finder.h"
|
| +#endif
|
| +
|
| using content::NavigationEntry;
|
| using content::WebContents;
|
|
|
| @@ -105,10 +112,24 @@
|
| // the WebContents' URL getter does.
|
| const history::HistoryAddPageArgs& add_page_args =
|
| CreateHistoryAddPageArgs(web_contents()->GetURL(), details, params);
|
| - if (!web_contents()->GetDelegate() ||
|
| - !web_contents()->GetDelegate()->ShouldAddNavigationToHistory(
|
| - add_page_args, details.type))
|
| +
|
| +#if !defined(OS_ANDROID)
|
| + // Don't update history if this web contents isn't associatd with a tab (i.e.
|
| + // instant or prerender) or is used for running an app.
|
| + Browser* browser = browser::FindBrowserWithWebContents(web_contents());
|
| + if (!browser || browser->is_app())
|
| return;
|
| +#else
|
| + // The above check is more thorough, but since we don't have Browser* on
|
| + // Android, at least check prerendering.
|
| + prerender::PrerenderManager* prerender_manager =
|
| + prerender::PrerenderManagerFactory::GetForProfile(
|
| + Profile::FromBrowserContext(web_contents()->GetBrowserContext()));
|
| + if (prerender_manager &&
|
| + prerender_manager->IsWebContentsPrerendering(web_contents())) {
|
| + return;
|
| + }
|
| +#endif
|
|
|
| UpdateHistoryForNavigation(add_page_args);
|
| }
|
|
|