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

Side by Side Diff: chrome/browser/platform_util_common_linux.cc

Issue 7249003: Move GetVersionStringModifier() and GetChannel() from platform_util_* to chrome_version_info_* (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: correct nits Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/platform_util.h ('k') | chrome/browser/platform_util_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/platform_util.h" 5 #include "chrome/browser/platform_util.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 g_signal_connect(dialog, 106 g_signal_connect(dialog,
107 "response", 107 "response",
108 G_CALLBACK(HandleOnResponseDialog), 108 G_CALLBACK(HandleOnResponseDialog),
109 NULL); 109 NULL);
110 gtk_util::ShowDialog(dialog); 110 gtk_util::ShowDialog(dialog);
111 // Not gtk_dialog_run as it prevents timers from running in the unit tests. 111 // Not gtk_dialog_run as it prevents timers from running in the unit tests.
112 MessageLoop::current()->Run(); 112 MessageLoop::current()->Run();
113 return g_dialog_response == GTK_RESPONSE_YES; 113 return g_dialog_response == GTK_RESPONSE_YES;
114 } 114 }
115 115
116 // Warning: this may be either Linux or ChromeOS.
117 std::string GetVersionStringModifier() {
118 char* env = getenv("CHROME_VERSION_EXTRA");
119 if (!env)
120 return std::string();
121 std::string modifier(env);
122
123 #if defined(GOOGLE_CHROME_BUILD)
124 // Only ever return "", "unknown", "dev" or "beta" in a branded build.
125 if (modifier == "unstable") // linux version of "dev"
126 modifier = "dev";
127 if (modifier == "stable") {
128 modifier = "";
129 } else if ((modifier == "dev") || (modifier == "beta")) {
130 // do nothing.
131 } else {
132 modifier = "unknown";
133 }
134 #endif
135
136 return modifier;
137 }
138
139 // Warning: this may be either Linux or ChromeOS.
140 Channel GetChannel() {
141 #if defined(GOOGLE_CHROME_BUILD)
142 std::string channel = GetVersionStringModifier();
143 if (channel.empty()) {
144 return CHANNEL_STABLE;
145 } else if (channel == "beta") {
146 return CHANNEL_BETA;
147 } else if (channel == "dev") {
148 return CHANNEL_DEV;
149 } else if (channel == "canary") {
150 return CHANNEL_CANARY;
151 }
152 #endif
153
154 return CHANNEL_UNKNOWN;
155 }
156
157 bool CanSetAsDefaultBrowser() { 116 bool CanSetAsDefaultBrowser() {
158 return true; 117 return true;
159 } 118 }
160 119
161 bool CanSetAsDefaultProtocolClient(const std::string& protocol) { 120 bool CanSetAsDefaultProtocolClient(const std::string& protocol) {
162 return CanSetAsDefaultBrowser(); 121 return CanSetAsDefaultBrowser();
163 } 122 }
164 123
165 } // namespace platform_util 124 } // namespace platform_util
OLDNEW
« no previous file with comments | « chrome/browser/platform_util.h ('k') | chrome/browser/platform_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698