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_extra_parts_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 ChromeBrowserMainExtraPartsGtk::ChromeBrowserMainExtraPartsGtk() | 17 ChromeBrowserPartsGtk::ChromeBrowserPartsGtk() |
18 : ChromeBrowserMainExtraParts() { | 18 : content::BrowserMainParts() { |
19 } | 19 } |
20 | 20 |
21 void ChromeBrowserMainExtraPartsGtk::PreEarlyInitialization() { | 21 void ChromeBrowserPartsGtk::PreEarlyInitialization() { |
22 DetectRunningAsRoot(); | 22 DetectRunningAsRoot(); |
23 } | 23 } |
24 | 24 |
| 25 void ChromeBrowserPartsGtk::PostEarlyInitialization() { |
| 26 } |
25 | 27 |
26 void ChromeBrowserMainExtraPartsGtk::DetectRunningAsRoot() { | 28 void ChromeBrowserPartsGtk::ToolkitInitialized() { |
| 29 } |
| 30 |
| 31 void ChromeBrowserPartsGtk::PreMainMessageLoopStart() { |
| 32 } |
| 33 |
| 34 void ChromeBrowserPartsGtk::PostMainMessageLoopStart() { |
| 35 } |
| 36 |
| 37 void ChromeBrowserPartsGtk::PreMainMessageLoopRun() { |
| 38 } |
| 39 |
| 40 bool ChromeBrowserPartsGtk::MainMessageLoopRun(int* result_code) { |
| 41 return false; |
| 42 } |
| 43 |
| 44 void ChromeBrowserPartsGtk::PostMainMessageLoopRun() { |
| 45 } |
| 46 |
| 47 void ChromeBrowserPartsGtk::DetectRunningAsRoot() { |
27 if (geteuid() == 0) { | 48 if (geteuid() == 0) { |
28 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 49 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
29 if (command_line.HasSwitch(switches::kUserDataDir)) | 50 if (command_line.HasSwitch(switches::kUserDataDir)) |
30 return; | 51 return; |
31 | 52 |
32 gfx::GtkInitFromCommandLine(command_line); | 53 gfx::GtkInitFromCommandLine(command_line); |
33 | 54 |
34 // Get just enough of our resource machinery up so we can extract the | 55 // Get just enough of our resource machinery up so we can extract the |
35 // locale appropriate string. Note that the GTK implementation ignores the | 56 // locale appropriate string. Note that the GTK implementation ignores the |
36 // passed in parameter and checks the LANG environment variables instead. | 57 // passed in parameter and checks the LANG environment variables instead. |
(...skipping 21 matching lines...) Expand all Loading... |
58 message = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); | 79 message = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); |
59 gtk_window_set_title(GTK_WINDOW(dialog), message.c_str()); | 80 gtk_window_set_title(GTK_WINDOW(dialog), message.c_str()); |
60 | 81 |
61 gtk_dialog_run(GTK_DIALOG(dialog)); | 82 gtk_dialog_run(GTK_DIALOG(dialog)); |
62 gtk_widget_destroy(dialog); | 83 gtk_widget_destroy(dialog); |
63 exit(EXIT_FAILURE); | 84 exit(EXIT_FAILURE); |
64 } | 85 } |
65 } | 86 } |
66 | 87 |
67 // static | 88 // static |
68 void ChromeBrowserMainExtraPartsGtk::ShowMessageBox(const char* message) { | 89 void ChromeBrowserPartsGtk::ShowMessageBox(const char* message) { |
69 GtkWidget* dialog = gtk_message_dialog_new( | 90 GtkWidget* dialog = gtk_message_dialog_new( |
70 NULL, | 91 NULL, |
71 static_cast<GtkDialogFlags>(0), | 92 static_cast<GtkDialogFlags>(0), |
72 GTK_MESSAGE_ERROR, | 93 GTK_MESSAGE_ERROR, |
73 GTK_BUTTONS_CLOSE, | 94 GTK_BUTTONS_CLOSE, |
74 "%s", | 95 "%s", |
75 message); | 96 message); |
76 | 97 |
77 gtk_window_set_title(GTK_WINDOW(dialog), message); | 98 gtk_window_set_title(GTK_WINDOW(dialog), message); |
78 gtk_dialog_run(GTK_DIALOG(dialog)); | 99 gtk_dialog_run(GTK_DIALOG(dialog)); |
79 gtk_widget_destroy(dialog); | 100 gtk_widget_destroy(dialog); |
80 } | 101 } |
OLD | NEW |