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

Side by Side Diff: chrome/browser/chromeos/login/screens/hid_detection_screen.cc

Issue 2633413002: cros: Remove BaseScreen::Initialize method. (Closed)
Patch Set: Created 3 years, 11 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
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 "chrome/browser/chromeos/login/screens/hid_detection_screen.h" 5 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 namespace chromeos { 50 namespace chromeos {
51 51
52 HIDDetectionScreen::HIDDetectionScreen(BaseScreenDelegate* base_screen_delegate, 52 HIDDetectionScreen::HIDDetectionScreen(BaseScreenDelegate* base_screen_delegate,
53 HIDDetectionView* view) 53 HIDDetectionView* view)
54 : HIDDetectionModel(base_screen_delegate), 54 : HIDDetectionModel(base_screen_delegate),
55 view_(view), 55 view_(view),
56 weak_ptr_factory_(this) { 56 weak_ptr_factory_(this) {
57 DCHECK(view_); 57 DCHECK(view_);
58 if (view_) 58 if (view_)
59 view_->Bind(*this); 59 view_->Bind(*this);
60
61 device::BluetoothAdapterFactory::GetAdapter(base::Bind(
62 &HIDDetectionScreen::InitializeAdapter, weak_ptr_factory_.GetWeakPtr()));
60 } 63 }
61 64
62 HIDDetectionScreen::~HIDDetectionScreen() { 65 HIDDetectionScreen::~HIDDetectionScreen() {
63 adapter_initially_powered_.reset(); 66 adapter_initially_powered_.reset();
64 input_service_proxy_.RemoveObserver(this); 67 input_service_proxy_.RemoveObserver(this);
65 if (view_) 68 if (view_)
66 view_->Unbind(); 69 view_->Unbind();
67 if (discovery_session_.get()) 70 if (discovery_session_.get())
68 discovery_session_->Stop(base::Bind(&base::DoNothing), 71 discovery_session_->Stop(base::Bind(&base::DoNothing),
69 base::Bind(&base::DoNothing)); 72 base::Bind(&base::DoNothing));
(...skipping 17 matching lines...) Expand all
87 void HIDDetectionScreen::Hide() { 90 void HIDDetectionScreen::Hide() {
88 showing_ = false; 91 showing_ = false;
89 input_service_proxy_.RemoveObserver(this); 92 input_service_proxy_.RemoveObserver(this);
90 if (discovery_session_.get()) 93 if (discovery_session_.get())
91 discovery_session_->Stop(base::Bind(&base::DoNothing), 94 discovery_session_->Stop(base::Bind(&base::DoNothing),
92 base::Bind(&base::DoNothing)); 95 base::Bind(&base::DoNothing));
93 if (view_) 96 if (view_)
94 view_->Hide(); 97 view_->Hide();
95 } 98 }
96 99
97 void HIDDetectionScreen::Initialize(::login::ScreenContext* context) {
98 HIDDetectionModel::Initialize(context);
99
100 device::BluetoothAdapterFactory::GetAdapter(
101 base::Bind(&HIDDetectionScreen::InitializeAdapter,
102 weak_ptr_factory_.GetWeakPtr()));
103 }
104
105 void HIDDetectionScreen::OnContinueButtonClicked() { 100 void HIDDetectionScreen::OnContinueButtonClicked() {
106 101
107 ContinueScenarioType scenario_type; 102 ContinueScenarioType scenario_type;
108 if (!pointing_device_id_.empty() && !keyboard_device_id_.empty()) 103 if (!pointing_device_id_.empty() && !keyboard_device_id_.empty())
109 scenario_type = All_DEVICES_DETECTED; 104 scenario_type = All_DEVICES_DETECTED;
110 else if (pointing_device_id_.empty()) 105 else if (pointing_device_id_.empty())
111 scenario_type = KEYBOARD_DEVICE_ONLY_DETECTED; 106 scenario_type = KEYBOARD_DEVICE_ONLY_DETECTED;
112 else 107 else
113 scenario_type = POINTING_DEVICE_ONLY_DETECTED; 108 scenario_type = POINTING_DEVICE_ONLY_DETECTED;
114 109
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 scoped_refptr<device::BluetoothAdapter> 546 scoped_refptr<device::BluetoothAdapter>
552 HIDDetectionScreen::GetAdapterForTesting() { 547 HIDDetectionScreen::GetAdapterForTesting() {
553 return adapter_; 548 return adapter_;
554 } 549 }
555 550
556 void HIDDetectionScreen::SetAdapterInitialPoweredForTesting(bool powered) { 551 void HIDDetectionScreen::SetAdapterInitialPoweredForTesting(bool powered) {
557 adapter_initially_powered_.reset(new bool(powered)); 552 adapter_initially_powered_.reset(new bool(powered));
558 } 553 }
559 554
560 } // namespace chromeos 555 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/screens/hid_detection_screen.h ('k') | chrome/browser/chromeos/login/screens/network_screen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698