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

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

Issue 137993020: (Try 2) InstantExtended: remove dead code related to the non-cacheable NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable InstantPolicyTests Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_instant_controller.h ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_instant_controller.cc
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc
index aab91f7cda3a11fc3b5fa133d64ea6e28fa4334c..ea895200ffb9bae1ece1e09258398627ab1fd2f5 100644
--- a/chrome/browser/ui/browser_instant_controller.cc
+++ b/chrome/browser/ui/browser_instant_controller.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
#include "chrome/browser/ui/omnibox/omnibox_view.h"
-#include "chrome/browser/ui/search/instant_ntp.h"
#include "chrome/browser/ui/search/instant_search_prerenderer.h"
#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
@@ -46,13 +45,11 @@ InstantSearchPrerenderer* GetInstantSearchPrerenderer(Profile* profile) {
BrowserInstantController::BrowserInstantController(Browser* browser)
: browser_(browser),
- instant_(this),
- instant_unload_handler_(browser) {
+ instant_(this) {
browser_->search_model()->AddObserver(this);
InstantService* instant_service =
InstantServiceFactory::GetForProfile(profile());
- instant_service->OnBrowserInstantControllerCreated();
instant_service->AddObserver(this);
}
@@ -62,62 +59,6 @@ BrowserInstantController::~BrowserInstantController() {
InstantService* instant_service =
InstantServiceFactory::GetForProfile(profile());
instant_service->RemoveObserver(this);
- instant_service->OnBrowserInstantControllerDestroyed();
-}
-
-bool BrowserInstantController::MaybeSwapInInstantNTPContents(
- const GURL& url,
- content::WebContents* source_contents,
- content::WebContents** target_contents) {
- if (url != GURL(chrome::kChromeUINewTabURL))
- return false;
-
- GURL extension_url(url);
- if (ExtensionWebUI::HandleChromeURLOverride(&extension_url, profile())) {
- // If there is an extension overriding the NTP do not use the Instant NTP.
- return false;
- }
-
- InstantService* instant_service =
- InstantServiceFactory::GetForProfile(profile());
- scoped_ptr<content::WebContents> instant_ntp =
- instant_service->ReleaseNTPContents();
- if (!instant_ntp)
- return false;
-
- *target_contents = instant_ntp.get();
- if (source_contents) {
- // If the Instant NTP hasn't yet committed an entry, we can't call
- // CopyStateFromAndPrune. Instead, load the Local NTP URL directly in the
- // source contents.
- // TODO(sreeram): Always using the local URL is wrong in the case of the
- // first tab in a window where we might want to use the remote URL. Fix.
- if (!instant_ntp->GetController().CanPruneAllButLastCommitted()) {
- source_contents->GetController().LoadURL(chrome::GetLocalInstantURL(
- profile()), content::Referrer(), content::PAGE_TRANSITION_GENERATED,
- std::string());
- *target_contents = source_contents;
- } else {
- instant_ntp->GetController().CopyStateFromAndPrune(
- &source_contents->GetController(), false);
- ReplaceWebContentsAt(
- browser_->tab_strip_model()->GetIndexOfWebContents(source_contents),
- instant_ntp.Pass());
- }
- } else {
- // If the Instant NTP hasn't yet committed an entry, we can't call
- // PruneAllButLastCommitted. In that case, there shouldn't be any entries
- // to prune anyway.
- if (instant_ntp->GetController().CanPruneAllButLastCommitted())
- instant_ntp->GetController().PruneAllButLastCommitted();
- else
- CHECK(!instant_ntp->GetController().GetLastCommittedEntry());
-
- // If |source_contents| is NULL, then the caller is responsible for
- // inserting instant_ntp into the tabstrip and will take ownership.
- ignore_result(instant_ntp.release());
- }
- return true;
}
bool BrowserInstantController::OpenInstant(WindowOpenDisposition disposition,
@@ -156,16 +97,6 @@ Profile* BrowserInstantController::profile() const {
return browser_->profile();
}
-void BrowserInstantController::ReplaceWebContentsAt(
- int index,
- scoped_ptr<content::WebContents> new_contents) {
- DCHECK_NE(TabStripModel::kNoTab, index);
- scoped_ptr<content::WebContents> old_contents(browser_->tab_strip_model()->
- ReplaceWebContentsAt(index, new_contents.release()));
- instant_unload_handler_.RunUnloadListenersOrDestroy(old_contents.Pass(),
- index);
-}
-
content::WebContents* BrowserInstantController::GetActiveWebContents() const {
return browser_->tab_strip_model()->GetActiveWebContents();
}
« no previous file with comments | « chrome/browser/ui/browser_instant_controller.h ('k') | chrome/browser/ui/browser_navigator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698