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

Unified Diff: chrome/browser/instant/instant_web_contents_container.h

Issue 12386019: Instant: Use only one hidden WebContents per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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_web_contents_container.h
diff --git a/chrome/browser/instant/instant_web_contents_container.h b/chrome/browser/instant/instant_web_contents_container.h
new file mode 100644
index 0000000000000000000000000000000000000000..24291ea1f45ad841a89b70c0afabca16d5715310
--- /dev/null
+++ b/chrome/browser/instant/instant_web_contents_container.h
@@ -0,0 +1,60 @@
+// 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.
+
+#ifndef CHROME_BROWSER_INSTANT_INSTANT_WEB_CONTENTS_CONTAINER_H_
+#define CHROME_BROWSER_INSTANT_INSTANT_WEB_CONTENTS_CONTAINER_H_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/instant/instant_page.h"
+#include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
+#include "content/public/browser/web_contents_delegate.h"
+
+class InstantService;
+
+namespace content {
+class WebContents;
+}
+
+// InstantWebContentsContainer owns a WebContents that can be shown as an
+// overlay or merged into a tab. It can't be instantiated per se, but exists by
+// way of its derived classes (InstantPreloader and InstantOverlay). It
+// implements WebContentsDelegate methods that are common to the derived
+// classes. It also owns an InstantPage object that it uses to talk the
+// SearchBox API with its contents.
+class InstantWebContentsContainer : public CoreTabHelperDelegate,
+ public content::WebContentsDelegate {
+ public:
+ content::WebContents* contents() const { return contents_.get(); }
+
+ protected:
+ InstantWebContentsContainer(InstantPage::Delegate* delegate,
+ InstantService* service);
+ virtual ~InstantWebContentsContainer();
+
+ // Overridden from CoreTabHelperDelegate:
+ virtual void SwapTabContents(content::WebContents* old_contents,
+ content::WebContents* new_contents) OVERRIDE;
+
+ // Overriden from content::WebContentsDelegate:
+ virtual content::WebContents* OpenURLFromTab(
+ content::WebContents* source,
+ const content::OpenURLParams& params) OVERRIDE;
+ virtual bool ShouldFocusPageAfterCrash() OVERRIDE;
+ virtual bool CanDownload(content::RenderViewHost* render_view_host,
+ int request_id,
+ const std::string& request_method) OVERRIDE;
+ virtual bool OnGoToEntryOffset(int offset) OVERRIDE;
+
+ virtual void SetUpContents();
+ virtual void TearDownContents();
+
+ scoped_ptr<content::WebContents> contents_;
+ InstantPage page_;
+
+ DISALLOW_COPY_AND_ASSIGN(InstantWebContentsContainer);
+};
+
+#endif // CHROME_BROWSER_INSTANT_INSTANT_WEB_CONTENTS_CONTAINER_H_

Powered by Google App Engine
This is Rietveld 408576698