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

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

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 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
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 <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 const std::string& event_name, 1853 const std::string& event_name,
1854 bool include_incognito, 1854 bool include_incognito,
1855 const Event::WillDispatchCallback& will_dispatch_callback, 1855 const Event::WillDispatchCallback& will_dispatch_callback,
1856 base::Value* arg) { 1856 base::Value* arg) {
1857 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1857 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1858 if (!EventRouter::Get(profile_)) 1858 if (!EventRouter::Get(profile_))
1859 return; 1859 return;
1860 scoped_ptr<base::ListValue> args(new base::ListValue()); 1860 scoped_ptr<base::ListValue> args(new base::ListValue());
1861 args->Append(arg); 1861 args->Append(arg);
1862 std::string json_args; 1862 std::string json_args;
1863 base::JSONWriter::Write(args.get(), &json_args); 1863 base::JSONWriter::Write(*args, &json_args);
1864 scoped_ptr<Event> event(new Event(event_name, args.Pass())); 1864 scoped_ptr<Event> event(new Event(event_name, args.Pass()));
1865 // The downloads system wants to share on-record events with off-record 1865 // The downloads system wants to share on-record events with off-record
1866 // extension renderers even in incognito_split_mode because that's how 1866 // extension renderers even in incognito_split_mode because that's how
1867 // chrome://downloads works. The "restrict_to_profile" mechanism does not 1867 // chrome://downloads works. The "restrict_to_profile" mechanism does not
1868 // anticipate this, so it does not automatically prevent sharing off-record 1868 // anticipate this, so it does not automatically prevent sharing off-record
1869 // events with on-record extension renderers. 1869 // events with on-record extension renderers.
1870 event->restrict_to_browser_context = 1870 event->restrict_to_browser_context =
1871 (include_incognito && !profile_->IsOffTheRecord()) ? NULL : profile_; 1871 (include_incognito && !profile_->IsOffTheRecord()) ? NULL : profile_;
1872 event->will_dispatch_callback = will_dispatch_callback; 1872 event->will_dispatch_callback = will_dispatch_callback;
1873 EventRouter::Get(profile_)->BroadcastEvent(event.Pass()); 1873 EventRouter::Get(profile_)->BroadcastEvent(event.Pass());
(...skipping 26 matching lines...) Expand all
1900 return; 1900 return;
1901 base::Time now(base::Time::Now()); 1901 base::Time now(base::Time::Now());
1902 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); 1902 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT();
1903 if (delta <= kFileExistenceRateLimitSeconds) 1903 if (delta <= kFileExistenceRateLimitSeconds)
1904 return; 1904 return;
1905 last_checked_removal_ = now; 1905 last_checked_removal_ = now;
1906 manager->CheckForHistoryFilesRemoval(); 1906 manager->CheckForHistoryFilesRemoval();
1907 } 1907 }
1908 1908
1909 } // namespace extensions 1909 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698