OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_INSTANT_INSTANT_PAGE_H_ |
| 6 #define CHROME_BROWSER_INSTANT_INSTANT_PAGE_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "chrome/browser/instant/instant_api_wrapper.h" |
| 11 #include "chrome/browser/instant/instant_controller.h" |
| 12 |
| 13 class InstantController; |
| 14 |
| 15 // InstantController interacts with a page that implements the Instant API |
| 16 // through one of the derived classes of InstantPage (InstantOverlay, InstantNTP |
| 17 // or InstantTab). |
| 18 // |
| 19 // InstantPage is a simple wrapper around InstantAPIWrapper::Controller that |
| 20 // adds some more common state and methods shared by all the implementors. |
| 21 class InstantPage : public InstantAPIWrapper::Controller { |
| 22 public: |
| 23 virtual ~InstantPage() {} |
| 24 |
| 25 // Pointer to the InstantAPIWrapper object owned by InstantPage. |
| 26 InstantAPIWrapper* api() { return &api_; } |
| 27 |
| 28 // The WebContents corresponding to the page we're talking to. May be NULL. |
| 29 virtual content::WebContents* contents() const = 0; |
| 30 |
| 31 // Overriden from InstantAPIWrapper::Controller. |
| 32 virtual bool supports_instant() const OVERRIDE { return supports_instant_; } |
| 33 virtual void set_supports_instant(bool supports_instant) OVERRIDE { |
| 34 supports_instant_ = supports_instant; |
| 35 } |
| 36 |
| 37 protected: |
| 38 explicit InstantPage(InstantController* controller) |
| 39 : controller_(controller), |
| 40 api_(ALLOW_THIS_IN_INITIALIZER_LIST(this), controller), |
| 41 supports_instant_(false) {} |
| 42 |
| 43 InstantController* const controller_; |
| 44 InstantAPIWrapper api_; |
| 45 bool supports_instant_; |
| 46 }; |
| 47 |
| 48 #endif // CHROME_BROWSER_INSTANT_INSTANT_PAGE_H_ |
OLD | NEW |