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

Side by Side Diff: base/omaha_version.cc

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 | « base/omaha_version.h ('k') | base/omaha_version_unittest.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 2007-2009 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/base/omaha_version.h"
17 #include "omaha/base/app_util.h"
18 #include "omaha/base/debug.h"
19 #include "omaha/base/file_ver.h"
20 #include "omaha/base/logging.h"
21 #include "omaha/base/utils.h"
22
23 namespace {
24
25 // The version string is not visible outside this module and it is only
26 // accessible through the omaha::GetVersionString accessor.
27 CString version_string;
28
29 ULONGLONG omaha_version = 0;
30
31 } // namespace
32
33 namespace omaha {
34
35 // In both GetVersion* methods, we assert only that InitializeVersion* was
36 // already called and not that they weren't called twice, which is OK.
37 // There is no detection that the version_ variables aren't accessed before
38 // being initialized because this would require accessor methods to enforce and
39 // lead to bloat.
40
41 const TCHAR* GetVersionString() {
42 ASSERT1(!version_string.IsEmpty());
43 return version_string;
44 }
45
46 ULONGLONG GetVersion() {
47 ASSERT1(!version_string.IsEmpty());
48 return omaha_version;
49 }
50
51 void InitializeVersionFromModule(HINSTANCE instance) {
52 ULONGLONG module_version = app_util::GetVersionFromModule(instance);
53
54 InitializeVersion(module_version);
55 }
56
57 void InitializeVersion(ULONGLONG version) {
58 omaha_version = version;
59
60 version_string = StringFromVersion(omaha_version);
61 }
62
63 } // namespace omaha
OLDNEW
« no previous file with comments | « base/omaha_version.h ('k') | base/omaha_version_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698