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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 (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 #include "chrome/browser/extensions/api/downloads/downloads_api.h" 5 #include "chrome/browser/extensions/api/downloads/downloads_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 1044
1045 void DownloadsDownloadFunction::OnStarted( 1045 void DownloadsDownloadFunction::OnStarted(
1046 const base::FilePath& creator_suggested_filename, 1046 const base::FilePath& creator_suggested_filename,
1047 downloads::FilenameConflictAction creator_conflict_action, 1047 downloads::FilenameConflictAction creator_conflict_action,
1048 DownloadItem* item, 1048 DownloadItem* item,
1049 content::DownloadInterruptReason interrupt_reason) { 1049 content::DownloadInterruptReason interrupt_reason) {
1050 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1050 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1051 VLOG(1) << __func__ << " " << item << " " << interrupt_reason; 1051 VLOG(1) << __func__ << " " << item << " " << interrupt_reason;
1052 if (item) { 1052 if (item) {
1053 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); 1053 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason);
1054 SetResult(base::MakeUnique<base::FundamentalValue>( 1054 SetResult(base::MakeUnique<base::Value>(
1055 static_cast<int>(item->GetId()))); 1055 static_cast<int>(item->GetId())));
1056 if (!creator_suggested_filename.empty() || 1056 if (!creator_suggested_filename.empty() ||
1057 (creator_conflict_action != 1057 (creator_conflict_action !=
1058 downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY)) { 1058 downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY)) {
1059 ExtensionDownloadsEventRouterData* data = 1059 ExtensionDownloadsEventRouterData* data =
1060 ExtensionDownloadsEventRouterData::Get(item); 1060 ExtensionDownloadsEventRouterData::Get(item);
1061 if (!data) { 1061 if (!data) {
1062 data = new ExtensionDownloadsEventRouterData( 1062 data = new ExtensionDownloadsEventRouterData(
1063 item, std::unique_ptr<base::DictionaryValue>( 1063 item, std::unique_ptr<base::DictionaryValue>(
1064 new base::DictionaryValue())); 1064 new base::DictionaryValue()));
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 data->set_json(std::move(new_json)); 1855 data->set_json(std::move(new_json));
1856 } 1856 }
1857 1857
1858 void ExtensionDownloadsEventRouter::OnDownloadRemoved( 1858 void ExtensionDownloadsEventRouter::OnDownloadRemoved(
1859 DownloadManager* manager, DownloadItem* download_item) { 1859 DownloadManager* manager, DownloadItem* download_item) {
1860 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1860 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1861 if (download_item->IsTemporary()) 1861 if (download_item->IsTemporary())
1862 return; 1862 return;
1863 DispatchEvent(events::DOWNLOADS_ON_ERASED, downloads::OnErased::kEventName, 1863 DispatchEvent(events::DOWNLOADS_ON_ERASED, downloads::OnErased::kEventName,
1864 true, Event::WillDispatchCallback(), 1864 true, Event::WillDispatchCallback(),
1865 base::MakeUnique<base::FundamentalValue>( 1865 base::MakeUnique<base::Value>(
1866 static_cast<int>(download_item->GetId()))); 1866 static_cast<int>(download_item->GetId())));
1867 } 1867 }
1868 1868
1869 void ExtensionDownloadsEventRouter::DispatchEvent( 1869 void ExtensionDownloadsEventRouter::DispatchEvent(
1870 events::HistogramValue histogram_value, 1870 events::HistogramValue histogram_value,
1871 const std::string& event_name, 1871 const std::string& event_name,
1872 bool include_incognito, 1872 bool include_incognito,
1873 const Event::WillDispatchCallback& will_dispatch_callback, 1873 const Event::WillDispatchCallback& will_dispatch_callback,
1874 std::unique_ptr<base::Value> arg) { 1874 std::unique_ptr<base::Value> arg) {
1875 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1875 DCHECK_CURRENTLY_ON(BrowserThread::UI);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 return; 1919 return;
1920 base::Time now(base::Time::Now()); 1920 base::Time now(base::Time::Now());
1921 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); 1921 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT();
1922 if (delta <= kFileExistenceRateLimitSeconds) 1922 if (delta <= kFileExistenceRateLimitSeconds)
1923 return; 1923 return;
1924 last_checked_removal_ = now; 1924 last_checked_removal_ = now;
1925 manager->CheckForHistoryFilesRemoval(); 1925 manager->CheckForHistoryFilesRemoval();
1926 } 1926 }
1927 1927
1928 } // namespace extensions 1928 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698