| OLD | NEW |
| (Empty) |
| 1 // Copyright 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 #ifndef OMAHA_CLIENT_HELP_URL_BUILDER_H_ | |
| 17 #define OMAHA_CLIENT_HELP_URL_BUILDER_H_ | |
| 18 | |
| 19 #include <windows.h> | |
| 20 #include <atlstr.h> | |
| 21 #include <vector> | |
| 22 #include "omaha/base/debug.h" | |
| 23 #include "omaha/common/goopdate_utils.h" | |
| 24 | |
| 25 namespace omaha { | |
| 26 | |
| 27 class HelpUrlBuilder { | |
| 28 public: | |
| 29 struct AppResult { | |
| 30 AppResult(CString app_guid, | |
| 31 HRESULT install_error_code, | |
| 32 int install_extra_code) : | |
| 33 guid(app_guid), | |
| 34 error_code(install_error_code), | |
| 35 extra_code(install_extra_code) {} | |
| 36 | |
| 37 CString guid; | |
| 38 HRESULT error_code; | |
| 39 int extra_code; | |
| 40 }; | |
| 41 | |
| 42 HelpUrlBuilder(bool is_machine, | |
| 43 const CString& language, | |
| 44 const GUID& iid, | |
| 45 const CString& brand) : | |
| 46 is_machine_(is_machine), | |
| 47 language_(language), | |
| 48 iid_(iid), | |
| 49 brand_(brand) {} | |
| 50 | |
| 51 HRESULT BuildUrl(const std::vector<AppResult>& app_results, | |
| 52 CString* help_url) const; | |
| 53 | |
| 54 private: | |
| 55 // Creates the query string based on the passed service_url and arguments. | |
| 56 // service_url must end in a '?' or '&'. | |
| 57 HRESULT BuildHttpGetString( | |
| 58 const CString& service_url, | |
| 59 const std::vector<AppResult>& app_results, | |
| 60 const CString& goopdate_version, | |
| 61 const CString& source_id, | |
| 62 CString* get_request) const; | |
| 63 | |
| 64 private: | |
| 65 const bool is_machine_; | |
| 66 const CString language_; | |
| 67 const GUID iid_; | |
| 68 const CString brand_; | |
| 69 | |
| 70 friend class HelpUrlBuilderTest; | |
| 71 DISALLOW_COPY_AND_ASSIGN(HelpUrlBuilder); | |
| 72 }; | |
| 73 | |
| 74 } // namespace omaha | |
| 75 | |
| 76 #endif // OMAHA_CLIENT_HELP_URL_BUILDER_H_ | |
| OLD | NEW |