| 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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 113 } |
| 114 | 114 |
| 115 string16 BookmarkEditorView::GetWindowTitle() const { | 115 string16 BookmarkEditorView::GetWindowTitle() const { |
| 116 return l10n_util::GetStringUTF16(details_.GetWindowTitleId()); | 116 return l10n_util::GetStringUTF16(details_.GetWindowTitleId()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool BookmarkEditorView::Accept() { | 119 bool BookmarkEditorView::Accept() { |
| 120 if (!IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)) { | 120 if (!IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)) { |
| 121 if (details_.GetNodeType() != BookmarkNode::FOLDER) { | 121 if (details_.GetNodeType() != BookmarkNode::FOLDER) { |
| 122 // The url is invalid, focus the url field. | 122 // The url is invalid, focus the url field. |
| 123 url_tf_->SelectAll(); | 123 url_tf_->SelectAll(true); |
| 124 url_tf_->RequestFocus(); | 124 url_tf_->RequestFocus(); |
| 125 } | 125 } |
| 126 return false; | 126 return false; |
| 127 } | 127 } |
| 128 // Otherwise save changes and close the dialog box. | 128 // Otherwise save changes and close the dialog box. |
| 129 ApplyEdits(); | 129 ApplyEdits(); |
| 130 return true; | 130 return true; |
| 131 } | 131 } |
| 132 | 132 |
| 133 bool BookmarkEditorView::AreAcceleratorsEnabled(ui::DialogButton button) { | 133 bool BookmarkEditorView::AreAcceleratorsEnabled(ui::DialogButton button) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 | 254 |
| 255 void BookmarkEditorView::Show(gfx::NativeWindow parent_window) { | 255 void BookmarkEditorView::Show(gfx::NativeWindow parent_window) { |
| 256 views::Widget::CreateWindowWithParent(this, parent_window); | 256 views::Widget::CreateWindowWithParent(this, parent_window); |
| 257 UserInputChanged(); | 257 UserInputChanged(); |
| 258 if (show_tree_ && bb_model_->IsLoaded()) | 258 if (show_tree_ && bb_model_->IsLoaded()) |
| 259 ExpandAndSelect(); | 259 ExpandAndSelect(); |
| 260 GetWidget()->Show(); | 260 GetWidget()->Show(); |
| 261 // Select all the text in the name Textfield. | 261 // Select all the text in the name Textfield. |
| 262 title_tf_->SelectAll(); | 262 title_tf_->SelectAll(true); |
| 263 // Give focus to the name Textfield. | 263 // Give focus to the name Textfield. |
| 264 title_tf_->RequestFocus(); | 264 title_tf_->RequestFocus(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void BookmarkEditorView::Close() { | 267 void BookmarkEditorView::Close() { |
| 268 DCHECK(GetWidget()); | 268 DCHECK(GetWidget()); |
| 269 GetWidget()->Close(); | 269 GetWidget()->Close(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void BookmarkEditorView::ShowContextMenuForView(views::View* source, | 272 void BookmarkEditorView::ShowContextMenuForView(views::View* source, |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); | 654 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); |
| 655 } | 655 } |
| 656 return context_menu_model_.get(); | 656 return context_menu_model_.get(); |
| 657 } | 657 } |
| 658 | 658 |
| 659 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, | 659 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, |
| 660 const string16& title) { | 660 const string16& title) { |
| 661 if (!title.empty()) | 661 if (!title.empty()) |
| 662 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); | 662 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); |
| 663 } | 663 } |
| OLD | NEW |