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

Side by Side Diff: chrome/browser/profiles/avatar_menu_model.cc

Issue 10692195: Consolidate Browser Creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/profiles/avatar_menu_model.h" 5 #include "chrome/browser/profiles/avatar_menu_model.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 string16()); 86 string16());
87 87
88 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_ICON); 88 ProfileMetrics::LogProfileSwitchUser(ProfileMetrics::SWITCH_PROFILE_ICON);
89 } 89 }
90 90
91 void AvatarMenuModel::EditProfile(size_t index) { 91 void AvatarMenuModel::EditProfile(size_t index) {
92 Browser* browser = browser_; 92 Browser* browser = browser_;
93 if (!browser) { 93 if (!browser) {
94 Profile* profile = g_browser_process->profile_manager()->GetProfileByPath( 94 Profile* profile = g_browser_process->profile_manager()->GetProfileByPath(
95 profile_info_->GetPathOfProfileAtIndex(GetItemAt(index).model_index)); 95 profile_info_->GetPathOfProfileAtIndex(GetItemAt(index).model_index));
96 browser = Browser::Create(profile); 96 browser = new Browser(Browser::CreateParams(profile));
97 } 97 }
98 std::string page = chrome::kManageProfileSubPage; 98 std::string page = chrome::kManageProfileSubPage;
99 page += "#"; 99 page += "#";
100 page += base::IntToString(static_cast<int>(index)); 100 page += base::IntToString(static_cast<int>(index));
101 chrome::ShowSettingsSubPage(browser, page); 101 chrome::ShowSettingsSubPage(browser, page);
102 } 102 }
103 103
104 void AvatarMenuModel::AddNewProfile() { 104 void AvatarMenuModel::AddNewProfile() {
105 ProfileManager::CreateMultiProfileAsync(string16(), string16()); 105 ProfileManager::CreateMultiProfileAsync(string16(), string16());
106 ProfileMetrics::LogProfileAddNewUser(ProfileMetrics::ADD_NEW_USER_ICON); 106 ProfileMetrics::LogProfileAddNewUser(ProfileMetrics::ADD_NEW_USER_ICON);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 item->active = browser_->profile()->GetPath() == path; 173 item->active = browser_->profile()->GetPath() == path;
174 } 174 }
175 items_.push_back(item); 175 items_.push_back(item);
176 } 176 }
177 } 177 }
178 178
179 void AvatarMenuModel::ClearMenu() { 179 void AvatarMenuModel::ClearMenu() {
180 STLDeleteContainerPointers(items_.begin(), items_.end()); 180 STLDeleteContainerPointers(items_.begin(), items_.end());
181 items_.clear(); 181 items_.clear();
182 } 182 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller.cc ('k') | chrome/browser/profiles/profile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698