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

Side by Side Diff: chrome/browser/ui/webui/md_downloads/downloads_list_tracker.cc

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ui/webui/md_downloads/downloads_list_tracker.h" 5 #include "chrome/browser/ui/webui/md_downloads/downloads_list_tracker.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void DownloadsListTracker::StartAndSendChunk() { 116 void DownloadsListTracker::StartAndSendChunk() {
117 sending_updates_ = true; 117 sending_updates_ = true;
118 118
119 CHECK_LE(sent_to_page_, sorted_items_.size()); 119 CHECK_LE(sent_to_page_, sorted_items_.size());
120 120
121 SortedSet::iterator it = sorted_items_.begin(); 121 SortedSet::iterator it = sorted_items_.begin();
122 std::advance(it, sent_to_page_); 122 std::advance(it, sent_to_page_);
123 123
124 base::ListValue list; 124 base::ListValue list;
125 while (it != sorted_items_.end() && list.GetSize() < chunk_size_) { 125 while (it != sorted_items_.end() && list.GetSize() < chunk_size_) {
126 list.Append(CreateDownloadItemValue(*it).Pass()); 126 list.Append(CreateDownloadItemValue(*it));
127 ++it; 127 ++it;
128 } 128 }
129 129
130 web_ui_->CallJavascriptFunction( 130 web_ui_->CallJavascriptFunction(
131 "downloads.Manager.insertItems", 131 "downloads.Manager.insertItems",
132 base::FundamentalValue(static_cast<int>(sent_to_page_)), 132 base::FundamentalValue(static_cast<int>(sent_to_page_)),
133 list); 133 list);
134 134
135 sent_to_page_ += list.GetSize(); 135 sent_to_page_ += list.GetSize();
136 } 136 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 DCHECK(state); 302 DCHECK(state);
303 303
304 file_value->SetString("danger_type", danger_type); 304 file_value->SetString("danger_type", danger_type);
305 file_value->SetString("last_reason_text", last_reason_text); 305 file_value->SetString("last_reason_text", last_reason_text);
306 file_value->SetInteger("percent", percent); 306 file_value->SetInteger("percent", percent);
307 file_value->SetString("progress_status_text", progress_status_text); 307 file_value->SetString("progress_status_text", progress_status_text);
308 file_value->SetBoolean("retry", retry); 308 file_value->SetBoolean("retry", retry);
309 file_value->SetString("state", state); 309 file_value->SetString("state", state);
310 310
311 return file_value.Pass(); 311 return file_value;
312 } 312 }
313 313
314 bool DownloadsListTracker::IsIncognito(const DownloadItem& item) const { 314 bool DownloadsListTracker::IsIncognito(const DownloadItem& item) const {
315 return GetOriginalNotifierManager() && GetMainNotifierManager() && 315 return GetOriginalNotifierManager() && GetMainNotifierManager() &&
316 GetMainNotifierManager()->GetDownload(item.GetId()) == &item; 316 GetMainNotifierManager()->GetDownload(item.GetId()) == &item;
317 } 317 }
318 318
319 const DownloadItem* DownloadsListTracker::GetItemForTesting(size_t index) 319 const DownloadItem* DownloadsListTracker::GetItemForTesting(size_t index)
320 const { 320 const {
321 if (index >= sorted_items_.size()) 321 if (index >= sorted_items_.size())
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 void DownloadsListTracker::InsertItem(const SortedSet::iterator& insert) { 376 void DownloadsListTracker::InsertItem(const SortedSet::iterator& insert) {
377 if (!sending_updates_) 377 if (!sending_updates_)
378 return; 378 return;
379 379
380 size_t index = GetIndex(insert); 380 size_t index = GetIndex(insert);
381 if (index >= chunk_size_ && index >= sent_to_page_) 381 if (index >= chunk_size_ && index >= sent_to_page_)
382 return; 382 return;
383 383
384 base::ListValue list; 384 base::ListValue list;
385 list.Append(CreateDownloadItemValue(*insert).Pass()); 385 list.Append(CreateDownloadItemValue(*insert));
386 386
387 web_ui_->CallJavascriptFunction( 387 web_ui_->CallJavascriptFunction(
388 "downloads.Manager.insertItems", 388 "downloads.Manager.insertItems",
389 base::FundamentalValue(static_cast<int>(index)), 389 base::FundamentalValue(static_cast<int>(index)),
390 list); 390 list);
391 391
392 sent_to_page_++; 392 sent_to_page_++;
393 } 393 }
394 394
395 void DownloadsListTracker::UpdateItem(const SortedSet::iterator& update) { 395 void DownloadsListTracker::UpdateItem(const SortedSet::iterator& update) {
(...skipping 16 matching lines...) Expand all
412 size_t index = GetIndex(remove); 412 size_t index = GetIndex(remove);
413 if (index < sent_to_page_) { 413 if (index < sent_to_page_) {
414 web_ui_->CallJavascriptFunction( 414 web_ui_->CallJavascriptFunction(
415 "downloads.Manager.removeItem", 415 "downloads.Manager.removeItem",
416 base::FundamentalValue(static_cast<int>(index))); 416 base::FundamentalValue(static_cast<int>(index)));
417 sent_to_page_--; 417 sent_to_page_--;
418 } 418 }
419 } 419 }
420 sorted_items_.erase(remove); 420 sorted_items_.erase(remove);
421 } 421 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698