OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/login/screens/network_screen.h" | 5 #include "chrome/browser/chromeos/login/screens/network_screen.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 void NetworkScreen::Initialize(::login::ScreenContext* context) { | 111 void NetworkScreen::Initialize(::login::ScreenContext* context) { |
112 NetworkModel::Initialize(context); | 112 NetworkModel::Initialize(context); |
113 OnSystemTimezoneChanged(); | 113 OnSystemTimezoneChanged(); |
114 UpdateLanguageList(); | 114 UpdateLanguageList(); |
115 } | 115 } |
116 | 116 |
117 void NetworkScreen::OnViewDestroyed(NetworkView* view) { | 117 void NetworkScreen::OnViewDestroyed(NetworkView* view) { |
118 if (view_ == view) { | 118 if (view_ == view) { |
119 view_ = nullptr; | 119 view_ = nullptr; |
120 timezone_subscription_.reset(); | 120 timezone_subscription_.reset(); |
| 121 // Ownership of NetworkScreen is complicated; ensure that we remove |
| 122 // this as a NetworkStateHandler observer when the view is destroyed. |
| 123 UnsubscribeNetworkNotification(); |
121 } | 124 } |
122 } | 125 } |
123 | 126 |
124 void NetworkScreen::OnUserAction(const std::string& action_id) { | 127 void NetworkScreen::OnUserAction(const std::string& action_id) { |
125 if (action_id == kUserActionContinueButtonClicked) { | 128 if (action_id == kUserActionContinueButtonClicked) { |
126 OnContinueButtonPressed(); | 129 OnContinueButtonPressed(); |
127 } else if (action_id == kUserActionConnectDebuggingFeaturesClicked) { | 130 } else if (action_id == kUserActionConnectDebuggingFeaturesClicked) { |
128 if (delegate_) | 131 if (delegate_) |
129 delegate_->OnEnableDebuggingScreenRequested(); | 132 delegate_->OnEnableDebuggingScreenRequested(); |
130 } else { | 133 } else { |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 FOR_EACH_OBSERVER(Observer, observers_, OnLanguageListReloaded()); | 440 FOR_EACH_OBSERVER(Observer, observers_, OnLanguageListReloaded()); |
438 } | 441 } |
439 | 442 |
440 void NetworkScreen::OnSystemTimezoneChanged() { | 443 void NetworkScreen::OnSystemTimezoneChanged() { |
441 std::string current_timezone_id; | 444 std::string current_timezone_id; |
442 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); | 445 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); |
443 GetContextEditor().SetString(kContextKeyTimezone, current_timezone_id); | 446 GetContextEditor().SetString(kContextKeyTimezone, current_timezone_id); |
444 } | 447 } |
445 | 448 |
446 } // namespace chromeos | 449 } // namespace chromeos |
OLD | NEW |