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

Side by Side Diff: athena/system/network_selector.cc

Issue 653563004: NULL -> nullptr under athena/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « athena/system/background_controller.cc ('k') | athena/system/system_ui_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 namespace { 50 namespace {
51 51
52 // The View for the user to enter the password for connceting to a network. This 52 // The View for the user to enter the password for connceting to a network. This
53 // view also shows an error message if the network connection fails. 53 // view also shows an error message if the network connection fails.
54 class PasswordView : public views::View, public views::ButtonListener { 54 class PasswordView : public views::View, public views::ButtonListener {
55 public: 55 public:
56 PasswordView(const ui::NetworkInfo& network, 56 PasswordView(const ui::NetworkInfo& network,
57 const base::Callback<void(bool)>& callback) 57 const base::Callback<void(bool)>& callback)
58 : network_(network), 58 : network_(network),
59 callback_(callback), 59 callback_(callback),
60 connect_(NULL), 60 connect_(nullptr),
61 cancel_(NULL), 61 cancel_(nullptr),
62 textfield_(NULL), 62 textfield_(nullptr),
63 error_msg_(NULL), 63 error_msg_(nullptr),
64 weak_ptr_(this) { 64 weak_ptr_(this) {
65 const int kHorizontal = 5; 65 const int kHorizontal = 5;
66 const int kVertical = 0; 66 const int kVertical = 0;
67 const int kPadding = 0; 67 const int kPadding = 0;
68 68
69 views::BoxLayout* layout = new views::BoxLayout( 69 views::BoxLayout* layout = new views::BoxLayout(
70 views::BoxLayout::kVertical, kHorizontal, kVertical, kPadding); 70 views::BoxLayout::kVertical, kHorizontal, kVertical, kPadding);
71 layout->set_main_axis_alignment( 71 layout->set_main_axis_alignment(
72 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START); 72 views::BoxLayout::MAIN_AXIS_ALIGNMENT_START);
73 layout->set_cross_axis_alignment( 73 layout->set_cross_axis_alignment(
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 textfield_->RequestFocus(); 156 textfield_->RequestFocus();
157 } 157 }
158 158
159 // views::ButtonListener: 159 // views::ButtonListener:
160 virtual void ButtonPressed(views::Button* sender, 160 virtual void ButtonPressed(views::Button* sender,
161 const ui::Event& event) override { 161 const ui::Event& event) override {
162 if (sender == connect_) { 162 if (sender == connect_) {
163 if (error_msg_) { 163 if (error_msg_) {
164 RemoveChildView(error_msg_); 164 RemoveChildView(error_msg_);
165 delete error_msg_; 165 delete error_msg_;
166 error_msg_ = NULL; 166 error_msg_ = nullptr;
167 } 167 }
168 connect_->SetEnabled(false); 168 connect_->SetEnabled(false);
169 NetworkHandler::Get()->network_configuration_handler()->SetNetworkProfile( 169 NetworkHandler::Get()->network_configuration_handler()->SetNetworkProfile(
170 network_.service_path, 170 network_.service_path,
171 NetworkProfileHandler::GetSharedProfilePath(), 171 NetworkProfileHandler::GetSharedProfilePath(),
172 base::Bind(&PasswordView::OnSetProfileSucceed, 172 base::Bind(&PasswordView::OnSetProfileSucceed,
173 weak_ptr_.GetWeakPtr(), 173 weak_ptr_.GetWeakPtr(),
174 textfield_->text()), 174 textfield_->text()),
175 base::Bind(&PasswordView::OnKnownError, weak_ptr_.GetWeakPtr())); 175 base::Bind(&PasswordView::OnKnownError, weak_ptr_.GetWeakPtr()));
176 } else if (sender == cancel_) { 176 } else if (sender == cancel_) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 base::WeakPtrFactory<NetworkRow> weak_ptr_; 310 base::WeakPtrFactory<NetworkRow> weak_ptr_;
311 311
312 DISALLOW_COPY_AND_ASSIGN(NetworkRow); 312 DISALLOW_COPY_AND_ASSIGN(NetworkRow);
313 }; 313 };
314 314
315 class NetworkSelector : public ui::NetworkListDelegate, 315 class NetworkSelector : public ui::NetworkListDelegate,
316 public chromeos::NetworkStateHandlerObserver, 316 public chromeos::NetworkStateHandlerObserver,
317 public views::DialogDelegate { 317 public views::DialogDelegate {
318 public: 318 public:
319 NetworkSelector() 319 NetworkSelector()
320 : scroll_content_(NULL), scroller_(NULL), 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 virtual ~NetworkSelector() {
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(), NULL); 338 this, athena::ScreenManager::Get()->GetContext(), nullptr);
339 widget->Show(); 339 widget->Show();
340 widget->CenterWindow(gfx::Size(400, 400)); 340 widget->CenterWindow(gfx::Size(400, 400));
341 } 341 }
342 342
343 void CreateNetworkList() { 343 void CreateNetworkList() {
344 const int kListHeight = 400; 344 const int kListHeight = 400;
345 scroller_ = new views::ScrollView(); 345 scroller_ = new views::ScrollView();
346 scroller_->set_background( 346 scroller_->set_background(
347 views::Background::CreateSolidBackground(SK_ColorWHITE)); 347 views::Background::CreateSolidBackground(SK_ColorWHITE));
348 348
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « athena/system/background_controller.cc ('k') | athena/system/system_ui_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698