| 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" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 15 #include "chrome/browser/bookmarks/bookmark_utils.h" | 15 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 16 #include "chrome/browser/history/history.h" | 16 #include "chrome/browser/history/history.h" |
| 17 #include "chrome/browser/net/url_fixer_upper.h" | 17 #include "chrome/browser/net/url_fixer_upper.h" |
| 18 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 #include "grit/chromium_strings.h" | 22 #include "grit/chromium_strings.h" |
| 23 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 24 #include "grit/locale_settings.h" | 24 #include "grit/locale_settings.h" |
| 25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
| 26 #include "ui/base/event.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/views/background.h" | 28 #include "ui/views/background.h" |
| 28 #include "ui/views/controls/button/text_button.h" | 29 #include "ui/views/controls/button/text_button.h" |
| 29 #include "ui/views/controls/label.h" | 30 #include "ui/views/controls/label.h" |
| 30 #include "ui/views/controls/menu/menu_model_adapter.h" | 31 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 31 #include "ui/views/controls/menu/menu_runner.h" | 32 #include "ui/views/controls/menu/menu_runner.h" |
| 32 #include "ui/views/controls/textfield/textfield.h" | 33 #include "ui/views/controls/textfield/textfield.h" |
| 33 #include "ui/views/controls/tree/tree_view.h" | 34 #include "ui/views/controls/tree/tree_view.h" |
| 34 #include "ui/views/focus/focus_manager.h" | 35 #include "ui/views/focus/focus_manager.h" |
| 35 #include "ui/views/layout/grid_layout.h" | 36 #include "ui/views/layout/grid_layout.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 EditorNode* bb_node = tree_model_->AsNode(node); | 189 EditorNode* bb_node = tree_model_->AsNode(node); |
| 189 return (bb_node->parent() && bb_node->parent()->parent()); | 190 return (bb_node->parent() && bb_node->parent()->parent()); |
| 190 } | 191 } |
| 191 | 192 |
| 192 void BookmarkEditorView::ContentsChanged(views::Textfield* sender, | 193 void BookmarkEditorView::ContentsChanged(views::Textfield* sender, |
| 193 const string16& new_contents) { | 194 const string16& new_contents) { |
| 194 UserInputChanged(); | 195 UserInputChanged(); |
| 195 } | 196 } |
| 196 | 197 |
| 197 bool BookmarkEditorView::HandleKeyEvent(views::Textfield* sender, | 198 bool BookmarkEditorView::HandleKeyEvent(views::Textfield* sender, |
| 198 const views::KeyEvent& key_event) { | 199 const ui::KeyEvent& key_event) { |
| 199 return false; | 200 return false; |
| 200 } | 201 } |
| 201 | 202 |
| 202 void BookmarkEditorView::ButtonPressed(views::Button* sender, | 203 void BookmarkEditorView::ButtonPressed(views::Button* sender, |
| 203 const views::Event& event) { | 204 const views::Event& event) { |
| 204 DCHECK_EQ(new_folder_button_.get(), sender); | 205 DCHECK_EQ(new_folder_button_.get(), sender); |
| 205 NewFolder(); | 206 NewFolder(); |
| 206 } | 207 } |
| 207 | 208 |
| 208 bool BookmarkEditorView::IsCommandIdChecked(int command_id) const { | 209 bool BookmarkEditorView::IsCommandIdChecked(int command_id) const { |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); | 656 IDS_BOOKMARK_EDITOR_NEW_FOLDER_MENU_ITEM); |
| 656 } | 657 } |
| 657 return context_menu_model_.get(); | 658 return context_menu_model_.get(); |
| 658 } | 659 } |
| 659 | 660 |
| 660 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, | 661 void BookmarkEditorView::EditorTreeModel::SetTitle(ui::TreeModelNode* node, |
| 661 const string16& title) { | 662 const string16& title) { |
| 662 if (!title.empty()) | 663 if (!title.empty()) |
| 663 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); | 664 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); |
| 664 } | 665 } |
| OLD | NEW |