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::ShouldProcessAboutToNavigateMainFrame() { |
| 61 // Nothing to do in an uncommitted NTP. |
| 62 return false; |
| 63 } |
| 64 |
| 65 bool InstantNTP::ShouldProcessSetSuggestions() { |
| 66 // Nothing to do in an uncommitted NTP. |
| 67 return false; |
| 68 } |
| 69 |
| 70 bool InstantNTP::ShouldProcessShowInstantPreview() { |
| 71 // Nothing to do in an uncommitted NTP. |
| 72 return false; |
| 73 } |
| 74 |
| 75 bool InstantNTP::ShouldProcessStartCapturingKeyStrokes() { |
| 76 // Nothing to do in an uncommitted NTP. |
| 77 return false; |
| 78 } |
| 79 |
| 80 bool InstantNTP::ShouldProcessStopCapturingKeyStrokes() { |
| 81 // Nothing to do in an uncommitted NTP. |
| 82 return false; |
| 83 } |
| 84 |
| 85 bool InstantNTP::ShouldProcessNavigateToURL() { |
| 86 // Nothing to do in an uncommitted NTP. |
| 87 return false; |
| 88 } |
OLD | NEW |