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

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

Issue 8302016: Make GTK and Aura parts orthogonal to OS parts (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 2 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
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/chrome_browser_main_gtk.h" 5 #include "chrome/browser/chrome_browser_main_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::BrowserParts() {
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 void ChromeBrowserPartsGtk::DetectRunningAsRoot() {
29 if (geteuid() == 0) { 26 if (geteuid() == 0) {
30 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 27 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
31 if (parsed_command_line().HasSwitch(switches::kUserDataDir)) 28 if (command_line.HasSwitch(switches::kUserDataDir))
32 return; 29 return;
33 30
34 gfx::GtkInitFromCommandLine(command_line); 31 gfx::GtkInitFromCommandLine(command_line);
35 32
36 // Get just enough of our resource machinery up so we can extract the 33 // Get just enough of our resource machinery up so we can extract the
37 // locale appropriate string. Note that the GTK implementation ignores the 34 // locale appropriate string. Note that the GTK implementation ignores the
38 // passed in parameter and checks the LANG environment variables instead. 35 // passed in parameter and checks the LANG environment variables instead.
39 ResourceBundle::InitSharedInstance(""); 36 ResourceBundle::InitSharedInstance("");
40 37
41 std::string message = l10n_util::GetStringFUTF8( 38 std::string message = l10n_util::GetStringFUTF8(
(...skipping 17 matching lines...) Expand all
59 56
60 message = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); 57 message = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
61 gtk_window_set_title(GTK_WINDOW(dialog), message.c_str()); 58 gtk_window_set_title(GTK_WINDOW(dialog), message.c_str());
62 59
63 gtk_dialog_run(GTK_DIALOG(dialog)); 60 gtk_dialog_run(GTK_DIALOG(dialog));
64 gtk_widget_destroy(dialog); 61 gtk_widget_destroy(dialog);
65 exit(EXIT_FAILURE); 62 exit(EXIT_FAILURE);
66 } 63 }
67 } 64 }
68 65
69 void ShowMissingLocaleMessageBox() { 66 // static
67 void ChromeBrowserPartsGtk::ShowMessageBox(const char* message) {
70 GtkWidget* dialog = gtk_message_dialog_new( 68 GtkWidget* dialog = gtk_message_dialog_new(
71 NULL, 69 NULL,
72 static_cast<GtkDialogFlags>(0), 70 static_cast<GtkDialogFlags>(0),
73 GTK_MESSAGE_ERROR, 71 GTK_MESSAGE_ERROR,
74 GTK_BUTTONS_CLOSE, 72 GTK_BUTTONS_CLOSE,
75 "%s", 73 "%s",
76 chrome_browser::kMissingLocaleDataMessage); 74 message);
77 75
78 gtk_window_set_title(GTK_WINDOW(dialog), 76 gtk_window_set_title(GTK_WINDOW(dialog), message);
79 chrome_browser::kMissingLocaleDataTitle);
80
81 gtk_dialog_run(GTK_DIALOG(dialog)); 77 gtk_dialog_run(GTK_DIALOG(dialog));
82 gtk_widget_destroy(dialog); 78 gtk_widget_destroy(dialog);
83 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698