| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options2/browser_options_handler2.h" | 5 #include "chrome/browser/ui/webui/options2/browser_options_handler2.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/value_conversions.h" |
| 16 #include "base/values.h" | 17 #include "base/values.h" |
| 17 #include "base/value_conversions.h" | |
| 18 #include "chrome/browser/auto_launch_trial.h" | 18 #include "chrome/browser/auto_launch_trial.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete.h" | 19 #include "chrome/browser/autocomplete/autocomplete.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_match.h" | 20 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/custom_home_pages_table_model.h" | 22 #include "chrome/browser/custom_home_pages_table_model.h" |
| 23 #include "chrome/browser/instant/instant_confirm_dialog.h" | 23 #include "chrome/browser/instant/instant_confirm_dialog.h" |
| 24 #include "chrome/browser/instant/instant_controller.h" | 24 #include "chrome/browser/instant/instant_controller.h" |
| 25 #include "chrome/browser/instant/instant_field_trial.h" | 25 #include "chrome/browser/instant/instant_field_trial.h" |
| 26 #include "chrome/browser/net/url_fixer_upper.h" | 26 #include "chrome/browser/net/url_fixer_upper.h" |
| 27 #include "chrome/browser/prefs/pref_service.h" | 27 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #include "chrome/browser/ui/browser_window.h" | 70 #include "chrome/browser/ui/browser_window.h" |
| 71 #include "chrome/browser/ui/views/window.h" | 71 #include "chrome/browser/ui/views/window.h" |
| 72 #include "third_party/skia/include/core/SkBitmap.h" | 72 #include "third_party/skia/include/core/SkBitmap.h" |
| 73 #endif // defined(OS_CHROMEOS) | 73 #endif // defined(OS_CHROMEOS) |
| 74 | 74 |
| 75 #if defined(OS_WIN) | 75 #if defined(OS_WIN) |
| 76 #include "chrome/installer/util/auto_launch_util.h" | 76 #include "chrome/installer/util/auto_launch_util.h" |
| 77 #endif // defined(OS_WIN) | 77 #endif // defined(OS_WIN) |
| 78 | 78 |
| 79 #if defined(TOOLKIT_GTK) | 79 #if defined(TOOLKIT_GTK) |
| 80 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 80 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 81 #endif // defined(TOOLKIT_GTK) | 81 #endif // defined(TOOLKIT_GTK) |
| 82 | 82 |
| 83 using content::BrowserThread; | 83 using content::BrowserThread; |
| 84 using content::UserMetricsAction; | 84 using content::UserMetricsAction; |
| 85 | 85 |
| 86 namespace options2 { | 86 namespace options2 { |
| 87 | 87 |
| 88 BrowserOptionsHandler::BrowserOptionsHandler() | 88 BrowserOptionsHandler::BrowserOptionsHandler() |
| 89 : template_url_service_(NULL), | 89 : template_url_service_(NULL), |
| 90 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_file_(this)), | 90 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_for_file_(this)), |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 profile_info_list); | 692 profile_info_list); |
| 693 } | 693 } |
| 694 | 694 |
| 695 void BrowserOptionsHandler::CreateProfile(const ListValue* args) { | 695 void BrowserOptionsHandler::CreateProfile(const ListValue* args) { |
| 696 ProfileManager::CreateMultiProfileAsync(); | 696 ProfileManager::CreateMultiProfileAsync(); |
| 697 } | 697 } |
| 698 | 698 |
| 699 void BrowserOptionsHandler::ObserveThemeChanged() { | 699 void BrowserOptionsHandler::ObserveThemeChanged() { |
| 700 Profile* profile = Profile::FromWebUI(web_ui()); | 700 Profile* profile = Profile::FromWebUI(web_ui()); |
| 701 #if defined(TOOLKIT_GTK) | 701 #if defined(TOOLKIT_GTK) |
| 702 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); | 702 ThemeServiceGtk* theme_service = ThemeServiceGtk::GetFrom(profile); |
| 703 bool is_gtk_theme = theme_service->UsingNativeTheme(); | 703 bool is_gtk_theme = theme_service->UsingNativeTheme(); |
| 704 base::FundamentalValue gtk_enabled(!is_gtk_theme); | 704 base::FundamentalValue gtk_enabled(!is_gtk_theme); |
| 705 web_ui()->CallJavascriptFunction("BrowserOptions.setGtkThemeButtonEnabled", | 705 web_ui()->CallJavascriptFunction("BrowserOptions.setGtkThemeButtonEnabled", |
| 706 gtk_enabled); | 706 gtk_enabled); |
| 707 #else | 707 #else |
| 708 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); | 708 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); |
| 709 bool is_gtk_theme = false; | 709 bool is_gtk_theme = false; |
| 710 #endif | 710 #endif |
| 711 | 711 |
| 712 bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme(); | 712 bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme(); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 sync_status->SetBoolean("hasUnrecoverableError", | 780 sync_status->SetBoolean("hasUnrecoverableError", |
| 781 service->unrecoverable_error_detected()); | 781 service->unrecoverable_error_detected()); |
| 782 sync_status->SetBoolean("autoLoginVisible", | 782 sync_status->SetBoolean("autoLoginVisible", |
| 783 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutologin) && | 783 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAutologin) && |
| 784 service->AreCredentialsAvailable()); | 784 service->AreCredentialsAvailable()); |
| 785 | 785 |
| 786 return sync_status; | 786 return sync_status; |
| 787 } | 787 } |
| 788 | 788 |
| 789 } // namespace options2 | 789 } // namespace options2 |
| OLD | NEW |