Index: chrome/browser/views/select_profile_dialog.cc |
diff --git a/chrome/browser/views/select_profile_dialog.cc b/chrome/browser/views/select_profile_dialog.cc |
index c92c2f89a88bce150d474e814ae8c90bee60f85e..d4af82e9f708da966978e51dd333fb15159d11bf 100644 |
--- a/chrome/browser/views/select_profile_dialog.cc |
+++ b/chrome/browser/views/select_profile_dialog.cc |
@@ -1,4 +1,4 @@ |
-// Copyright (c) 2010 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2006-2008 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. |
@@ -83,8 +83,8 @@ std::wstring SelectProfileDialog::GetWindowTitle() const { |
} |
bool SelectProfileDialog::Accept() { |
- size_t index = profile_combobox_->selected_item(); |
- if (index > profiles_.size()) { |
+ int index = profile_combobox_->selected_item(); |
+ if (index < 0) { |
NOTREACHED(); |
return true; |
} |
@@ -93,10 +93,11 @@ bool SelectProfileDialog::Accept() { |
// new profile dialog to the user. |
if (index == profiles_.size()) { |
NewProfileDialog::RunDialog(); |
- } else { |
- std::wstring profile_name = profiles_[index]; |
- UserDataManager::Get()->LaunchChromeForProfile(profile_name); |
+ return true; |
} |
+ |
+ std::wstring profile_name = profiles_[index]; |
+ UserDataManager::Get()->LaunchChromeForProfile(profile_name); |
return true; |
} |
@@ -115,11 +116,10 @@ int SelectProfileDialog::GetItemCount() { |
} |
std::wstring SelectProfileDialog::GetItemAt(int index) { |
- size_t index_size_t = index; |
- DCHECK_LE(index_size_t, profiles_.size()); |
+ DCHECK(index >= 0 && index <= static_cast<int>(profiles_.size())); |
// For the last item in the drop down, return the <New Profile> text, |
// otherwise return the corresponding profile name from the vector. |
- return index_size_t == profiles_.size() ? |
+ return index == profiles_.size() ? |
l10n_util::GetString(IDS_SELECT_PROFILE_DIALOG_NEW_PROFILE_ENTRY) : |
profiles_[index]; |
} |