| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 continue_pressed_(false), | 58 continue_pressed_(false), |
| 59 view_(view), | 59 view_(view), |
| 60 delegate_(delegate), | 60 delegate_(delegate), |
| 61 network_state_helper_(new login::NetworkStateHelper), | 61 network_state_helper_(new login::NetworkStateHelper), |
| 62 weak_factory_(this) { | 62 weak_factory_(this) { |
| 63 if (view_) | 63 if (view_) |
| 64 view_->Bind(*this); | 64 view_->Bind(*this); |
| 65 | 65 |
| 66 input_method::InputMethodManager::Get()->AddObserver(this); | 66 input_method::InputMethodManager::Get()->AddObserver(this); |
| 67 InitializeTimezoneObserver(); | 67 InitializeTimezoneObserver(); |
| 68 OnSystemTimezoneChanged(); |
| 69 UpdateLanguageList(); |
| 68 } | 70 } |
| 69 | 71 |
| 70 NetworkScreen::~NetworkScreen() { | 72 NetworkScreen::~NetworkScreen() { |
| 71 if (view_) | 73 if (view_) |
| 72 view_->Unbind(); | 74 view_->Unbind(); |
| 73 connection_timer_.Stop(); | 75 connection_timer_.Stop(); |
| 74 UnsubscribeNetworkNotification(); | 76 UnsubscribeNetworkNotification(); |
| 75 | 77 |
| 76 input_method::InputMethodManager::Get()->RemoveObserver(this); | 78 input_method::InputMethodManager::Get()->RemoveObserver(this); |
| 77 } | 79 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 97 if (view_) | 99 if (view_) |
| 98 view_->Show(); | 100 view_->Show(); |
| 99 } | 101 } |
| 100 | 102 |
| 101 void NetworkScreen::Hide() { | 103 void NetworkScreen::Hide() { |
| 102 timezone_subscription_.reset(); | 104 timezone_subscription_.reset(); |
| 103 if (view_) | 105 if (view_) |
| 104 view_->Hide(); | 106 view_->Hide(); |
| 105 } | 107 } |
| 106 | 108 |
| 107 void NetworkScreen::Initialize(::login::ScreenContext* context) { | |
| 108 NetworkModel::Initialize(context); | |
| 109 OnSystemTimezoneChanged(); | |
| 110 UpdateLanguageList(); | |
| 111 } | |
| 112 | |
| 113 void NetworkScreen::OnViewDestroyed(NetworkView* view) { | 109 void NetworkScreen::OnViewDestroyed(NetworkView* view) { |
| 114 if (view_ == view) { | 110 if (view_ == view) { |
| 115 view_ = nullptr; | 111 view_ = nullptr; |
| 116 timezone_subscription_.reset(); | 112 timezone_subscription_.reset(); |
| 117 // Ownership of NetworkScreen is complicated; ensure that we remove | 113 // Ownership of NetworkScreen is complicated; ensure that we remove |
| 118 // this as a NetworkStateHandler observer when the view is destroyed. | 114 // this as a NetworkStateHandler observer when the view is destroyed. |
| 119 UnsubscribeNetworkNotification(); | 115 UnsubscribeNetworkNotification(); |
| 120 } | 116 } |
| 121 } | 117 } |
| 122 | 118 |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 observer.OnLanguageListReloaded(); | 440 observer.OnLanguageListReloaded(); |
| 445 } | 441 } |
| 446 | 442 |
| 447 void NetworkScreen::OnSystemTimezoneChanged() { | 443 void NetworkScreen::OnSystemTimezoneChanged() { |
| 448 std::string current_timezone_id; | 444 std::string current_timezone_id; |
| 449 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); | 445 CrosSettings::Get()->GetString(kSystemTimezone, ¤t_timezone_id); |
| 450 GetContextEditor().SetString(kContextKeyTimezone, current_timezone_id); | 446 GetContextEditor().SetString(kContextKeyTimezone, current_timezone_id); |
| 451 } | 447 } |
| 452 | 448 |
| 453 } // namespace chromeos | 449 } // namespace chromeos |
| OLD | NEW |