| 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/options/personal_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/personal_options_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
| 44 | 44 |
| 45 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
| 46 #include "chrome/browser/chromeos/login/user_manager.h" | 46 #include "chrome/browser/chromeos/login/user_manager.h" |
| 47 #include "chrome/browser/chromeos/options/take_photo_dialog.h" | 47 #include "chrome/browser/chromeos/options/take_photo_dialog.h" |
| 48 #include "chrome/browser/ui/browser_window.h" | 48 #include "chrome/browser/ui/browser_window.h" |
| 49 #include "chrome/browser/ui/views/window.h" | 49 #include "chrome/browser/ui/views/window.h" |
| 50 #include "third_party/skia/include/core/SkBitmap.h" | 50 #include "third_party/skia/include/core/SkBitmap.h" |
| 51 #endif // defined(OS_CHROMEOS) | 51 #endif // defined(OS_CHROMEOS) |
| 52 #if defined(TOOLKIT_GTK) | 52 #if defined(TOOLKIT_GTK) |
| 53 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 53 #include "chrome/browser/ui/gtk/theme_service_gtk.h" |
| 54 #endif // defined(TOOLKIT_GTK) | 54 #endif // defined(TOOLKIT_GTK) |
| 55 | 55 |
| 56 using content::UserMetricsAction; | 56 using content::UserMetricsAction; |
| 57 | 57 |
| 58 PersonalOptionsHandler::PersonalOptionsHandler() { | 58 PersonalOptionsHandler::PersonalOptionsHandler() { |
| 59 multiprofile_ = ProfileManager::IsMultipleProfilesEnabled(); | 59 multiprofile_ = ProfileManager::IsMultipleProfilesEnabled(); |
| 60 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 61 registrar_.Add(this, | 61 registrar_.Add(this, |
| 62 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, | 62 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, |
| 63 content::NotificationService::AllSources()); | 63 content::NotificationService::AllSources()); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 visible.reset(Value::CreateBooleanValue(multiprofile_)); | 334 visible.reset(Value::CreateBooleanValue(multiprofile_)); |
| 335 web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesSectionVisible", | 335 web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesSectionVisible", |
| 336 *visible); | 336 *visible); |
| 337 if (multiprofile_) | 337 if (multiprofile_) |
| 338 SendProfilesInfo(); | 338 SendProfilesInfo(); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void PersonalOptionsHandler::ObserveThemeChanged() { | 341 void PersonalOptionsHandler::ObserveThemeChanged() { |
| 342 Profile* profile = Profile::FromWebUI(web_ui()); | 342 Profile* profile = Profile::FromWebUI(web_ui()); |
| 343 #if defined(TOOLKIT_GTK) | 343 #if defined(TOOLKIT_GTK) |
| 344 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); | 344 ThemeServiceGtk* theme_service = ThemeServiceGtk::GetFrom(profile); |
| 345 bool is_gtk_theme = theme_service->UsingNativeTheme(); | 345 bool is_gtk_theme = theme_service->UsingNativeTheme(); |
| 346 base::FundamentalValue gtk_enabled(!is_gtk_theme); | 346 base::FundamentalValue gtk_enabled(!is_gtk_theme); |
| 347 web_ui()->CallJavascriptFunction( | 347 web_ui()->CallJavascriptFunction( |
| 348 "options.PersonalOptions.setGtkThemeButtonEnabled", gtk_enabled); | 348 "options.PersonalOptions.setGtkThemeButtonEnabled", gtk_enabled); |
| 349 #else | 349 #else |
| 350 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); | 350 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); |
| 351 bool is_gtk_theme = false; | 351 bool is_gtk_theme = false; |
| 352 #endif | 352 #endif |
| 353 | 353 |
| 354 bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme(); | 354 bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 profile_info_list.Append(profile_value); | 434 profile_info_list.Append(profile_value); |
| 435 } | 435 } |
| 436 | 436 |
| 437 web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesInfo", | 437 web_ui()->CallJavascriptFunction("PersonalOptions.setProfilesInfo", |
| 438 profile_info_list); | 438 profile_info_list); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { | 441 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { |
| 442 ProfileManager::CreateMultiProfileAsync(); | 442 ProfileManager::CreateMultiProfileAsync(); |
| 443 } | 443 } |
| OLD | NEW |