blob: 0ccc9b0ac20af0f82618f6bb3b62aa6cb7016f4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/search/instant_ntp.h"
#include "base/metrics/histogram.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
#include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h"
#include "content/public/browser/web_contents.h"
#include "url/gurl.h"
InstantNTP::InstantNTP(InstantPage::Delegate* delegate,
const std::string& instant_url,
bool is_incognito)
: InstantPage(delegate, instant_url, is_incognito),
loader_(this) {
DCHECK(delegate);
}
InstantNTP::~InstantNTP() {
}
void InstantNTP::InitContents(Profile* profile,
const content::WebContents* active_tab,
const base::Closure& on_stale_callback) {
GURL instantNTP_url(instant_url());
loader_.Init(instantNTP_url, profile, active_tab, on_stale_callback);
SetContents(loader_.contents());
content::WebContents* content = contents();
SearchTabHelper::FromWebContents(content)->InitForPreloadedNTP();
NTPUserDataLogger::CreateForWebContents(content);
NTPUserDataLogger::FromWebContents(content)->set_ntp_url(instantNTP_url);
loader_.Load();
}
scoped_ptr<content::WebContents> InstantNTP::ReleaseContents() {
SetContents(NULL);
return loader_.ReleaseContents();
}
void InstantNTP::RenderViewCreated(content::RenderViewHost* render_view_host) {
delegate()->InstantPageRenderViewCreated(contents());
}
void InstantNTP::RenderProcessGone(base::TerminationStatus /* status */) {
delegate()->InstantPageRenderProcessGone(contents());
}
void InstantNTP::OnSwappedContents() {
SetContents(loader_.contents());
}
void InstantNTP::OnFocus() {
NOTREACHED();
}
void InstantNTP::OnMouseDown() {
NOTREACHED();
}
void InstantNTP::OnMouseUp() {
NOTREACHED();
}
content::WebContents* InstantNTP::OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) {
return NULL;
}
void InstantNTP::LoadCompletedMainFrame() {
}
|