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

Side by Side Diff: goopdate/job_observer.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « goopdate/installer_wrapper_unittest.cc ('k') | goopdate/job_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2008-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 // TODO(omaha3): Rename the files and class to ondemand_com_decorator.* and
17 // OnDemandCOMDecorator, respectively.
18
19 #ifndef OMAHA_GOOPDATE_JOB_OBSERVER_H_
20 #define OMAHA_GOOPDATE_JOB_OBSERVER_H_
21
22 #include <windows.h>
23 #include <atlbase.h>
24 #include <atlcom.h>
25 #include "base/scoped_ptr.h"
26 #include "omaha/client/install_apps.h"
27 #include "goopdate/omaha3_idl.h"
28
29 namespace omaha {
30
31 class JobObserverCOMDecorator
32 : public CComObjectRootEx<CComMultiThreadModel>,
33 public OnDemandObserver,
34 public IProgressWndEvents {
35 public:
36 BEGIN_COM_MAP(JobObserverCOMDecorator)
37 COM_INTERFACE_ENTRY(IProgressWndEvents)
38 END_COM_MAP()
39
40 JobObserverCOMDecorator();
41 virtual ~JobObserverCOMDecorator();
42 void Initialize(IJobObserver* job_observer);
43
44 // OnDemandObserver implementation.
45 virtual void OnCheckingForUpdate();
46 virtual void OnUpdateAvailable(const CString& app_name,
47 const CString& version_string);
48 virtual void OnWaitingToDownload(const CString& app_name);
49 virtual void OnDownloading(const CString& app_name,
50 int time_remaining_ms,
51 int pos);
52 virtual void OnWaitingRetryDownload(const CString& app_name,
53 time64 next_retry_time);
54 virtual void OnWaitingToInstall(const CString& app_name,
55 bool* can_start_install);
56 virtual void OnInstalling(const CString& app_name);
57 virtual void OnPause();
58 virtual void OnComplete(const ObserverCompletionInfo& observer_info);
59 virtual void SetEventSink(OnDemandEventsInterface* event_sink);
60
61 void Uninitialize();
62
63 // IProgressWndEvents.
64 STDMETHOD(DoPause)();
65 STDMETHOD(DoResume)();
66 STDMETHOD(DoClose)();
67 STDMETHOD(DoRestartBrowsers)();
68 STDMETHOD(DoReboot)();
69 STDMETHOD(DoLaunchBrowser)(const WCHAR* url);
70
71 private:
72 OnDemandEventsInterface* on_demand_events() {
73 return on_demand_events_;
74 }
75
76 // Since the code is running in an MTA, write access to
77 // on_demand_events_ must be atomic.
78 void set_job_events(OnDemandEventsInterface* on_demand_events) {
79 // InterlockedExchangePointer is broken due to ATL defining a function with
80 // the same name in the global namespace and hiding the Win32 API.
81 // InterlockedExchange introduces a full memory barrier.
82 ::InterlockedExchange(
83 reinterpret_cast<volatile LONG*>(&on_demand_events_),
84 reinterpret_cast<LONG>(on_demand_events));
85 }
86
87 CComPtr<IJobObserver> job_observer_;
88 OnDemandEventsInterface* volatile on_demand_events_;
89 DWORD thread_id_;
90 DWORD worker_job_thread_id_;
91 };
92
93 } // namespace omaha
94
95 #endif // OMAHA_GOOPDATE_JOB_OBSERVER_H_
OLDNEW
« no previous file with comments | « goopdate/installer_wrapper_unittest.cc ('k') | goopdate/job_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698