OLD | NEW |
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/ui/views/bookmarks/bookmark_editor_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 title = l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME); | 319 title = l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NEW_FOLDER_NAME); |
320 } else if (details_.type == EditDetails::NEW_URL) { | 320 } else if (details_.type == EditDetails::NEW_URL) { |
321 bookmark_utils::GetURLAndTitleToBookmarkFromCurrentTab(profile_, | 321 bookmark_utils::GetURLAndTitleToBookmarkFromCurrentTab(profile_, |
322 &url, &title); | 322 &url, &title); |
323 } | 323 } |
324 title_tf_.SetText(title); | 324 title_tf_.SetText(title); |
325 title_tf_.SetController(this); | 325 title_tf_.SetController(this); |
326 | 326 |
327 title_label_ = new views::Label( | 327 title_label_ = new views::Label( |
328 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL)); | 328 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL)); |
329 title_tf_.SetAccessibleName(title_label_->GetText()); | 329 title_tf_.SetAccessibleName(title_label_->text()); |
330 | 330 |
331 if (show_tree_) { | 331 if (show_tree_) { |
332 tree_view_ = new views::TreeView(); | 332 tree_view_ = new views::TreeView(); |
333 tree_view_->set_lines_at_root(true); | 333 tree_view_->set_lines_at_root(true); |
334 new_folder_button_.reset(new views::NativeTextButton( | 334 new_folder_button_.reset(new views::NativeTextButton( |
335 this, | 335 this, |
336 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NEW_FOLDER_BUTTON))); | 336 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NEW_FOLDER_BUTTON))); |
337 new_folder_button_->set_parent_owned(false); | 337 new_folder_button_->set_parent_owned(false); |
338 tree_view_->set_context_menu_controller(this); | 338 tree_view_->set_context_menu_controller(this); |
339 | 339 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // Because this gets parsed by FixupURL(), it's safe to omit the scheme or | 387 // Because this gets parsed by FixupURL(), it's safe to omit the scheme or |
388 // trailing slash, and unescape most characters, but we need to not drop any | 388 // trailing slash, and unescape most characters, but we need to not drop any |
389 // username/password, or unescape anything that changes the meaning. | 389 // username/password, or unescape anything that changes the meaning. |
390 string16 url_text = net::FormatUrl(url, languages, | 390 string16 url_text = net::FormatUrl(url, languages, |
391 net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword, | 391 net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword, |
392 net::UnescapeRule::SPACES, NULL, NULL, NULL); | 392 net::UnescapeRule::SPACES, NULL, NULL, NULL); |
393 | 393 |
394 url_tf_ = new views::Textfield; | 394 url_tf_ = new views::Textfield; |
395 url_tf_->SetText(url_text); | 395 url_tf_->SetText(url_text); |
396 url_tf_->SetController(this); | 396 url_tf_->SetController(this); |
397 url_tf_->SetAccessibleName(url_label_->GetText()); | 397 url_tf_->SetAccessibleName(url_label_->text()); |
398 | 398 |
399 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 399 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
400 | 400 |
401 layout->StartRow(0, labels_column_set_id); | 401 layout->StartRow(0, labels_column_set_id); |
402 layout->AddView(url_label_); | 402 layout->AddView(url_label_); |
403 layout->AddView(url_tf_); | 403 layout->AddView(url_tf_); |
404 } | 404 } |
405 | 405 |
406 if (show_tree_) { | 406 if (show_tree_) { |
407 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 407 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 expanded_nodes->insert(bb_model_->GetNodeByID(editor_node->value)); | 667 expanded_nodes->insert(bb_model_->GetNodeByID(editor_node->value)); |
668 for (int i = 0; i < editor_node->child_count(); ++i) | 668 for (int i = 0; i < editor_node->child_count(); ++i) |
669 UpdateExpandedNodes(editor_node->GetChild(i), expanded_nodes); | 669 UpdateExpandedNodes(editor_node->GetChild(i), expanded_nodes); |
670 } | 670 } |
671 | 671 |
672 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, | 672 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, |
673 const string16& title) { | 673 const string16& title) { |
674 if (!title.empty()) | 674 if (!title.empty()) |
675 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); | 675 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); |
676 } | 676 } |
OLD | NEW |