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

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

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 years, 6 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 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 bool include_incognito, 1855 bool include_incognito,
1856 const Event::WillDispatchCallback& will_dispatch_callback, 1856 const Event::WillDispatchCallback& will_dispatch_callback,
1857 base::Value* arg) { 1857 base::Value* arg) {
1858 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1858 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1859 if (!EventRouter::Get(profile_)) 1859 if (!EventRouter::Get(profile_))
1860 return; 1860 return;
1861 scoped_ptr<base::ListValue> args(new base::ListValue()); 1861 scoped_ptr<base::ListValue> args(new base::ListValue());
1862 args->Append(arg); 1862 args->Append(arg);
1863 std::string json_args; 1863 std::string json_args;
1864 base::JSONWriter::Write(*args, &json_args); 1864 base::JSONWriter::Write(*args, &json_args);
1865 scoped_ptr<Event> event(new Event(event_name, args.Pass())); 1865 scoped_ptr<Event> event(new Event(events::UNKNOWN, event_name, args.Pass()));
1866 // The downloads system wants to share on-record events with off-record 1866 // The downloads system wants to share on-record events with off-record
1867 // extension renderers even in incognito_split_mode because that's how 1867 // extension renderers even in incognito_split_mode because that's how
1868 // chrome://downloads works. The "restrict_to_profile" mechanism does not 1868 // chrome://downloads works. The "restrict_to_profile" mechanism does not
1869 // anticipate this, so it does not automatically prevent sharing off-record 1869 // anticipate this, so it does not automatically prevent sharing off-record
1870 // events with on-record extension renderers. 1870 // events with on-record extension renderers.
1871 event->restrict_to_browser_context = 1871 event->restrict_to_browser_context =
1872 (include_incognito && !profile_->IsOffTheRecord()) ? NULL : profile_; 1872 (include_incognito && !profile_->IsOffTheRecord()) ? NULL : profile_;
1873 event->will_dispatch_callback = will_dispatch_callback; 1873 event->will_dispatch_callback = will_dispatch_callback;
1874 EventRouter::Get(profile_)->BroadcastEvent(event.Pass()); 1874 EventRouter::Get(profile_)->BroadcastEvent(event.Pass());
1875 DownloadsNotificationSource notification_source; 1875 DownloadsNotificationSource notification_source;
(...skipping 25 matching lines...) Expand all
1901 return; 1901 return;
1902 base::Time now(base::Time::Now()); 1902 base::Time now(base::Time::Now());
1903 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT(); 1903 int delta = now.ToTimeT() - last_checked_removal_.ToTimeT();
1904 if (delta <= kFileExistenceRateLimitSeconds) 1904 if (delta <= kFileExistenceRateLimitSeconds)
1905 return; 1905 return;
1906 last_checked_removal_ = now; 1906 last_checked_removal_ = now;
1907 manager->CheckForHistoryFilesRemoval(); 1907 manager->CheckForHistoryFilesRemoval();
1908 } 1908 }
1909 1909
1910 } // namespace extensions 1910 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/dial/dial_api.cc ('k') | chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698