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

Side by Side Diff: chromeos/network/favorite_state.cc

Issue 21046008: Convert all connect code to use NetworkHandler instead of NetworkLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add NetworkConfigurationHandler::SetNetworkProfile Created 7 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chromeos/network/favorite_state.h" 5 #include "chromeos/network/favorite_state.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chromeos/network/network_event_log.h" 10 #include "chromeos/network/network_event_log.h"
11 #include "chromeos/network/network_profile_handler.h" 11 #include "chromeos/network/network_profile_handler.h"
12 #include "chromeos/network/network_state.h" 12 #include "chromeos/network/network_state.h"
13 #include "third_party/cros_system_api/dbus/service_constants.h" 13 #include "third_party/cros_system_api/dbus/service_constants.h"
14 14
15 namespace chromeos { 15 namespace chromeos {
16 16
17 FavoriteState::FavoriteState(const std::string& path) 17 FavoriteState::FavoriteState(const std::string& path)
18 : ManagedState(MANAGED_TYPE_FAVORITE, path), 18 : ManagedState(MANAGED_TYPE_FAVORITE, path) {
19 onc_source_(onc::ONC_SOURCE_NONE) {
20 } 19 }
21 20
22 FavoriteState::~FavoriteState() { 21 FavoriteState::~FavoriteState() {
23 } 22 }
24 23
25 bool FavoriteState::PropertyChanged(const std::string& key, 24 bool FavoriteState::PropertyChanged(const std::string& key,
26 const base::Value& value) { 25 const base::Value& value) {
27 if (ManagedStatePropertyChanged(key, value)) 26 if (ManagedStatePropertyChanged(key, value))
28 return true; 27 return true;
29 if (key == flimflam::kProfileProperty) { 28 if (key == flimflam::kProfileProperty) {
30 return GetStringValue(key, value, &profile_path_); 29 return GetStringValue(key, value, &profile_path_);
31 } else if (key == flimflam::kUIDataProperty) { 30 } else if (key == flimflam::kUIDataProperty) {
32 if (!NetworkState::GetOncSource(value, &onc_source_)) { 31 if (!NetworkState::GetUIDataFromValue(value, &ui_data_)) {
33 NET_LOG_ERROR("Failed to parse " + key, path()); 32 NET_LOG_ERROR("Failed to parse " + key, path());
34 return false; 33 return false;
35 } 34 }
36 return true; 35 return true;
37 } 36 }
38 return false; 37 return false;
39 } 38 }
40 39
41 bool FavoriteState::IsManaged() const { 40 bool FavoriteState::IsManaged() const {
42 return onc_source_ == onc::ONC_SOURCE_DEVICE_POLICY || 41 return ui_data_.onc_source() == onc::ONC_SOURCE_DEVICE_POLICY ||
43 onc_source_ == onc::ONC_SOURCE_USER_POLICY; 42 ui_data_.onc_source() == onc::ONC_SOURCE_USER_POLICY;
44 } 43 }
45 44
46 bool FavoriteState::IsPrivate() const { 45 bool FavoriteState::IsPrivate() const {
47 return !profile_path_.empty() && 46 return !profile_path_.empty() &&
48 profile_path_ != NetworkProfileHandler::kSharedProfilePath; 47 profile_path_ != NetworkProfileHandler::kSharedProfilePath;
49 } 48 }
50 49
51 } // namespace chromeos 50 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698