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

Side by Side Diff: chrome_frame/urlmon_bind_status_callback.cc

Issue 2087004: Merge 47232 - Not using std::wstring to store progress status text because ms... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/375/src/
Patch Set: Created 10 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
« no previous file with comments | « chrome_frame/urlmon_bind_status_callback.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome_frame/urlmon_bind_status_callback.h" 5 #include "chrome_frame/urlmon_bind_status_callback.h"
6 6
7 #include <mshtml.h> 7 #include <mshtml.h>
8 #include <shlguid.h> 8 #include <shlguid.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 } 196 }
197 DLOG(INFO) << __FUNCTION__ << "Url: " << url_ << 197 DLOG(INFO) << __FUNCTION__ << "Url: " << url_ <<
198 StringPrintf("Renderer type: %s", 198 StringPrintf("Renderer type: %s",
199 renderer_type_ == CHROME ? "CHROME" : "OTHER"); 199 renderer_type_ == CHROME ? "CHROME" : "OTHER");
200 } 200 }
201 } 201 }
202 202
203 ///////////////////////////////////////////////////////////////////// 203 /////////////////////////////////////////////////////////////////////
204 204
205 BSCBStorageBind::BSCBStorageBind() : clip_format_(CF_NULL) {
206 }
207
208 BSCBStorageBind::~BSCBStorageBind() {
209 for (std::vector<Progress*>::iterator i = saved_progress_.begin();
210 i != saved_progress_.end(); i++) {
211 delete (*i);
212 }
213 }
214
205 HRESULT BSCBStorageBind::Initialize(IMoniker* moniker, IBindCtx* bind_ctx) { 215 HRESULT BSCBStorageBind::Initialize(IMoniker* moniker, IBindCtx* bind_ctx) {
206 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i", 216 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
207 PlatformThread::CurrentId()); 217 PlatformThread::CurrentId());
208 218
209 std::wstring url = GetActualUrlFromMoniker(moniker, bind_ctx, 219 std::wstring url = GetActualUrlFromMoniker(moniker, bind_ctx,
210 std::wstring()); 220 std::wstring());
211 HRESULT hr = data_sniffer_.InitializeCache(url); 221 HRESULT hr = data_sniffer_.InitializeCache(url);
212 if (FAILED(hr)) 222 if (FAILED(hr))
213 return hr; 223 return hr;
214 224
(...skipping 26 matching lines...) Expand all
241 // chrome frame 251 // chrome frame
242 if (status_code == BINDSTATUS_REDIRECTING) { 252 if (status_code == BINDSTATUS_REDIRECTING) {
243 scoped_refptr<BindContextInfo> info = 253 scoped_refptr<BindContextInfo> info =
244 BindContextInfo::FromBindContext(bind_ctx_); 254 BindContextInfo::FromBindContext(bind_ctx_);
245 DCHECK(info); 255 DCHECK(info);
246 if (info) 256 if (info)
247 info->set_url(status_text); 257 info->set_url(status_text);
248 } 258 }
249 259
250 if (ShouldCacheProgress(status_code)) { 260 if (ShouldCacheProgress(status_code)) {
251 Progress new_progress = { progress, progress_max, status_code, 261 saved_progress_.push_back(new Progress(progress, progress_max, status_code,
252 status_text ? status_text : std::wstring() }; 262 status_text));
253 saved_progress_.push_back(new_progress);
254 } else { 263 } else {
255 hr = CallbackImpl::OnProgress(progress, progress_max, status_code, 264 hr = CallbackImpl::OnProgress(progress, progress_max, status_code,
256 status_text); 265 status_text);
257 } 266 }
258 267
259 return hr; 268 return hr;
260 } 269 }
261 270
262 // Refer to urlmon_moniker.h for explanation of how things work. 271 // Refer to urlmon_moniker.h for explanation of how things work.
263 STDMETHODIMP BSCBStorageBind::OnDataAvailable(DWORD flags, DWORD size, 272 STDMETHODIMP BSCBStorageBind::OnDataAvailable(DWORD flags, DWORD size,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 if (data_sniffer_.is_chrome()) { 347 if (data_sniffer_.is_chrome()) {
339 // Remember clip format. If we are switching to chrome, then in order 348 // Remember clip format. If we are switching to chrome, then in order
340 // to make mshtml return INET_E_TERMINATED_BIND and reissue navigation 349 // to make mshtml return INET_E_TERMINATED_BIND and reissue navigation
341 // with the same bind context, we have to return a mime type that is 350 // with the same bind context, we have to return a mime type that is
342 // special cased by mshtml. 351 // special cased by mshtml.
343 static const CLIPFORMAT kMagicClipFormat = 352 static const CLIPFORMAT kMagicClipFormat =
344 RegisterClipboardFormat(CFSTR_MIME_MPEG); 353 RegisterClipboardFormat(CFSTR_MIME_MPEG);
345 clip_format_ = kMagicClipFormat; 354 clip_format_ = kMagicClipFormat;
346 } else { 355 } else {
347 if (!saved_progress_.empty()) { 356 if (!saved_progress_.empty()) {
348 for (std::vector<Progress>::iterator i = saved_progress_.begin(); 357 for (std::vector<Progress*>::iterator i = saved_progress_.begin();
349 i != saved_progress_.end(); i++) { 358 i != saved_progress_.end(); i++) {
350 const wchar_t* status_text = i->status_text_.empty() ? 359 Progress* p = (*i);
351 NULL : i->status_text_.c_str(); 360 CallbackImpl::OnProgress(p->progress(), p->progress_max(),
352 CallbackImpl::OnProgress(i->progress_, i->progress_max_, 361 p->status_code(), p->status_text());
353 i->status_code_, status_text); 362 delete p;
354 } 363 }
355 saved_progress_.clear(); 364 saved_progress_.clear();
356 } 365 }
357 } 366 }
358 367
359 if (data_sniffer_.is_cache_valid()) { 368 if (data_sniffer_.is_cache_valid()) {
360 if (data_sniffer_.is_chrome()) { 369 if (data_sniffer_.is_chrome()) {
361 scoped_refptr<BindContextInfo> info = 370 scoped_refptr<BindContextInfo> info =
362 BindContextInfo::FromBindContext(bind_ctx_); 371 BindContextInfo::FromBindContext(bind_ctx_);
363 DCHECK(info); 372 DCHECK(info);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 case BINDSTATUS_CACHEFILENAMEAVAILABLE: 416 case BINDSTATUS_CACHEFILENAMEAVAILABLE:
408 case BINDSTATUS_SERVER_MIMETYPEAVAILABLE: 417 case BINDSTATUS_SERVER_MIMETYPEAVAILABLE:
409 return true; 418 return true;
410 default: 419 default:
411 break; 420 break;
412 } 421 }
413 } 422 }
414 423
415 return false; 424 return false;
416 } 425 }
OLDNEW
« no previous file with comments | « chrome_frame/urlmon_bind_status_callback.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698