| 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/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" | 16 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" |
| 17 #include "chrome/browser/ui/browser_dialogs.h" |
| 17 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 18 #include "chrome/grit/locale_settings.h" | 19 #include "chrome/grit/locale_settings.h" |
| 19 #include "components/bookmarks/browser/bookmark_model.h" | 20 #include "components/bookmarks/browser/bookmark_model.h" |
| 20 #include "components/bookmarks/browser/bookmark_utils.h" | 21 #include "components/bookmarks/browser/bookmark_utils.h" |
| 21 #include "components/constrained_window/constrained_window_views.h" | 22 #include "components/constrained_window/constrained_window_views.h" |
| 22 #include "components/history/core/browser/history_service.h" | 23 #include "components/history/core/browser/history_service.h" |
| 23 #include "components/url_formatter/url_fixer.h" | 24 #include "components/url_formatter/url_fixer.h" |
| 24 #include "components/user_prefs/user_prefs.h" | 25 #include "components/user_prefs/user_prefs.h" |
| 25 #include "ui/accessibility/ax_view_state.h" | 26 #include "ui/accessibility/ax_view_state.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 using bookmarks::BookmarkNode; | 44 using bookmarks::BookmarkNode; |
| 44 using views::GridLayout; | 45 using views::GridLayout; |
| 45 | 46 |
| 46 namespace { | 47 namespace { |
| 47 | 48 |
| 48 // Background color of text field when URL is invalid. | 49 // Background color of text field when URL is invalid. |
| 49 const SkColor kErrorColor = SkColorSetRGB(0xFF, 0xBC, 0xBC); | 50 const SkColor kErrorColor = SkColorSetRGB(0xFF, 0xBC, 0xBC); |
| 50 | 51 |
| 51 } // namespace | 52 } // namespace |
| 52 | 53 |
| 53 // static | |
| 54 void BookmarkEditor::Show(gfx::NativeWindow parent_window, | |
| 55 Profile* profile, | |
| 56 const EditDetails& details, | |
| 57 Configuration configuration) { | |
| 58 DCHECK(profile); | |
| 59 BookmarkEditorView* editor = new BookmarkEditorView(profile, | |
| 60 details.parent_node, details, configuration); | |
| 61 editor->Show(parent_window); | |
| 62 } | |
| 63 | |
| 64 BookmarkEditorView::BookmarkEditorView( | 54 BookmarkEditorView::BookmarkEditorView( |
| 65 Profile* profile, | 55 Profile* profile, |
| 66 const BookmarkNode* parent, | 56 const BookmarkNode* parent, |
| 67 const EditDetails& details, | 57 const EditDetails& details, |
| 68 BookmarkEditor::Configuration configuration) | 58 BookmarkEditor::Configuration configuration) |
| 69 : profile_(profile), | 59 : profile_(profile), |
| 70 tree_view_(NULL), | 60 tree_view_(NULL), |
| 71 url_label_(NULL), | 61 url_label_(NULL), |
| 72 url_tf_(NULL), | 62 url_tf_(NULL), |
| 73 title_label_(NULL), | 63 title_label_(NULL), |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 } | 637 } |
| 648 return context_menu_model_.get(); | 638 return context_menu_model_.get(); |
| 649 } | 639 } |
| 650 | 640 |
| 651 void BookmarkEditorView::EditorTreeModel::SetTitle( | 641 void BookmarkEditorView::EditorTreeModel::SetTitle( |
| 652 ui::TreeModelNode* node, | 642 ui::TreeModelNode* node, |
| 653 const base::string16& title) { | 643 const base::string16& title) { |
| 654 if (!title.empty()) | 644 if (!title.empty()) |
| 655 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); | 645 ui::TreeNodeModel<EditorNode>::SetTitle(node, title); |
| 656 } | 646 } |
| 647 |
| 648 namespace chrome { |
| 649 |
| 650 void ShowBookmarkEditorViews(gfx::NativeWindow parent_window, |
| 651 Profile* profile, |
| 652 const BookmarkEditor::EditDetails& details, |
| 653 BookmarkEditor::Configuration configuration) { |
| 654 DCHECK(profile); |
| 655 BookmarkEditorView* editor = new BookmarkEditorView( |
| 656 profile, details.parent_node, details, configuration); |
| 657 editor->Show(parent_window); |
| 658 } |
| 659 |
| 660 } // namespace chrome |
| OLD | NEW |