root/chromeos/network/favorite_state.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


// Copyright 2013 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 CHROMEOS_NETWORK_FAVORITE_STATE_H_
#define CHROMEOS_NETWORK_FAVORITE_STATE_H_

#include <string>

#include "base/values.h"
#include "chromeos/network/managed_state.h"
#include "chromeos/network/network_ui_data.h"
#include "components/onc/onc_constants.h"

namespace chromeos {

// A simple class to provide essential information for Services created
// by Shill corresponding to Profile Entries (i.e. 'preferred' or 'favorite'
// networks).
// Note: NetworkStateHandler will store an entry for each member of
// Manager.ServiceCompleteList, even for visible entries that are not
// favorites. This is necessary to avoid unnecessarily re-requesting entries,
// and to limit the code complexity. The IsFavorite() accessor is used to skip
// entries that are not actually favorites.
class CHROMEOS_EXPORT FavoriteState : public ManagedState {
 public:
  explicit FavoriteState(const std::string& path);
  virtual ~FavoriteState();

  // ManagedState overrides
  virtual bool PropertyChanged(const std::string& key,
                               const base::Value& value) OVERRIDE;

  // Accessors
  const std::string& profile_path() const { return profile_path_; }
  const NetworkUIData& ui_data() const { return ui_data_; }
  const base::DictionaryValue& proxy_config() const { return proxy_config_; }
  const std::string& guid() const { return guid_; }
  const base::DictionaryValue& properties() const { return properties_; }

  // Returns true if this is a favorite stored in a profile (see note above).
  bool IsFavorite() const;

  // Returns true if the network properties are stored in a user profile.
  bool IsPrivate() const;

 private:
  std::string profile_path_;
  NetworkUIData ui_data_;
  std::string guid_;

  // TODO(pneubeck): Remove this once (Managed)NetworkConfigurationHandler
  // provides proxy configuration. crbug.com/241775
  base::DictionaryValue proxy_config_;

  // Keep all Favorite properties in a dictionary so that all configured
  // properties can be examined for debugging. Since the Favorite list is
  // mostly fixed, the overhead should be reasonable.
  base::DictionaryValue properties_;

  DISALLOW_COPY_AND_ASSIGN(FavoriteState);
};

}  // namespace chromeos

#endif  // CHROMEOS_NETWORK_FAVORITE_STATE_H_

/* [<][>][^][v][top][bottom][index][help] */