OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/network_screen.h" | 5 #include "chrome/browser/chromeos/login/network_screen.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 59 matching lines...) Loading... |
70 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); | 70 NetworkLibrary* network = CrosLibrary::Get()->GetNetworkLibrary(); |
71 if (network && network->Connected()) { | 71 if (network && network->Connected()) { |
72 NotifyOnConnection(); | 72 NotifyOnConnection(); |
73 } else { | 73 } else { |
74 continue_pressed_ = true; | 74 continue_pressed_ = true; |
75 WaitForConnection(network_id_); | 75 WaitForConnection(network_id_); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 //////////////////////////////////////////////////////////////////////////////// | 79 //////////////////////////////////////////////////////////////////////////////// |
80 // NetworkLibrary::Observer implementation: | 80 // NetworkLibrary::NetworkManagerObserver implementation: |
81 | 81 |
82 void NetworkScreen::NetworkChanged(NetworkLibrary* network_lib) { | 82 void NetworkScreen::OnNetworkManagerChanged(NetworkLibrary* network_lib) { |
83 UpdateStatus(network_lib); | 83 UpdateStatus(network_lib); |
84 } | 84 } |
85 | 85 |
86 /////////////////////////////////////////////////////////////////////////////// | 86 /////////////////////////////////////////////////////////////////////////////// |
87 // NetworkScreen, ViewScreen implementation: | 87 // NetworkScreen, ViewScreen implementation: |
88 | 88 |
89 void NetworkScreen::CreateView() { | 89 void NetworkScreen::CreateView() { |
90 language_switch_menu_.InitLanguageMenu(); | 90 language_switch_menu_.InitLanguageMenu(); |
91 ViewScreen<NetworkSelectionView>::CreateView(); | 91 ViewScreen<NetworkSelectionView>::CreateView(); |
92 } | 92 } |
(...skipping 10 matching lines...) Loading... |
103 help_app_.reset(new HelpAppLauncher(view()->GetNativeWindow())); | 103 help_app_.reset(new HelpAppLauncher(view()->GetNativeWindow())); |
104 help_app_->ShowHelpTopic(HelpAppLauncher::HELP_CONNECTIVITY); | 104 help_app_->ShowHelpTopic(HelpAppLauncher::HELP_CONNECTIVITY); |
105 } | 105 } |
106 | 106 |
107 //////////////////////////////////////////////////////////////////////////////// | 107 //////////////////////////////////////////////////////////////////////////////// |
108 // NetworkScreen, public: | 108 // NetworkScreen, public: |
109 | 109 |
110 void NetworkScreen::Refresh() { | 110 void NetworkScreen::Refresh() { |
111 if (CrosLibrary::Get()->EnsureLoaded()) { | 111 if (CrosLibrary::Get()->EnsureLoaded()) { |
112 SubscribeNetworkNotification(); | 112 SubscribeNetworkNotification(); |
113 NetworkChanged(chromeos::CrosLibrary::Get()->GetNetworkLibrary()); | 113 OnNetworkManagerChanged(chromeos::CrosLibrary::Get()->GetNetworkLibrary()); |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 //////////////////////////////////////////////////////////////////////////////// | 117 //////////////////////////////////////////////////////////////////////////////// |
118 // NetworkScreen, private: | 118 // NetworkScreen, private: |
119 | 119 |
120 void NetworkScreen::SubscribeNetworkNotification() { | 120 void NetworkScreen::SubscribeNetworkNotification() { |
121 if (!is_network_subscribed_) { | 121 if (!is_network_subscribed_) { |
122 is_network_subscribed_ = true; | 122 is_network_subscribed_ = true; |
123 chromeos::CrosLibrary::Get()->GetNetworkLibrary()->AddObserver(this); | 123 chromeos::CrosLibrary::Get()->GetNetworkLibrary() |
| 124 ->AddNetworkManagerObserver(this); |
124 } | 125 } |
125 } | 126 } |
126 | 127 |
127 void NetworkScreen::UnsubscribeNetworkNotification() { | 128 void NetworkScreen::UnsubscribeNetworkNotification() { |
128 if (is_network_subscribed_) { | 129 if (is_network_subscribed_) { |
129 is_network_subscribed_ = false; | 130 is_network_subscribed_ = false; |
130 chromeos::CrosLibrary::Get()->GetNetworkLibrary()->RemoveObserver(this); | 131 chromeos::CrosLibrary::Get()->GetNetworkLibrary() |
| 132 ->RemoveNetworkManagerObserver(this); |
131 } | 133 } |
132 } | 134 } |
133 | 135 |
134 void NetworkScreen::NotifyOnConnection() { | 136 void NetworkScreen::NotifyOnConnection() { |
135 // TODO(nkostylev): Check network connectivity. | 137 // TODO(nkostylev): Check network connectivity. |
136 UnsubscribeNetworkNotification(); | 138 UnsubscribeNetworkNotification(); |
137 connection_timer_.Stop(); | 139 connection_timer_.Stop(); |
138 delegate()->GetObserver(this)->OnExit(ScreenObserver::NETWORK_CONNECTED); | 140 delegate()->GetObserver(this)->OnExit(ScreenObserver::NETWORK_CONNECTED); |
139 } | 141 } |
140 | 142 |
(...skipping 62 matching lines...) Loading... |
203 &NetworkScreen::OnConnectionTimeout); | 205 &NetworkScreen::OnConnectionTimeout); |
204 } | 206 } |
205 | 207 |
206 network_id_ = network_id; | 208 network_id_ = network_id; |
207 view()->ShowConnectingStatus(continue_pressed_, network_id_); | 209 view()->ShowConnectingStatus(continue_pressed_, network_id_); |
208 | 210 |
209 view()->EnableContinue(false); | 211 view()->EnableContinue(false); |
210 } | 212 } |
211 | 213 |
212 } // namespace chromeos | 214 } // namespace chromeos |
OLD | NEW |