| 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/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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 string16 title16; | 307 string16 title16; |
| 308 bookmark_utils::GetURLAndTitleToBookmarkFromCurrentTab(profile_, | 308 bookmark_utils::GetURLAndTitleToBookmarkFromCurrentTab(profile_, |
| 309 &url, &title16); | 309 &url, &title16); |
| 310 title = UTF16ToWide(title16); | 310 title = UTF16ToWide(title16); |
| 311 } | 311 } |
| 312 title_tf_.SetText(title); | 312 title_tf_.SetText(title); |
| 313 title_tf_.SetController(this); | 313 title_tf_.SetController(this); |
| 314 | 314 |
| 315 title_label_ = new views::Label( | 315 title_label_ = new views::Label( |
| 316 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL))); | 316 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_NAME_LABEL))); |
| 317 title_tf_.SetAccessibleName(WideToUTF16Hack(title_label_->GetText())); | 317 title_tf_.SetAccessibleName(title_label_->GetText()); |
| 318 | 318 |
| 319 if (show_tree_) { | 319 if (show_tree_) { |
| 320 tree_view_ = new views::TreeView(); | 320 tree_view_ = new views::TreeView(); |
| 321 tree_view_->set_lines_at_root(true); | 321 tree_view_->set_lines_at_root(true); |
| 322 new_folder_button_.reset(new views::NativeTextButton( | 322 new_folder_button_.reset(new views::NativeTextButton( |
| 323 this, | 323 this, |
| 324 UTF16ToWide(l10n_util::GetStringUTF16( | 324 UTF16ToWide(l10n_util::GetStringUTF16( |
| 325 IDS_BOOKMARK_EDITOR_NEW_FOLDER_BUTTON)))); | 325 IDS_BOOKMARK_EDITOR_NEW_FOLDER_BUTTON)))); |
| 326 new_folder_button_->set_parent_owned(false); | 326 new_folder_button_->set_parent_owned(false); |
| 327 tree_view_->set_context_menu_controller(this); | 327 tree_view_->set_context_menu_controller(this); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 // Because this gets parsed by FixupURL(), it's safe to omit the scheme or | 376 // Because this gets parsed by FixupURL(), it's safe to omit the scheme or |
| 377 // trailing slash, and unescape most characters, but we need to not drop any | 377 // trailing slash, and unescape most characters, but we need to not drop any |
| 378 // username/password, or unescape anything that changes the meaning. | 378 // username/password, or unescape anything that changes the meaning. |
| 379 string16 url_text = net::FormatUrl(url, languages, | 379 string16 url_text = net::FormatUrl(url, languages, |
| 380 net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword, | 380 net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword, |
| 381 UnescapeRule::SPACES, NULL, NULL, NULL); | 381 UnescapeRule::SPACES, NULL, NULL, NULL); |
| 382 | 382 |
| 383 url_tf_ = new views::Textfield; | 383 url_tf_ = new views::Textfield; |
| 384 url_tf_->SetText(UTF16ToWide(url_text)); | 384 url_tf_->SetText(UTF16ToWide(url_text)); |
| 385 url_tf_->SetController(this); | 385 url_tf_->SetController(this); |
| 386 url_tf_->SetAccessibleName(WideToUTF16Hack(url_label_->GetText())); | 386 url_tf_->SetAccessibleName(url_label_->GetText()); |
| 387 | 387 |
| 388 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 388 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 389 | 389 |
| 390 layout->StartRow(0, labels_column_set_id); | 390 layout->StartRow(0, labels_column_set_id); |
| 391 layout->AddView(url_label_); | 391 layout->AddView(url_label_); |
| 392 layout->AddView(url_tf_); | 392 layout->AddView(url_tf_); |
| 393 } | 393 } |
| 394 | 394 |
| 395 if (show_tree_) { | 395 if (show_tree_) { |
| 396 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 396 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 EditorNode* editor_node, | 649 EditorNode* editor_node, |
| 650 BookmarkExpandedStateTracker::Nodes* expanded_nodes) { | 650 BookmarkExpandedStateTracker::Nodes* expanded_nodes) { |
| 651 if (!tree_view_->IsExpanded(editor_node)) | 651 if (!tree_view_->IsExpanded(editor_node)) |
| 652 return; | 652 return; |
| 653 | 653 |
| 654 if (editor_node->value != 0) // The root is 0 | 654 if (editor_node->value != 0) // The root is 0 |
| 655 expanded_nodes->insert(bb_model_->GetNodeByID(editor_node->value)); | 655 expanded_nodes->insert(bb_model_->GetNodeByID(editor_node->value)); |
| 656 for (int i = 0; i < editor_node->child_count(); ++i) | 656 for (int i = 0; i < editor_node->child_count(); ++i) |
| 657 UpdateExpandedNodes(editor_node->GetChild(i), expanded_nodes); | 657 UpdateExpandedNodes(editor_node->GetChild(i), expanded_nodes); |
| 658 } | 658 } |
| OLD | NEW |