OLD | NEW |
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/local_discovery/privetv3_session.h" | 5 #include "chrome/browser/local_discovery/privetv3_session.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "chrome/browser/local_discovery/privet_http.h" | 10 #include "chrome/browser/local_discovery/privet_http.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 void PrivetV3Session::FetcherDelegate::OnParsedJson( | 79 void PrivetV3Session::FetcherDelegate::OnParsedJson( |
80 PrivetURLFetcher* fetcher, | 80 PrivetURLFetcher* fetcher, |
81 const base::DictionaryValue& value, | 81 const base::DictionaryValue& value, |
82 bool has_error) { | 82 bool has_error) { |
83 if (session_) { | 83 if (session_) { |
84 DeleteThis(); | 84 DeleteThis(); |
85 callback_.Run( | 85 callback_.Run( |
86 has_error ? Result::STATUS_SETUPERROR : Result::STATUS_SUCCESS, value); | 86 has_error ? Result::STATUS_DEVICEERROR : Result::STATUS_SUCCESS, value); |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 void PrivetV3Session::FetcherDelegate::DeleteThis() { | 90 void PrivetV3Session::FetcherDelegate::DeleteThis() { |
91 base::MessageLoop::current()->PostTask( | 91 base::MessageLoop::current()->PostTask( |
92 FROM_HERE, base::Bind(&PrivetV3Session::DeleteFetcher, session_, | 92 FROM_HERE, base::Bind(&PrivetV3Session::DeleteFetcher, session_, |
93 base::Unretained(this))); | 93 base::Unretained(this))); |
94 } | 94 } |
95 | 95 |
96 PrivetV3Session::Request::Request() { | 96 PrivetV3Session::Request::Request() { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 void PrivetV3Session::RunCallback(const base::Closure& callback) { | 164 void PrivetV3Session::RunCallback(const base::Closure& callback) { |
165 callback.Run(); | 165 callback.Run(); |
166 } | 166 } |
167 | 167 |
168 void PrivetV3Session::DeleteFetcher(const FetcherDelegate* fetcher) { | 168 void PrivetV3Session::DeleteFetcher(const FetcherDelegate* fetcher) { |
169 fetchers_.erase(std::find(fetchers_.begin(), fetchers_.end(), fetcher)); | 169 fetchers_.erase(std::find(fetchers_.begin(), fetchers_.end(), fetcher)); |
170 } | 170 } |
171 | 171 |
172 } // namespace local_discovery | 172 } // namespace local_discovery |
OLD | NEW |