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

Side by Side Diff: chrome/browser/ui/webui/options/manage_profile_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/manage_profile_handler.h" 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "base/value_conversions.h" 11 #include "base/value_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chrome/browser/browser_process.h" 13 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/profiles/profile_info_cache.h" 14 #include "chrome/browser/profiles/profile_info_cache.h"
15 #include "chrome/browser/profiles/profile_manager.h" 15 #include "chrome/browser/profiles/profile_manager.h"
16 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "content/browser/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
18 #include "content/common/notification_service.h" 18 #include "content/public/browser/notification_service.h"
19 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
20 20
21 ManageProfileHandler::ManageProfileHandler() { 21 ManageProfileHandler::ManageProfileHandler() {
22 } 22 }
23 23
24 ManageProfileHandler::~ManageProfileHandler() { 24 ManageProfileHandler::~ManageProfileHandler() {
25 } 25 }
26 26
27 void ManageProfileHandler::GetLocalizedValues( 27 void ManageProfileHandler::GetLocalizedValues(
28 DictionaryValue* localized_strings) { 28 DictionaryValue* localized_strings) {
29 DCHECK(localized_strings); 29 DCHECK(localized_strings);
30 30
31 static OptionsStringResource resources[] = { 31 static OptionsStringResource resources[] = {
32 { "manageProfilesTitle", IDS_PROFILES_MANAGE_TITLE }, 32 { "manageProfilesTitle", IDS_PROFILES_MANAGE_TITLE },
33 { "manageProfilesNameLabel", IDS_PROFILES_MANAGE_NAME_LABEL }, 33 { "manageProfilesNameLabel", IDS_PROFILES_MANAGE_NAME_LABEL },
34 { "manageProfilesDuplicateNameError", 34 { "manageProfilesDuplicateNameError",
35 IDS_PROFILES_MANAGE_DUPLICATE_NAME_ERROR }, 35 IDS_PROFILES_MANAGE_DUPLICATE_NAME_ERROR },
36 { "manageProfilesIconLabel", IDS_PROFILES_MANAGE_ICON_LABEL }, 36 { "manageProfilesIconLabel", IDS_PROFILES_MANAGE_ICON_LABEL },
37 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE }, 37 { "deleteProfileTitle", IDS_PROFILES_DELETE_TITLE },
38 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL }, 38 { "deleteProfileOK", IDS_PROFILES_DELETE_OK_BUTTON_LABEL },
39 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE }, 39 { "deleteProfileMessage", IDS_PROFILES_DELETE_MESSAGE },
40 }; 40 };
41 41
42 RegisterStrings(localized_strings, resources, arraysize(resources)); 42 RegisterStrings(localized_strings, resources, arraysize(resources));
43 } 43 }
44 44
45 void ManageProfileHandler::Initialize() { 45 void ManageProfileHandler::Initialize() {
46 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, 46 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
47 NotificationService::AllSources()); 47 content::NotificationService::AllSources());
48 SendProfileNames(); 48 SendProfileNames();
49 } 49 }
50 50
51 void ManageProfileHandler::RegisterMessages() { 51 void ManageProfileHandler::RegisterMessages() {
52 web_ui_->RegisterMessageCallback("setProfileNameAndIcon", 52 web_ui_->RegisterMessageCallback("setProfileNameAndIcon",
53 base::Bind(&ManageProfileHandler::SetProfileNameAndIcon, 53 base::Bind(&ManageProfileHandler::SetProfileNameAndIcon,
54 base::Unretained(this))); 54 base::Unretained(this)));
55 web_ui_->RegisterMessageCallback("deleteProfile", 55 web_ui_->RegisterMessageCallback("deleteProfile",
56 base::Bind(&ManageProfileHandler::DeleteProfile, 56 base::Bind(&ManageProfileHandler::DeleteProfile,
57 base::Unretained(this))); 57 base::Unretained(this)));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 profile_value.SetString("name", cache.GetNameOfProfileAtIndex(index)); 170 profile_value.SetString("name", cache.GetNameOfProfileAtIndex(index));
171 profile_value.SetString("iconURL", 171 profile_value.SetString("iconURL",
172 cache.GetDefaultAvatarIconUrl(icon_index)); 172 cache.GetDefaultAvatarIconUrl(icon_index));
173 profile_value.Set("filePath", base::CreateFilePathValue(profile_path)); 173 profile_value.Set("filePath", base::CreateFilePathValue(profile_path));
174 profile_value.SetBoolean("isCurrentProfile", 174 profile_value.SetBoolean("isCurrentProfile",
175 profile_path == current_profile_path); 175 profile_path == current_profile_path);
176 176
177 web_ui_->CallJavascriptFunction("ManageProfileOverlay.setProfileInfo", 177 web_ui_->CallJavascriptFunction("ManageProfileOverlay.setProfileInfo",
178 profile_value); 178 profile_value);
179 } 179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698