| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_EDITOR_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_EDITOR_H_ |
| 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_EDITOR_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_EDITOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 NO_TREE | 26 NO_TREE |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // Describes what the user is editing. | 29 // Describes what the user is editing. |
| 30 class EditDetails { | 30 class EditDetails { |
| 31 public: | 31 public: |
| 32 // Returns an EditDetails instance for the user editing the given bookmark. | 32 // Returns an EditDetails instance for the user editing the given bookmark. |
| 33 static EditDetails EditNode(const BookmarkNode* node); | 33 static EditDetails EditNode(const BookmarkNode* node); |
| 34 | 34 |
| 35 // Returns an EditDetails instance for the user adding a bookmark within | 35 // Returns an EditDetails instance for the user adding a bookmark within |
| 36 // a given parent node. | 36 // a given parent node with a specified index. |
| 37 static EditDetails AddNodeInFolder(const BookmarkNode* parent_node); | 37 static EditDetails AddNodeInFolder(const BookmarkNode* parent_node, |
| 38 int index); |
| 38 | 39 |
| 39 // Returns an EditDetails instance for the user adding a folder within a | 40 // Returns an EditDetails instance for the user adding a folder within a |
| 40 // given parent node. | 41 // given parent node with a specified index. |
| 41 static EditDetails AddFolder(const BookmarkNode* parent_node); | 42 static EditDetails AddFolder(const BookmarkNode* parent_node, |
| 43 int index); |
| 42 | 44 |
| 43 enum Type { | 45 enum Type { |
| 44 // The user is editing an existing node in the model. The node the user | 46 // The user is editing an existing node in the model. The node the user |
| 45 // is editing is set in |existing_node|. | 47 // is editing is set in |existing_node|. |
| 46 EXISTING_NODE, | 48 EXISTING_NODE, |
| 47 | 49 |
| 48 // A new bookmark should be created if the user accepts the edit. | 50 // A new bookmark should be created if the user accepts the edit. |
| 49 // |existing_node| is null in this case. | 51 // |existing_node| is null in this case. |
| 50 NEW_URL, | 52 NEW_URL, |
| 51 | 53 |
| 52 // A new folder bookmark should be created if the user accepts the edit. | 54 // A new folder bookmark should be created if the user accepts the edit. |
| 53 // The contents of the folder should be that of |urls|. | 55 // The contents of the folder should be that of |urls|. |
| 54 // |existing_node| is null in this case. | 56 // |existing_node| is null in this case. |
| 55 NEW_FOLDER | 57 NEW_FOLDER |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 ~EditDetails(); | 60 ~EditDetails(); |
| 59 | 61 |
| 60 // See description of enum value for details. | 62 // See description of enum value for details. |
| 61 const Type type; | 63 const Type type; |
| 62 | 64 |
| 63 // If type == EXISTING_NODE this gives the existing node. | 65 // If type == EXISTING_NODE this gives the existing node. |
| 64 const BookmarkNode* existing_node; | 66 const BookmarkNode* existing_node; |
| 65 | 67 |
| 66 // If type == NEW_URL or type == NEW_FOLDER this gives the parent node | 68 // If type == NEW_URL or type == NEW_FOLDER this gives the parent node |
| 67 // to place the new node in. | 69 // to place the new node in. |
| 68 const BookmarkNode* parent_node; | 70 const BookmarkNode* parent_node; |
| 69 | 71 |
| 72 // If type == NEW_URL or type == NEW_FOLDER this gives the index to insert |
| 73 // the new node at. |
| 74 int index; |
| 75 |
| 70 // If type == NEW_FOLDER, this is the urls/title pairs to add to the | 76 // If type == NEW_FOLDER, this is the urls/title pairs to add to the |
| 71 // folder. | 77 // folder. |
| 72 std::vector<std::pair<GURL, string16> > urls; | 78 std::vector<std::pair<GURL, string16> > urls; |
| 73 | 79 |
| 74 private: | 80 private: |
| 75 explicit EditDetails(Type node_type); | 81 explicit EditDetails(Type node_type); |
| 76 }; | 82 }; |
| 77 | 83 |
| 78 // Shows the bookmark editor. If --use-more-webui is enabled use the bookmark | 84 // Shows the bookmark editor. If --use-more-webui is enabled use the bookmark |
| 79 // manager to add or edit bookmarks. The bookmark editor allows editing an | 85 // manager to add or edit bookmarks. The bookmark editor allows editing an |
| (...skipping 15 matching lines...) Expand all Loading... |
| 95 const BookmarkNode* parent, | 101 const BookmarkNode* parent, |
| 96 const EditDetails& details, | 102 const EditDetails& details, |
| 97 Configuration configuration); | 103 Configuration configuration); |
| 98 | 104 |
| 99 // Shows the WebUI bookmark editor. | 105 // Shows the WebUI bookmark editor. |
| 100 static void ShowWebUI(Profile* profile, | 106 static void ShowWebUI(Profile* profile, |
| 101 const EditDetails& details); | 107 const EditDetails& details); |
| 102 }; | 108 }; |
| 103 | 109 |
| 104 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_EDITOR_H_ | 110 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_EDITOR_H_ |
| OLD | NEW |