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

Side by Side Diff: chrome/installer/util/channel_info.h

Issue 811283002: [Installer] Cleaning up dead code for App Launcher / App Host installs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove query-eula-acceptance; changing ChannelInfo cleanup approach. Created 5 years, 11 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 CHROME_INSTALLER_UTIL_CHANNEL_INFO_H_ 5 #ifndef CHROME_INSTALLER_UTIL_CHANNEL_INFO_H_
6 #define CHROME_INSTALLER_UTIL_CHANNEL_INFO_H_ 6 #define CHROME_INSTALLER_UTIL_CHANNEL_INFO_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string16.h"
11
10 namespace base { 12 namespace base {
11 namespace win { 13 namespace win {
12 class RegKey; 14 class RegKey;
13 } 15 }
14 } 16 }
15 17
16 namespace installer { 18 namespace installer {
17 19
18 // A helper class for parsing and modifying the Google Update additional 20 // A helper class for parsing and modifying the Google Update additional
19 // parameter ("ap") client state value for a product. 21 // parameter ("ap") client state value for a product.
20 class ChannelInfo { 22 class ChannelInfo {
21 public: 23 public:
22 24
23 // Initialize an instance from the "ap" value in a given registry key. 25 // Initialize an instance from the "ap" value in a given registry key.
24 // Returns false if the value is present but could not be read from the 26 // Returns false if the value is present but could not be read from the
25 // registry. Returns true if the value was not present or could be read. 27 // registry. Returns true if the value was not present or could be read.
26 // Also returns true if the key is not valid. 28 // Also returns true if the key is not valid.
27 // An absent "ap" value is treated identically to an empty "ap" value. 29 // An absent "ap" value is treated identically to an empty "ap" value.
28 bool Initialize(const base::win::RegKey& key); 30 bool Initialize(const base::win::RegKey& key);
29 31
30 // Writes the info to the "ap" value in a given registry key. 32 // Writes the info to the "ap" value in a given registry key.
31 // Returns false if the value could not be written to the registry. 33 // Returns false if the value could not be written to the registry.
32 bool Write(base::win::RegKey* key) const; 34 bool Write(base::win::RegKey* key) const;
33 35
34 const std::wstring& value() const { return value_; } 36 const std::wstring& value() const { return value_; }
grt (UTC plus 2) 2015/01/20 21:30:23 string16 here and below, and remove #include <stri
huangs 2015/01/20 23:26:00 Done.
35 void set_value(const std::wstring& value) { value_ = value; } 37 void set_value(const std::wstring& value) { value_ = value; }
36 bool Equals(const ChannelInfo& other) const { 38 bool Equals(const ChannelInfo& other) const {
37 return value_ == other.value_; 39 return value_ == other.value_;
38 } 40 }
39 41
40 // Determines the update channel for the value. Possible |channel_name| 42 // Determines the update channel for the value. Possible |channel_name|
41 // results are the empty string (stable channel), "beta", and "dev". Returns 43 // results are the empty string (stable channel), "beta", and "dev". Returns
42 // false (without modifying |channel_name|) if the channel could not be 44 // false (without modifying |channel_name|) if the channel could not be
43 // determined. 45 // determined.
44 bool GetChannelName(std::wstring* channel_name) const; 46 bool GetChannelName(base::string16* channel_name) const;
45 47
46 // Returns true if the -chrome modifier is present in the value. 48 // Returns true if the -chrome modifier is present in the value.
47 bool IsChrome() const; 49 bool IsChrome() const;
48 50
49 // Adds or removes the -chrome modifier, returning true if the value is 51 // Adds or removes the -chrome modifier, returning true if the value is
50 // modified. 52 // modified.
51 bool SetChrome(bool value); 53 bool SetChrome(bool value);
52 54
53 // Returns true if the -chromeframe modifier is present in the value. 55 // Returns true if the -chromeframe modifier is present in the value.
54 bool IsChromeFrame() const; 56 bool IsChromeFrame() const;
55 57
56 // Adds or removes the -chromeframe modifier, returning true if the value is 58 // Adds or removes the -chromeframe modifier, returning true if the value is
57 // modified. 59 // modified.
58 bool SetChromeFrame(bool value); 60 bool SetChromeFrame(bool value);
59 61
60 // Returns true if the -applauncher modifier is present in the value. 62 // (Deprecated) Returns true if the -applauncher modifier is present in the
63 // value.
61 bool IsAppLauncher() const; 64 bool IsAppLauncher() const;
62 65
63 // Adds or removes the -applauncher modifier, returning true if the value is 66 // (Deprecated) Adds or removes the -applauncher modifier, returning true if
64 // modified. 67 // the value is modified.
65 bool SetAppLauncher(bool value); 68 bool SetAppLauncher(bool value);
66 69
67 // Returns true if the -multi modifier is present in the value. 70 // Returns true if the -multi modifier is present in the value.
68 bool IsMultiInstall() const; 71 bool IsMultiInstall() const;
69 72
70 // Adds or removes the -multi modifier, returning true if the value is 73 // Adds or removes the -multi modifier, returning true if the value is
71 // modified. 74 // modified.
72 bool SetMultiInstall(bool value); 75 bool SetMultiInstall(bool value);
73 76
74 // Returns true if the -readymode modifier is present in the value. 77 // Returns true if the -readymode modifier is present in the value.
75 bool IsReadyMode() const; 78 bool IsReadyMode() const;
76 79
77 // Adds or removes the -readymode modifier, returning true if the value is 80 // Adds or removes the -readymode modifier, returning true if the value is
78 // modified. 81 // modified.
79 bool SetReadyMode(bool value); 82 bool SetReadyMode(bool value);
80 83
81 // Adds the -stage: modifier with the given string (if |stage| is non-NULL) or 84 // Adds the -stage: modifier with the given string (if |stage| is non-NULL) or
82 // removes the -stage: modifier (otherwise), returning true if the value is 85 // removes the -stage: modifier (otherwise), returning true if the value is
83 // modified. 86 // modified.
84 bool SetStage(const wchar_t* stage); 87 bool SetStage(const wchar_t* stage);
85 88
86 // Returns the string identifying the current stage, or an empty string if the 89 // Returns the string identifying the current stage, or an empty string if the
87 // -stage: modifier is not present in the value. 90 // -stage: modifier is not present in the value.
88 std::wstring GetStage() const; 91 base::string16 GetStage() const;
89 92
90 // Returns true if the -full suffix is present in the value. 93 // Returns true if the -full suffix is present in the value.
91 bool HasFullSuffix() const; 94 bool HasFullSuffix() const;
92 95
93 // Adds or removes the -full suffix, returning true if the value is 96 // Adds or removes the -full suffix, returning true if the value is
94 // modified. 97 // modified.
95 bool SetFullSuffix(bool value); 98 bool SetFullSuffix(bool value);
96 99
97 // Returns true if the -multifail suffix is present in the value. 100 // Returns true if the -multifail suffix is present in the value.
98 bool HasMultiFailSuffix() const; 101 bool HasMultiFailSuffix() const;
99 102
100 // Adds or removes the -multifail suffix, returning true if the value is 103 // Adds or removes the -multifail suffix, returning true if the value is
101 // modified. 104 // modified.
102 bool SetMultiFailSuffix(bool value); 105 bool SetMultiFailSuffix(bool value);
103 106
104 // Adds or removes the -migrating suffix, returning true if the value is 107 // Adds or removes the -migrating suffix, returning true if the value is
105 // modified. 108 // modified.
106 bool SetMigratingSuffix(bool value); 109 bool SetMigratingSuffix(bool value);
107 110
108 // Returns true if the -migrating suffix is present in the value. 111 // Returns true if the -migrating suffix is present in the value.
109 bool HasMigratingSuffix() const; 112 bool HasMigratingSuffix() const;
110 113
111 // Removes all modifiers and suffixes. For example, 2.0-dev-multi-chrome-full 114 // Removes all modifiers and suffixes. For example, 2.0-dev-multi-chrome-full
112 // becomes 2.0-dev. Returns true if the value is modified. 115 // becomes 2.0-dev. Returns true if the value is modified.
113 bool RemoveAllModifiersAndSuffixes(); 116 bool RemoveAllModifiersAndSuffixes();
114 117
115 private: 118 private:
116 std::wstring value_; 119 base::string16 value_;
117 }; // class ChannelInfo 120 }; // class ChannelInfo
118 121
119 } // namespace installer 122 } // namespace installer
120 123
121 #endif // CHROME_INSTALLER_UTIL_CHANNEL_INFO_H_ 124 #endif // CHROME_INSTALLER_UTIL_CHANNEL_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698