summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/web/WebPageImportanceSignals.cpp
blob: f541185cabecddce250e3e5e277a60320edf1781 (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
// Copyright 2015 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 "public/web/WebPageImportanceSignals.h"

#include "platform/Histogram.h"
#include "public/web/WebViewClient.h"

namespace blink {

void WebPageImportanceSignals::reset()
{
    m_hadFormInteraction = false;
    m_issuedNonGetFetchFromScript = false;
    if (m_observer)
        m_observer->pageImportanceSignalsChanged();
}

void WebPageImportanceSignals::setHadFormInteraction()
{
    m_hadFormInteraction = true;
    if (m_observer)
        m_observer->pageImportanceSignalsChanged();
}

void WebPageImportanceSignals::setIssuedNonGetFetchFromScript()
{
    m_issuedNonGetFetchFromScript = true;
    if (m_observer)
        m_observer->pageImportanceSignalsChanged();
}

void WebPageImportanceSignals::onCommitLoad()
{
    DEFINE_STATIC_LOCAL(EnumerationHistogram, hadFormInteractionHistogram, ("PageImportanceSignals.HadFormInteraction.OnCommitLoad", 2));
    hadFormInteractionHistogram.count(m_hadFormInteraction);

    DEFINE_STATIC_LOCAL(EnumerationHistogram, issuedNonGetHistogram, ("PageImportanceSignals.IssuedNonGetFetchFromScript.OnCommitLoad", 2));
    issuedNonGetHistogram.count(m_issuedNonGetFetchFromScript);

    reset();
}

} // namespace blink