Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/browser/ui/views/bookmark_editor_view.cc

Issue 6452011: Rework tree APIs to reflect Google style and more const-correctness.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 void BookmarkEditorView::Layout() { 133 void BookmarkEditorView::Layout() {
134 // Let the grid layout manager lay out most of the dialog... 134 // Let the grid layout manager lay out most of the dialog...
135 GetLayoutManager()->Layout(this); 135 GetLayoutManager()->Layout(this);
136 136
137 if (!show_tree_) 137 if (!show_tree_)
138 return; 138 return;
139 139
140 // Manually lay out the New Folder button in the same row as the OK/Cancel 140 // Manually lay out the New Folder button in the same row as the OK/Cancel
141 // buttons... 141 // buttons...
142 gfx::Rect parent_bounds = GetParent()->GetContentsBounds(); 142 gfx::Rect parent_bounds = parent()->GetContentsBounds();
143 gfx::Size prefsize = new_group_button_->GetPreferredSize(); 143 gfx::Size prefsize = new_group_button_->GetPreferredSize();
144 int button_y = 144 int button_y =
145 parent_bounds.bottom() - prefsize.height() - views::kButtonVEdgeMargin; 145 parent_bounds.bottom() - prefsize.height() - views::kButtonVEdgeMargin;
146 new_group_button_->SetBounds(kPanelHorizMargin, button_y, prefsize.width(), 146 new_group_button_->SetBounds(kPanelHorizMargin, button_y, prefsize.width(),
147 prefsize.height()); 147 prefsize.height());
148 } 148 }
149 149
150 gfx::Size BookmarkEditorView::GetPreferredSize() { 150 gfx::Size BookmarkEditorView::GetPreferredSize() {
151 if (!show_tree_) 151 if (!show_tree_)
152 return views::View::GetPreferredSize(); 152 return views::View::GetPreferredSize();
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 } 396 }
397 } 397 }
398 398
399 void BookmarkEditorView::BookmarkNodeChildrenReordered( 399 void BookmarkEditorView::BookmarkNodeChildrenReordered(
400 BookmarkModel* model, const BookmarkNode* node) { 400 BookmarkModel* model, const BookmarkNode* node) {
401 Reset(); 401 Reset();
402 } 402 }
403 403
404 void BookmarkEditorView::Reset() { 404 void BookmarkEditorView::Reset() {
405 if (!show_tree_) { 405 if (!show_tree_) {
406 if (GetParent()) 406 if (parent())
407 UserInputChanged(); 407 UserInputChanged();
408 return; 408 return;
409 } 409 }
410 410
411 new_group_button_->SetEnabled(true); 411 new_group_button_->SetEnabled(true);
412 412
413 // Do this first, otherwise when we invoke SetModel with the real one 413 // Do this first, otherwise when we invoke SetModel with the real one
414 // tree_view will try to invoke something on the model we just deleted. 414 // tree_view will try to invoke something on the model we just deleted.
415 tree_view_->SetModel(NULL); 415 tree_view_->SetModel(NULL);
416 416
417 EditorNode* root_node = CreateRootNode(); 417 EditorNode* root_node = CreateRootNode();
418 tree_model_.reset(new EditorTreeModel(root_node)); 418 tree_model_.reset(new EditorTreeModel(root_node));
419 419
420 tree_view_->SetModel(tree_model_.get()); 420 tree_view_->SetModel(tree_model_.get());
421 tree_view_->SetController(this); 421 tree_view_->SetController(this);
422 422
423 context_menu_.reset(); 423 context_menu_.reset();
424 424
425 if (GetParent()) 425 if (parent())
426 ExpandAndSelect(); 426 ExpandAndSelect();
427 } 427 }
428 GURL BookmarkEditorView::GetInputURL() const { 428 GURL BookmarkEditorView::GetInputURL() const {
429 return URLFixerUpper::FixupURL(UTF16ToUTF8(url_tf_.text()), std::string()); 429 return URLFixerUpper::FixupURL(UTF16ToUTF8(url_tf_.text()), std::string());
430 } 430 }
431 431
432 std::wstring BookmarkEditorView::GetInputTitle() const { 432 std::wstring BookmarkEditorView::GetInputTitle() const {
433 return title_tf_.text(); 433 return title_tf_.text();
434 } 434 }
435 435
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmark_bar_view_test.cc ('k') | chrome/browser/ui/views/bookmark_editor_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698