| 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 #include "chrome/browser/instant/instant_ntp.h" | |
| 6 | |
| 7 #include "chrome/common/url_constants.h" | |
| 8 #include "content/public/browser/navigation_entry.h" | |
| 9 #include "content/public/browser/web_contents.h" | |
| 10 | |
| 11 InstantNTP::InstantNTP(InstantPage::Delegate* delegate, | |
| 12 const std::string& instant_url) | |
| 13 : InstantPage(delegate), | |
| 14 loader_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | |
| 15 instant_url_(instant_url) { | |
| 16 } | |
| 17 | |
| 18 InstantNTP::~InstantNTP() { | |
| 19 } | |
| 20 | |
| 21 void InstantNTP::InitContents(Profile* profile, | |
| 22 const content::WebContents* active_tab, | |
| 23 const base::Closure& on_stale_callback) { | |
| 24 loader_.Init(GURL(instant_url_), profile, active_tab, on_stale_callback); | |
| 25 SetContents(loader_.contents()); | |
| 26 loader_.Load(); | |
| 27 contents()->GetController().GetPendingEntry()->SetVirtualURL( | |
| 28 GURL(chrome::kChromeUINewTabURL)); | |
| 29 } | |
| 30 | |
| 31 scoped_ptr<content::WebContents> InstantNTP::ReleaseContents() { | |
| 32 SetContents(NULL); | |
| 33 return loader_.ReleaseContents(); | |
| 34 } | |
| 35 | |
| 36 void InstantNTP::OnSwappedContents() { | |
| 37 SetContents(loader_.contents()); | |
| 38 contents()->GetController().GetPendingEntry()->SetVirtualURL( | |
| 39 GURL(chrome::kChromeUINewTabURL)); | |
| 40 } | |
| 41 | |
| 42 void InstantNTP::OnFocus() { | |
| 43 NOTREACHED(); | |
| 44 } | |
| 45 | |
| 46 void InstantNTP::OnMouseDown() { | |
| 47 NOTREACHED(); | |
| 48 } | |
| 49 | |
| 50 void InstantNTP::OnMouseUp() { | |
| 51 NOTREACHED(); | |
| 52 } | |
| 53 | |
| 54 content::WebContents* InstantNTP::OpenURLFromTab( | |
| 55 content::WebContents* source, | |
| 56 const content::OpenURLParams& params) { | |
| 57 return NULL; | |
| 58 } | |
| 59 | |
| 60 bool InstantNTP::ShouldProcessRenderViewCreated() { | |
| 61 return true; | |
| 62 } | |
| 63 | |
| 64 bool InstantNTP::ShouldProcessRenderViewGone() { | |
| 65 return true; | |
| 66 } | |
| OLD | NEW |