OLD | NEW |
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/chrome_browser_main_gtk.h" | 5 #include "chrome/browser/chrome_browser_parts_gtk.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "grit/chromium_strings.h" | 11 #include "grit/chromium_strings.h" |
12 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/gfx/gtk_util.h" | 15 #include "ui/gfx/gtk_util.h" |
16 | 16 |
17 ChromeBrowserMainPartsGtk::ChromeBrowserMainPartsGtk( | 17 ChromeBrowserPartsGtk::ChromeBrowserPartsGtk() |
18 const MainFunctionParams& parameters) | 18 : content::BrowserMainParts() { |
19 : ChromeBrowserMainPartsPosix(parameters) { | |
20 } | 19 } |
21 | 20 |
22 void ChromeBrowserMainPartsGtk::PreEarlyInitialization() { | 21 void ChromeBrowserPartsGtk::PreEarlyInitialization() { |
23 DetectRunningAsRoot(); | 22 DetectRunningAsRoot(); |
24 | |
25 ChromeBrowserMainPartsPosix::PreEarlyInitialization(); | |
26 } | 23 } |
27 | 24 |
28 void ChromeBrowserMainPartsGtk::DetectRunningAsRoot() { | 25 bool ChromeBrowserPartsGtk::MainMessageLoopRun(int* result_code) { |
| 26 return false; |
| 27 } |
| 28 |
| 29 void ChromeBrowserPartsGtk::DetectRunningAsRoot() { |
29 if (geteuid() == 0) { | 30 if (geteuid() == 0) { |
30 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 31 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
31 if (parsed_command_line().HasSwitch(switches::kUserDataDir)) | 32 if (command_line.HasSwitch(switches::kUserDataDir)) |
32 return; | 33 return; |
33 | 34 |
34 gfx::GtkInitFromCommandLine(command_line); | 35 gfx::GtkInitFromCommandLine(command_line); |
35 | 36 |
36 // Get just enough of our resource machinery up so we can extract the | 37 // Get just enough of our resource machinery up so we can extract the |
37 // locale appropriate string. Note that the GTK implementation ignores the | 38 // locale appropriate string. Note that the GTK implementation ignores the |
38 // passed in parameter and checks the LANG environment variables instead. | 39 // passed in parameter and checks the LANG environment variables instead. |
39 ResourceBundle::InitSharedInstance(""); | 40 ResourceBundle::InitSharedInstance(""); |
40 | 41 |
41 std::string message = l10n_util::GetStringFUTF8( | 42 std::string message = l10n_util::GetStringFUTF8( |
(...skipping 17 matching lines...) Expand all Loading... |
59 | 60 |
60 message = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); | 61 message = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); |
61 gtk_window_set_title(GTK_WINDOW(dialog), message.c_str()); | 62 gtk_window_set_title(GTK_WINDOW(dialog), message.c_str()); |
62 | 63 |
63 gtk_dialog_run(GTK_DIALOG(dialog)); | 64 gtk_dialog_run(GTK_DIALOG(dialog)); |
64 gtk_widget_destroy(dialog); | 65 gtk_widget_destroy(dialog); |
65 exit(EXIT_FAILURE); | 66 exit(EXIT_FAILURE); |
66 } | 67 } |
67 } | 68 } |
68 | 69 |
69 void ShowMissingLocaleMessageBox() { | 70 // static |
| 71 void ChromeBrowserPartsGtk::ShowMessageBox(const char* message) { |
70 GtkWidget* dialog = gtk_message_dialog_new( | 72 GtkWidget* dialog = gtk_message_dialog_new( |
71 NULL, | 73 NULL, |
72 static_cast<GtkDialogFlags>(0), | 74 static_cast<GtkDialogFlags>(0), |
73 GTK_MESSAGE_ERROR, | 75 GTK_MESSAGE_ERROR, |
74 GTK_BUTTONS_CLOSE, | 76 GTK_BUTTONS_CLOSE, |
75 "%s", | 77 "%s", |
76 chrome_browser::kMissingLocaleDataMessage); | 78 message); |
77 | 79 |
78 gtk_window_set_title(GTK_WINDOW(dialog), | 80 gtk_window_set_title(GTK_WINDOW(dialog), message); |
79 chrome_browser::kMissingLocaleDataTitle); | |
80 | |
81 gtk_dialog_run(GTK_DIALOG(dialog)); | 81 gtk_dialog_run(GTK_DIALOG(dialog)); |
82 gtk_widget_destroy(dialog); | 82 gtk_widget_destroy(dialog); |
83 } | 83 } |
OLD | NEW |