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" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/stl_util-inl.h" | 12 #include "base/stl_util-inl.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/browser/sync/profile_sync_service.h" | 20 #include "chrome/browser/sync/profile_sync_service.h" |
21 #include "chrome/browser/sync/sync_setup_flow.h" | 21 #include "chrome/browser/sync/sync_setup_flow.h" |
22 #include "chrome/browser/sync/sync_ui_util.h" | 22 #include "chrome/browser/sync/sync_ui_util.h" |
23 #include "chrome/browser/themes/theme_service.h" | 23 #include "chrome/browser/themes/theme_service.h" |
24 #include "chrome/browser/themes/theme_service_factory.h" | 24 #include "chrome/browser/themes/theme_service_factory.h" |
25 #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h" | |
26 #include "chrome/common/chrome_notification_types.h" | 25 #include "chrome/common/chrome_notification_types.h" |
27 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
28 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/common/net/gaia/google_service_auth_error.h" | 28 #include "chrome/common/net/gaia/google_service_auth_error.h" |
30 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
31 #include "content/browser/user_metrics.h" | 30 #include "content/browser/user_metrics.h" |
32 #include "content/common/notification_service.h" | 31 #include "content/common/notification_service.h" |
33 #include "grit/chromium_strings.h" | 32 #include "grit/chromium_strings.h" |
34 #include "grit/generated_resources.h" | 33 #include "grit/generated_resources.h" |
35 #include "grit/locale_settings.h" | 34 #include "grit/locale_settings.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 bool is_gtk_theme = false; | 341 bool is_gtk_theme = false; |
343 #endif | 342 #endif |
344 | 343 |
345 bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme(); | 344 bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme(); |
346 FundamentalValue enabled(!is_classic_theme); | 345 FundamentalValue enabled(!is_classic_theme); |
347 web_ui_->CallJavascriptFunction( | 346 web_ui_->CallJavascriptFunction( |
348 "options.PersonalOptions.setThemesResetButtonEnabled", enabled); | 347 "options.PersonalOptions.setThemesResetButtonEnabled", enabled); |
349 } | 348 } |
350 | 349 |
351 void PersonalOptionsHandler::Initialize() { | 350 void PersonalOptionsHandler::Initialize() { |
352 #if defined(ENABLE_CONFIGURATION_POLICY) | |
353 banner_handler_.reset( | |
354 new OptionsManagedBannerHandler(web_ui_, | |
355 ASCIIToUTF16("PersonalOptions"), | |
356 OPTIONS_PAGE_CONTENT)); | |
357 #endif | |
358 | |
359 // Listen for theme installation. | 351 // Listen for theme installation. |
360 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 352 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
361 NotificationService::AllSources()); | 353 NotificationService::AllSources()); |
362 ObserveThemeChanged(); | 354 ObserveThemeChanged(); |
363 | 355 |
364 ProfileSyncService* sync_service = | 356 ProfileSyncService* sync_service = |
365 web_ui_->GetProfile()->GetProfileSyncService(); | 357 web_ui_->GetProfile()->GetProfileSyncService(); |
366 if (sync_service) { | 358 if (sync_service) { |
367 sync_service->AddObserver(this); | 359 sync_service->AddObserver(this); |
368 OnStateChanged(); | 360 OnStateChanged(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 timestamp)); | 397 timestamp)); |
406 web_ui_->CallJavascriptFunction("PersonalOptions.setAccountPicture", | 398 web_ui_->CallJavascriptFunction("PersonalOptions.setAccountPicture", |
407 image_url); | 399 image_url); |
408 | 400 |
409 StringValue email_value(email); | 401 StringValue email_value(email); |
410 web_ui_->CallJavascriptFunction("AccountsOptions.updateAccountPicture", | 402 web_ui_->CallJavascriptFunction("AccountsOptions.updateAccountPicture", |
411 email_value, image_url); | 403 email_value, image_url); |
412 } | 404 } |
413 } | 405 } |
414 #endif | 406 #endif |
OLD | NEW |