OLD | NEW |
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/profiles/avatar_menu_model.h" | 5 #include "chrome/browser/profiles/avatar_menu_model.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/string_number_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/avatar_menu_model_observer.h" | 10 #include "chrome/browser/profiles/avatar_menu_model_observer.h" |
10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/profiles/profile_info_cache.h" | 12 #include "chrome/browser/profiles/profile_info_cache.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
15 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
16 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 path, observer); | 84 path, observer); |
84 } | 85 } |
85 | 86 |
86 void AvatarMenuModel::EditProfile(size_t index) { | 87 void AvatarMenuModel::EditProfile(size_t index) { |
87 Browser* browser = browser_; | 88 Browser* browser = browser_; |
88 if (!browser) { | 89 if (!browser) { |
89 Profile* profile = g_browser_process->profile_manager()->GetProfileByPath( | 90 Profile* profile = g_browser_process->profile_manager()->GetProfileByPath( |
90 profile_info_->GetPathOfProfileAtIndex(GetItemAt(index).model_index)); | 91 profile_info_->GetPathOfProfileAtIndex(GetItemAt(index).model_index)); |
91 browser = Browser::Create(profile); | 92 browser = Browser::Create(profile); |
92 } | 93 } |
93 browser->ShowOptionsTab(chrome::kPersonalOptionsSubPage); | 94 std::string page = chrome::kManageProfileSubPage; |
| 95 page += "#"; |
| 96 page += base::IntToString(static_cast<int>(index)); |
| 97 browser->ShowOptionsTab(page); |
94 } | 98 } |
95 | 99 |
96 void AvatarMenuModel::AddNewProfile() { | 100 void AvatarMenuModel::AddNewProfile() { |
97 ProfileManager::CreateMultiProfileAsync(); | 101 ProfileManager::CreateMultiProfileAsync(); |
98 } | 102 } |
99 | 103 |
100 size_t AvatarMenuModel::GetNumberOfItems() { | 104 size_t AvatarMenuModel::GetNumberOfItems() { |
101 return items_.size(); | 105 return items_.size(); |
102 } | 106 } |
103 | 107 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 item->active = browser_->profile()->GetPath() == path; | 141 item->active = browser_->profile()->GetPath() == path; |
138 } | 142 } |
139 items_.push_back(item); | 143 items_.push_back(item); |
140 } | 144 } |
141 } | 145 } |
142 | 146 |
143 void AvatarMenuModel::ClearMenu() { | 147 void AvatarMenuModel::ClearMenu() { |
144 STLDeleteContainerPointers(items_.begin(), items_.end()); | 148 STLDeleteContainerPointers(items_.begin(), items_.end()); |
145 items_.clear(); | 149 items_.clear(); |
146 } | 150 } |
OLD | NEW |