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_.Load(GURL(instant_url_), profile, active_tab, on_stale_callback); |
| 25 SetContents(loader_.contents()); |
| 26 contents()->GetController().GetPendingEntry()->SetVirtualURL( |
| 27 GURL(chrome::kChromeUINewTabURL)); |
| 28 } |
| 29 |
| 30 scoped_ptr<content::WebContents> InstantNTP::ReleaseContents() { |
| 31 SetContents(NULL); |
| 32 return loader_.ReleaseContents(); |
| 33 } |
| 34 |
| 35 void InstantNTP::OnSwappedContents() { |
| 36 SetContents(loader_.contents()); |
| 37 contents()->GetController().GetPendingEntry()->SetVirtualURL( |
| 38 GURL(chrome::kChromeUINewTabURL)); |
| 39 } |
| 40 |
| 41 void InstantNTP::OnFocus() { |
| 42 NOTREACHED(); |
| 43 } |
| 44 |
| 45 void InstantNTP::OnMouseDown() { |
| 46 NOTREACHED(); |
| 47 } |
| 48 |
| 49 void InstantNTP::OnMouseUp() { |
| 50 NOTREACHED(); |
| 51 } |
| 52 |
| 53 content::WebContents* InstantNTP::OpenURLFromTab( |
| 54 content::WebContents* source, |
| 55 const content::OpenURLParams& params) { |
| 56 return NULL; |
| 57 } |
| 58 |
| 59 bool InstantNTP::ShouldProcessAboutToNavigateMainFrame() { |
| 60 // Nothing to do in an uncommitted NTP. |
| 61 return false; |
| 62 } |
| 63 |
| 64 bool InstantNTP::ShouldProcessSetSuggestions() { |
| 65 // Nothing to do in an uncommitted NTP. |
| 66 return false; |
| 67 } |
| 68 |
| 69 bool InstantNTP::ShouldProcessShowInstantPreview() { |
| 70 // Nothing to do in an uncommitted NTP. |
| 71 return false; |
| 72 } |
| 73 |
| 74 bool InstantNTP::ShouldProcessStartCapturingKeyStrokes() { |
| 75 // Nothing to do in an uncommitted NTP. |
| 76 return false; |
| 77 } |
| 78 |
| 79 bool InstantNTP::ShouldProcessStopCapturingKeyStrokes() { |
| 80 // Nothing to do in an uncommitted NTP. |
| 81 return false; |
| 82 } |
| 83 |
| 84 bool InstantNTP::ShouldProcessNavigateToURL() { |
| 85 // Nothing to do in an uncommitted NTP. |
| 86 return false; |
| 87 } |
OLD | NEW |