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

Side by Side Diff: chrome/browser/extensions/api/dial/dial_api.cc

Issue 177003015: Pull AsyncApiFunction out of src/chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase for storage_api Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
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/time.h" 9 #include "base/time/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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 void DialAPI::ShutdownOnUIThread() {} 146 void DialAPI::ShutdownOnUIThread() {}
147 147
148 namespace api { 148 namespace api {
149 149
150 DialDiscoverNowFunction::DialDiscoverNowFunction() 150 DialDiscoverNowFunction::DialDiscoverNowFunction()
151 : dial_(NULL), result_(false) { 151 : dial_(NULL), result_(false) {
152 } 152 }
153 153
154 bool DialDiscoverNowFunction::Prepare() { 154 bool DialDiscoverNowFunction::Prepare() {
155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 155 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
156 DCHECK(GetProfile()); 156 DCHECK(browser_context());
157 dial_ = DialAPIFactory::GetForProfile(GetProfile()).get(); 157 dial_ = DialAPIFactory::GetForBrowserContext(browser_context()).get();
158 return true; 158 return true;
159 } 159 }
160 160
161 void DialDiscoverNowFunction::Work() { 161 void DialDiscoverNowFunction::Work() {
162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 162 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
163 result_ = dial_->dial_registry()->DiscoverNow(); 163 result_ = dial_->dial_registry()->DiscoverNow();
164 } 164 }
165 165
166 bool DialDiscoverNowFunction::Respond() { 166 bool DialDiscoverNowFunction::Respond() {
167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
168 if (!result_) 168 if (!result_)
169 error_ = kDialServiceError; 169 error_ = kDialServiceError;
170 170
171 SetResult(new base::FundamentalValue(result_)); 171 SetResult(new base::FundamentalValue(result_));
172 return true; 172 return true;
173 } 173 }
174 174
175 } // namespace api 175 } // namespace api
176 176
177 } // namespace extensions 177 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/dial/dial_api.h ('k') | chrome/browser/extensions/api/dial/dial_api_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698