Index: chrome/browser/instant/instant_page.h |
diff --git a/chrome/browser/instant/instant_page.h b/chrome/browser/instant/instant_page.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..600a2617573af9c63cc2f8da1d14d2ea91d47da2 |
--- /dev/null |
+++ b/chrome/browser/instant/instant_page.h |
@@ -0,0 +1,48 @@ |
+// 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_PAGE_H_ |
+#define CHROME_BROWSER_INSTANT_INSTANT_PAGE_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "chrome/browser/instant/instant_api_wrapper.h" |
+#include "chrome/browser/instant/instant_controller.h" |
+ |
+class InstantController; |
+ |
+// InstantController interacts with a page that implements the Instant API |
+// through one of the derived classes of InstantPage (InstantOverlay, InstantNTP |
+// or InstantTab). |
+// |
+// InstantPage is a simple wrapper around InstantAPIWrapper::Controller that |
+// adds some more common state and methods shared by all the implementors. |
+class InstantPage : public InstantAPIWrapper::Controller { |
+ public: |
+ virtual ~InstantPage() {} |
+ |
+ // Pointer to the InstantAPIWrapper object owned by InstantPage. |
+ InstantAPIWrapper* api() { return &api_; } |
+ |
+ // The WebContents corresponding to the page we're talking to. May be NULL. |
+ virtual content::WebContents* contents() const = 0; |
+ |
+ // Overriden from InstantAPIWrapper::Controller. |
+ virtual bool supports_instant() const OVERRIDE { return supports_instant_; } |
+ virtual void set_supports_instant(bool supports_instant) OVERRIDE { |
+ supports_instant_ = supports_instant; |
+ } |
+ |
+ protected: |
+ explicit InstantPage(InstantController* controller) |
+ : controller_(controller), |
+ api_(ALLOW_THIS_IN_INITIALIZER_LIST(this), controller), |
+ supports_instant_(false) {} |
+ |
+ InstantController* const controller_; |
+ InstantAPIWrapper api_; |
+ bool supports_instant_; |
+}; |
+ |
+#endif // CHROME_BROWSER_INSTANT_INSTANT_PAGE_H_ |