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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/callback.h" 10 #include "base/callback.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/stl_util-inl.h" 13 #include "base/stl_util-inl.h"
14 #include "base/stringprintf.h" 14 #include "base/stringprintf.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "build/build_config.h" 18 #include "build/build_config.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/profiles/profile_manager.h" 20 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/browser/sync/profile_sync_service.h" 21 #include "chrome/browser/sync/profile_sync_service.h"
22 #include "chrome/browser/sync/sync_setup_flow.h" 22 #include "chrome/browser/sync/sync_setup_flow.h"
23 #include "chrome/browser/sync/sync_ui_util.h" 23 #include "chrome/browser/sync/sync_ui_util.h"
24 #include "chrome/browser/themes/theme_service.h" 24 #include "chrome/browser/themes/theme_service.h"
25 #include "chrome/browser/themes/theme_service_factory.h" 25 #include "chrome/browser/themes/theme_service_factory.h"
26 #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h" 26 #include "chrome/browser/ui/webui/options/options_managed_banner_handler.h"
27 #include "chrome/common/chrome_notification_types.h"
27 #include "chrome/common/chrome_paths.h" 28 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 29 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/net/gaia/google_service_auth_error.h" 30 #include "chrome/common/net/gaia/google_service_auth_error.h"
30 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
31 #include "content/browser/user_metrics.h" 32 #include "content/browser/user_metrics.h"
32 #include "content/common/notification_service.h" 33 #include "content/common/notification_service.h"
33 #include "grit/chromium_strings.h" 34 #include "grit/chromium_strings.h"
34 #include "grit/generated_resources.h" 35 #include "grit/generated_resources.h"
35 #include "grit/locale_settings.h" 36 #include "grit/locale_settings.h"
36 #include "grit/theme_resources.h" 37 #include "grit/theme_resources.h"
37 #include "ui/base/l10n/l10n_util.h" 38 #include "ui/base/l10n/l10n_util.h"
38 39
39 #if defined(OS_CHROMEOS) 40 #if defined(OS_CHROMEOS)
40 #include "chrome/browser/chromeos/login/user_manager.h" 41 #include "chrome/browser/chromeos/login/user_manager.h"
41 #include "chrome/browser/chromeos/options/take_photo_dialog.h" 42 #include "chrome/browser/chromeos/options/take_photo_dialog.h"
42 #include "chrome/browser/ui/browser_window.h" 43 #include "chrome/browser/ui/browser_window.h"
43 #include "chrome/browser/ui/views/window.h" 44 #include "chrome/browser/ui/views/window.h"
44 #include "third_party/skia/include/core/SkBitmap.h" 45 #include "third_party/skia/include/core/SkBitmap.h"
45 #endif // defined(OS_CHROMEOS) 46 #endif // defined(OS_CHROMEOS)
46 #if defined(TOOLKIT_GTK) 47 #if defined(TOOLKIT_GTK)
47 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 48 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
48 #endif // defined(TOOLKIT_GTK) 49 #endif // defined(TOOLKIT_GTK)
49 50
50 PersonalOptionsHandler::PersonalOptionsHandler() { 51 PersonalOptionsHandler::PersonalOptionsHandler() {
51 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 52 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
52 multiprofile_ = browser_command_line.HasSwitch(switches::kMultiProfiles); 53 multiprofile_ = browser_command_line.HasSwitch(switches::kMultiProfiles);
53 #if defined(OS_CHROMEOS) 54 #if defined(OS_CHROMEOS)
54 registrar_.Add(this, 55 registrar_.Add(this,
55 NotificationType::LOGIN_USER_IMAGE_CHANGED, 56 chrome::LOGIN_USER_IMAGE_CHANGED,
56 NotificationService::AllSources()); 57 NotificationService::AllSources());
57 #endif 58 #endif
58 } 59 }
59 60
60 PersonalOptionsHandler::~PersonalOptionsHandler() { 61 PersonalOptionsHandler::~PersonalOptionsHandler() {
61 ProfileSyncService* sync_service = 62 ProfileSyncService* sync_service =
62 web_ui_->GetProfile()->GetProfileSyncService(); 63 web_ui_->GetProfile()->GetProfileSyncService();
63 if (sync_service) 64 if (sync_service)
64 sync_service->RemoveObserver(this); 65 sync_service->RemoveObserver(this);
65 } 66 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 "themesSetGTK", 199 "themesSetGTK",
199 NewCallback(this, &PersonalOptionsHandler::ThemesSetGTK)); 200 NewCallback(this, &PersonalOptionsHandler::ThemesSetGTK));
200 #endif 201 #endif
201 #if defined(OS_CHROMEOS) 202 #if defined(OS_CHROMEOS)
202 web_ui_->RegisterMessageCallback( 203 web_ui_->RegisterMessageCallback(
203 "loadAccountPicture", 204 "loadAccountPicture",
204 NewCallback(this, &PersonalOptionsHandler::LoadAccountPicture)); 205 NewCallback(this, &PersonalOptionsHandler::LoadAccountPicture));
205 #endif 206 #endif
206 } 207 }
207 208
208 void PersonalOptionsHandler::Observe(NotificationType type, 209 void PersonalOptionsHandler::Observe(int type,
209 const NotificationSource& source, 210 const NotificationSource& source,
210 const NotificationDetails& details) { 211 const NotificationDetails& details) {
211 if (type == NotificationType::BROWSER_THEME_CHANGED) { 212 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) {
212 ObserveThemeChanged(); 213 ObserveThemeChanged();
213 #if defined(OS_CHROMEOS) 214 #if defined(OS_CHROMEOS)
214 } else if (type == NotificationType::LOGIN_USER_IMAGE_CHANGED) { 215 } else if (type == chrome::LOGIN_USER_IMAGE_CHANGED) {
215 LoadAccountPicture(NULL); 216 LoadAccountPicture(NULL);
216 #endif 217 #endif
217 } else { 218 } else {
218 OptionsPageUIHandler::Observe(type, source, details); 219 OptionsPageUIHandler::Observe(type, source, details);
219 } 220 }
220 } 221 }
221 222
222 void PersonalOptionsHandler::OnStateChanged() { 223 void PersonalOptionsHandler::OnStateChanged() {
223 string16 status_label; 224 string16 status_label;
224 string16 link_label; 225 string16 link_label;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 "options.PersonalOptions.setThemesResetButtonEnabled", enabled); 350 "options.PersonalOptions.setThemesResetButtonEnabled", enabled);
350 } 351 }
351 352
352 void PersonalOptionsHandler::Initialize() { 353 void PersonalOptionsHandler::Initialize() {
353 banner_handler_.reset( 354 banner_handler_.reset(
354 OptionsManagedBannerHandler::Create(web_ui_, 355 OptionsManagedBannerHandler::Create(web_ui_,
355 ASCIIToUTF16("PersonalOptions"), 356 ASCIIToUTF16("PersonalOptions"),
356 OPTIONS_PAGE_CONTENT)); 357 OPTIONS_PAGE_CONTENT));
357 358
358 // Listen for theme installation. 359 // Listen for theme installation.
359 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, 360 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
360 NotificationService::AllSources()); 361 NotificationService::AllSources());
361 ObserveThemeChanged(); 362 ObserveThemeChanged();
362 363
363 ProfileSyncService* sync_service = 364 ProfileSyncService* sync_service =
364 web_ui_->GetProfile()->GetProfileSyncService(); 365 web_ui_->GetProfile()->GetProfileSyncService();
365 if (sync_service) { 366 if (sync_service) {
366 sync_service->AddObserver(this); 367 sync_service->AddObserver(this);
367 OnStateChanged(); 368 OnStateChanged();
368 369
369 DictionaryValue args; 370 DictionaryValue args;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 timestamp)); 405 timestamp));
405 web_ui_->CallJavascriptFunction("PersonalOptions.setAccountPicture", 406 web_ui_->CallJavascriptFunction("PersonalOptions.setAccountPicture",
406 image_url); 407 image_url);
407 408
408 StringValue email_value(email); 409 StringValue email_value(email);
409 web_ui_->CallJavascriptFunction("AccountsOptions.updateAccountPicture", 410 web_ui_->CallJavascriptFunction("AccountsOptions.updateAccountPicture",
410 email_value, image_url); 411 email_value, image_url);
411 } 412 }
412 } 413 }
413 #endif 414 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/personal_options_handler.h ('k') | chrome/browser/ui/webui/plugins_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698