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_WEB_CONTENTS_CONTAINER_H_ |
| 6 #define CHROME_BROWSER_INSTANT_INSTANT_WEB_CONTENTS_CONTAINER_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/instant/instant_page.h" |
| 12 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
| 13 #include "content/public/browser/web_contents_delegate.h" |
| 14 |
| 15 class InstantService; |
| 16 |
| 17 namespace content { |
| 18 class WebContents; |
| 19 } |
| 20 |
| 21 // InstantWebContentsContainer owns a WebContents that can be shown as an |
| 22 // overlay or merged into a tab. It can't be instantiated per se, but exists by |
| 23 // way of its derived classes (InstantPreloader and InstantOverlay). It |
| 24 // implements WebContentsDelegate methods that are common to the derived |
| 25 // classes. It also owns an InstantPage object that it uses to talk the |
| 26 // SearchBox API with its contents. |
| 27 class InstantWebContentsContainer : public CoreTabHelperDelegate, |
| 28 public content::WebContentsDelegate { |
| 29 public: |
| 30 content::WebContents* contents() const { return contents_.get(); } |
| 31 |
| 32 protected: |
| 33 InstantWebContentsContainer(InstantPage::Delegate* delegate, |
| 34 InstantService* service); |
| 35 virtual ~InstantWebContentsContainer(); |
| 36 |
| 37 // Overridden from CoreTabHelperDelegate: |
| 38 virtual void SwapTabContents(content::WebContents* old_contents, |
| 39 content::WebContents* new_contents) OVERRIDE; |
| 40 |
| 41 // Overriden from content::WebContentsDelegate: |
| 42 virtual content::WebContents* OpenURLFromTab( |
| 43 content::WebContents* source, |
| 44 const content::OpenURLParams& params) OVERRIDE; |
| 45 virtual bool ShouldFocusPageAfterCrash() OVERRIDE; |
| 46 virtual bool CanDownload(content::RenderViewHost* render_view_host, |
| 47 int request_id, |
| 48 const std::string& request_method) OVERRIDE; |
| 49 virtual bool OnGoToEntryOffset(int offset) OVERRIDE; |
| 50 |
| 51 virtual void SetUpContents(); |
| 52 virtual void TearDownContents(); |
| 53 |
| 54 scoped_ptr<content::WebContents> contents_; |
| 55 InstantPage page_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(InstantWebContentsContainer); |
| 58 }; |
| 59 |
| 60 #endif // CHROME_BROWSER_INSTANT_INSTANT_WEB_CONTENTS_CONTAINER_H_ |
OLD | NEW |