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

Unified Diff: chrome/browser/ui/webui/new_profile_handler.cc

Issue 7563023: Multi-Profiles: Remove new profile setup UI (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/new_profile_handler.h ('k') | chrome/browser/ui/webui/new_profile_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/new_profile_handler.cc
diff --git a/chrome/browser/ui/webui/new_profile_handler.cc b/chrome/browser/ui/webui/new_profile_handler.cc
deleted file mode 100644
index 121f58e8f6ccd3d3dd5617941ab66fac998b4904..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/webui/new_profile_handler.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/new_profile_handler.h"
-
-#include "base/string_number_conversions.h"
-#include "base/values.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/profiles/profile_info_cache.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/common/url_constants.h"
-#include "content/browser/tab_contents/tab_contents.h"
-
-NewProfileHandler::NewProfileHandler() {
-}
-
-void NewProfileHandler::RegisterMessages() {
- web_ui_->RegisterMessageCallback("create",
- NewCallback(this, &NewProfileHandler::HandleCreate));
- web_ui_->RegisterMessageCallback("cancel",
- NewCallback(this, &NewProfileHandler::HandleCancel));
- web_ui_->RegisterMessageCallback("requestProfileInfo",
- NewCallback(this, &NewProfileHandler::HandleRequestProfileInfo));
-}
-
-void NewProfileHandler::HandleCreate(const ListValue* args) {
- string16 profile_name;
- bool ret = args->GetString(0, &profile_name);
- if (!ret || profile_name.empty())
- return;
-
- std::string string_index;
- ret = args->GetString(1, &string_index);
- if (!ret || string_index.empty())
- return;
- int profile_avatar_index;
- if (!base::StringToInt(string_index, &profile_avatar_index))
- return;
-
- ProfileInfoCache& cache =
- g_browser_process->profile_manager()->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(
- web_ui_->GetProfile()->GetPath());
- if (index != std::string::npos) {
- cache.SetNameOfProfileAtIndex(index, profile_name);
- cache.SetAvatarIconOfProfileAtIndex(index, profile_avatar_index);
- }
-
- web_ui_->tab_contents()->OpenURL(GURL(chrome::kChromeUINewTabURL),
- GURL(), CURRENT_TAB,
- PageTransition::LINK);
-}
-
-void NewProfileHandler::HandleCancel(const ListValue* args) {
- g_browser_process->profile_manager()->ScheduleProfileForDeletion(
- web_ui_->GetProfile()->GetPath());
-}
-
-void NewProfileHandler::HandleRequestProfileInfo(const ListValue* args) {
- SendDefaultAvatarImages();
- SendProfileInfo();
-}
-
-void NewProfileHandler::SendDefaultAvatarImages() {
- ListValue image_url_list;
- for (size_t i = 0; i < ProfileInfoCache::GetDefaultAvatarIconCount(); i++) {
- std::string url = ProfileInfoCache::GetDefaultAvatarIconUrl(i);
- image_url_list.Append(Value::CreateStringValue(url));
- }
- web_ui_->CallJavascriptFunction("newProfile.setDefaultAvatarImages",
- image_url_list);
-}
-
-void NewProfileHandler::SendProfileInfo() {
- ProfileInfoCache& cache =
- g_browser_process->profile_manager()->GetProfileInfoCache();
- size_t index = cache.GetIndexOfProfileWithPath(
- web_ui_->GetProfile()->GetPath());
- if (index != std::string::npos) {
- StringValue profile_name(cache.GetNameOfProfileAtIndex(index));
- FundamentalValue profile_icon_index(static_cast<int>(
- cache.GetAvatarIconIndexOfProfileAtIndex(index)));
- web_ui_->CallJavascriptFunction("newProfile.setProfileInfo",
- profile_name,
- profile_icon_index);
- }
-}
« no previous file with comments | « chrome/browser/ui/webui/new_profile_handler.h ('k') | chrome/browser/ui/webui/new_profile_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698