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

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

Issue 7617006: views/bookmarks: Fix memory leak in BookmarkEditorView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: allocate on free store(heap) instead Created 9 years, 4 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
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_editor_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bookmarks/bookmark_editor_view.h" 5 #include "chrome/browser/ui/views/bookmarks/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 13 matching lines...) Expand all
24 #include "views/background.h" 24 #include "views/background.h"
25 #include "views/controls/button/text_button.h" 25 #include "views/controls/button/text_button.h"
26 #include "views/controls/label.h" 26 #include "views/controls/label.h"
27 #include "views/controls/menu/menu_2.h" 27 #include "views/controls/menu/menu_2.h"
28 #include "views/controls/textfield/textfield.h" 28 #include "views/controls/textfield/textfield.h"
29 #include "views/focus/focus_manager.h" 29 #include "views/focus/focus_manager.h"
30 #include "views/layout/grid_layout.h" 30 #include "views/layout/grid_layout.h"
31 #include "views/layout/layout_constants.h" 31 #include "views/layout/layout_constants.h"
32 #include "views/widget/widget.h" 32 #include "views/widget/widget.h"
33 33
34 using views::Button;
35 using views::ColumnSet;
36 using views::GridLayout; 34 using views::GridLayout;
37 using views::Label; 35
38 using views::Textfield; 36 namespace {
39 37
40 // Background color of text field when URL is invalid. 38 // Background color of text field when URL is invalid.
41 static const SkColor kErrorColor = SkColorSetRGB(0xFF, 0xBC, 0xBC); 39 const SkColor kErrorColor = SkColorSetRGB(0xFF, 0xBC, 0xBC);
42 40
43 // Preferred width of the tree. 41 // Preferred width of the tree.
44 static const int kTreeWidth = 300; 42 const int kTreeWidth = 300;
45 43
46 // ID for various children. 44 // ID for various children.
47 static const int kNewFolderButtonID = 1002; 45 const int kNewFolderButtonID = 1002;
46
47 } // namespace
48 48
49 // static 49 // static
50 void BookmarkEditor::Show(gfx::NativeWindow parent_hwnd, 50 void BookmarkEditor::Show(gfx::NativeWindow parent_hwnd,
51 Profile* profile, 51 Profile* profile,
52 const BookmarkNode* parent, 52 const BookmarkNode* parent,
53 const EditDetails& details, 53 const EditDetails& details,
54 Configuration configuration) { 54 Configuration configuration) {
55 DCHECK(profile); 55 DCHECK(profile);
56 BookmarkEditorView* editor = 56 BookmarkEditorView* editor =
57 new BookmarkEditorView(profile, parent, details, configuration); 57 new BookmarkEditorView(profile, parent, details, configuration);
58 editor->Show(parent_hwnd); 58 editor->Show(parent_hwnd);
59 } 59 }
60 60
61 BookmarkEditorView::BookmarkEditorView( 61 BookmarkEditorView::BookmarkEditorView(
62 Profile* profile, 62 Profile* profile,
63 const BookmarkNode* parent, 63 const BookmarkNode* parent,
64 const EditDetails& details, 64 const EditDetails& details,
65 BookmarkEditor::Configuration configuration) 65 BookmarkEditor::Configuration configuration)
66 : profile_(profile), 66 : profile_(profile),
67 tree_view_(NULL), 67 tree_view_(NULL),
68 new_folder_button_(NULL), 68 new_folder_button_(NULL),
69 url_label_(NULL), 69 url_label_(NULL),
70 url_tf_(NULL),
70 title_label_(NULL), 71 title_label_(NULL),
71 parent_(parent), 72 parent_(parent),
72 details_(details), 73 details_(details),
73 running_menu_for_root_(false), 74 running_menu_for_root_(false),
74 show_tree_(configuration == SHOW_TREE) { 75 show_tree_(configuration == SHOW_TREE) {
75 DCHECK(profile); 76 DCHECK(profile);
76 Init(); 77 Init();
77 } 78 }
78 79
79 BookmarkEditorView::~BookmarkEditorView() { 80 BookmarkEditorView::~BookmarkEditorView() {
(...skipping 23 matching lines...) Expand all
103 bool BookmarkEditorView::CanResize() const { 104 bool BookmarkEditorView::CanResize() const {
104 return true; 105 return true;
105 } 106 }
106 107
107 std::wstring BookmarkEditorView::GetWindowTitle() const { 108 std::wstring BookmarkEditorView::GetWindowTitle() const {
108 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_TITLE)); 109 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_TITLE));
109 } 110 }
110 111
111 bool BookmarkEditorView::Accept() { 112 bool BookmarkEditorView::Accept() {
112 if (!IsDialogButtonEnabled(MessageBoxFlags::DIALOGBUTTON_OK)) { 113 if (!IsDialogButtonEnabled(MessageBoxFlags::DIALOGBUTTON_OK)) {
113 // The url is invalid, focus the url field. 114 if (details_.type != EditDetails::NEW_FOLDER) {
114 url_tf_.SelectAll(); 115 // The url is invalid, focus the url field.
115 url_tf_.RequestFocus(); 116 url_tf_->SelectAll();
117 url_tf_->RequestFocus();
118 }
116 return false; 119 return false;
117 } 120 }
118 // Otherwise save changes and close the dialog box. 121 // Otherwise save changes and close the dialog box.
119 ApplyEdits(); 122 ApplyEdits();
120 return true; 123 return true;
121 } 124 }
122 125
123 bool BookmarkEditorView::AreAcceleratorsEnabled( 126 bool BookmarkEditorView::AreAcceleratorsEnabled(
124 MessageBoxFlags::DialogButton button) { 127 MessageBoxFlags::DialogButton button) {
125 return !show_tree_ || !tree_view_->GetEditingNode(); 128 return !show_tree_ || !tree_view_->GetEditingNode();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 views::TreeView* tree_view) { 175 views::TreeView* tree_view) {
173 } 176 }
174 177
175 bool BookmarkEditorView::CanEdit(views::TreeView* tree_view, 178 bool BookmarkEditorView::CanEdit(views::TreeView* tree_view,
176 ui::TreeModelNode* node) { 179 ui::TreeModelNode* node) {
177 // Only allow editting of children of the bookmark bar node and other node. 180 // Only allow editting of children of the bookmark bar node and other node.
178 EditorNode* bb_node = tree_model_->AsNode(node); 181 EditorNode* bb_node = tree_model_->AsNode(node);
179 return (bb_node->parent() && bb_node->parent()->parent()); 182 return (bb_node->parent() && bb_node->parent()->parent());
180 } 183 }
181 184
182 void BookmarkEditorView::ContentsChanged(Textfield* sender, 185 void BookmarkEditorView::ContentsChanged(views::Textfield* sender,
183 const std::wstring& new_contents) { 186 const std::wstring& new_contents) {
184 UserInputChanged(); 187 UserInputChanged();
185 } 188 }
186 189
187 void BookmarkEditorView::ButtonPressed( 190 void BookmarkEditorView::ButtonPressed(views::Button* sender,
188 Button* sender, const views::Event& event) { 191 const views::Event& event) {
189 DCHECK(sender); 192 DCHECK(sender);
190 switch (sender->id()) { 193 switch (sender->id()) {
191 case kNewFolderButtonID: 194 case kNewFolderButtonID:
192 NewFolder(); 195 NewFolder();
193 break; 196 break;
194 197
195 default: 198 default:
196 NOTREACHED(); 199 NOTREACHED();
197 } 200 }
198 } 201 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 context_menu_.reset(new views::Menu2(context_menu_contents_.get())); 284 context_menu_.reset(new views::Menu2(context_menu_contents_.get()));
282 } 285 }
283 context_menu_->RunContextMenuAt(p); 286 context_menu_->RunContextMenuAt(p);
284 } 287 }
285 288
286 void BookmarkEditorView::Init() { 289 void BookmarkEditorView::Init() {
287 bb_model_ = profile_->GetBookmarkModel(); 290 bb_model_ = profile_->GetBookmarkModel();
288 DCHECK(bb_model_); 291 DCHECK(bb_model_);
289 bb_model_->AddObserver(this); 292 bb_model_->AddObserver(this);
290 293
291 url_tf_.set_parent_owned(false);
292 title_tf_.set_parent_owned(false); 294 title_tf_.set_parent_owned(false);
293 295
294 std::wstring title; 296 std::wstring title;
295 GURL url; 297 GURL url;
296 if (details_.type == EditDetails::EXISTING_NODE) { 298 if (details_.type == EditDetails::EXISTING_NODE) {
297 title = details_.existing_node->GetTitle(); 299 title = details_.existing_node->GetTitle();
298 url = details_.existing_node->url(); 300 url = details_.existing_node->url();
299 } else if (details_.type == EditDetails::NEW_FOLDER) { 301 } else if (details_.type == EditDetails::NEW_FOLDER) {
300 title = UTF16ToWide( 302 title = UTF16ToWide(
301 l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME)); 303 l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME));
302 } else if (details_.type == EditDetails::NEW_URL) { 304 } else if (details_.type == EditDetails::NEW_URL) {
303 string16 title16; 305 string16 title16;
304 bookmark_utils::GetURLAndTitleToBookmarkFromCurrentTab(profile_, 306 bookmark_utils::GetURLAndTitleToBookmarkFromCurrentTab(profile_,
305 &url, &title16); 307 &url, &title16);
306 title = UTF16ToWide(title16); 308 title = UTF16ToWide(title16);
307 } 309 }
308 title_tf_.SetText(title); 310 title_tf_.SetText(title);
309 title_tf_.SetController(this); 311 title_tf_.SetController(this);
310 312
311 title_label_ = new views::Label( 313 title_label_ = new views::Label(
312 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NAME_LABEL))); 314 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NAME_LABEL)));
313 title_tf_.SetAccessibleName(WideToUTF16Hack(title_label_->GetText())); 315 title_tf_.SetAccessibleName(WideToUTF16Hack(title_label_->GetText()));
314 316
315 string16 url_text;
316 if (details_.type != EditDetails::NEW_FOLDER) {
317 std::string languages = profile_
318 ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)
319 : std::string();
320 // Because this gets parsed by FixupURL(), it's safe to omit the scheme or
321 // trailing slash, and unescape most characters, but we need to not drop any
322 // username/password, or unescape anything that changes the meaning.
323 url_text = net::FormatUrl(url, languages,
324 net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword,
325 UnescapeRule::SPACES, NULL, NULL, NULL);
326 }
327 url_tf_.SetText(UTF16ToWide(url_text));
328 url_tf_.SetController(this);
329
330 url_label_ = new views::Label(
331 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_URL_LABEL)));
332 url_tf_.SetAccessibleName(WideToUTF16Hack(url_label_->GetText()));
333
334 if (show_tree_) { 317 if (show_tree_) {
335 tree_view_ = new views::TreeView(); 318 tree_view_ = new views::TreeView();
336 tree_view_->set_lines_at_root(true); 319 tree_view_->set_lines_at_root(true);
337 new_folder_button_.reset(new views::NativeTextButton( 320 new_folder_button_.reset(new views::NativeTextButton(
338 this, 321 this,
339 UTF16ToWide(l10n_util::GetStringUTF16( 322 UTF16ToWide(l10n_util::GetStringUTF16(
340 IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON)))); 323 IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON))));
341 new_folder_button_->set_parent_owned(false); 324 new_folder_button_->set_parent_owned(false);
342 tree_view_->set_context_menu_controller(this); 325 tree_view_->set_context_menu_controller(this);
343 326
344 tree_view_->SetRootShown(false); 327 tree_view_->SetRootShown(false);
345 new_folder_button_->SetEnabled(false); 328 new_folder_button_->SetEnabled(false);
346 new_folder_button_->set_id(kNewFolderButtonID); 329 new_folder_button_->set_id(kNewFolderButtonID);
347 } 330 }
348 331
349 // Yummy layout code. 332 // Yummy layout code.
350 GridLayout* layout = GridLayout::CreatePanel(this); 333 GridLayout* layout = GridLayout::CreatePanel(this);
351 SetLayoutManager(layout); 334 SetLayoutManager(layout);
352 335
353 const int labels_column_set_id = 0; 336 const int labels_column_set_id = 0;
354 const int single_column_view_set_id = 1; 337 const int single_column_view_set_id = 1;
355 const int buttons_column_set_id = 2; 338 const int buttons_column_set_id = 2;
356 339
357 ColumnSet* column_set = layout->AddColumnSet(labels_column_set_id); 340 views::ColumnSet* column_set = layout->AddColumnSet(labels_column_set_id);
358 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, 341 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
359 GridLayout::USE_PREF, 0, 0); 342 GridLayout::USE_PREF, 0, 0);
360 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); 343 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing);
361 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1, 344 column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1,
362 GridLayout::USE_PREF, 0, 0); 345 GridLayout::USE_PREF, 0, 0);
363 346
364 column_set = layout->AddColumnSet(single_column_view_set_id); 347 column_set = layout->AddColumnSet(single_column_view_set_id);
365 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, 348 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
366 GridLayout::FIXED, kTreeWidth, 0); 349 GridLayout::FIXED, kTreeWidth, 0);
367 350
368 column_set = layout->AddColumnSet(buttons_column_set_id); 351 column_set = layout->AddColumnSet(buttons_column_set_id);
369 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0, 352 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0,
370 GridLayout::USE_PREF, 0, 0); 353 GridLayout::USE_PREF, 0, 0);
371 column_set->AddPaddingColumn(1, views::kRelatedControlHorizontalSpacing); 354 column_set->AddPaddingColumn(1, views::kRelatedControlHorizontalSpacing);
372 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0, 355 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0,
373 GridLayout::USE_PREF, 0, 0); 356 GridLayout::USE_PREF, 0, 0);
374 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing); 357 column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing);
375 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0, 358 column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 0,
376 GridLayout::USE_PREF, 0, 0); 359 GridLayout::USE_PREF, 0, 0);
377 column_set->LinkColumnSizes(0, 2, 4, -1); 360 column_set->LinkColumnSizes(0, 2, 4, -1);
378 361
379 layout->StartRow(0, labels_column_set_id); 362 layout->StartRow(0, labels_column_set_id);
380 363
381 layout->AddView(title_label_); 364 layout->AddView(title_label_);
382 layout->AddView(&title_tf_); 365 layout->AddView(&title_tf_);
383 366
384 if (details_.type != EditDetails::NEW_FOLDER) { 367 if (details_.type != EditDetails::NEW_FOLDER) {
368 url_label_ = new views::Label(
369 UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_URL_LABEL)));
370
371 std::string languages = profile_
372 ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages)
373 : std::string();
374 // Because this gets parsed by FixupURL(), it's safe to omit the scheme or
375 // trailing slash, and unescape most characters, but we need to not drop any
376 // username/password, or unescape anything that changes the meaning.
377 string16 url_text = net::FormatUrl(url, languages,
378 net::kFormatUrlOmitAll & ~net::kFormatUrlOmitUsernamePassword,
379 UnescapeRule::SPACES, NULL, NULL, NULL);
380
381 url_tf_ = new views::Textfield;
382 url_tf_->SetText(UTF16ToWide(url_text));
383 url_tf_->SetController(this);
384 url_tf_->SetAccessibleName(WideToUTF16Hack(url_label_->GetText()));
385
385 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 386 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
386 387
387 layout->StartRow(0, labels_column_set_id); 388 layout->StartRow(0, labels_column_set_id);
388 layout->AddView(url_label_); 389 layout->AddView(url_label_);
389 layout->AddView(&url_tf_); 390 layout->AddView(url_tf_);
390 } 391 }
391 392
392 if (show_tree_) { 393 if (show_tree_) {
393 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 394 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
394 layout->StartRow(1, single_column_view_set_id); 395 layout->StartRow(1, single_column_view_set_id);
395 layout->AddView(tree_view_); 396 layout->AddView(tree_view_);
396 } 397 }
397 398
398 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 399 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
399 400
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 tree_model_.reset(new EditorTreeModel(root_node)); 452 tree_model_.reset(new EditorTreeModel(root_node));
452 453
453 tree_view_->SetModel(tree_model_.get()); 454 tree_view_->SetModel(tree_model_.get());
454 tree_view_->SetController(this); 455 tree_view_->SetController(this);
455 456
456 context_menu_.reset(); 457 context_menu_.reset();
457 458
458 if (parent()) 459 if (parent())
459 ExpandAndSelect(); 460 ExpandAndSelect();
460 } 461 }
462
461 GURL BookmarkEditorView::GetInputURL() const { 463 GURL BookmarkEditorView::GetInputURL() const {
462 return URLFixerUpper::FixupURL(UTF16ToUTF8(url_tf_.text()), std::string()); 464 return URLFixerUpper::FixupURL(UTF16ToUTF8(url_tf_->text()), std::string());
463 } 465 }
464 466
465 std::wstring BookmarkEditorView::GetInputTitle() const { 467 std::wstring BookmarkEditorView::GetInputTitle() const {
466 return title_tf_.text(); 468 return title_tf_.text();
467 } 469 }
468 470
469 void BookmarkEditorView::UserInputChanged() { 471 void BookmarkEditorView::UserInputChanged() {
470 const GURL url(GetInputURL()); 472 const GURL url(GetInputURL());
471 if (!url.is_valid()) 473 if (!url.is_valid())
472 url_tf_.SetBackgroundColor(kErrorColor); 474 url_tf_->SetBackgroundColor(kErrorColor);
Peter Kasting 2011/08/11 20:53:31 This doesn't seem safe. UserInputChanged() can be
tfarina 2011/08/11 21:10:13 Done.
473 else 475 else
474 url_tf_.UseDefaultBackgroundColor(); 476 url_tf_->UseDefaultBackgroundColor();
475 GetDialogClientView()->UpdateDialogButtons(); 477 GetDialogClientView()->UpdateDialogButtons();
476 } 478 }
477 479
478 void BookmarkEditorView::NewFolder() { 480 void BookmarkEditorView::NewFolder() {
479 // Create a new entry parented to the selected item, or the bookmark 481 // Create a new entry parented to the selected item, or the bookmark
480 // bar if nothing is selected. 482 // bar if nothing is selected.
481 EditorNode* parent = tree_model_->AsNode(tree_view_->GetSelectedNode()); 483 EditorNode* parent = tree_model_->AsNode(tree_view_->GetSelectedNode());
482 if (!parent) { 484 if (!parent) {
483 NOTREACHED(); 485 NOTREACHED();
484 return; 486 return;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 } 573 }
572 574
573 void BookmarkEditorView::ApplyEdits(EditorNode* parent) { 575 void BookmarkEditorView::ApplyEdits(EditorNode* parent) {
574 DCHECK(!show_tree_ || parent); 576 DCHECK(!show_tree_ || parent);
575 577
576 // We're going to apply edits to the bookmark bar model, which will call us 578 // We're going to apply edits to the bookmark bar model, which will call us
577 // back. Normally when a structural edit occurs we reset the tree model. 579 // back. Normally when a structural edit occurs we reset the tree model.
578 // We don't want to do that here, so we remove ourselves as an observer. 580 // We don't want to do that here, so we remove ourselves as an observer.
579 bb_model_->RemoveObserver(this); 581 bb_model_->RemoveObserver(this);
580 582
581 GURL new_url(GetInputURL()); 583 GURL new_url(GetInputURL());
Peter Kasting 2011/08/11 20:53:31 Similarly, ApplyEdits() can seemingly be called in
tfarina 2011/08/11 21:10:13 Done.
582 string16 new_title(WideToUTF16Hack(GetInputTitle())); 584 string16 new_title(WideToUTF16Hack(GetInputTitle()));
583 585
584 if (!show_tree_) { 586 if (!show_tree_) {
585 bookmark_utils::ApplyEditsWithNoFolderChange( 587 bookmark_utils::ApplyEditsWithNoFolderChange(
586 bb_model_, parent_, details_, new_title, new_url); 588 bb_model_, parent_, details_, new_title, new_url);
587 return; 589 return;
588 } 590 }
589 591
590 // Create the new folders and update the titles. 592 // Create the new folders and update the titles.
591 const BookmarkNode* new_parent = NULL; 593 const BookmarkNode* new_parent = NULL;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 EditorNode* editor_node, 643 EditorNode* editor_node,
642 BookmarkExpandedStateTracker::Nodes* expanded_nodes) { 644 BookmarkExpandedStateTracker::Nodes* expanded_nodes) {
643 if (!tree_view_->IsExpanded(editor_node)) 645 if (!tree_view_->IsExpanded(editor_node))
644 return; 646 return;
645 647
646 if (editor_node->value != 0) // The root is 0 648 if (editor_node->value != 0) // The root is 0
647 expanded_nodes->insert(bb_model_->GetNodeByID(editor_node->value)); 649 expanded_nodes->insert(bb_model_->GetNodeByID(editor_node->value));
648 for (int i = 0; i < editor_node->child_count(); ++i) 650 for (int i = 0; i < editor_node->child_count(); ++i)
649 UpdateExpandedNodes(editor_node->GetChild(i), expanded_nodes); 651 UpdateExpandedNodes(editor_node->GetChild(i), expanded_nodes);
650 } 652 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_editor_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698