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

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

Issue 120503005: Merge NativeTextfieldViews into views::Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix touch drag and drop unit test. Created 6 years, 11 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) 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 context_menu_runner_.reset(); 417 context_menu_runner_.reset();
418 418
419 if (parent()) 419 if (parent())
420 ExpandAndSelect(); 420 ExpandAndSelect();
421 } 421 }
422 422
423 GURL BookmarkEditorView::GetInputURL() const { 423 GURL BookmarkEditorView::GetInputURL() const {
424 if (details_.GetNodeType() == BookmarkNode::FOLDER) 424 if (details_.GetNodeType() == BookmarkNode::FOLDER)
425 return GURL(); 425 return GURL();
426 return URLFixerUpper::FixupURL( 426 return URLFixerUpper::FixupURL(
427 base::UTF16ToUTF8(url_tf_->text()), std::string()); 427 base::UTF16ToUTF8(url_tf_->GetText()), std::string());
428 } 428 }
429 429
430 void BookmarkEditorView::UserInputChanged() { 430 void BookmarkEditorView::UserInputChanged() {
431 if (details_.GetNodeType() != BookmarkNode::FOLDER) { 431 if (details_.GetNodeType() != BookmarkNode::FOLDER) {
432 const GURL url(GetInputURL()); 432 const GURL url(GetInputURL());
433 if (!url.is_valid()) 433 if (!url.is_valid())
434 url_tf_->SetBackgroundColor(kErrorColor); 434 url_tf_->SetBackgroundColor(kErrorColor);
435 else 435 else
436 url_tf_->UseDefaultBackgroundColor(); 436 url_tf_->UseDefaultBackgroundColor();
437 } 437 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 537
538 void BookmarkEditorView::ApplyEdits(EditorNode* parent) { 538 void BookmarkEditorView::ApplyEdits(EditorNode* parent) {
539 DCHECK(!show_tree_ || parent); 539 DCHECK(!show_tree_ || parent);
540 540
541 // We're going to apply edits to the bookmark bar model, which will call us 541 // We're going to apply edits to the bookmark bar model, which will call us
542 // back. Normally when a structural edit occurs we reset the tree model. 542 // back. Normally when a structural edit occurs we reset the tree model.
543 // We don't want to do that here, so we remove ourselves as an observer. 543 // We don't want to do that here, so we remove ourselves as an observer.
544 bb_model_->RemoveObserver(this); 544 bb_model_->RemoveObserver(this);
545 545
546 GURL new_url(GetInputURL()); 546 GURL new_url(GetInputURL());
547 base::string16 new_title(title_tf_->text()); 547 base::string16 new_title(title_tf_->GetText());
548 548
549 if (!show_tree_) { 549 if (!show_tree_) {
550 BookmarkEditor::ApplyEditsWithNoFolderChange( 550 BookmarkEditor::ApplyEditsWithNoFolderChange(
551 bb_model_, parent_, details_, new_title, new_url); 551 bb_model_, parent_, details_, new_title, new_url);
552 return; 552 return;
553 } 553 }
554 554
555 // Create the new folders and update the titles. 555 // Create the new folders and update the titles.
556 const BookmarkNode* new_parent = NULL; 556 const BookmarkNode* new_parent = NULL;
557 ApplyNameChangesAndCreateNewFolders( 557 ApplyNameChangesAndCreateNewFolders(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 } 625 }
626 return context_menu_model_.get(); 626 return context_menu_model_.get();
627 } 627 }
628 628
629 void BookmarkEditorView::EditorTreeModel::SetTitle( 629 void BookmarkEditorView::EditorTreeModel::SetTitle(
630 ui::TreeModelNode* node, 630 ui::TreeModelNode* node,
631 const base::string16& title) { 631 const base::string16& title) {
632 if (!title.empty()) 632 if (!title.empty())
633 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); 633 ui::TreeNodeModel<EditorNode>::SetTitle(node, title);
634 } 634 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698