Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: src/platform/update_engine/update_check_action.cc

Issue 1881001: AU: Many minor cleanup changes (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: fixes for review Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "update_engine/update_check_action.h" 5 #include "update_engine/update_check_action.h"
6 #include <inttypes.h> 6 #include <inttypes.h>
7 #include <sstream> 7 #include <sstream>
8 8
9 #include <libxml/parser.h> 9 #include <libxml/parser.h>
10 #include <libxml/xpath.h> 10 #include <libxml/xpath.h>
11 #include <libxml/xpathInternals.h> 11 #include <libxml/xpathInternals.h>
12 12
13 #include "chromeos/obsolete_logging.h" 13 #include "chromeos/obsolete_logging.h"
14 #include "update_engine/action_pipe.h" 14 #include "update_engine/action_pipe.h"
15 #include "update_engine/utils.h" 15 #include "update_engine/utils.h"
16 16
17 using std::string; 17 using std::string;
18 18
19 namespace chromeos_update_engine { 19 namespace chromeos_update_engine {
20 20
21 const char* const UpdateCheckParams::kAppId( 21 const char* const UpdateCheckParams::kAppId(
22 "{87efface-864d-49a5-9bb3-4b050a7c227a}"); 22 "{87efface-864d-49a5-9bb3-4b050a7c227a}");
23 const char* const UpdateCheckParams::kOsPlatform("Chrome OS"); 23 const char* const UpdateCheckParams::kOsPlatform("Chrome OS");
24 const char* const UpdateCheckParams::kOsVersion("Indy"); 24 const char* const UpdateCheckParams::kOsVersion("Indy");
25 const char* const UpdateCheckParams::kUpdateUrl(
26 "https://tools.google.com/service/update2");
25 27
26 namespace { 28 namespace {
27 29
28 const string kGupdateVersion("ChromeOSUpdateEngine-0.1.0.0"); 30 const string kGupdateVersion("ChromeOSUpdateEngine-0.1.0.0");
29 31
30 // This is handy for passing strings into libxml2 32 // This is handy for passing strings into libxml2
31 #define ConstXMLStr(x) (reinterpret_cast<const xmlChar*>(x)) 33 #define ConstXMLStr(x) (reinterpret_cast<const xmlChar*>(x))
32 34
33 // These are for scoped_ptr_malloc, which is like scoped_ptr, but allows 35 // These are for scoped_ptr_malloc, which is like scoped_ptr, but allows
34 // a custom free() function to be specified. 36 // a custom free() function to be specified.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 : http_fetcher_(http_fetcher) {} 100 : http_fetcher_(http_fetcher) {}
99 101
100 UpdateCheckAction::~UpdateCheckAction() {} 102 UpdateCheckAction::~UpdateCheckAction() {}
101 103
102 void UpdateCheckAction::PerformAction() { 104 void UpdateCheckAction::PerformAction() {
103 CHECK(HasInputObject()); 105 CHECK(HasInputObject());
104 params_ = GetInputObject(); 106 params_ = GetInputObject();
105 http_fetcher_->set_delegate(this); 107 http_fetcher_->set_delegate(this);
106 string request_post(FormatRequest(params_)); 108 string request_post(FormatRequest(params_));
107 http_fetcher_->SetPostData(request_post.data(), request_post.size()); 109 http_fetcher_->SetPostData(request_post.data(), request_post.size());
108 http_fetcher_->BeginTransfer("https://tools.google.com/service/update2"); 110 http_fetcher_->BeginTransfer(params_.update_url);
109 } 111 }
110 112
111 void UpdateCheckAction::TerminateProcessing() { 113 void UpdateCheckAction::TerminateProcessing() {
112 http_fetcher_->TerminateTransfer(); 114 http_fetcher_->TerminateTransfer();
113 } 115 }
114 116
115 // We just store the response in the buffer. Once we've received all bytes, 117 // We just store the response in the buffer. Once we've received all bytes,
116 // we'll look in the buffer and decide what to do. 118 // we'll look in the buffer and decide what to do.
117 void UpdateCheckAction::ReceivedBytes(HttpFetcher *fetcher, 119 void UpdateCheckAction::ReceivedBytes(HttpFetcher *fetcher,
118 const char* bytes, 120 const char* bytes,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 output_object.hash = XmlGetProperty(updatecheck_node, "hash"); 257 output_object.hash = XmlGetProperty(updatecheck_node, "hash");
256 output_object.size = ParseInt(XmlGetProperty(updatecheck_node, "size")); 258 output_object.size = ParseInt(XmlGetProperty(updatecheck_node, "size"));
257 output_object.needs_admin = 259 output_object.needs_admin =
258 XmlGetProperty(updatecheck_node, "needsadmin") == "true"; 260 XmlGetProperty(updatecheck_node, "needsadmin") == "true";
259 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true"; 261 output_object.prompt = XmlGetProperty(updatecheck_node, "Prompt") == "true";
260 SetOutputObject(output_object); 262 SetOutputObject(output_object);
261 return; 263 return;
262 } 264 }
263 265
264 }; // namespace chromeos_update_engine 266 }; // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « src/platform/update_engine/update_check_action.h ('k') | src/platform/update_engine/update_check_action_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698