OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/dial/dial_api.h" | 5 #include "chrome/browser/extensions/api/dial/dial_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/browser/extensions/api/dial/dial_api_factory.h" | 10 #include "chrome/browser/extensions/api/dial/dial_api_factory.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 namespace api { | 146 namespace api { |
147 | 147 |
148 DialDiscoverNowFunction::DialDiscoverNowFunction() | 148 DialDiscoverNowFunction::DialDiscoverNowFunction() |
149 : dial_(NULL), result_(false) { | 149 : dial_(NULL), result_(false) { |
150 } | 150 } |
151 | 151 |
152 bool DialDiscoverNowFunction::Prepare() { | 152 bool DialDiscoverNowFunction::Prepare() { |
153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 153 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
154 DCHECK(profile()); | 154 DCHECK(profile()); |
155 dial_ = DialAPIFactory::GetInstance()->GetForProfile(profile()); | 155 dial_ = DialAPIFactory::GetInstance()->GetForProfile(profile()).get(); |
156 return true; | 156 return true; |
157 } | 157 } |
158 | 158 |
159 void DialDiscoverNowFunction::Work() { | 159 void DialDiscoverNowFunction::Work() { |
160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
161 result_ = dial_->dial_registry()->DiscoverNow(); | 161 result_ = dial_->dial_registry()->DiscoverNow(); |
162 } | 162 } |
163 | 163 |
164 bool DialDiscoverNowFunction::Respond() { | 164 bool DialDiscoverNowFunction::Respond() { |
165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
166 if (!result_) | 166 if (!result_) |
167 error_ = kDialServiceError; | 167 error_ = kDialServiceError; |
168 | 168 |
169 SetResult(base::Value::CreateBooleanValue(result_)); | 169 SetResult(base::Value::CreateBooleanValue(result_)); |
170 return true; | 170 return true; |
171 } | 171 } |
172 | 172 |
173 } // namespace api | 173 } // namespace api |
174 | 174 |
175 } // namespace extensions | 175 } // namespace extensions |
OLD | NEW |