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

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

Issue 6621045: Add cmdline switch for folks that really did want to run as root.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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/app/generated_resources.grd ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser_main_gtk.h" 5 #include "chrome/browser/browser_main_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 #if defined(USE_NSS) 70 #if defined(USE_NSS)
71 // We want to be sure to init NSPR on the main thread. 71 // We want to be sure to init NSPR on the main thread.
72 base::EnsureNSPRInit(); 72 base::EnsureNSPRInit();
73 #endif 73 #endif
74 } 74 }
75 75
76 void BrowserMainPartsGtk::DetectRunningAsRoot() { 76 void BrowserMainPartsGtk::DetectRunningAsRoot() {
77 if (geteuid() == 0) { 77 if (geteuid() == 0) {
78 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 78 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
79 if (!parsed_command_line().HasSwitch(switches::kUserDataDir))
80 return;
81
79 gfx::GtkInitFromCommandLine(command_line); 82 gfx::GtkInitFromCommandLine(command_line);
80 83
81 // Get just enough of our resource machinery up so we can extract the 84 // Get just enough of our resource machinery up so we can extract the
82 // locale appropriate string. Note that the GTK implementation ignores the 85 // locale appropriate string. Note that the GTK implementation ignores the
83 // passed in parameter and checks the LANG environment variables instead. 86 // passed in parameter and checks the LANG environment variables instead.
84 ResourceBundle::InitSharedInstance(""); 87 ResourceBundle::InitSharedInstance("");
85 88
86 std::string message = l10n_util::GetStringFUTF8( 89 std::string message = l10n_util::GetStringFUTF8(
87 IDS_REFUSE_TO_RUN_AS_ROOT, 90 IDS_REFUSE_TO_RUN_AS_ROOT,
88 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 91 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
89 GtkWidget* dialog = gtk_message_dialog_new( 92 GtkWidget* dialog = gtk_message_dialog_new(
90 NULL, 93 NULL,
91 static_cast<GtkDialogFlags>(0), 94 static_cast<GtkDialogFlags>(0),
92 GTK_MESSAGE_ERROR, 95 GTK_MESSAGE_ERROR,
93 GTK_BUTTONS_CLOSE, 96 GTK_BUTTONS_CLOSE,
94 "%s", 97 "%s",
95 message.c_str()); 98 message.c_str());
96 99
100 LOG(ERROR) << "Startup refusing to run as root.";
97 message = l10n_util::GetStringFUTF8( 101 message = l10n_util::GetStringFUTF8(
98 IDS_REFUSE_TO_RUN_AS_ROOT_2, 102 IDS_REFUSE_TO_RUN_AS_ROOT_2,
99 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 103 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
100 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), 104 gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
101 "%s", 105 "%s",
102 message.c_str()); 106 message.c_str());
103 107
104 message = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); 108 message = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
105 gtk_window_set_title(GTK_WINDOW(dialog), message.c_str()); 109 gtk_window_set_title(GTK_WINDOW(dialog), message.c_str());
106 110
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ui::SetX11ErrorHandlers(BrowserX11ErrorHandler, BrowserX11IOErrorHandler); 181 ui::SetX11ErrorHandlers(BrowserX11ErrorHandler, BrowserX11IOErrorHandler);
178 } 182 }
179 183
180 #if !defined(OS_CHROMEOS) 184 #if !defined(OS_CHROMEOS)
181 // static 185 // static
182 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts( 186 BrowserMainParts* BrowserMainParts::CreateBrowserMainParts(
183 const MainFunctionParams& parameters) { 187 const MainFunctionParams& parameters) {
184 return new BrowserMainPartsGtk(parameters); 188 return new BrowserMainPartsGtk(parameters);
185 } 189 }
186 #endif 190 #endif
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698