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

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

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 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 (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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 1046
1047 void DownloadsDownloadFunction::OnStarted( 1047 void DownloadsDownloadFunction::OnStarted(
1048 const base::FilePath& creator_suggested_filename, 1048 const base::FilePath& creator_suggested_filename,
1049 downloads::FilenameConflictAction creator_conflict_action, 1049 downloads::FilenameConflictAction creator_conflict_action,
1050 DownloadItem* item, 1050 DownloadItem* item,
1051 content::DownloadInterruptReason interrupt_reason) { 1051 content::DownloadInterruptReason interrupt_reason) {
1052 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1052 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1053 VLOG(1) << __func__ << " " << item << " " << interrupt_reason; 1053 VLOG(1) << __func__ << " " << item << " " << interrupt_reason;
1054 if (item) { 1054 if (item) {
1055 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason); 1055 DCHECK_EQ(content::DOWNLOAD_INTERRUPT_REASON_NONE, interrupt_reason);
1056 SetResult(base::MakeUnique<base::FundamentalValue>( 1056 SetResult(base::MakeUnique<base::Value>(static_cast<int>(item->GetId())));
1057 static_cast<int>(item->GetId())));
1058 if (!creator_suggested_filename.empty() || 1057 if (!creator_suggested_filename.empty() ||
1059 (creator_conflict_action != 1058 (creator_conflict_action !=
1060 downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY)) { 1059 downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY)) {
1061 ExtensionDownloadsEventRouterData* data = 1060 ExtensionDownloadsEventRouterData* data =
1062 ExtensionDownloadsEventRouterData::Get(item); 1061 ExtensionDownloadsEventRouterData::Get(item);
1063 if (!data) { 1062 if (!data) {
1064 data = new ExtensionDownloadsEventRouterData( 1063 data = new ExtensionDownloadsEventRouterData(
1065 item, std::unique_ptr<base::DictionaryValue>( 1064 item, std::unique_ptr<base::DictionaryValue>(
1066 new base::DictionaryValue())); 1065 new base::DictionaryValue()));
1067 } 1066 }
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 data->OnChangedFired(); 1854 data->OnChangedFired();
1856 } 1855 }
1857 data->set_json(std::move(new_json)); 1856 data->set_json(std::move(new_json));
1858 } 1857 }
1859 1858
1860 void ExtensionDownloadsEventRouter::OnDownloadRemoved( 1859 void ExtensionDownloadsEventRouter::OnDownloadRemoved(
1861 DownloadManager* manager, DownloadItem* download_item) { 1860 DownloadManager* manager, DownloadItem* download_item) {
1862 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1861 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1863 if (download_item->IsTemporary()) 1862 if (download_item->IsTemporary())
1864 return; 1863 return;
1865 DispatchEvent(events::DOWNLOADS_ON_ERASED, downloads::OnErased::kEventName, 1864 DispatchEvent(
1866 true, Event::WillDispatchCallback(), 1865 events::DOWNLOADS_ON_ERASED, downloads::OnErased::kEventName, true,
1867 base::MakeUnique<base::FundamentalValue>( 1866 Event::WillDispatchCallback(),
1868 static_cast<int>(download_item->GetId()))); 1867 base::MakeUnique<base::Value>(static_cast<int>(download_item->GetId())));
1869 } 1868 }
1870 1869
1871 void ExtensionDownloadsEventRouter::DispatchEvent( 1870 void ExtensionDownloadsEventRouter::DispatchEvent(
1872 events::HistogramValue histogram_value, 1871 events::HistogramValue histogram_value,
1873 const std::string& event_name, 1872 const std::string& event_name,
1874 bool include_incognito, 1873 bool include_incognito,
1875 const Event::WillDispatchCallback& will_dispatch_callback, 1874 const Event::WillDispatchCallback& will_dispatch_callback,
1876 std::unique_ptr<base::Value> arg) { 1875 std::unique_ptr<base::Value> arg) {
1877 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1876 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1878 if (!EventRouter::Get(profile_)) 1877 if (!EventRouter::Get(profile_))
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 return; 1920 return;
1922 base::Time now(base::Time::Now()); 1921 base::Time now(base::Time::Now());
1923 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); 1922 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT();
1924 if (delta <= kFileExistenceRateLimitSeconds) 1923 if (delta <= kFileExistenceRateLimitSeconds)
1925 return; 1924 return;
1926 last_checked_removal_ = now; 1925 last_checked_removal_ = now;
1927 manager->CheckForHistoryFilesRemoval(); 1926 manager->CheckForHistoryFilesRemoval();
1928 } 1927 }
1929 1928
1930 } // namespace extensions 1929 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698