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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
7 // | 7 // |
8 // OVERVIEW | 8 // OVERVIEW |
9 // | 9 // |
10 // A MetricsService instance is created at ChromeFrame startup in | 10 // A MetricsService instance is created at ChromeFrame startup in |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 132 } |
133 | 133 |
134 DCHECK(cache_stream_.get()); | 134 DCHECK(cache_stream_.get()); |
135 | 135 |
136 unsigned long written = 0; | 136 unsigned long written = 0; |
137 cache_stream_->Write(upload_data.c_str(), upload_data_size_, &written); | 137 cache_stream_->Write(upload_data.c_str(), upload_data_size_, &written); |
138 DCHECK(written == upload_data_size_); | 138 DCHECK(written == upload_data_size_); |
139 | 139 |
140 RewindStream(cache_stream_); | 140 RewindStream(cache_stream_); |
141 | 141 |
142 server_url_ = ASCIIToWide(server_url); | 142 server_url_ = base::ASCIIToWide(server_url); |
143 mime_type_ = mime_type; | 143 mime_type_ = mime_type; |
144 DCHECK(!server_url_.empty()); | 144 DCHECK(!server_url_.empty()); |
145 DCHECK(!mime_type_.empty()); | 145 DCHECK(!mime_type_.empty()); |
146 | 146 |
147 hr = CreateURLMoniker(NULL, server_url_.c_str(), | 147 hr = CreateURLMoniker(NULL, server_url_.c_str(), |
148 upload_moniker_.Receive()); | 148 upload_moniker_.Receive()); |
149 if (FAILED(hr)) { | 149 if (FAILED(hr)) { |
150 DLOG(ERROR) << "Failed to create url moniker for url:" | 150 DLOG(ERROR) << "Failed to create url moniker for url:" |
151 << server_url_.c_str() | 151 << server_url_.c_str() |
152 << " Error:" | 152 << " Error:" |
(...skipping 25 matching lines...) Expand all Loading... |
178 "Content-Length: %s\r\n" | 178 "Content-Length: %s\r\n" |
179 "Content-Type: %s\r\n" | 179 "Content-Type: %s\r\n" |
180 "%s\r\n", | 180 "%s\r\n", |
181 base::Int64ToString(upload_data_size_).c_str(), | 181 base::Int64ToString(upload_data_size_).c_str(), |
182 mime_type_.c_str(), | 182 mime_type_.c_str(), |
183 http_utils::GetDefaultUserAgentHeaderWithCFTag().c_str()); | 183 http_utils::GetDefaultUserAgentHeaderWithCFTag().c_str()); |
184 | 184 |
185 *additional_headers = reinterpret_cast<wchar_t*>( | 185 *additional_headers = reinterpret_cast<wchar_t*>( |
186 CoTaskMemAlloc((new_headers.size() + 1) * sizeof(wchar_t))); | 186 CoTaskMemAlloc((new_headers.size() + 1) * sizeof(wchar_t))); |
187 | 187 |
188 lstrcpynW(*additional_headers, ASCIIToWide(new_headers).c_str(), | 188 lstrcpynW(*additional_headers, base::ASCIIToWide(new_headers).c_str(), |
189 new_headers.size()); | 189 new_headers.size()); |
190 | 190 |
191 return BSCBImpl::BeginningTransaction(url, headers, reserved, | 191 return BSCBImpl::BeginningTransaction(url, headers, reserved, |
192 additional_headers); | 192 additional_headers); |
193 } | 193 } |
194 | 194 |
195 STDMETHOD(GetBindInfo)(DWORD* bind_flags, BINDINFO* bind_info) { | 195 STDMETHOD(GetBindInfo)(DWORD* bind_flags, BINDINFO* bind_info) { |
196 if ((bind_info == NULL) || (bind_info->cbSize == 0) || | 196 if ((bind_info == NULL) || (bind_info->cbSize == 0) || |
197 (bind_flags == NULL)) | 197 (bind_flags == NULL)) |
198 return E_INVALIDARG; | 198 return E_INVALIDARG; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 const int kGUIDSize = 39; | 308 const int kGUIDSize = 39; |
309 | 309 |
310 GUID guid; | 310 GUID guid; |
311 HRESULT guid_result = CoCreateGuid(&guid); | 311 HRESULT guid_result = CoCreateGuid(&guid); |
312 DCHECK(SUCCEEDED(guid_result)); | 312 DCHECK(SUCCEEDED(guid_result)); |
313 | 313 |
314 base::string16 guid_string; | 314 base::string16 guid_string; |
315 int result = StringFromGUID2(guid, | 315 int result = StringFromGUID2(guid, |
316 WriteInto(&guid_string, kGUIDSize), kGUIDSize); | 316 WriteInto(&guid_string, kGUIDSize), kGUIDSize); |
317 DCHECK(result == kGUIDSize); | 317 DCHECK(result == kGUIDSize); |
318 client_id_ = WideToUTF8(guid_string.substr(1, guid_string.length() - 2)); | 318 client_id_ = |
| 319 base::WideToUTF8(guid_string.substr(1, guid_string.length() - 2)); |
319 } | 320 } |
320 return client_id_; | 321 return client_id_; |
321 } | 322 } |
322 | 323 |
323 // static | 324 // static |
324 void CALLBACK MetricsService::TransmissionTimerProc(HWND window, | 325 void CALLBACK MetricsService::TransmissionTimerProc(HWND window, |
325 unsigned int message, | 326 unsigned int message, |
326 unsigned int event_id, | 327 unsigned int event_id, |
327 unsigned int time) { | 328 unsigned int time) { |
328 DVLOG(1) << "Transmission timer notified"; | 329 DVLOG(1) << "Transmission timer notified"; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 version += "-F"; | 455 version += "-F"; |
455 if (!version_info.IsOfficialBuild()) | 456 if (!version_info.IsOfficialBuild()) |
456 version.append("-devel"); | 457 version.append("-devel"); |
457 return version; | 458 return version; |
458 } else { | 459 } else { |
459 NOTREACHED() << "Unable to retrieve version string."; | 460 NOTREACHED() << "Unable to retrieve version string."; |
460 } | 461 } |
461 | 462 |
462 return std::string(); | 463 return std::string(); |
463 } | 464 } |
OLD | NEW |