| 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/views/options/general_page_view.h" | 5 #include "chrome/browser/views/options/general_page_view.h" |
| 6 | 6 |
| 7 #include "app/combobox_model.h" | 7 #include "app/combobox_model.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/browser.h" | 14 #include "chrome/browser/browser.h" |
| 15 #include "chrome/browser/browser_window.h" | 15 #include "chrome/browser/browser_window.h" |
| 16 #include "chrome/browser/custom_home_pages_table_model.h" | 16 #include "chrome/browser/custom_home_pages_table_model.h" |
| 17 #include "chrome/browser/dom_ui/new_tab_ui.h" | 17 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 18 #include "chrome/browser/instant/instant_confirm_dialog.h" | 18 #include "chrome/browser/instant/instant_confirm_dialog.h" |
| 19 #include "chrome/browser/net/url_fixer_upper.h" | 19 #include "chrome/browser/net/url_fixer_upper.h" |
| 20 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
| 21 #include "chrome/browser/profile.h" | 21 #include "chrome/browser/profile.h" |
| 22 #include "chrome/browser/prefs/session_startup_pref.h" | 22 #include "chrome/browser/prefs/session_startup_pref.h" |
| 23 #include "chrome/browser/search_engines/template_url.h" | 23 #include "chrome/browser/search_engines/template_url.h" |
| 24 #include "chrome/browser/search_engines/template_url_model.h" | 24 #include "chrome/browser/search_engines/template_url_model.h" |
| 25 #include "chrome/browser/search_engines/template_url_model_observer.h" | 25 #include "chrome/browser/search_engines/template_url_model_observer.h" |
| 26 #include "chrome/browser/show_options_url.h" |
| 26 #include "chrome/browser/views/keyword_editor_view.h" | 27 #include "chrome/browser/views/keyword_editor_view.h" |
| 27 #include "chrome/browser/views/options/managed_prefs_banner_view.h" | 28 #include "chrome/browser/views/options/managed_prefs_banner_view.h" |
| 28 #include "chrome/browser/views/options/options_group_view.h" | 29 #include "chrome/browser/views/options/options_group_view.h" |
| 29 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 30 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 31 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 32 #include "chrome/installer/util/browser_distribution.h" | 33 #include "chrome/installer/util/browser_distribution.h" |
| 33 #include "grit/chromium_strings.h" | 34 #include "grit/chromium_strings.h" |
| 34 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
| 35 #include "views/controls/button/radio_button.h" | 36 #include "views/controls/button/radio_button.h" |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 instant_checkbox_->SetChecked(prefs->GetBoolean(prefs::kInstantEnabled)); | 445 instant_checkbox_->SetChecked(prefs->GetBoolean(prefs::kInstantEnabled)); |
| 445 } | 446 } |
| 446 | 447 |
| 447 void GeneralPageView::HighlightGroup(OptionsGroup highlight_group) { | 448 void GeneralPageView::HighlightGroup(OptionsGroup highlight_group) { |
| 448 if (highlight_group == OPTIONS_GROUP_DEFAULT_SEARCH) | 449 if (highlight_group == OPTIONS_GROUP_DEFAULT_SEARCH) |
| 449 default_search_group_->SetHighlighted(true); | 450 default_search_group_->SetHighlighted(true); |
| 450 } | 451 } |
| 451 | 452 |
| 452 void GeneralPageView::LinkActivated(views::Link* source, int event_flags) { | 453 void GeneralPageView::LinkActivated(views::Link* source, int event_flags) { |
| 453 DCHECK(source == instant_link_); | 454 DCHECK(source == instant_link_); |
| 454 // We open a new browser window so the Options dialog doesn't get lost behind | 455 browser::ShowOptionsURL(profile(), |
| 455 // other windows. | 456 GURL(browser::kInstantLearnMoreURL)); |
| 456 Browser* browser = Browser::Create(profile()); | |
| 457 browser->OpenURL(GURL(browser::kInstantLearnMoreURL), | |
| 458 GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); | |
| 459 browser->window()->Show(); | |
| 460 } | 457 } |
| 461 | 458 |
| 462 /////////////////////////////////////////////////////////////////////////////// | 459 /////////////////////////////////////////////////////////////////////////////// |
| 463 // GeneralPageView, private: | 460 // GeneralPageView, private: |
| 464 | 461 |
| 465 void GeneralPageView::SetDefaultBrowserUIState( | 462 void GeneralPageView::SetDefaultBrowserUIState( |
| 466 ShellIntegration::DefaultBrowserUIState state) { | 463 ShellIntegration::DefaultBrowserUIState state) { |
| 467 bool button_enabled = state == ShellIntegration::STATE_NOT_DEFAULT; | 464 bool button_enabled = state == ShellIntegration::STATE_NOT_DEFAULT; |
| 468 default_browser_use_as_default_button_->SetEnabled(button_enabled); | 465 default_browser_use_as_default_button_->SetEnabled(button_enabled); |
| 469 default_browser_use_as_default_button_->SetNeedElevation(true); | 466 default_browser_use_as_default_button_->SetNeedElevation(true); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 } | 874 } |
| 878 homepage_use_url_textfield_->SetEnabled(enabled); | 875 homepage_use_url_textfield_->SetEnabled(enabled); |
| 879 homepage_use_url_textfield_->SetReadOnly(!enabled); | 876 homepage_use_url_textfield_->SetReadOnly(!enabled); |
| 880 } | 877 } |
| 881 | 878 |
| 882 void GeneralPageView::SetDefaultSearchProvider() { | 879 void GeneralPageView::SetDefaultSearchProvider() { |
| 883 const int index = default_search_engine_combobox_->selected_item(); | 880 const int index = default_search_engine_combobox_->selected_item(); |
| 884 default_search_engines_model_->model()->SetDefaultSearchProvider( | 881 default_search_engines_model_->model()->SetDefaultSearchProvider( |
| 885 default_search_engines_model_->GetTemplateURLAt(index)); | 882 default_search_engines_model_->GetTemplateURLAt(index)); |
| 886 } | 883 } |
| OLD | NEW |