Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / performance_monitor / event.cc
blob46b48b999900f5259a4463ffe1e514a8b935f23d
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
3 // found in the LICENSE file.
5 #include "chrome/browser/performance_monitor/event.h"
7 #include "base/logging.h"
9 namespace performance_monitor {
11 Event::Event(const EventType& type,
12 const base::Time& time,
13 scoped_ptr<base::DictionaryValue> data)
14 : type_(type), time_(time), data_(data.release()) {
17 Event::~Event() {
20 scoped_ptr<Event> Event::FromValue(scoped_ptr<base::DictionaryValue> data) {
21 int type = 0;
22 if (!data->GetInteger(std::string("eventType"), &type))
23 return scoped_ptr<Event>();
24 double time = 0.0;
25 if (!data->GetDouble(std::string("time"), &time))
26 return scoped_ptr<Event>();
27 return scoped_ptr<Event>(new Event(static_cast<EventType>(type),
28 base::Time::FromInternalValue((int64)time),
29 data.Pass()));
32 } // namespace performance_monitor