summaryrefslogtreecommitdiffstats
path: root/ash/system/network/network_observer.h
blob: afd0722afeea7fd37e8172c94dc2f74cbe8dc4ca (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
// Copyright (c) 2012 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.

#ifndef ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H
#define ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H
#pragma once

#include "base/string16.h"

namespace ash {

struct NetworkIconInfo;
class NetworkTrayDelegate;

class NetworkTrayDelegate {
 public:
  virtual ~NetworkTrayDelegate() {}

  virtual void NotificationLinkClicked() = 0;
};

class NetworkObserver {
 public:
  enum ErrorType {
    // Priority order, highest to lowest.
    ERROR_CONNECT_FAILED,
    ERROR_DATA_NONE,
    ERROR_DATA_LOW
  };

  virtual ~NetworkObserver() {}

  virtual void OnNetworkRefresh(const NetworkIconInfo& info) = 0;

  // Sets a network error notification. |error_type| identifies the type of
  // error. |delegate|->NotificationLinkClicked() will be called if |link_text|
  // is clicked (if supplied, |link_text| may be empty).
  virtual void SetNetworkError(NetworkTrayDelegate* delegate,
                               ErrorType error_type,
                               const string16& title,
                               const string16& message,
                               const string16& link_text) = 0;
  // Clears the error notification for |error_type|.
  virtual void ClearNetworkError(ErrorType error_type) = 0;
};

}  // namespace ash

#endif  // ASH_SYSTEM_NETWORK_NETWORK_OBSERVER_H