| OLD | NEW |
| (Empty) |
| 1 // Copyright 2009-2010 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 deserialize an update request into | |
| 17 // a corresponding object object. | |
| 18 | |
| 19 #ifndef OMAHA_COMMON_UPDATE_RESPONSE_H_ | |
| 20 #define OMAHA_COMMON_UPDATE_RESPONSE_H_ | |
| 21 | |
| 22 #include <windows.h> | |
| 23 #include <utility> | |
| 24 #include <vector> | |
| 25 #include "base/basictypes.h" | |
| 26 #include "omaha/common/protocol_definition.h" | |
| 27 | |
| 28 namespace omaha { | |
| 29 | |
| 30 namespace xml { | |
| 31 | |
| 32 class UpdateResponse { | |
| 33 public: | |
| 34 ~UpdateResponse(); | |
| 35 | |
| 36 // Creates an instance of the class. Caller takes ownership. | |
| 37 static UpdateResponse* Create(); | |
| 38 | |
| 39 // Initializes an update response from a xml document in a buffer. | |
| 40 HRESULT Deserialize(const std::vector<uint8>& buffer); | |
| 41 | |
| 42 // Initializes an update response from a xml document in a file. | |
| 43 HRESULT DeserializeFromFile(const CString& filename); | |
| 44 | |
| 45 int GetElapsedSecondsSinceDayStart() const; | |
| 46 | |
| 47 const response::Response& response() const { return response_; } | |
| 48 | |
| 49 private: | |
| 50 friend class XmlParser; | |
| 51 friend class XmlParserTest; | |
| 52 | |
| 53 // Sets response_ for unit testing. | |
| 54 friend void SetResponseForUnitTest(UpdateResponse* update_response, | |
| 55 const response::Response& response); | |
| 56 | |
| 57 UpdateResponse(); | |
| 58 | |
| 59 response::Response response_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(UpdateResponse); | |
| 62 }; | |
| 63 | |
| 64 typedef std::pair<HRESULT, CString> UpdateResponseResult; | |
| 65 | |
| 66 } // namespace xml | |
| 67 | |
| 68 } // namespace omaha | |
| 69 | |
| 70 #endif // OMAHA_COMMON_UPDATE_RESPONSE_H_ | |
| 71 | |
| OLD | NEW |