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 #include "omaha/goopdate/update_request_utils.h" | |
17 #include "omaha/base/logging.h" | |
18 #include "omaha/goopdate/model.h" | |
19 | |
20 namespace omaha { | |
21 | |
22 namespace update_request_utils { | |
23 | |
24 void BuildRequest(const App* app, | |
25 bool is_update_check, | |
26 xml::UpdateRequest* update_request) { | |
27 ASSERT1(app); | |
28 ASSERT1(update_request); | |
29 | |
30 if (!is_update_check && app->ping_events().empty()) { | |
31 return; | |
32 } | |
33 | |
34 if (!app->is_eula_accepted()) { | |
35 CORE_LOG(L3, (_T("[App EULA not accepted - not including app in ping][%s]"), | |
36 app->app_guid_string())); | |
37 return; | |
38 } | |
39 | |
40 xml::request::App request_app; | |
41 | |
42 // Pick up the current and next versions. | |
43 request_app.version = app->current_version()->version(); | |
44 request_app.next_version = app->next_version()->version(); | |
45 | |
46 request_app.app_id = app->app_guid_string(); | |
47 request_app.lang = app->language(); | |
48 request_app.iid = GuidToString(app->iid()); | |
49 request_app.brand_code = app->brand_code(); | |
50 request_app.client_id = app->client_id(); | |
51 request_app.experiments = app->GetExperimentLabels(); | |
52 request_app.ap = app->ap(); | |
53 | |
54 // referral_id is not sent. | |
55 | |
56 request_app.install_time_diff_sec = app->install_time_diff_sec(); | |
57 request_app.data.install_data_index = app->server_install_data_index(); | |
58 | |
59 if (is_update_check) { | |
60 request_app.ping.active = app->did_run(); | |
61 request_app.ping.days_since_last_active_ping = | |
62 app->days_since_last_active_ping(); | |
63 request_app.ping.days_since_last_roll_call = | |
64 app->days_since_last_roll_call(); | |
65 | |
66 request_app.update_check.is_valid = true; | |
67 request_app.update_check.is_update_disabled = | |
68 FAILED(app->CheckGroupPolicy()); | |
69 request_app.update_check.tt_token = app->tt_token(); | |
70 } | |
71 | |
72 request_app.ping_events = app->ping_events(); | |
73 | |
74 update_request->AddApp(request_app); | |
75 } | |
76 | |
77 } // namespace update_request_utils | |
78 | |
79 } // namespace omaha | |
OLD | NEW |