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

Unified Diff: chrome/browser/instant/instant_ntp.cc

Issue 11824050: InstantExtended: Committed NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 7 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
Index: chrome/browser/instant/instant_ntp.cc
diff --git a/chrome/browser/instant/instant_ntp.cc b/chrome/browser/instant/instant_ntp.cc
new file mode 100644
index 0000000000000000000000000000000000000000..451de3034a2e046e65c40e9ad3f9aeffa45c5db3
--- /dev/null
+++ b/chrome/browser/instant/instant_ntp.cc
@@ -0,0 +1,89 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/instant/instant_ntp.h"
+
+#include "chrome/common/url_constants.h"
+#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/web_contents.h"
+
+InstantNTP::InstantNTP(InstantPage::Delegate* delegate,
+ const std::string& instant_url)
+ : InstantPage(delegate),
+ loader_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
+ instant_url_(instant_url) {
+}
+
+InstantNTP::~InstantNTP() {
+}
+
+void InstantNTP::InitContents(Profile* profile,
+ const content::WebContents* active_tab,
+ const base::Closure& on_stale_callback) {
+ loader_.Load(GURL(instant_url_), profile, active_tab, on_stale_callback);
+ SetContents(loader_.contents());
+ contents()->GetController().GetPendingEntry()->SetVirtualURL(
+ GURL(chrome::kChromeUINewTabURL));
+}
+
+scoped_ptr<content::WebContents> InstantNTP::ReleaseContents() {
+ SetContents(NULL);
+ return loader_.ReleaseContents();
+}
+
+scoped_ptr<content::WebContents> InstantNTP::SwapContents(
+ scoped_ptr<content::WebContents> new_contents) {
+ scoped_ptr<content::WebContents> old_contents = ReleaseContents();
+ loader_.SetContents(new_contents.Pass());
+ SetContents(loader_.contents());
+ contents()->GetController().GetPendingEntry()->SetVirtualURL(
+ GURL(chrome::kChromeUINewTabURL));
+ return old_contents.Pass();
+}
+
+void InstantNTP::OnFocus() {
+ NOTREACHED();
+}
+
+bool InstantNTP::OnOpenURL() {
+ return false;
+}
+
+void InstantNTP::OnMouseDown() {
+ NOTREACHED();
+}
+
+void InstantNTP::OnMouseUp() {
+ NOTREACHED();
+}
+
+bool InstantNTP::ShouldProcessAboutToNavigateMainFrame() const {
+ // Nothing to do in an uncommitted NTP.
+ return false;
+}
+
+bool InstantNTP::ShouldProcessSetSuggestions() const {
+ // Nothing to do in an uncommitted NTP.
+ return false;
+}
+
+bool InstantNTP::ShouldProcessShowInstantPreview() const {
+ // Nothing to do in an uncommitted NTP.
+ return false;
+}
+
+bool InstantNTP::ShouldProcessStartCapturingKeyStrokes() const {
+ // Nothing to do in an uncommitted NTP.
+ return false;
+}
+
+bool InstantNTP::ShouldProcessStopCapturingKeyStrokes() const {
+ // Nothing to do in an uncommitted NTP.
+ return false;
+}
+
+bool InstantNTP::ShouldProcessNavigateToURL() const {
+ // Nothing to do in an uncommitted NTP.
+ return false;
+}

Powered by Google App Engine
This is Rietveld 408576698