| 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_bubble_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 bookmark_bubble_->GetWidget()->Close(); | 91 bookmark_bubble_->GetWidget()->Close(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 BookmarkBubbleView::~BookmarkBubbleView() { | 94 BookmarkBubbleView::~BookmarkBubbleView() { |
| 95 if (apply_edits_) { | 95 if (apply_edits_) { |
| 96 ApplyEdits(); | 96 ApplyEdits(); |
| 97 } else if (remove_bookmark_) { | 97 } else if (remove_bookmark_) { |
| 98 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_); | 98 BookmarkModel* model = BookmarkModelFactory::GetForProfile(profile_); |
| 99 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url_); | 99 const BookmarkNode* node = model->GetMostRecentlyAddedUserNodeForURL(url_); |
| 100 if (node) | 100 if (node) |
| 101 model->Remove(node->parent(), node->parent()->GetIndexOf(node)); | 101 model->Remove(node); |
| 102 } | 102 } |
| 103 // |parent_combobox_| needs to be destroyed before |parent_model_| as it | 103 // |parent_combobox_| needs to be destroyed before |parent_model_| as it |
| 104 // uses |parent_model_| in its destructor. | 104 // uses |parent_model_| in its destructor. |
| 105 delete parent_combobox_; | 105 delete parent_combobox_; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void BookmarkBubbleView::WindowClosing() { | 108 void BookmarkBubbleView::WindowClosing() { |
| 109 // We have to reset |bubble_| here, not in our destructor, because we'll be | 109 // We have to reset |bubble_| here, not in our destructor, because we'll be |
| 110 // destroyed asynchronously and the shown state will be checked before then. | 110 // destroyed asynchronously and the shown state will be checked before then. |
| 111 DCHECK_EQ(bookmark_bubble_, this); | 111 DCHECK_EQ(bookmark_bubble_, this); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 if (node) { | 365 if (node) { |
| 366 const base::string16 new_title = title_tf_->text(); | 366 const base::string16 new_title = title_tf_->text(); |
| 367 if (new_title != node->GetTitle()) { | 367 if (new_title != node->GetTitle()) { |
| 368 model->SetTitle(node, new_title); | 368 model->SetTitle(node, new_title); |
| 369 content::RecordAction( | 369 content::RecordAction( |
| 370 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); | 370 UserMetricsAction("BookmarkBubble_ChangeTitleInBubble")); |
| 371 } | 371 } |
| 372 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); | 372 parent_model_.MaybeChangeParent(node, parent_combobox_->selected_index()); |
| 373 } | 373 } |
| 374 } | 374 } |
| OLD | NEW |