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

Side by Side Diff: chrome/common/net/net_error_tracker.cc

Issue 13270005: Display DNS probe results. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix one last nit Created 7 years, 5 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
« no previous file with comments | « chrome/common/net/net_error_tracker.h ('k') | chrome/common/net/net_error_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 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/common/net/net_error_tracker.h"
6
7 NetErrorTracker::NetErrorTracker(const Callback& callback)
8 : callback_(callback),
9 load_state_(LOAD_NONE),
10 load_type_(PAGE_NORMAL),
11 error_type_(ERROR_OTHER),
12 dns_error_page_state_(DNS_ERROR_PAGE_NONE) {
13 }
14
15 NetErrorTracker::~NetErrorTracker() {
16 }
17
18 void NetErrorTracker::OnStartProvisionalLoad(FrameType frame, PageType page) {
19 if (frame == FRAME_SUB)
20 return;
21
22 load_state_ = LOAD_STARTED;
23 load_type_ = page;
24
25 // TODO(ttuttle): Add support for aborts, then move this to OnCommit.
26 if (load_type_ == PAGE_NORMAL)
27 SetDnsErrorPageState(DNS_ERROR_PAGE_NONE);
28 }
29
30 void NetErrorTracker::OnCommitProvisionalLoad(FrameType frame) {
31 if (frame == FRAME_SUB)
32 return;
33
34 load_state_ = LOAD_COMMITTED;
35 }
36
37 void NetErrorTracker::OnFailProvisionalLoad(FrameType frame, ErrorType error) {
38 if (frame == FRAME_SUB)
39 return;
40
41 load_state_ = LOAD_FAILED;
42
43 if (load_type_ == PAGE_NORMAL) {
44 error_type_ = error;
45 if (error_type_ == ERROR_DNS)
46 SetDnsErrorPageState(DNS_ERROR_PAGE_PENDING);
47 }
48 }
49
50 void NetErrorTracker::OnFinishLoad(FrameType frame) {
51 if (frame == FRAME_SUB)
52 return;
53
54 load_state_ = LOAD_FINISHED;
55
56 if (load_type_ == PAGE_ERROR && error_type_ == ERROR_DNS)
57 SetDnsErrorPageState(DNS_ERROR_PAGE_LOADED);
58 }
59
60 void NetErrorTracker::SetDnsErrorPageState(DnsErrorPageState state) {
61 if (state == dns_error_page_state_)
62 return;
63
64 dns_error_page_state_ = state;
65 callback_.Run(state);
66 }
OLDNEW
« no previous file with comments | « chrome/common/net/net_error_tracker.h ('k') | chrome/common/net/net_error_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698