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

Side by Side Diff: chrome/browser/bookmarks/bookmark_editor.h

Issue 7919028: Revert 101581 - Add --use-more-webui runtime flag to toggle WebUI replacements for native dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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) 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>
11 11
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
14 14
15 class BookmarkNode; 15 class BookmarkNode;
16 class GURL; 16 class GURL;
17 class Profile; 17 class Profile;
18 18
19 // Small, cross platform interface that shows the correct platform specific 19 // Small, cross platform interface that shows the correct platform specific
20 // bookmark editor dialog. 20 // bookmark editor dialog.
21 class BookmarkEditor { 21 class BookmarkEditor {
22 public: 22 public:
23 // An enumeration of the possible configurations offered. 23 // An enumeration of the possible configurations offered.
24 enum Configuration { 24 enum Configuration {
25 SHOW_TREE, 25 SHOW_TREE,
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 struct EditDetails {
31 public:
32 // Returns an EditDetails instance for the user editing the given bookmark.
33 static EditDetails EditNode(const BookmarkNode* node);
34
35 // Returns an EditDetails instance for the user adding a bookmark within
36 // a given parent node.
37 static EditDetails AddNodeInFolder(const BookmarkNode* parent_node);
38
39 // Returns an EditDetails instance for the user adding a folder within a
40 // given parent node.
41 static EditDetails AddFolder(const BookmarkNode* parent_node);
42
43 enum Type { 31 enum Type {
44 // The user is editing an existing node in the model. The node the user 32 // The user is editing an existing node in the model. The node the user
45 // is editing is set in |existing_node|. 33 // is editing is set in |existing_node|.
46 EXISTING_NODE, 34 EXISTING_NODE,
47 35
48 // A new bookmark should be created if the user accepts the edit. 36 // A new bookmark should be created if the user accepts the edit.
49 // |existing_node| is null in this case. 37 // |existing_node| is null in this case.
50 NEW_URL, 38 NEW_URL,
51 39
52 // A new folder bookmark should be created if the user accepts the edit. 40 // A new folder bookmark should be created if the user accepts the edit.
53 // The contents of the folder should be that of |urls|. 41 // The contents of the folder should be that of |urls|.
54 // |existing_node| is null in this case. 42 // |existing_node| is null in this case.
55 NEW_FOLDER 43 NEW_FOLDER
56 }; 44 };
57 45
46 EditDetails();
47 explicit EditDetails(const BookmarkNode* node);
58 ~EditDetails(); 48 ~EditDetails();
59 49
60 // See description of enum value for details. 50 // See description of enum value for details.
61 const Type type; 51 Type type;
62 52
63 // If type == EXISTING_NODE this gives the existing node. 53 // If type == EXISTING_NODE this gives the existing node.
64 const BookmarkNode* existing_node; 54 const BookmarkNode* existing_node;
65 55
66 // If type == NEW_URL or type == NEW_FOLDER this gives the parent node
67 // to place the new node in.
68 const BookmarkNode* parent_node;
69
70 // If type == NEW_FOLDER, this is the urls/title pairs to add to the 56 // If type == NEW_FOLDER, this is the urls/title pairs to add to the
71 // folder. 57 // folder.
72 std::vector<std::pair<GURL, string16> > urls; 58 std::vector<std::pair<GURL, string16> > urls;
73
74 private:
75 explicit EditDetails(Type node_type);
76 }; 59 };
77 60
78 // Shows the bookmark editor. If --use-more-webui is enabled use the bookmark 61 // Shows the bookmark editor. The bookmark editor allows editing an
79 // manager to add or edit bookmarks. The bookmark editor allows editing an
80 // existing node or creating a new bookmark node (as determined by 62 // existing node or creating a new bookmark node (as determined by
81 // |details.type|). If |configuration| is SHOW_TREE, a tree is shown allowing 63 // |details.type|). If |configuration| is SHOW_TREE, a tree is shown allowing
82 // the user to choose the parent of the node. 64 // the user to choose the parent of the node.
83 // |parent| gives the initial parent to select in the tree for the node. 65 // |parent| gives the initial parent to select in the tree for the node.
84 // |parent| is only used if |details.existing_node| is null. 66 // |parent| is only used if |details.existing_node| is null.
67 // TODO(flackr): Rename this to ShowNative and add cross platform Show method
68 // which will show a WebUI version of the dialog if --pure-views is set.
85 static void Show(gfx::NativeWindow parent_window, 69 static void Show(gfx::NativeWindow parent_window,
86 Profile* profile, 70 Profile* profile,
71 const BookmarkNode* parent,
87 const EditDetails& details, 72 const EditDetails& details,
88 Configuration configuration); 73 Configuration configuration);
89
90 private:
91 // Shows the native bookmark editor.
92 // TODO(flackr): Remove parent argument.
93 static void ShowNative(gfx::NativeWindow parent_window,
94 Profile* profile,
95 const BookmarkNode* parent,
96 const EditDetails& details,
97 Configuration configuration);
98
99 // Shows the WebUI bookmark editor.
100 static void ShowWebUI(Profile* profile,
101 const EditDetails& details);
102 }; 74 };
103 75
104 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_EDITOR_H_ 76 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_EDITOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_context_menu_controller.cc ('k') | chrome/browser/bookmarks/bookmark_editor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698