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

Side by Side Diff: extensions/browser/api/dns/dns_api.cc

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix test Created 6 years, 7 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 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 "extensions/browser/api/dns/dns_api.h" 5 #include "extensions/browser/api/dns/dns_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "content/public/browser/browser_context.h" 9 #include "content/public/browser/browser_context.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 12 matching lines...) Expand all
23 namespace extensions { 23 namespace extensions {
24 24
25 DnsResolveFunction::DnsResolveFunction() 25 DnsResolveFunction::DnsResolveFunction()
26 : resource_context_(NULL), 26 : resource_context_(NULL),
27 response_(false), 27 response_(false),
28 request_handle_(new net::HostResolver::RequestHandle()), 28 request_handle_(new net::HostResolver::RequestHandle()),
29 addresses_(new net::AddressList) {} 29 addresses_(new net::AddressList) {}
30 30
31 DnsResolveFunction::~DnsResolveFunction() {} 31 DnsResolveFunction::~DnsResolveFunction() {}
32 32
33 bool DnsResolveFunction::RunImpl() { 33 bool DnsResolveFunction::RunAsync() {
34 scoped_ptr<Resolve::Params> params(Resolve::Params::Create(*args_)); 34 scoped_ptr<Resolve::Params> params(Resolve::Params::Create(*args_));
35 EXTENSION_FUNCTION_VALIDATE(params.get()); 35 EXTENSION_FUNCTION_VALIDATE(params.get());
36 36
37 hostname_ = params->hostname; 37 hostname_ = params->hostname;
38 resource_context_ = browser_context()->GetResourceContext(); 38 resource_context_ = browser_context()->GetResourceContext();
39 39
40 bool result = BrowserThread::PostTask( 40 bool result = BrowserThread::PostTask(
41 BrowserThread::IO, 41 BrowserThread::IO,
42 FROM_HERE, 42 FROM_HERE,
43 base::Bind(&DnsResolveFunction::WorkOnIOThread, this)); 43 base::Bind(&DnsResolveFunction::WorkOnIOThread, this));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool post_task_result = BrowserThread::PostTask( 95 bool post_task_result = BrowserThread::PostTask(
96 BrowserThread::UI, 96 BrowserThread::UI,
97 FROM_HERE, 97 FROM_HERE,
98 base::Bind(&DnsResolveFunction::RespondOnUIThread, this)); 98 base::Bind(&DnsResolveFunction::RespondOnUIThread, this));
99 DCHECK(post_task_result); 99 DCHECK(post_task_result);
100 100
101 Release(); // Added in WorkOnIOThread(). 101 Release(); // Added in WorkOnIOThread().
102 } 102 }
103 103
104 } // namespace extensions 104 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698