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

Side by Side Diff: extensions/browser/api/alarms/alarm_manager.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
« no previous file with comments | « extensions/browser/PRESUBMIT.py ('k') | extensions/browser/api/app_runtime/app_runtime_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/api/alarms/alarm_manager.h" 5 #include "extensions/browser/api/alarms/alarm_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 26 matching lines...) Expand all
37 class DefaultAlarmDelegate : public AlarmManager::Delegate { 37 class DefaultAlarmDelegate : public AlarmManager::Delegate {
38 public: 38 public:
39 explicit DefaultAlarmDelegate(content::BrowserContext* context) 39 explicit DefaultAlarmDelegate(content::BrowserContext* context)
40 : browser_context_(context) {} 40 : browser_context_(context) {}
41 ~DefaultAlarmDelegate() override {} 41 ~DefaultAlarmDelegate() override {}
42 42
43 void OnAlarm(const std::string& extension_id, const Alarm& alarm) override { 43 void OnAlarm(const std::string& extension_id, const Alarm& alarm) override {
44 scoped_ptr<base::ListValue> args(new base::ListValue()); 44 scoped_ptr<base::ListValue> args(new base::ListValue());
45 args->Append(alarm.js_alarm->ToValue().release()); 45 args->Append(alarm.js_alarm->ToValue().release());
46 scoped_ptr<Event> event( 46 scoped_ptr<Event> event(
47 new Event(alarms::OnAlarm::kEventName, args.Pass())); 47 new Event(events::UNKNOWN, alarms::OnAlarm::kEventName, args.Pass()));
48 EventRouter::Get(browser_context_) 48 EventRouter::Get(browser_context_)
49 ->DispatchEventToExtension(extension_id, event.Pass()); 49 ->DispatchEventToExtension(extension_id, event.Pass());
50 } 50 }
51 51
52 private: 52 private:
53 content::BrowserContext* browser_context_; 53 content::BrowserContext* browser_context_;
54 }; 54 };
55 55
56 // Creates a TimeDelta from a delay as specified in the API. 56 // Creates a TimeDelta from a delay as specified in the API.
57 base::TimeDelta TimeDeltaFromDelay(double delay_in_minutes) { 57 base::TimeDelta TimeDeltaFromDelay(double delay_in_minutes) {
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 if (create_info.period_in_minutes.get()) { 458 if (create_info.period_in_minutes.get()) {
459 js_alarm->period_in_minutes.reset( 459 js_alarm->period_in_minutes.reset(
460 new double(*create_info.period_in_minutes)); 460 new double(*create_info.period_in_minutes));
461 } 461 }
462 } 462 }
463 463
464 Alarm::~Alarm() { 464 Alarm::~Alarm() {
465 } 465 }
466 466
467 } // namespace extensions 467 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/PRESUBMIT.py ('k') | extensions/browser/api/app_runtime/app_runtime_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698