| OLD | NEW |
| (Empty) |
| 1 // Copyright 2007-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 // application_usage_data.h : Includes methods to deal with application | |
| 17 // usage data. Currently it only deals with the did_run key. | |
| 18 // The class provides methods to process the application data, before and | |
| 19 // after the update check. In case of the did_run key we read the key | |
| 20 // pre-update check and clear it post-update check. | |
| 21 | |
| 22 #ifndef OMAHA_GOOPDATE_APPLICATION_USAGE_DATA_H__ | |
| 23 #define OMAHA_GOOPDATE_APPLICATION_USAGE_DATA_H__ | |
| 24 | |
| 25 #include <windows.h> | |
| 26 #include <atlstr.h> | |
| 27 #include "base/basictypes.h" | |
| 28 | |
| 29 namespace omaha { | |
| 30 | |
| 31 enum ActiveStates; | |
| 32 | |
| 33 class ApplicationUsageData { | |
| 34 public: | |
| 35 ApplicationUsageData(bool is_machine, bool check_low_integrity); | |
| 36 ~ApplicationUsageData(); | |
| 37 | |
| 38 // Reads the did run values for the application indentified by the app_guid. | |
| 39 HRESULT ReadDidRun(const CString& app_guid); | |
| 40 | |
| 41 // Clears and performs the post processing after an update ckeck for the | |
| 42 // did run key. | |
| 43 HRESULT ResetDidRun(const CString& app_guid); | |
| 44 | |
| 45 bool exists() const { return exists_; } | |
| 46 bool did_run() const { return did_run_; } | |
| 47 ActiveStates active_state() const; | |
| 48 | |
| 49 private: | |
| 50 // Processes the did run value for the machine goopdate. | |
| 51 HRESULT ProcessMachineDidRun(const CString& app_guid); | |
| 52 | |
| 53 // Processes the did run value for the user goopdate. | |
| 54 HRESULT ProcessUserDidRun(const CString& app_guid); | |
| 55 | |
| 56 // Calls the pre or the post update check methods based on the | |
| 57 // is_pre_update_check_ value. | |
| 58 HRESULT ProcessDidRun(const CString& app_guid); | |
| 59 | |
| 60 // Pre or post process the key that is passed in. | |
| 61 HRESULT ProcessKey(const CString& key_name); | |
| 62 | |
| 63 // Reads the did run value and populates did_run_ and exists_. | |
| 64 HRESULT ProcessPreUpdateCheck(const CString& key_name); | |
| 65 | |
| 66 // Clears the did_run value. | |
| 67 HRESULT ProcessPostUpdateCheck(const CString& key_name); | |
| 68 | |
| 69 // Reads and updates the did_run key for the machine. This is a backward | |
| 70 // compatibility requirement, since applications have not been updated to | |
| 71 // write to HKCU yet. | |
| 72 HRESULT ProcessBackWardCompatKey(const CString& key_name); | |
| 73 | |
| 74 bool exists_; // Whether the did_run value exists. | |
| 75 bool did_run_; // The value of did_run. | |
| 76 bool is_machine_; // Whether this is a machine instance. | |
| 77 bool is_pre_update_check_; // Internal state of pre or post update. | |
| 78 bool check_low_integrity_; // Whether to check the low integrity registry | |
| 79 // location. | |
| 80 | |
| 81 DISALLOW_EVIL_CONSTRUCTORS(ApplicationUsageData); | |
| 82 }; | |
| 83 | |
| 84 } // namespace omaha | |
| 85 | |
| 86 #endif // OMAHA_GOOPDATE_APPLICATION_USAGE_DATA_H__ | |
| OLD | NEW |