OLD | NEW |
| (Empty) |
1 // Copyright 2009 Google Inc. | |
2 // | |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 // you may not use this file except in compliance with the License. | |
5 // You may obtain a copy of the License at | |
6 // | |
7 // http://www.apache.org/licenses/LICENSE-2.0 | |
8 // | |
9 // Unless required by applicable law or agreed to in writing, software | |
10 // distributed under the License is distributed on an "AS IS" BASIS, | |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 // See the License for the specific language governing permissions and | |
13 // limitations under the License. | |
14 // ======================================================================== | |
15 // | |
16 // UpdateRequest allows the caller to build an update request object and | |
17 // serialize it as a string. | |
18 | |
19 #ifndef OMAHA_COMMON_UPDATE_REQUEST_H_ | |
20 #define OMAHA_COMMON_UPDATE_REQUEST_H_ | |
21 | |
22 #include <windows.h> | |
23 #include "base/basictypes.h" | |
24 #include "omaha/common/protocol_definition.h" | |
25 | |
26 namespace omaha { | |
27 | |
28 namespace xml { | |
29 | |
30 class UpdateRequest { | |
31 public: | |
32 ~UpdateRequest(); | |
33 | |
34 // Creates an instance of the class. Caller takes ownership. | |
35 static UpdateRequest* Create(bool is_machine, | |
36 const CString& session_id, | |
37 const CString& install_source, | |
38 const CString& origin_url); | |
39 | |
40 // Adds an 'app' element to the request. | |
41 void AddApp(const request::App& app); | |
42 | |
43 // Returns true if the requests does not contain applications. | |
44 bool IsEmpty() const; | |
45 | |
46 // Serializes the request into a buffer. | |
47 HRESULT Serialize(CString* buffer) const; | |
48 | |
49 // Returns true if one of the applications in the request carries a | |
50 // trusted tester token. | |
51 bool has_tt_token() const; | |
52 | |
53 const request::Request& request() const { return request_; } | |
54 | |
55 private: | |
56 friend class XmlParserTest; | |
57 | |
58 UpdateRequest(); | |
59 | |
60 request::Request request_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(UpdateRequest); | |
63 }; | |
64 | |
65 } // namespace xml | |
66 | |
67 } // namespace omaha | |
68 | |
69 #endif // OMAHA_COMMON_UPDATE_REQUEST_H_ | |
OLD | NEW |