OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/client/plugin/pepper_pin_fetcher.h" |
| 6 |
| 7 #include "remoting/client/plugin/chromoting_instance.h" |
| 8 |
| 9 namespace remoting { |
| 10 |
| 11 PepperPinFetcher::PepperPinFetcher(base::WeakPtr<ChromotingInstance> parent) |
| 12 : parent_(parent), |
| 13 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 14 } |
| 15 |
| 16 PepperPinFetcher::~PepperPinFetcher() { |
| 17 } |
| 18 |
| 19 void PepperPinFetcher::FetchPin( |
| 20 const PinFetchedCallback& pin_fetched_callback) { |
| 21 if (parent_) { |
| 22 pin_fetched_callback_ = pin_fetched_callback; |
| 23 parent_->FetchPin(weak_factory_.GetWeakPtr()); |
| 24 } |
| 25 } |
| 26 |
| 27 void PepperPinFetcher::OnPinFetched(const std::string& pin) { |
| 28 if (!pin_fetched_callback_.is_null()) { |
| 29 pin_fetched_callback_.Run(pin); |
| 30 pin_fetched_callback_.Reset(); |
| 31 } |
| 32 } |
| 33 |
| 34 } // namespace remoting |
OLD | NEW |