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

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

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). Created 9 years 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 16 matching lines...) Expand all
27 #include "chrome/browser/sync/sync_ui_util.h" 27 #include "chrome/browser/sync/sync_ui_util.h"
28 #include "chrome/browser/themes/theme_service.h" 28 #include "chrome/browser/themes/theme_service.h"
29 #include "chrome/browser/themes/theme_service_factory.h" 29 #include "chrome/browser/themes/theme_service_factory.h"
30 #include "chrome/browser/ui/webui/web_ui_util.h" 30 #include "chrome/browser/ui/webui/web_ui_util.h"
31 #include "chrome/common/chrome_notification_types.h" 31 #include "chrome/common/chrome_notification_types.h"
32 #include "chrome/common/chrome_paths.h" 32 #include "chrome/common/chrome_paths.h"
33 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
34 #include "chrome/common/net/gaia/google_service_auth_error.h" 34 #include "chrome/common/net/gaia/google_service_auth_error.h"
35 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
36 #include "content/browser/tab_contents/tab_contents.h" 36 #include "content/browser/tab_contents/tab_contents.h"
37 #include "content/browser/user_metrics.h"
38 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/user_metrics.h"
39 #include "grit/chromium_strings.h" 39 #include "grit/chromium_strings.h"
40 #include "grit/generated_resources.h" 40 #include "grit/generated_resources.h"
41 #include "grit/locale_settings.h" 41 #include "grit/locale_settings.h"
42 #include "grit/theme_resources.h" 42 #include "grit/theme_resources.h"
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/gtk_theme_service.h"
54 #endif // defined(TOOLKIT_GTK) 54 #endif // defined(TOOLKIT_GTK)
55 55
56 using content::UserMetricsAction;
57
56 PersonalOptionsHandler::PersonalOptionsHandler() { 58 PersonalOptionsHandler::PersonalOptionsHandler() {
57 multiprofile_ = ProfileManager::IsMultipleProfilesEnabled(); 59 multiprofile_ = ProfileManager::IsMultipleProfilesEnabled();
58 #if defined(OS_CHROMEOS) 60 #if defined(OS_CHROMEOS)
59 registrar_.Add(this, 61 registrar_.Add(this,
60 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED, 62 chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
61 content::NotificationService::AllSources()); 63 content::NotificationService::AllSources());
62 #endif 64 #endif
63 } 65 }
64 66
65 PersonalOptionsHandler::~PersonalOptionsHandler() { 67 PersonalOptionsHandler::~PersonalOptionsHandler() {
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 ProfileSyncService* sync_service = profile->GetProfileSyncService(); 373 ProfileSyncService* sync_service = profile->GetProfileSyncService();
372 if (sync_service) { 374 if (sync_service) {
373 sync_service->AddObserver(this); 375 sync_service->AddObserver(this);
374 OnStateChanged(); 376 OnStateChanged();
375 } else { 377 } else {
376 web_ui_->CallJavascriptFunction("options.PersonalOptions.hideSyncSection"); 378 web_ui_->CallJavascriptFunction("options.PersonalOptions.hideSyncSection");
377 } 379 }
378 } 380 }
379 381
380 void PersonalOptionsHandler::ThemesReset(const ListValue* args) { 382 void PersonalOptionsHandler::ThemesReset(const ListValue* args) {
381 UserMetrics::RecordAction(UserMetricsAction("Options_ThemesReset")); 383 content::RecordAction(UserMetricsAction("Options_ThemesReset"));
382 Profile* profile = Profile::FromWebUI(web_ui_); 384 Profile* profile = Profile::FromWebUI(web_ui_);
383 ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme(); 385 ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme();
384 } 386 }
385 387
386 #if defined(TOOLKIT_GTK) 388 #if defined(TOOLKIT_GTK)
387 void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) { 389 void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) {
388 UserMetrics::RecordAction(UserMetricsAction("Options_GtkThemeSet")); 390 content::RecordAction(UserMetricsAction("Options_GtkThemeSet"));
389 Profile* profile = Profile::FromWebUI(web_ui_); 391 Profile* profile = Profile::FromWebUI(web_ui_);
390 ThemeServiceFactory::GetForProfile(profile)->SetNativeTheme(); 392 ThemeServiceFactory::GetForProfile(profile)->SetNativeTheme();
391 } 393 }
392 #endif 394 #endif
393 395
394 #if defined(OS_CHROMEOS) 396 #if defined(OS_CHROMEOS)
395 void PersonalOptionsHandler::UpdateAccountPicture() { 397 void PersonalOptionsHandler::UpdateAccountPicture() {
396 std::string email = chromeos::UserManager::Get()->logged_in_user().email(); 398 std::string email = chromeos::UserManager::Get()->logged_in_user().email();
397 if (!email.empty()) { 399 if (!email.empty()) {
398 web_ui_->CallJavascriptFunction("PersonalOptions.updateAccountPicture"); 400 web_ui_->CallJavascriptFunction("PersonalOptions.updateAccountPicture");
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 profile_info_list.Append(profile_value); 435 profile_info_list.Append(profile_value);
434 } 436 }
435 437
436 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo", 438 web_ui_->CallJavascriptFunction("PersonalOptions.setProfilesInfo",
437 profile_info_list); 439 profile_info_list);
438 } 440 }
439 441
440 void PersonalOptionsHandler::CreateProfile(const ListValue* args) { 442 void PersonalOptionsHandler::CreateProfile(const ListValue* args) {
441 ProfileManager::CreateMultiProfileAsync(); 443 ProfileManager::CreateMultiProfileAsync();
442 } 444 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/options_ui.cc ('k') | chrome/browser/web_resource/notification_promo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698