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

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, 10 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..17f95060e8d559c4f4376386b4a2acb5dbf9de31
--- /dev/null
+++ b/chrome/browser/instant/instant_web_contents_container.h
@@ -0,0 +1,59 @@
+// 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's shown as an Instant
samarth 2013/03/01 17:59:53 I'm finding the relationship between InstantLoader
sreeram 2013/03/07 18:18:46 As discussed offline, I've kept the current struct
samarth 2013/03/11 19:03:24 Sorry, I'm looking at this again and this still do
+// overlay. It can't be instantiated per se, but exists by way of its derived
+// classes (InstantLoader 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