Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: chrome/browser/ui/webui/options/personal_options_handler.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 10 #include "base/bind.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/sync/sync_ui_util.h" 26 #include "chrome/browser/sync/sync_ui_util.h"
27 #include "chrome/browser/themes/theme_service.h" 27 #include "chrome/browser/themes/theme_service.h"
28 #include "chrome/browser/themes/theme_service_factory.h" 28 #include "chrome/browser/themes/theme_service_factory.h"
29 #include "chrome/common/chrome_notification_types.h" 29 #include "chrome/common/chrome_notification_types.h"
30 #include "chrome/common/chrome_paths.h" 30 #include "chrome/common/chrome_paths.h"
31 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/net/gaia/google_service_auth_error.h" 32 #include "chrome/common/net/gaia/google_service_auth_error.h"
33 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
34 #include "content/browser/tab_contents/tab_contents.h" 34 #include "content/browser/tab_contents/tab_contents.h"
35 #include "content/browser/user_metrics.h" 35 #include "content/browser/user_metrics.h"
36 #include "content/common/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "grit/chromium_strings.h" 37 #include "grit/chromium_strings.h"
38 #include "grit/generated_resources.h" 38 #include "grit/generated_resources.h"
39 #include "grit/locale_settings.h" 39 #include "grit/locale_settings.h"
40 #include "grit/theme_resources.h" 40 #include "grit/theme_resources.h"
41 #include "ui/base/l10n/l10n_util.h" 41 #include "ui/base/l10n/l10n_util.h"
42 42
43 #if defined(OS_CHROMEOS) 43 #if defined(OS_CHROMEOS)
44 #include "chrome/browser/chromeos/login/user_manager.h" 44 #include "chrome/browser/chromeos/login/user_manager.h"
45 #include "chrome/browser/chromeos/options/take_photo_dialog.h" 45 #include "chrome/browser/chromeos/options/take_photo_dialog.h"
46 #include "chrome/browser/ui/browser_window.h" 46 #include "chrome/browser/ui/browser_window.h"
47 #include "chrome/browser/ui/views/window.h" 47 #include "chrome/browser/ui/views/window.h"
48 #include "third_party/skia/include/core/SkBitmap.h" 48 #include "third_party/skia/include/core/SkBitmap.h"
49 #endif // defined(OS_CHROMEOS) 49 #endif // defined(OS_CHROMEOS)
50 #if defined(TOOLKIT_GTK) 50 #if defined(TOOLKIT_GTK)
51 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 51 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
52 #endif // defined(TOOLKIT_GTK) 52 #endif // defined(TOOLKIT_GTK)
53 53
54 PersonalOptionsHandler::PersonalOptionsHandler() { 54 PersonalOptionsHandler::PersonalOptionsHandler() {
55 multiprofile_ = ProfileManager::IsMultipleProfilesEnabled(); 55 multiprofile_ = ProfileManager::IsMultipleProfilesEnabled();
56 #if defined(OS_CHROMEOS) 56 #if defined(OS_CHROMEOS)
57 registrar_.Add(this, 57 registrar_.Add(this,
58 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, 58 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
59 NotificationService::AllSources()); 59 content::NotificationService::AllSources());
60 #endif 60 #endif
61 } 61 }
62 62
63 PersonalOptionsHandler::~PersonalOptionsHandler() { 63 PersonalOptionsHandler::~PersonalOptionsHandler() {
64 ProfileSyncService* sync_service = 64 ProfileSyncService* sync_service =
65 Profile::FromWebUI(web_ui_)->GetProfileSyncService(); 65 Profile::FromWebUI(web_ui_)->GetProfileSyncService();
66 if (sync_service) 66 if (sync_service)
67 sync_service->RemoveObserver(this); 67 sync_service->RemoveObserver(this);
68 } 68 }
69 69
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 } 342 }
343 343
344 void PersonalOptionsHandler::Initialize() { 344 void PersonalOptionsHandler::Initialize() {
345 Profile* profile = Profile::FromWebUI(web_ui_); 345 Profile* profile = Profile::FromWebUI(web_ui_);
346 346
347 // Listen for theme installation. 347 // Listen for theme installation.
348 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 348 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
349 content::Source<ThemeService>( 349 content::Source<ThemeService>(
350 ThemeServiceFactory::GetForProfile(profile))); 350 ThemeServiceFactory::GetForProfile(profile)));
351 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, 351 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
352 NotificationService::AllSources()); 352 content::NotificationService::AllSources());
353 ObserveThemeChanged(); 353 ObserveThemeChanged();
354 354
355 ProfileSyncService* sync_service = profile->GetProfileSyncService(); 355 ProfileSyncService* sync_service = profile->GetProfileSyncService();
356 if (sync_service) { 356 if (sync_service) {
357 sync_service->AddObserver(this); 357 sync_service->AddObserver(this);
358 OnStateChanged(); 358 OnStateChanged();
359 } else { 359 } else {
360 web_ui_->CallJavascriptFunction("options.PersonalOptions.hideSyncSection"); 360 web_ui_->CallJavascriptFunction("options.PersonalOptions.hideSyncSection");
361 } 361 }
362 } 362 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 profile_info_list.Append(profile_value); 406 profile_info_list.Append(profile_value);
407 } 407 }
408 408
409 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", 409 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo",
410 profile_info_list); 410 profile_info_list);
411 } 411 }
412 412
413 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { 413 void PersonalOptionsHandler::CreateProfile(const ListValue* args) {
414 ProfileManager::CreateMultiProfileAsync(); 414 ProfileManager::CreateMultiProfileAsync();
415 } 415 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/manage_profile_handler.cc ('k') | chrome/browser/ui/webui/plugins_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698