| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |