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

Side by Side Diff: chrome/browser/extensions/api/dial/dial_device_data.cc

Issue 11444020: DIAL extension API skeleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: abc.... Created 8 years 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "chrome/browser/extensions/api/dial/dial_device_data.h"
6
7 #include "chrome/common/extensions/api/dial.h"
8
9 namespace extensions {
10
11 DialDeviceData::DialDeviceData() : max_age_(-1), config_id_(-1) { }
12
13 DialDeviceData::DialDeviceData(const DialDeviceData& other_data) {
14 CopyFrom(other_data);
15 }
16
17 DialDeviceData& DialDeviceData::operator=(const DialDeviceData& other_data) {
18 CopyFrom(other_data);
19 return *this;
20 }
21
22 DialDeviceData::~DialDeviceData() { }
23
24 const std::string& DialDeviceData::device_id() const {
25 return device_id_;
26 }
27
28 void DialDeviceData::set_device_id(const std::string& id) {
29 device_id_ = id;
30 }
31
32 const std::string& DialDeviceData::label() const {
33 return label_;
34 }
35
36 void DialDeviceData::set_label(const std::string& label) {
37 label_ = label;
38 }
39
40 const std::string& DialDeviceData::device_description_url() const {
41 return device_description_url_;
42 }
43
44 void DialDeviceData::set_device_description_url(const std::string& url) {
45 device_description_url_ = url;
46 }
47
48 const base::Time& DialDeviceData::response_time() const {
49 return response_time_;
50 }
51
52 void DialDeviceData::set_response_time(const base::Time& response_time) {
53 response_time_ = response_time;
54 }
55
56 void DialDeviceData::FillDialDevice(api::dial::DialDevice* device) const {
57 DCHECK(!device_id_.empty());
58 device->device_label = label();
59 device->device_description_url = device_description_url();
60 if (has_config_id()) {
61 device->config_id.reset(new int(config_id()));
62 }
63 }
64
65 void DialDeviceData::CopyFrom(const DialDeviceData& other_data) {
66 device_id_ = other_data.device_id_;
67 label_ = other_data.label_;
68 device_description_url_ = other_data.device_description_url_;
69 response_time_ = other_data.response_time_;
70 max_age_ = other_data.max_age_;
71 config_id_ = other_data.config_id_;
72 }
73
74 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/dial/dial_device_data.h ('k') | chrome/browser/extensions/api/dial/dial_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698