summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/bookmark_editor_view.cc
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-03 23:14:01 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-03 23:14:01 +0000
commit3ec1a3af311b95b325a3302679be1eb68e89e58e (patch)
tree61049c73993b824ce537cf62cea8acfb74cbf14a /chrome/browser/views/bookmark_editor_view.cc
parent32f720c5a051885d45b79533522c06870e7037ff (diff)
downloadchromium_src-3ec1a3af311b95b325a3302679be1eb68e89e58e.zip
chromium_src-3ec1a3af311b95b325a3302679be1eb68e89e58e.tar.gz
chromium_src-3ec1a3af311b95b325a3302679be1eb68e89e58e.tar.bz2
Miscellaneous bookmark manager polish:
. Adds a menu button on the bookmark manager. If I finish up import I'll add a second one for importing. . Creating new page/folder from menu items selects new item in table. . I changed around the FolderBookmarkTableModel to copy the contents into a vector (now extends VectorBackedTabledModel). This is necessitated by TableView not providing a moved notification. The problem with previous approach is that I sent out ModelChanged on any change, which loses selection and causes things to snap around. I considered adding a moved method to TableView, but it's too much work at this time. . Added persisting of divider location in bookmark manager. . When focus is on table pressing enter on a folder descends into the folder, and pressing backspace goes back up a folder. BUG=674 TEST=none Review URL: http://codereview.chromium.org/8967 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4512 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/bookmark_editor_view.cc')
-rw-r--r--chrome/browser/views/bookmark_editor_view.cc44
1 files changed, 27 insertions, 17 deletions
diff --git a/chrome/browser/views/bookmark_editor_view.cc b/chrome/browser/views/bookmark_editor_view.cc
index 1179037..db8d5ec 100644
--- a/chrome/browser/views/bookmark_editor_view.cc
+++ b/chrome/browser/views/bookmark_editor_view.cc
@@ -40,29 +40,19 @@ static const int kTreeWidth = 300;
// ID for various children.
static const int kNewGroupButtonID = 1002;
-// static
-void BookmarkEditorView::Show(HWND parent_hwnd,
- Profile* profile,
- BookmarkNode* parent,
- BookmarkNode* node,
- Configuration configuration) {
- DCHECK(profile);
- BookmarkEditorView* editor =
- new BookmarkEditorView(profile, parent, node, configuration);
- editor->Show(parent_hwnd);
-}
-
BookmarkEditorView::BookmarkEditorView(Profile* profile,
BookmarkNode* parent,
BookmarkNode* node,
- Configuration configuration)
+ Configuration configuration,
+ Handler* handler)
: profile_(profile),
tree_view_(NULL),
new_group_button_(NULL),
parent_(parent),
node_(node),
running_menu_for_root_(false),
- show_tree_(configuration == SHOW_TREE) {
+ show_tree_(configuration == SHOW_TREE),
+ handler_(handler) {
DCHECK(profile);
Init();
}
@@ -75,6 +65,19 @@ BookmarkEditorView::~BookmarkEditorView() {
bb_model_->RemoveObserver(this);
}
+// static
+void BookmarkEditorView::Show(HWND parent_hwnd,
+ Profile* profile,
+ BookmarkNode* parent,
+ BookmarkNode* node,
+ Configuration configuration,
+ Handler* handler) {
+ DCHECK(profile);
+ BookmarkEditorView* editor =
+ new BookmarkEditorView(profile, parent, node, configuration, handler);
+ editor->Show(parent_hwnd);
+}
+
bool BookmarkEditorView::IsDialogButtonEnabled(DialogButton button) const {
if (button == DIALOGBUTTON_OK) {
const GURL url(GetInputURL());
@@ -480,7 +483,11 @@ void BookmarkEditorView::ApplyEdits(EditorNode* parent) {
if (!show_tree_ ) {
if (!node_) {
- bb_model_->AddURL(parent_, parent_->GetChildCount(), new_title, new_url);
+ BookmarkNode* node =
+ bb_model_->AddURL(parent_, parent_->GetChildCount(), new_title,
+ new_url);
+ if (handler_.get())
+ handler_->NodeCreated(node);
return;
}
// If we're not showing the tree we only need to modify the node.
@@ -535,8 +542,11 @@ void BookmarkEditorView::ApplyEdits(EditorNode* parent) {
}
} else {
// We're adding a new URL.
- bb_model_->AddURL(new_parent, new_parent->GetChildCount(), new_title,
- new_url);
+ BookmarkNode* node =
+ bb_model_->AddURL(new_parent, new_parent->GetChildCount(), new_title,
+ new_url);
+ if (handler_.get())
+ handler_->NodeCreated(node);
}
}