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

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

Issue 8539038: Add ChromeBrowserMainExtraParts for non main parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again + explicit reset of parts_ Created 9 years, 1 month 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_parts_gtk.h" 5 #include "chrome/browser/chrome_browser_main_extra_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 ChromeBrowserPartsGtk::ChromeBrowserPartsGtk() 17 ChromeBrowserMainExtraPartsGtk::ChromeBrowserMainExtraPartsGtk()
18 : content::BrowserMainParts() { 18 : ChromeBrowserMainExtraParts() {
19 } 19 }
20 20
21 void ChromeBrowserPartsGtk::PreEarlyInitialization() { 21 void ChromeBrowserMainExtraPartsGtk::PreEarlyInitialization() {
22 DetectRunningAsRoot(); 22 DetectRunningAsRoot();
23 } 23 }
24 24
25 void ChromeBrowserPartsGtk::PostEarlyInitialization() {
26 }
27 25
28 void ChromeBrowserPartsGtk::ToolkitInitialized() { 26 void ChromeBrowserMainExtraPartsGtk::DetectRunningAsRoot() {
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() {
48 if (geteuid() == 0) { 27 if (geteuid() == 0) {
49 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 28 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
50 if (command_line.HasSwitch(switches::kUserDataDir)) 29 if (command_line.HasSwitch(switches::kUserDataDir))
51 return; 30 return;
52 31
53 gfx::GtkInitFromCommandLine(command_line); 32 gfx::GtkInitFromCommandLine(command_line);
54 33
55 // Get just enough of our resource machinery up so we can extract the 34 // Get just enough of our resource machinery up so we can extract the
56 // locale appropriate string. Note that the GTK implementation ignores the 35 // locale appropriate string. Note that the GTK implementation ignores the
57 // passed in parameter and checks the LANG environment variables instead. 36 // passed in parameter and checks the LANG environment variables instead.
(...skipping 21 matching lines...) Expand all
79 message = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); 58 message = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
80 gtk_window_set_title(GTK_WINDOW(dialog), message.c_str()); 59 gtk_window_set_title(GTK_WINDOW(dialog), message.c_str());
81 60
82 gtk_dialog_run(GTK_DIALOG(dialog)); 61 gtk_dialog_run(GTK_DIALOG(dialog));
83 gtk_widget_destroy(dialog); 62 gtk_widget_destroy(dialog);
84 exit(EXIT_FAILURE); 63 exit(EXIT_FAILURE);
85 } 64 }
86 } 65 }
87 66
88 // static 67 // static
89 void ChromeBrowserPartsGtk::ShowMessageBox(const char* message) { 68 void ChromeBrowserMainExtraPartsGtk::ShowMessageBox(const char* message) {
90 GtkWidget* dialog = gtk_message_dialog_new( 69 GtkWidget* dialog = gtk_message_dialog_new(
91 NULL, 70 NULL,
92 static_cast<GtkDialogFlags>(0), 71 static_cast<GtkDialogFlags>(0),
93 GTK_MESSAGE_ERROR, 72 GTK_MESSAGE_ERROR,
94 GTK_BUTTONS_CLOSE, 73 GTK_BUTTONS_CLOSE,
95 "%s", 74 "%s",
96 message); 75 message);
97 76
98 gtk_window_set_title(GTK_WINDOW(dialog), message); 77 gtk_window_set_title(GTK_WINDOW(dialog), message);
99 gtk_dialog_run(GTK_DIALOG(dialog)); 78 gtk_dialog_run(GTK_DIALOG(dialog));
100 gtk_widget_destroy(dialog); 79 gtk_widget_destroy(dialog);
101 } 80 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main_extra_parts_gtk.h ('k') | chrome/browser/chrome_browser_main_extra_parts_touch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698