Chromium Code Reviews| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 LayoutDelegate* delegate = LayoutDelegate::Get(); | 345 LayoutDelegate* delegate = LayoutDelegate::Get(); |
| 346 | 346 |
| 347 const int labels_column_set_id = 0; | 347 const int labels_column_set_id = 0; |
| 348 const int single_column_view_set_id = 1; | 348 const int single_column_view_set_id = 1; |
| 349 const int buttons_column_set_id = 2; | 349 const int buttons_column_set_id = 2; |
| 350 | 350 |
| 351 views::ColumnSet* column_set = layout->AddColumnSet(labels_column_set_id); | 351 views::ColumnSet* column_set = layout->AddColumnSet(labels_column_set_id); |
| 352 column_set->AddColumn(delegate->GetControlLabelGridAlignment(), | 352 column_set->AddColumn(delegate->GetControlLabelGridAlignment(), |
| 353 GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); | 353 GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0); |
| 354 column_set->AddPaddingColumn( | 354 column_set->AddPaddingColumn( |
| 355 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType:: | 355 0, |
|
Elly Fong-Jones
2017/01/31 15:42:14
is this what 'git cl format' does?
Peter Kasting
2017/01/31 21:41:55
Yes. I was surprised.
| |
| 356 RELATED_CONTROL_HORIZONTAL_SPACING)); | 356 delegate->GetMetric( |
| 357 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); | |
| 357 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, | 358 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, |
| 358 GridLayout::USE_PREF, 0, 0); | 359 GridLayout::USE_PREF, 0, 0); |
| 359 | 360 |
| 360 column_set = layout->AddColumnSet(single_column_view_set_id); | 361 column_set = layout->AddColumnSet(single_column_view_set_id); |
| 361 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 362 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
| 362 GridLayout::USE_PREF, 0, 0); | 363 GridLayout::USE_PREF, 0, 0); |
| 363 | 364 |
| 364 column_set = layout->AddColumnSet(buttons_column_set_id); | 365 column_set = layout->AddColumnSet(buttons_column_set_id); |
| 365 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0, | 366 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0, |
| 366 GridLayout::USE_PREF, 0, 0); | 367 GridLayout::USE_PREF, 0, 0); |
| 367 column_set->AddPaddingColumn( | 368 column_set->AddPaddingColumn( |
| 368 1, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType:: | 369 1, |
| 369 RELATED_CONTROL_HORIZONTAL_SPACING)); | 370 delegate->GetMetric( |
| 371 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); | |
| 370 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0, | 372 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0, |
| 371 GridLayout::USE_PREF, 0, 0); | 373 GridLayout::USE_PREF, 0, 0); |
| 372 column_set->AddPaddingColumn( | 374 column_set->AddPaddingColumn( |
| 373 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType:: | 375 0, |
| 374 RELATED_CONTROL_HORIZONTAL_SPACING)); | 376 delegate->GetMetric( |
| 377 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); | |
| 375 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0, | 378 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0, |
| 376 GridLayout::USE_PREF, 0, 0); | 379 GridLayout::USE_PREF, 0, 0); |
| 377 column_set->LinkColumnSizes(0, 2, 4, -1); | 380 column_set->LinkColumnSizes(0, 2, 4, -1); |
| 378 | 381 |
| 379 layout->StartRow(0, labels_column_set_id); | 382 layout->StartRow(0, labels_column_set_id); |
| 380 layout->AddView(title_label_); | 383 layout->AddView(title_label_); |
| 381 layout->AddView(title_tf_); | 384 layout->AddView(title_tf_); |
| 382 | 385 |
| 383 if (details_.GetNodeType() != BookmarkNode::FOLDER) { | 386 if (details_.GetNodeType() != BookmarkNode::FOLDER) { |
| 384 url_label_ = new views::Label( | 387 url_label_ = new views::Label( |
| 385 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL)); | 388 l10n_util::GetStringUTF16(IDS_BOOKMARK_EDITOR_URL_LABEL)); |
| 386 | 389 |
| 387 url_tf_ = new views::Textfield; | 390 url_tf_ = new views::Textfield; |
| 388 url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url)); | 391 url_tf_->SetText(chrome::FormatBookmarkURLForDisplay(url)); |
| 389 url_tf_->set_controller(this); | 392 url_tf_->set_controller(this); |
| 390 url_tf_->SetAccessibleName( | 393 url_tf_->SetAccessibleName( |
| 391 l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_EDITOR_URL_LABEL)); | 394 l10n_util::GetStringUTF16(IDS_BOOKMARK_AX_EDITOR_URL_LABEL)); |
| 392 | 395 |
| 393 layout->AddPaddingRow( | 396 layout->AddPaddingRow( |
| 394 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType:: | 397 0, |
| 395 RELATED_CONTROL_VERTICAL_SPACING)); | 398 delegate->GetMetric( |
| 399 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 396 | 400 |
| 397 layout->StartRow(0, labels_column_set_id); | 401 layout->StartRow(0, labels_column_set_id); |
| 398 layout->AddView(url_label_); | 402 layout->AddView(url_label_); |
| 399 layout->AddView(url_tf_); | 403 layout->AddView(url_tf_); |
| 400 } | 404 } |
| 401 | 405 |
| 402 if (show_tree_) { | 406 if (show_tree_) { |
| 403 layout->AddPaddingRow( | 407 layout->AddPaddingRow( |
| 404 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType:: | 408 0, |
| 405 RELATED_CONTROL_VERTICAL_SPACING)); | 409 delegate->GetMetric( |
| 410 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 406 layout->StartRow(1, single_column_view_set_id); | 411 layout->StartRow(1, single_column_view_set_id); |
| 407 layout->AddView(tree_view_->CreateParentIfNecessary()); | 412 layout->AddView(tree_view_->CreateParentIfNecessary()); |
| 408 } | 413 } |
| 409 | 414 |
| 410 if (delegate->UseExtraDialogPadding()) { | 415 if (delegate->UseExtraDialogPadding()) { |
| 411 layout->AddPaddingRow( | 416 layout->AddPaddingRow( |
| 412 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType:: | 417 0, |
| 413 RELATED_CONTROL_VERTICAL_SPACING)); | 418 delegate->GetMetric( |
| 419 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 414 } | 420 } |
| 415 | 421 |
| 416 if (!show_tree_ || bb_model_->loaded()) | 422 if (!show_tree_ || bb_model_->loaded()) |
| 417 Reset(); | 423 Reset(); |
| 418 } | 424 } |
| 419 | 425 |
| 420 void BookmarkEditorView::Reset() { | 426 void BookmarkEditorView::Reset() { |
| 421 if (!show_tree_) { | 427 if (!show_tree_) { |
| 422 if (parent()) | 428 if (parent()) |
| 423 UserInputChanged(); | 429 UserInputChanged(); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 Profile* profile, | 676 Profile* profile, |
| 671 const BookmarkEditor::EditDetails& details, | 677 const BookmarkEditor::EditDetails& details, |
| 672 BookmarkEditor::Configuration configuration) { | 678 BookmarkEditor::Configuration configuration) { |
| 673 DCHECK(profile); | 679 DCHECK(profile); |
| 674 BookmarkEditorView* editor = new BookmarkEditorView( | 680 BookmarkEditorView* editor = new BookmarkEditorView( |
| 675 profile, details.parent_node, details, configuration); | 681 profile, details.parent_node, details, configuration); |
| 676 editor->Show(parent_window); | 682 editor->Show(parent_window); |
| 677 } | 683 } |
| 678 | 684 |
| 679 } // namespace chrome | 685 } // namespace chrome |
| OLD | NEW |