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

Side by Side Diff: chrome/browser/intranet_redirect_detector.h

Issue 6526059: Plumb through NetworkChangeNotifier::IsOffline() to WebKit, enabling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Appease the C++ type system Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_INTRANET_REDIRECT_DETECTOR_H_ 5 #ifndef CHROME_BROWSER_INTRANET_REDIRECT_DETECTOR_H_
6 #define CHROME_BROWSER_INTRANET_REDIRECT_DETECTOR_H_ 6 #define CHROME_BROWSER_INTRANET_REDIRECT_DETECTOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 17 matching lines...) Expand all
28 // 28 //
29 // We use this information in the AlternateNavURLFetcher to avoid displaying 29 // We use this information in the AlternateNavURLFetcher to avoid displaying
30 // infobars for these cases. Our infobars are designed to allow users to get at 30 // infobars for these cases. Our infobars are designed to allow users to get at
31 // intranet sites when they were erroneously taken to a search result page. In 31 // intranet sites when they were erroneously taken to a search result page. In
32 // these cases, however, users would be shown a confusing and useless infobar 32 // these cases, however, users would be shown a confusing and useless infobar
33 // when they really did mean to do a search. 33 // when they really did mean to do a search.
34 // 34 //
35 // Consumers should call RedirectOrigin(), which is guaranteed to synchronously 35 // Consumers should call RedirectOrigin(), which is guaranteed to synchronously
36 // return a value at all times (even during startup or in unittest mode). If no 36 // return a value at all times (even during startup or in unittest mode). If no
37 // redirection is in place, the returned GURL will be empty. 37 // redirection is in place, the returned GURL will be empty.
38 class IntranetRedirectDetector : public URLFetcher::Delegate, 38 class IntranetRedirectDetector
39 public NotificationObserver, 39 : public URLFetcher::Delegate,
40 public net::NetworkChangeNotifier::Observer { 40 public NotificationObserver,
41 public net::NetworkChangeNotifier::IPAddressObserver {
41 public: 42 public:
42 // Only the main browser process loop should call this, when setting up 43 // Only the main browser process loop should call this, when setting up
43 // g_browser_process->intranet_redirect_detector_. No code other than the 44 // g_browser_process->intranet_redirect_detector_. No code other than the
44 // IntranetRedirectDetector itself should actually use 45 // IntranetRedirectDetector itself should actually use
45 // g_browser_process->intranet_redirect_detector() (which shouldn't be hard, 46 // g_browser_process->intranet_redirect_detector() (which shouldn't be hard,
46 // since there aren't useful public functions on this object for consumers to 47 // since there aren't useful public functions on this object for consumers to
47 // access anyway). 48 // access anyway).
48 IntranetRedirectDetector(); 49 IntranetRedirectDetector();
49 ~IntranetRedirectDetector(); 50 ~IntranetRedirectDetector();
50 51
(...skipping 23 matching lines...) Expand all
74 const net::URLRequestStatus& status, 75 const net::URLRequestStatus& status,
75 int response_code, 76 int response_code,
76 const ResponseCookies& cookies, 77 const ResponseCookies& cookies,
77 const std::string& data); 78 const std::string& data);
78 79
79 // NotificationObserver 80 // NotificationObserver
80 virtual void Observe(NotificationType type, 81 virtual void Observe(NotificationType type,
81 const NotificationSource& source, 82 const NotificationSource& source,
82 const NotificationDetails& details); 83 const NotificationDetails& details);
83 84
84 // NetworkChangeNotifier::Observer 85 // NetworkChangeNotifier::IPAddressObserver
85 virtual void OnIPAddressChanged(); 86 virtual void OnIPAddressChanged();
86 87
87 NotificationRegistrar registrar_; 88 NotificationRegistrar registrar_;
88 GURL redirect_origin_; 89 GURL redirect_origin_;
89 ScopedRunnableMethodFactory<IntranetRedirectDetector> fetcher_factory_; 90 ScopedRunnableMethodFactory<IntranetRedirectDetector> fetcher_factory_;
90 Fetchers fetchers_; 91 Fetchers fetchers_;
91 std::vector<GURL> resulting_origins_; 92 std::vector<GURL> resulting_origins_;
92 bool in_sleep_; // True if we're in the seven-second "no fetching" period 93 bool in_sleep_; // True if we're in the seven-second "no fetching" period
93 // that begins at browser start, or the one-second "no 94 // that begins at browser start, or the one-second "no
94 // fetching" period that begins after network switches. 95 // fetching" period that begins after network switches.
(...skipping 12 matching lines...) Expand all
107 explicit IntranetRedirectHostResolverProc(net::HostResolverProc* previous); 108 explicit IntranetRedirectHostResolverProc(net::HostResolverProc* previous);
108 109
109 virtual int Resolve(const std::string& host, 110 virtual int Resolve(const std::string& host,
110 net::AddressFamily address_family, 111 net::AddressFamily address_family,
111 net::HostResolverFlags host_resolver_flags, 112 net::HostResolverFlags host_resolver_flags,
112 net::AddressList* addrlist, 113 net::AddressList* addrlist,
113 int* os_error); 114 int* os_error);
114 }; 115 };
115 116
116 #endif // CHROME_BROWSER_INTRANET_REDIRECT_DETECTOR_H_ 117 #endif // CHROME_BROWSER_INTRANET_REDIRECT_DETECTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker.cc ('k') | chrome/browser/intranet_redirect_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698