| 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 <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "chrome/browser/accessibility_events.h" | 9 #include "chrome/browser/accessibility_events.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/prefs/pref_member.h" | 11 #include "chrome/browser/prefs/pref_member.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
| 15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
| 16 #include "chrome/browser/ui/gtk/accessible_widget_helper_gtk.h" | 16 #include "chrome/browser/ui/gtk/accessible_widget_helper_gtk.h" |
| 17 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 18 #include "chrome/browser/ui/gtk/options/advanced_page_gtk.h" | 18 #include "chrome/browser/ui/gtk/options/advanced_page_gtk.h" |
| 19 #include "chrome/browser/ui/gtk/options/content_page_gtk.h" | 19 #include "chrome/browser/ui/gtk/options/content_page_gtk.h" |
| 20 #include "chrome/browser/ui/gtk/options/general_page_gtk.h" | 20 #include "chrome/browser/ui/gtk/options/general_page_gtk.h" |
| 21 #include "chrome/browser/ui/options/options_window.h" | 21 #include "chrome/browser/ui/options/options_window.h" |
| 22 #include "chrome/browser/ui/window_sizer.h" | 22 #include "chrome/browser/ui/window_sizer.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "grit/chromium_strings.h" | 24 #include "grit/chromium_strings.h" |
| 25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 27 | 27 |
| 28 #if defined(OS_CHROMEOS) | |
| 29 #include "chrome/browser/chromeos/options/internet_page_view.h" | |
| 30 #include "chrome/browser/chromeos/options/system_page_view.h" | |
| 31 #endif | |
| 32 | |
| 33 /////////////////////////////////////////////////////////////////////////////// | 28 /////////////////////////////////////////////////////////////////////////////// |
| 34 // OptionsWindowGtk | 29 // OptionsWindowGtk |
| 35 // | 30 // |
| 36 // The contents of the Options dialog window. | 31 // The contents of the Options dialog window. |
| 37 | 32 |
| 38 class OptionsWindowGtk { | 33 class OptionsWindowGtk { |
| 39 public: | 34 public: |
| 40 explicit OptionsWindowGtk(Profile* profile); | 35 explicit OptionsWindowGtk(Profile* profile); |
| 41 ~OptionsWindowGtk(); | 36 ~OptionsWindowGtk(); |
| 42 | 37 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 accessible_widget_helper_->SendOpenWindowNotification(dialog_name); | 108 accessible_widget_helper_->SendOpenWindowNotification(dialog_name); |
| 114 | 109 |
| 115 gtk_window_set_default_size(GTK_WINDOW(dialog_), 500, -1); | 110 gtk_window_set_default_size(GTK_WINDOW(dialog_), 500, -1); |
| 116 // Allow browser windows to go in front of the options dialog in metacity. | 111 // Allow browser windows to go in front of the options dialog in metacity. |
| 117 gtk_window_set_type_hint(GTK_WINDOW(dialog_), GDK_WINDOW_TYPE_HINT_NORMAL); | 112 gtk_window_set_type_hint(GTK_WINDOW(dialog_), GDK_WINDOW_TYPE_HINT_NORMAL); |
| 118 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), | 113 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog_)->vbox), |
| 119 gtk_util::kContentAreaSpacing); | 114 gtk_util::kContentAreaSpacing); |
| 120 | 115 |
| 121 notebook_ = gtk_notebook_new(); | 116 notebook_ = gtk_notebook_new(); |
| 122 | 117 |
| 123 #if defined(OS_CHROMEOS) | |
| 124 gtk_notebook_append_page( | |
| 125 GTK_NOTEBOOK(notebook_), | |
| 126 (new chromeos::SystemPageView(profile_))->WrapInGtkWidget(), | |
| 127 gtk_label_new( | |
| 128 l10n_util::GetStringUTF8(IDS_OPTIONS_SYSTEM_TAB_LABEL).c_str())); | |
| 129 | |
| 130 gtk_notebook_append_page( | |
| 131 GTK_NOTEBOOK(notebook_), | |
| 132 (new chromeos::InternetPageView(profile_))->WrapInGtkWidget(), | |
| 133 gtk_label_new( | |
| 134 l10n_util::GetStringUTF8(IDS_OPTIONS_INTERNET_TAB_LABEL).c_str())); | |
| 135 #endif | |
| 136 | |
| 137 gtk_notebook_append_page( | 118 gtk_notebook_append_page( |
| 138 GTK_NOTEBOOK(notebook_), | 119 GTK_NOTEBOOK(notebook_), |
| 139 general_page_.get_page_widget(), | 120 general_page_.get_page_widget(), |
| 140 gtk_label_new( | 121 gtk_label_new( |
| 141 l10n_util::GetStringUTF8(IDS_OPTIONS_GENERAL_TAB_LABEL).c_str())); | 122 l10n_util::GetStringUTF8(IDS_OPTIONS_GENERAL_TAB_LABEL).c_str())); |
| 142 | 123 |
| 143 gtk_notebook_append_page( | 124 gtk_notebook_append_page( |
| 144 GTK_NOTEBOOK(notebook_), | 125 GTK_NOTEBOOK(notebook_), |
| 145 content_page_.get_page_widget(), | 126 content_page_.get_page_widget(), |
| 146 gtk_label_new( | 127 gtk_label_new( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // static | 214 // static |
| 234 void OptionsWindowGtk::OnWindowDestroy(GtkWidget* widget, | 215 void OptionsWindowGtk::OnWindowDestroy(GtkWidget* widget, |
| 235 OptionsWindowGtk* window) { | 216 OptionsWindowGtk* window) { |
| 236 options_window = NULL; | 217 options_window = NULL; |
| 237 MessageLoop::current()->DeleteSoon(FROM_HERE, window); | 218 MessageLoop::current()->DeleteSoon(FROM_HERE, window); |
| 238 } | 219 } |
| 239 | 220 |
| 240 /////////////////////////////////////////////////////////////////////////////// | 221 /////////////////////////////////////////////////////////////////////////////// |
| 241 // Factory/finder method: | 222 // Factory/finder method: |
| 242 | 223 |
| 243 #if !defined(OS_CHROMEOS) | |
| 244 // ShowOptionsWindow for non ChromeOS build. For ChromeOS build, see | |
| 245 // chrome/browser/chromeos/options/options_window_view.h | |
| 246 void ShowOptionsWindow(OptionsPage page, | 224 void ShowOptionsWindow(OptionsPage page, |
| 247 OptionsGroup highlight_group, | 225 OptionsGroup highlight_group, |
| 248 Profile* profile) { | 226 Profile* profile) { |
| 249 DCHECK(profile); | 227 DCHECK(profile); |
| 250 | 228 |
| 251 // If there's already an existing options window, activate it and switch to | 229 // If there's already an existing options window, activate it and switch to |
| 252 // the specified page. | 230 // the specified page. |
| 253 if (!options_window) { | 231 if (!options_window) { |
| 254 // Creating and initializing a bunch of controls generates a bunch of | 232 // Creating and initializing a bunch of controls generates a bunch of |
| 255 // spurious events as control values change. Temporarily suppress | 233 // spurious events as control values change. Temporarily suppress |
| 256 // accessibility events until the window is created. | 234 // accessibility events until the window is created. |
| 257 profile->PauseAccessibilityEvents(); | 235 profile->PauseAccessibilityEvents(); |
| 258 | 236 |
| 259 // Create the options window. | 237 // Create the options window. |
| 260 options_window = new OptionsWindowGtk(profile); | 238 options_window = new OptionsWindowGtk(profile); |
| 261 | 239 |
| 262 // Resume accessibility events. | 240 // Resume accessibility events. |
| 263 profile->ResumeAccessibilityEvents(); | 241 profile->ResumeAccessibilityEvents(); |
| 264 } | 242 } |
| 265 options_window->ShowOptionsPage(page, highlight_group); | 243 options_window->ShowOptionsPage(page, highlight_group); |
| 266 } | 244 } |
| 267 #endif // !defined(OS_CHROMEOS) | |
| OLD | NEW |