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

Side by Side Diff: chrome/browser/sync/notifier/base/network_status_detector_task.h

Issue 1956001: Moved XMPP notifier library from chrome/browser/sync to chrome/common.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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
(Empty)
1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_BASE_NETWORK_STATUS_DETECTOR_TASK_H_
6 #define CHROME_BROWSER_SYNC_NOTIFIER_BASE_NETWORK_STATUS_DETECTOR_TASK_H_
7
8 #include "chrome/browser/sync/notifier/base/time.h"
9 #include "talk/base/sigslot.h"
10 #include "talk/base/task.h"
11
12 namespace notifier {
13
14 class AsyncNetworkAlive;
15
16 // Detects the current network state and any changes to that.
17 class NetworkStatusDetectorTask : public talk_base::Task,
18 public sigslot::has_slots<> {
19 public:
20 // Create an instance of (a subclass of) this class.
21 static NetworkStatusDetectorTask* Create(talk_base::Task* parent);
22
23 // Determines the current network state and then calls
24 // SignalNetworkStateDetected.
25 void DetectNetworkState();
26
27 // Fires whenever the network state is detected.
28 // SignalNetworkStateDetected(was_alive, is_alive);
29 sigslot::signal2<bool, bool> SignalNetworkStateDetected;
30
31 protected:
32 explicit NetworkStatusDetectorTask(talk_base::Task* parent)
33 : talk_base::Task(parent),
34 initial_detection_done_(false),
35 is_alive_(false) {
36 }
37
38 virtual ~NetworkStatusDetectorTask() { }
39
40 virtual int ProcessStart() = 0;
41
42 // Stay around until aborted.
43 virtual int ProcessResponse() {
44 return STATE_BLOCKED;
45 }
46
47 void SetNetworkAlive(bool is_alive);
48
49 private:
50 bool initial_detection_done_;
51 bool is_alive_;
52
53 DISALLOW_COPY_AND_ASSIGN(NetworkStatusDetectorTask);
54 };
55
56 } // namespace notifier
57
58 #endif // CHROME_BROWSER_SYNC_NOTIFIER_BASE_NETWORK_STATUS_DETECTOR_TASK_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/notifier/base/nethelpers.cc ('k') | chrome/browser/sync/notifier/base/network_status_detector_task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698