OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/options/general_page_gtk.h" | 5 #include "chrome/browser/gtk/options/general_page_gtk.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/custom_home_pages_table_model.h" | 14 #include "chrome/browser/custom_home_pages_table_model.h" |
15 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h" | 15 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h" |
16 #include "chrome/browser/gtk/gtk_chrome_link_button.h" | 16 #include "chrome/browser/gtk/gtk_chrome_link_button.h" |
17 #include "chrome/browser/gtk/gtk_util.h" | 17 #include "chrome/browser/gtk/gtk_util.h" |
18 #include "chrome/browser/gtk/keyword_editor_view.h" | 18 #include "chrome/browser/gtk/keyword_editor_view.h" |
19 #include "chrome/browser/gtk/options/managed_prefs_banner_gtk.h" | 19 #include "chrome/browser/gtk/options/managed_prefs_banner_gtk.h" |
20 #include "chrome/browser/gtk/options/options_layout_gtk.h" | 20 #include "chrome/browser/gtk/options/options_layout_gtk.h" |
21 #include "chrome/browser/gtk/options/url_picker_dialog_gtk.h" | 21 #include "chrome/browser/gtk/options/url_picker_dialog_gtk.h" |
22 #include "chrome/browser/instant/instant_confirm_dialog.h" | 22 #include "chrome/browser/instant/instant_confirm_dialog.h" |
| 23 #include "chrome/browser/instant/instant_controller.h" |
23 #include "chrome/browser/net/url_fixer_upper.h" | 24 #include "chrome/browser/net/url_fixer_upper.h" |
24 #include "chrome/browser/prefs/pref_service.h" | 25 #include "chrome/browser/prefs/pref_service.h" |
25 #include "chrome/browser/prefs/session_startup_pref.h" | 26 #include "chrome/browser/prefs/session_startup_pref.h" |
26 #include "chrome/browser/profile.h" | 27 #include "chrome/browser/profile.h" |
27 #include "chrome/browser/search_engines/template_url.h" | 28 #include "chrome/browser/search_engines/template_url.h" |
28 #include "chrome/browser/search_engines/template_url_model.h" | 29 #include "chrome/browser/search_engines/template_url_model.h" |
29 #include "chrome/browser/show_options_url.h" | 30 #include "chrome/browser/show_options_url.h" |
30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/common/notification_service.h" | 32 #include "chrome/common/notification_service.h" |
32 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 if (initializing_) | 549 if (initializing_) |
549 return; | 550 return; |
550 | 551 |
551 bool enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)); | 552 bool enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)); |
552 | 553 |
553 if (enabled) { | 554 if (enabled) { |
554 if (!instant_.GetValue()) | 555 if (!instant_.GetValue()) |
555 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(instant_checkbox_), false); | 556 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(instant_checkbox_), false); |
556 browser::ShowInstantConfirmDialogIfNecessary(GetWindow(), profile()); | 557 browser::ShowInstantConfirmDialogIfNecessary(GetWindow(), profile()); |
557 } else { | 558 } else { |
558 instant_.SetValue(enabled); | 559 InstantController::Disable(profile()); |
559 } | 560 } |
560 | 561 |
561 // TODO(estade): UMA? | 562 // TODO(estade): UMA? |
562 } | 563 } |
563 | 564 |
564 void GeneralPageGtk::OnDefaultSearchEngineChanged(GtkWidget* combo_box) { | 565 void GeneralPageGtk::OnDefaultSearchEngineChanged(GtkWidget* combo_box) { |
565 if (default_search_initializing_) | 566 if (default_search_initializing_) |
566 return; | 567 return; |
567 SetDefaultSearchEngineFromComboBox(); | 568 SetDefaultSearchEngineFromComboBox(); |
568 } | 569 } |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 int desired_width = allocation->x - sender->parent->allocation.x; | 799 int desired_width = allocation->x - sender->parent->allocation.x; |
799 GtkRequisition req; | 800 GtkRequisition req; |
800 gtk_widget_size_request(instant_indent_, &req); | 801 gtk_widget_size_request(instant_indent_, &req); |
801 if (req.width != desired_width) | 802 if (req.width != desired_width) |
802 gtk_widget_set_size_request(instant_indent_, desired_width, -1); | 803 gtk_widget_set_size_request(instant_indent_, desired_width, -1); |
803 } | 804 } |
804 | 805 |
805 void GeneralPageGtk::OnSearchLearnMoreClicked(GtkWidget* sender) { | 806 void GeneralPageGtk::OnSearchLearnMoreClicked(GtkWidget* sender) { |
806 browser::ShowOptionsURL(profile(), GURL(browser::kInstantLearnMoreURL)); | 807 browser::ShowOptionsURL(profile(), GURL(browser::kInstantLearnMoreURL)); |
807 } | 808 } |
OLD | NEW |