| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/system/network_selector.h" | 5 #include "athena/system/network_selector.h" |
| 6 | 6 |
| 7 #include "athena/screen/public/screen_manager.h" | 7 #include "athena/screen/public/screen_manager.h" |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chromeos/network/network_configuration_handler.h" | 10 #include "chromeos/network/network_configuration_handler.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 connect_ = new views::BlueButton(this, base::ASCIIToUTF16("Connect")); | 90 connect_ = new views::BlueButton(this, base::ASCIIToUTF16("Connect")); |
| 91 container->AddChildView(connect_); | 91 container->AddChildView(connect_); |
| 92 | 92 |
| 93 cancel_ = new views::LabelButton(this, base::ASCIIToUTF16("Cancel")); | 93 cancel_ = new views::LabelButton(this, base::ASCIIToUTF16("Cancel")); |
| 94 cancel_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 94 cancel_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 95 container->AddChildView(cancel_); | 95 container->AddChildView(cancel_); |
| 96 | 96 |
| 97 AddChildView(container); | 97 AddChildView(container); |
| 98 } | 98 } |
| 99 | 99 |
| 100 virtual ~PasswordView() {} | 100 ~PasswordView() override {} |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 void CloseDialog(bool successful) { callback_.Run(successful); } | 103 void CloseDialog(bool successful) { callback_.Run(successful); } |
| 104 | 104 |
| 105 void OnKnownError(const std::string& error_name, | 105 void OnKnownError(const std::string& error_name, |
| 106 scoped_ptr<base::DictionaryValue> error_data) { | 106 scoped_ptr<base::DictionaryValue> error_data) { |
| 107 std::string message; | 107 std::string message; |
| 108 if (!error_data->GetString(chromeos::network_handler::kDbusErrorMessage, | 108 if (!error_data->GetString(chromeos::network_handler::kDbusErrorMessage, |
| 109 &message)) | 109 &message)) |
| 110 message = error_name; | 110 message = error_name; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 class NetworkRow : public views::View { | 197 class NetworkRow : public views::View { |
| 198 public: | 198 public: |
| 199 NetworkRow(const ui::NetworkInfo& network) | 199 NetworkRow(const ui::NetworkInfo& network) |
| 200 : network_(network), weak_ptr_(this) { | 200 : network_(network), weak_ptr_(this) { |
| 201 SetBorder(views::Border::CreateEmptyBorder(10, 5, 10, 5)); | 201 SetBorder(views::Border::CreateEmptyBorder(10, 5, 10, 5)); |
| 202 SetLayoutManager( | 202 SetLayoutManager( |
| 203 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 10)); | 203 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 10)); |
| 204 Update(network); | 204 Update(network); |
| 205 } | 205 } |
| 206 | 206 |
| 207 virtual ~NetworkRow() {} | 207 ~NetworkRow() override {} |
| 208 | 208 |
| 209 void Update(const ui::NetworkInfo& network) { | 209 void Update(const ui::NetworkInfo& network) { |
| 210 network_ = network; | 210 network_ = network; |
| 211 views::ImageView* icon = new views::ImageView(); | 211 views::ImageView* icon = new views::ImageView(); |
| 212 icon->SetImage(network.image); | 212 icon->SetImage(network.image); |
| 213 icon->SetBounds(0, 0, network.image.width(), network.image.height()); | 213 icon->SetBounds(0, 0, network.image.width(), network.image.height()); |
| 214 | 214 |
| 215 views::Label* label = new views::Label(network.label); | 215 views::Label* label = new views::Label(network.label); |
| 216 if (network.highlight) | 216 if (network.highlight) |
| 217 label->SetFontList(label->font_list().Derive(0, gfx::Font::BOLD)); | 217 label->SetFontList(label->font_list().Derive(0, gfx::Font::BOLD)); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 NetworkSelector() | 319 NetworkSelector() |
| 320 : scroll_content_(nullptr), scroller_(nullptr), network_list_(this) { | 320 : scroll_content_(nullptr), scroller_(nullptr), network_list_(this) { |
| 321 CreateNetworkList(); | 321 CreateNetworkList(); |
| 322 CreateWidget(); | 322 CreateWidget(); |
| 323 | 323 |
| 324 NetworkHandler::Get()->network_state_handler()->RequestScan(); | 324 NetworkHandler::Get()->network_state_handler()->RequestScan(); |
| 325 NetworkHandler::Get()->network_state_handler()->AddObserver(this, | 325 NetworkHandler::Get()->network_state_handler()->AddObserver(this, |
| 326 FROM_HERE); | 326 FROM_HERE); |
| 327 } | 327 } |
| 328 | 328 |
| 329 virtual ~NetworkSelector() { | 329 ~NetworkSelector() override { |
| 330 NetworkHandler::Get()->network_state_handler()->RemoveObserver(this, | 330 NetworkHandler::Get()->network_state_handler()->RemoveObserver(this, |
| 331 FROM_HERE); | 331 FROM_HERE); |
| 332 } | 332 } |
| 333 | 333 |
| 334 private: | 334 private: |
| 335 void CreateWidget() { | 335 void CreateWidget() { |
| 336 // Same as CreateDialogWidgetWithBounds() with an empty |bounds|. | 336 // Same as CreateDialogWidgetWithBounds() with an empty |bounds|. |
| 337 views::Widget* widget = views::DialogDelegate::CreateDialogWidget( | 337 views::Widget* widget = views::DialogDelegate::CreateDialogWidget( |
| 338 this, athena::ScreenManager::Get()->GetContext(), nullptr); | 338 this, athena::ScreenManager::Get()->GetContext(), nullptr); |
| 339 widget->Show(); | 339 widget->Show(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 424 |
| 425 } // namespace | 425 } // namespace |
| 426 | 426 |
| 427 namespace athena { | 427 namespace athena { |
| 428 | 428 |
| 429 void CreateNetworkSelector() { | 429 void CreateNetworkSelector() { |
| 430 new NetworkSelector(); | 430 new NetworkSelector(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 } // namespace athena | 433 } // namespace athena |
| OLD | NEW |