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

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

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 #ifndef CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_DEVICE_DATA_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_DEVICE_DATA_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/time.h"
12 #include "base/values.h"
13
14 namespace extensions {
15
16 namespace api {
17 namespace dial {
18 struct DialDevice;
19 } // namespace api
20 } // namespace dial
21
22 // Dial device information that is used within the DialService and Registry on
23 // the IO thread. It is updated as new information arrives and a list of
24 // DialDeviceData is copied and sent to event listeners on the UI thread.
25 class DialDeviceData {
26 public:
27 DialDeviceData();
28 DialDeviceData(const DialDeviceData& other_data);
29 ~DialDeviceData();
30
31 DialDeviceData& operator=(const DialDeviceData& other_data);
32
33 const std::string& device_id() const;
34 void set_device_id(const std::string& id);
35
36 const std::string& label() const;
37 void set_label(const std::string& label);
38
39 const std::string& device_description_url() const;
40 void set_device_description_url(const std::string& url);
41
42 const base::Time& response_time() const;
43 void set_response_time(const base::Time& response_time);
44
45 int max_age() const { return max_age_; }
46 void set_max_age(int max_age) { max_age_ = max_age; }
47 bool has_max_age() const { return max_age_ >= 0; }
48
49 int config_id() const { return config_id_; }
50 void set_config_id(int config_id) { config_id_ = config_id; }
51 bool has_config_id() const { return config_id_ >= 0; }
52
53 // Fills the |device| API struct from this instance.
54 void FillDialDevice(api::dial::DialDevice* device) const;
55
56 private:
57 // Hardware identifier from the DIAL response. Not exposed to API clients.
58 std::string device_id_;
59
60 // Identifies this device to clients of the API.
61 std::string label_;
62
63 // The device description URL.
64 std::string device_description_url_;
65
66 // The time that the most recent response was received.
67 base::Time response_time_;
68
69 // Optional (-1 means unset).
70 int max_age_;
71
72 // Optional (-1 means unset).
73 int config_id_;
74
75 // Implementation of copy ctor and assignment operator.
76 void CopyFrom(const DialDeviceData& other_data);
77 };
78
79 } // namespace extensions
80
81 #endif // CHROME_BROWSER_EXTENSIONS_API_DIAL_DIAL_DEVICE_DATA_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/dial/dial_apitest.cc ('k') | chrome/browser/extensions/api/dial/dial_device_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698