Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: chrome/browser/instant/instant_ntp.cc

Issue 11824050: InstantExtended: Committed NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 scoped_ptr<content::WebContents> InstantNTP::SwapContents(
36 scoped_ptr<content::WebContents> new_contents) {
37 scoped_ptr<content::WebContents> old_contents = ReleaseContents();
38 loader_.SetContents(new_contents.Pass());
39 SetContents(loader_.contents());
40 contents()->GetController().GetPendingEntry()->SetVirtualURL(
41 GURL(chrome::kChromeUINewTabURL));
42 return old_contents.Pass();
43 }
44
45 void InstantNTP::OnFocus() {
46 NOTREACHED();
47 }
48
49 bool InstantNTP::OnOpenURL() {
50 return false;
51 }
52
53 void InstantNTP::OnMouseDown() {
54 NOTREACHED();
55 }
56
57 void InstantNTP::OnMouseUp() {
58 NOTREACHED();
59 }
60
61 bool InstantNTP::ShouldProcessAboutToNavigateMainFrame() const {
62 // Nothing to do in an uncommitted NTP.
63 return false;
64 }
65
66 bool InstantNTP::ShouldProcessSetSuggestions() const {
67 // Nothing to do in an uncommitted NTP.
68 return false;
69 }
70
71 bool InstantNTP::ShouldProcessShowInstantPreview() const {
72 // Nothing to do in an uncommitted NTP.
73 return false;
74 }
75
76 bool InstantNTP::ShouldProcessStartCapturingKeyStrokes() const {
77 // Nothing to do in an uncommitted NTP.
78 return false;
79 }
80
81 bool InstantNTP::ShouldProcessStopCapturingKeyStrokes() const {
82 // Nothing to do in an uncommitted NTP.
83 return false;
84 }
85
86 bool InstantNTP::ShouldProcessNavigateToURL() const {
87 // Nothing to do in an uncommitted NTP.
88 return false;
89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698