| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/common/net/url_request_context_getter.h" | 10 #include "chrome/common/net/url_request_context_getter.h" |
| 11 #include "chrome/service/net/service_url_request_context.h" | 11 #include "chrome/service/net/service_url_request_context.h" |
| 12 #include "chrome/service/remoting/remoting_directory_service.h" | 12 #include "chrome/service/remoting/remoting_directory_service.h" |
| 13 #include "net/base/net_util.h" | 13 #include "net/base/net_util.h" |
| 14 #include "net/http/http_request_headers.h" | 14 #include "net/http/http_request_headers.h" |
| 15 #include "remoting/host/host_key_pair.h" | 15 #include "remoting/host/host_key_pair.h" |
| 16 | 16 |
| 17 static const char kRemotingDirectoryUrl[] = | 17 static const char kRemotingDirectoryUrl[] = |
| 18 "http://www-googleapis-test.sandbox.google.com/chromoting/v1/@me/hosts"; | 18 "https://www.googleapis.com/chromoting/v1/@me/hosts"; |
| 19 | 19 |
| 20 RemotingDirectoryService::RemotingDirectoryService(Client* client) | 20 RemotingDirectoryService::RemotingDirectoryService(Client* client) |
| 21 : client_(client) { | 21 : client_(client) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 RemotingDirectoryService::~RemotingDirectoryService() { | 24 RemotingDirectoryService::~RemotingDirectoryService() { |
| 25 DCHECK(!fetcher_.get()) << "URLFetcher not destroyed."; | 25 DCHECK(!fetcher_.get()) << "URLFetcher not destroyed."; |
| 26 } | 26 } |
| 27 | 27 |
| 28 void RemotingDirectoryService::AddHost(const std::string& token) { | 28 void RemotingDirectoryService::AddHost(const std::string& token) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // Destroy the fetcher after the response has been received. | 75 // Destroy the fetcher after the response has been received. |
| 76 fetcher_.reset(); | 76 fetcher_.reset(); |
| 77 | 77 |
| 78 // TODO(hclam): Simply checking 200 status is not enough. | 78 // TODO(hclam): Simply checking 200 status is not enough. |
| 79 if (response_code == 200) { | 79 if (response_code == 200) { |
| 80 client_->OnRemotingHostAdded(); | 80 client_->OnRemotingHostAdded(); |
| 81 } else { | 81 } else { |
| 82 client_->OnRemotingDirectoryError(); | 82 client_->OnRemotingDirectoryError(); |
| 83 } | 83 } |
| 84 } | 84 } |
| OLD | NEW |