| 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/ui/views/bookmark_editor_view.h" | 5 #include "chrome/browser/ui/views/bookmark_editor_view.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 if (details_.type == EditDetails::EXISTING_NODE) | 271 if (details_.type == EditDetails::EXISTING_NODE) |
| 272 title = details_.existing_node->GetTitle(); | 272 title = details_.existing_node->GetTitle(); |
| 273 else if (details_.type == EditDetails::NEW_FOLDER) | 273 else if (details_.type == EditDetails::NEW_FOLDER) |
| 274 title = UTF16ToWide( | 274 title = UTF16ToWide( |
| 275 l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME)); | 275 l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME)); |
| 276 title_tf_.SetText(title); | 276 title_tf_.SetText(title); |
| 277 title_tf_.SetController(this); | 277 title_tf_.SetController(this); |
| 278 | 278 |
| 279 title_label_ = new views::Label( | 279 title_label_ = new views::Label( |
| 280 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NAME_LABEL))); | 280 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NAME_LABEL))); |
| 281 title_tf_.SetAccessibleName(title_label_->GetText()); | 281 title_tf_.SetAccessibleName(WideToUTF16Hack(title_label_->GetText())); |
| 282 | 282 |
| 283 string16 url_text; | 283 string16 url_text; |
| 284 if (details_.type == EditDetails::EXISTING_NODE) { | 284 if (details_.type == EditDetails::EXISTING_NODE) { |
| 285 std::string languages = profile_ | 285 std::string languages = profile_ |
| 286 ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) | 286 ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) |
| 287 : std::string(); | 287 : std::string(); |
| 288 // Because this gets parsed by FixupURL(), it's safe to omit the scheme or | 288 // Because this gets parsed by FixupURL(), it's safe to omit the scheme or |
| 289 // trailing slash, and unescape most characters, but we need to not drop any | 289 // trailing slash, and unescape most characters, but we need to not drop any |
| 290 // username/password, or unescape anything that changes the meaning. | 290 // username/password, or unescape anything that changes the meaning. |
| 291 url_text = net::FormatUrl(details_.existing_node->GetURL(), languages, | 291 url_text = net::FormatUrl(details_.existing_node->GetURL(), languages, |
| 292 net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword, | 292 net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword, |
| 293 UnescapeRule::SPACES, NULL, NULL, NULL); | 293 UnescapeRule::SPACES, NULL, NULL, NULL); |
| 294 } | 294 } |
| 295 url_tf_.SetText(UTF16ToWide(url_text)); | 295 url_tf_.SetText(UTF16ToWide(url_text)); |
| 296 url_tf_.SetController(this); | 296 url_tf_.SetController(this); |
| 297 | 297 |
| 298 url_label_ = new views::Label( | 298 url_label_ = new views::Label( |
| 299 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_URL_LABEL))); | 299 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_URL_LABEL))); |
| 300 url_tf_.SetAccessibleName(url_label_->GetText()); | 300 url_tf_.SetAccessibleName(WideToUTF16Hack(url_label_->GetText())); |
| 301 | 301 |
| 302 if (show_tree_) { | 302 if (show_tree_) { |
| 303 tree_view_ = new views::TreeView(); | 303 tree_view_ = new views::TreeView(); |
| 304 new_group_button_.reset(new views::NativeButton( | 304 new_group_button_.reset(new views::NativeButton( |
| 305 this, | 305 this, |
| 306 UTF16ToWide(l10n_util::GetStringUTF16( | 306 UTF16ToWide(l10n_util::GetStringUTF16( |
| 307 IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON)))); | 307 IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON)))); |
| 308 new_group_button_->set_parent_owned(false); | 308 new_group_button_->set_parent_owned(false); |
| 309 tree_view_->SetContextMenuController(this); | 309 tree_view_->SetContextMenuController(this); |
| 310 | 310 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 break; | 579 break; |
| 580 } | 580 } |
| 581 } | 581 } |
| 582 DCHECK(child_bb_node); | 582 DCHECK(child_bb_node); |
| 583 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle()); | 583 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle()); |
| 584 } | 584 } |
| 585 ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node, | 585 ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node, |
| 586 parent_b_node, parent_bb_node); | 586 parent_b_node, parent_bb_node); |
| 587 } | 587 } |
| 588 } | 588 } |
| OLD | NEW |