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 "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/callback.h" | 10 #include "base/callback.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 void PersonalOptionsHandler::OnLoginFailure( | 331 void PersonalOptionsHandler::OnLoginFailure( |
332 const GoogleServiceAuthError& error) { | 332 const GoogleServiceAuthError& error) { |
333 OnStateChanged(); | 333 OnStateChanged(); |
334 } | 334 } |
335 | 335 |
336 void PersonalOptionsHandler::ObserveThemeChanged() { | 336 void PersonalOptionsHandler::ObserveThemeChanged() { |
337 Profile* profile = web_ui_->GetProfile(); | 337 Profile* profile = web_ui_->GetProfile(); |
338 #if defined(TOOLKIT_GTK) | 338 #if defined(TOOLKIT_GTK) |
339 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); | 339 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); |
340 bool is_gtk_theme = theme_service->UsingNativeTheme(); | 340 bool is_gtk_theme = theme_service->UsingNativeTheme(); |
341 FundamentalValue gtk_enabled(!is_gtk_theme); | 341 base::FundamentalValue gtk_enabled(!is_gtk_theme); |
342 web_ui_->CallJavascriptFunction( | 342 web_ui_->CallJavascriptFunction( |
343 "options.PersonalOptions.setGtkThemeButtonEnabled", gtk_enabled); | 343 "options.PersonalOptions.setGtkThemeButtonEnabled", gtk_enabled); |
344 #else | 344 #else |
345 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); | 345 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); |
346 bool is_gtk_theme = false; | 346 bool is_gtk_theme = false; |
347 #endif | 347 #endif |
348 | 348 |
349 bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme(); | 349 bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme(); |
350 FundamentalValue enabled(!is_classic_theme); | 350 base::FundamentalValue enabled(!is_classic_theme); |
351 web_ui_->CallJavascriptFunction( | 351 web_ui_->CallJavascriptFunction( |
352 "options.PersonalOptions.setThemesResetButtonEnabled", enabled); | 352 "options.PersonalOptions.setThemesResetButtonEnabled", enabled); |
353 } | 353 } |
354 | 354 |
355 void PersonalOptionsHandler::Initialize() { | 355 void PersonalOptionsHandler::Initialize() { |
356 // Listen for theme installation. | 356 // Listen for theme installation. |
357 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 357 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
358 Source<ThemeService>(ThemeServiceFactory::GetForProfile( | 358 Source<ThemeService>(ThemeServiceFactory::GetForProfile( |
359 web_ui_->GetProfile()))); | 359 web_ui_->GetProfile()))); |
360 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, | 360 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 428 } |
429 | 429 |
430 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", | 430 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", |
431 profile_info_list); | 431 profile_info_list); |
432 } | 432 } |
433 | 433 |
434 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { | 434 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { |
435 ProfileManager::CreateMultiProfileAsync(); | 435 ProfileManager::CreateMultiProfileAsync(); |
436 } | 436 } |
437 | 437 |
OLD | NEW |