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

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

Issue 466036: AU: Beginnings of delta support (Closed)
Patch Set: Created 11 years 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 #ifndef UPDATE_ENGINE_UPDATE_CHECK_ACTION_H__ 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_CHECK_ACTION_H__
6 #define UPDATE_ENGINE_UPDATE_CHECK_ACTION_H__ 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_CHECK_ACTION_H__
7 7
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <fcntl.h> 10 #include <fcntl.h>
11 11
12 #include <string> 12 #include <string>
13 13
14 #include <curl/curl.h> 14 #include <curl/curl.h>
15 15
16 #include "base/scoped_ptr.h" 16 #include "base/scoped_ptr.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 bool prompt; 86 bool prompt;
87 }; 87 };
88 COMPILE_ASSERT(sizeof(off_t) == 8, off_t_not_64bit); 88 COMPILE_ASSERT(sizeof(off_t) == 8, off_t_not_64bit);
89 89
90 class UpdateCheckAction; 90 class UpdateCheckAction;
91 class NoneType; 91 class NoneType;
92 92
93 template<> 93 template<>
94 class ActionTraits<UpdateCheckAction> { 94 class ActionTraits<UpdateCheckAction> {
95 public: 95 public:
96 // Does not take an object for input 96 // Takes parameters on the input pipe
97 typedef NoneType InputObjectType; 97 typedef UpdateCheckParams InputObjectType;
98 // On success, puts the output path on output 98 // On success, puts the output path on output
99 typedef UpdateCheckResponse OutputObjectType; 99 typedef UpdateCheckResponse OutputObjectType;
100 }; 100 };
101 101
102 class UpdateCheckAction : public Action<UpdateCheckAction>, 102 class UpdateCheckAction : public Action<UpdateCheckAction>,
103 public HttpFetcherDelegate { 103 public HttpFetcherDelegate {
104 public: 104 public:
105 // The ctor takes in all the parameters that will be used for 105 // The ctor takes in all the parameters that will be used for
106 // making the request to Omaha. For some of them we have constants 106 // making the request to Omaha. For some of them we have constants
107 // that should be used. 107 // that should be used.
108 // Takes ownership of the passed in HttpFetcher. Useful for testing. 108 // Takes ownership of the passed in HttpFetcher. Useful for testing.
109 // A good calling pattern is: 109 // A good calling pattern is:
110 // UpdateCheckAction(..., new WhateverHttpFetcher); 110 // UpdateCheckAction(..., new WhateverHttpFetcher);
111 UpdateCheckAction(const UpdateCheckParams& params, 111 UpdateCheckAction(HttpFetcher* http_fetcher);
112 HttpFetcher* http_fetcher);
113 virtual ~UpdateCheckAction(); 112 virtual ~UpdateCheckAction();
114 typedef ActionTraits<UpdateCheckAction>::InputObjectType InputObjectType; 113 typedef ActionTraits<UpdateCheckAction>::InputObjectType InputObjectType;
115 typedef ActionTraits<UpdateCheckAction>::OutputObjectType OutputObjectType; 114 typedef ActionTraits<UpdateCheckAction>::OutputObjectType OutputObjectType;
116 void PerformAction(); 115 void PerformAction();
117 void TerminateProcessing(); 116 void TerminateProcessing();
118 117
119 // Debugging/logging 118 // Debugging/logging
120 std::string Type() const { return "UpdateCheckAction"; } 119 static std::string StaticType() { return "UpdateCheckAction"; }
120 std::string Type() const { return StaticType(); }
121 121
122 // Delegate methods (see http_fetcher.h) 122 // Delegate methods (see http_fetcher.h)
123 virtual void ReceivedBytes(HttpFetcher *fetcher, 123 virtual void ReceivedBytes(HttpFetcher *fetcher,
124 const char* bytes, int length); 124 const char* bytes, int length);
125 virtual void TransferComplete(HttpFetcher *fetcher, bool successful); 125 virtual void TransferComplete(HttpFetcher *fetcher, bool successful);
126 126
127 private: 127 private:
128 // These are data that are passed in the request to the Omaha server 128 // These are data that are passed in the request to the Omaha server
129 UpdateCheckParams params_; 129 UpdateCheckParams params_;
130 130
131 // pointer to the HttpFetcher that does the http work 131 // pointer to the HttpFetcher that does the http work
132 scoped_ptr<HttpFetcher> http_fetcher_; 132 scoped_ptr<HttpFetcher> http_fetcher_;
133 133
134 // Stores the response from the omaha server 134 // Stores the response from the omaha server
135 std::vector<char> response_buffer_; 135 std::vector<char> response_buffer_;
136 136
137 DISALLOW_COPY_AND_ASSIGN(UpdateCheckAction); 137 DISALLOW_COPY_AND_ASSIGN(UpdateCheckAction);
138 }; 138 };
139 139
140 } // namespace chromeos_update_engine 140 } // namespace chromeos_update_engine
141 141
142 #endif // UPDATE_ENGINE_UPDATE_CHECK_ACTION_H__ 142 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_CHECK_ACTION_H__
OLDNEW
« no previous file with comments | « src/platform/update_engine/testrunner.cc ('k') | src/platform/update_engine/update_check_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698